Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
Escapes }} and | by wrapping them in <nowiki> tags, and steps around
<nowiki> tags so as to not double-wrap things.
Change-Id: Ia50906524c1fcf55c9f390a114856bc7f20b2d3a
Objective:
* Add button to launch template dialog
* Add template dialog
Changes;
*.php
* Add messages and links to files
ve.ce.Node.css
* Make inline templates display as inline-block to contain their
contents (allowing shields to work properly)
ve.ui.MWTemplateDialog.js
* New empty dialog for templates
ve.ui.MWTemplateButtonTool.js
* New template button, appears in context and launches dialog
Change-Id: I9174ed7c9012522246a6defc859276bf36763f5b
Objectives:
* Split ve.Surface into ve.Editor and ve.ui.Surface
* Move actions, triggers and commands to ve.ui
* Move toolbar wrapping, floating, shadow and actions functionality to configurable options of ve.ui.Toolbar
* Make ve.ce.Surface and ve.ui.Surface inherit ve.Element and use this.$$ for iframe friendliness
* Make the toolbar separately initialized so it's possible to have a surface without one, as well as control where the toolbar is
Some change notes:
VisualEditor.php
* Added standalone module for mediawiki integrated unit testing
ve.ce.Surface.js
* Remove requirement to pass in an attached container to construct object
* Inherit ve.Element and use this.$$ instead of $
* Make getSelectionRect iframe friendly
* Move most of the initialize stuff to a new initialize method to be called after the surface is attached to the DOM
ve.init.mw.ViewPageTarget.js
* Merge toolbar functions into setup/teardown methods
* Add toolbar manually (since it's not added by the surface anymore)
ve.init.sa.Target.js
* Update new init procedure for editor, surface and toolbar separately
* Move toolbar floating stuff to ve.Toolbar
Change-Id: If91a9d6e76a8be8d1b5a2566394765a37d29a8a7
Objectives:
* Move ve.ui.Element to ve.Element
* Make CE nodes inherit from ve.Element
Changes:
ve.ui.Element.js, ve.Element.js
* Move and rename
* Move ve.ui.get$$ to ve.Element.static.get$$
* Add static getDocument and getWindow methods
* Add instance getElementDocument and getElementWindow methods
* Add getTagName method, which by default reads the static tagName property, but when overridden can return a tag name based on other factors
*.php
* Updated file link
ve.ce.*Annotation.js, ve.ce.*Node.js, ve.ce.View.js, ve.ce.Document
* Added config options pass through
* Replaced passing elements through constructor with defining static tag names
* Added getTagName overrides where needed that derive tag name from model
* Refactore dom wrapper methods, now consistently using getTagName
ve.ce.Surface.js
* Removed static initialization (not needed)
ve.dm.Model.js, ve.ui.Window.js
* Added missing docs
ve.ui.GroupElement.js, ve.ui.Layout.js, ve.ui.Widget.js,
* Updated class name for elements
ve.ui.Frame.js, ve.ui.LookupInputWidget.js
* Updated location of get$$
ve.ui.js
* Move get$$ to ve.Element
ve.js
* Add auto-init of static properties to mixinClass
Change-Id: I39ae14966456903728e4d9e53f806ddce9ca2b70
Objective:
Add a basic (empty) dialog for mediawiki references. Editor to follow.
Changes:
*.php
* Added file links and messages
ve.ui.MWMetaDialog.js
* Moved initialize method to the top (for consistent ordering)
ve.ui.MWReferenceDialog.js
* New class, basic empty dialog for references
ve.ui.LinkInspector.js, ve.ui.MWLinkInspector.js, ve.ui.MediaButtonTool.js
* Cleanup documentation
* Whitespace
icons.ai, reference.png, reference.svg
* Switch to reference icon being 3 books on a shelf
ve.ui.MWReferenceButtonTool.js
* New class, basic dialog button for references
Change-Id: Ia4e30e9239fa1e3b28c0a1ef1ca0a6515a8103ef
Objective:
* Add default sort key field to meta dialog
* Replace PagePanelLayout with a generic panel containing one or more FieldsetLayout elements
Changes:
*.php
* Added/removed file links
ve.dm.MWDefaultSortMetaItem.js
* Added getContent method
ve.dm.MetaItem.js
* Added replaceWith method
ve.dm.MetaList.js
* Allow insertion at the end by omitting offset and index
ve.dm.MWMetaDialog.js
* Added default sort key field
* Put category and default sort fields inside fieldsets
* Added loading/saving default sort key
ve.ui.PagedLayout.js
* Changed class used for pages to generic panel layout
ve.ui.PagePanelLayout
* Moved title/icon stuff to field set
ve.ui.FieldsetLayout.js
* New class, adds fieldset with legend
ve.ui.StackPanelLayout.js
* Moved up to the layouts directory
ve.ui.Dialog.css
* Moved style for paged panel from layout stylesheet
ve.ui.Layout.css
* Added styles for fieldsets
ve.ui.Widget.css
* Adjusted margins of input label widgets
ve.ui.MWCategoryWidget.js, ve.ui.MWCategoryPopupWidget.js
* Added setDefaultSortKey method
Change-Id: I979f5e3f08a688790c9f54086206ed1999af13ea
It now allows you to specify which attributes to preserve in various
ways rather than just setting true or false.
Removed unused factory methods that exposed the old value.
Change-Id: I914164adcf1f0e48fa3fa85277e68c72dbad393e
Objective:
Generalize the shield and phantom magic, so we can use it for pretty much
any node we like. Usually this will be used with generated content nodes,
but also with aliens (of course) and possible other stuff in the future.
Bonus:
Also fixes a bug in DM that would crash VE when you selected to the end
and hit backspace.
Changes:
*.php
* Added links to files
aliens.html
* Added attributes to aliens to make them aliens again
ve.ce.AlienNode.js
* Moved shield and phantom functionality to ve.ce.ProtectedNode
ve.ce.AlienNode.js, ve.ce.MWReferenceListNode.js,
ve.ce.MWReferenceNode.js, ve.ce.MWTemplateNode.js
* Mixed in ve.ce.ProtectedNode
ve.ce.Node.css
* Reorganized styles and updated class names
* Added simple light blue hover with outline (using inset box shadow) for
protected nodes, same style as before for aliens
ve.ce.Surface.css
* Moved phantom styles to ve.ce.Node.css
ve.ce.BranchNode.js
* Moved call to setLive(false) to happen before detach() so that the
surface object is still available and events can be disconnected
ve.ce.BranchNode.js, ve.ce.Document.js, ve.ce.js, ve.ce.Surface.js, ve.ce.SurfaceObserver.js
* Adjusted CSS class names
ve.ce.Node.js
* Moved shield template to ve.ce.ProtectedNode
ve.ce.ProtectedNode.js
* New class, mix into another class to protect it from editing
ve.ce.RelocatableNode.js
* Renamed temporary surface property to relocatingSurface to avoid
confusion when debugging
ve.ce.Surface.js
* Moved phantom template to ve.ce.ProtectedNode
ve.dm.Transaction.js
* Fixed bug where most of the internal list was being deleted when the
end of the document was selected and the user pressed backspace
Change-Id: I2468b16e1ba6785ad298e38190e33493135719c3
Refactoring of externally sourced suggestions for text inputs.
*.php
* Added links to new file
ve.ui.InputLabelWidget.js
* Changed to focus input element, not wrapper div
ve.ui.InputWidget.js
* Fixed incorrect documentation
ve.ui.LookupInputWidget.js
* New mixing that abstracts placing a menu of options below a text input
and filling it with data from an external source
ve.ui.MenuWidget.js
* Fixed to get reference to input element, no wrapper div
ve.ui.MWLinkTargetInputWidget.js
* Moved pending and lookup functionality to mixing
* Implemented menu population using only matching pages, rather than a
combination of that and page existence checks (fewer API calls)
ve.ui.TextInputMenuWidget.js
* Added configurable container to render underneath, rather than assuming
this.input.$
* Added auto-position-on-window-resize functionality
* Fixed frame position correction to ensure that it only is used when the
overlay is in a different frame from the container to position
underneath
ve.ui.TextInputWidget.js
* Added placeholder text feature
Change-Id: If5ed1b64fd15982807691ce8bb0362970633108a
Takes a path as input, reads it in and replaces the
"Generated by" sections and writes it back to disk.
:
Change-Id: Idd68032ba5b621958a353582ea994acd0c4cfbd3
The tests passed just fine in Gerrit, because it runs the tests via
MediaWiki using ResourceLoader, which was able to load jquery.client
just fine from MW core.
Change-Id: I004514ab761107b687be2fe1ff49ecfd25bead5b
Changed:
VisualEditor.i18n.php
* Updated Link inspector i18n messages
ve.ui.MetaDialog.js -> ve.ui.PagedDialog
* Moved paging functionality into Paged dialog
ve.ui.EditorPanelLayout -> ve.ui.PagePanelLayout.js
* Renamed from EditorPanelLayout to work nicely with the concept of
stacks and pages
ve.ui.GroupElement.js
* Added addItem method and change addItems to use it
ve.ui.Dialog.css
* Updated classname as per refactor of meta dialog
ve.ui.StackPanelLayout.js
* Set currentItem property on showItem
* In addItems method, show currentItem with class method
** rather display block on element
ve.ui.Layout.css
* Make editorPanel layout 100% in width.
ve.ui.Widget.css
* Added CategoryWidget and CategoryPopup styles
* Other adjustments
ve.ui.PopupWidget.js
* Added auto-close on loss of focus
* Made friendly with being initialized inside a frame
ve.ui.MWLinkTargetInputWidget.js
* Mixin ve.ui.PendingInputWidget and remove pending methods
* Prevent querying on spaces
* Reintroduce i18n messages for menu sections
ve.ui.MenuWidget.js
* Update cases of $input config property to input
New:
ve.ui.PagedDialog.js
* Refactored base-class for mwMeta dialog (and probably other dialogs
too)
* Abstracts adding and accessing pages
ve.ui.PendingInputWidget.js
* Moved pushPending and popPending methods into pending class
Change-Id: I29bcd92b7b5641941a4e98e65b2a56424a5263ff
Because we have a node for <table>, we also need one for <caption>,
otherwise we'll try to alienate it and fail.
Added the test case as a separate example document so Ed can use it
for his tests.
Removed test case asserting <caption> is alienated.
Change-Id: I3a917db58e6c0eb97899b214b07d01fc8d86b56d
Actually really resizing the image
Show bounding box on mouseover with 4 handles. Bounding box is resizable. Image resizes to match bounding box on mouse up.
Change-Id: I1f3dac64eb86dd1f258937e4915af101b3ac19d8
*.php
* Added links to new file
ve.ce.ImageNode.js
* Added relocatable node mixin
* Added $image reference to the actual img element, so if it's wrapped
in a sub class the functionality in the parent class doesn't break.
* Moved drag start event handling to relocatable node
* Removed drag end binding, not needed.
ve.ce.MWImageNode.js
* Moved addClass to initialization section of constructor.
* Copied 'view' data prop from image element to keep stuff working after
the wrapping.
ve.ce.Node.css
* Switched to default (arrow) cursor for images.
ve.ce.RelocatableNode.js
* New mixing for nodes that should be relocatable
* Added implementation for drag start, which tells the surface to allow
dragging this node.
ve.ce.Surface.js
* Added relocation support, which is used by relocatable nodes
* Split onDocumentDragDrop into onDocumentDragOver and onDocumentDrop
which now have implementations that support relocation of nodes
ve.ui.Context.js
* Added relocation tracking to prevent context being shown while
relocating
Change-Id: I8703adfb707af2c3224431afc3418356ac2c686c
Objective:
Make it possible for inspectors to inspect nodes or annotations, rather
than only annotations. Meanwhile, also make it possible for dialogs to
edit an annotation.
Strategy:
Switch from using type patterns to associate inspectors with annotations
to using arrays of classes, similar to how dialogs already work.
Introduce a view registry which provides lookups for relationships
between models and views. This is more centralized and less repetitive
than implement matching functions for both annotations and nodes in both
the dialog and inspector factories.
Changes:
*.php
* Added links to new file
ve.AnnotationAction.js
* Removed unused parameter to filter annotations using a string or regexp
ve.dm.AnnotationSet.js
* Switched from property/value arguments to callbacks
ve.ui.*(Dialog|Inspector).js
* Replaced type patterns with class lists
* Added class to view registry
ve.ui.*Tool.js, ve.ui.Context.js
* Updated model/view relationship lookup
ve.ui.*Factory.js
* Removed overly-specific lookup functions
ve.ui.Inspector.js
* Removed typePattern property
* Updated model/view relationship lookup
ve.ui.ViewRegistry.js
* New class!
* Migrated node and annotation lookup functions from factories
Change-Id: Ic2bbcf072fdd87e5ce8a03fe1ae3e6d8d50e2593
*.php
* Added links to new file
ve.ce.ImageNode.js
* Added focusable node mixin
ve.ce.FocusableNode.js
* New class!
* Adds isFocused and setFocused methods
* When a node is focused or blurred, 'focus' and 'blur' events are emitted
* While a node is focused, it will have the 've-ce-node-focused' class added to it's this.$
ve.ce.Surface.js
* Add detection of node focusing and setting focus and blur on nodes on change
Change-Id: I3f1ad6309571f2bfe568550e2e8f1bd5a0302085
* Create MWTemplateBlockNode & MWTemplateInlineNode (in ce and dm)
* Move Alien's 'isInline' code to ve.dm.Node.static.isHybridInline
* Move definition of ce.AlienBlock/InlineNode inside ce.Aline.js file
to match dm.AlienBlock/InlineNode and MWTemplate
* Duplicate AlienBlock/Inline styles for templates
* Create test case for inline templates
* Count test cases in ve.dm.Converter.test.js automatically
Change-Id: Id9bc7f049ea974dd5e7f8b7a66080939e0948bbd
This node stores the rendered in the index-value store, hashed on
a custom hash of the dm (type + mw) which makes it unique it its
parameters.
Bug: 46571
Change-Id: I0ab4c9f7bca207121d5b42e83c821771b6139da8
We weren't really using it exclusively for nodes any more, and the only
functionality in there was for using .static.name
Change-Id: Ie26928cd01faee95a10912201663b45f1f20fb19
Just like ve.dm.Model is a common base class for dm.Node, dm.Annotation
and dm.MetaItem.
ce.View abstracts the this.model and this.$ behavior, including liveness,
whitelisted HTML attribute rendering and adding a back reference in
.data(). The back reference has been renamed from .data( 'node' ) to
the more generic .data( 'view' ).
At this point this means ce.Annotation is just a shell around ce.View
(except where it defaults to a span rather than a div), but that could
change in the future.
Change-Id: I0eef5b80718e0b0fcd3f8bba096b452f0bb680d0
ve.dm.Model is now the common base class for these three. ve.dm.Node
inherited from ve.Node before, so it now uses it as a mixin instead.
This required changing ve.Node's usage of ve.EventEmitter from
inhertiance to a mixin as well, because inherited methods apparently
don't get mixed in correctly.
* Change annotation terminology from linmodAnnotation to element for
consistency with Node, MetaItem and Model
* Reimplement getClonedElement() in Node for .internal treatment
Change-Id: Ifd3922af23557c0b0f8984d36b31c8a1e2ec497e
This changes the annotation API to be the same as the node API, sans
a few boolean flags that don't apply. The APIs were different, but
there was really no good reason why, so this makes things simpler for
API users. It also means we'll be able to factor a bunch of things out
because they're now duplicated between nodes, meta items and annotations.
Linear model annotations are now objects with 'type' and 'attributes'
properties (rather than 'name' and 'data'), for consistency with elements.
They now also contain html/0/* attributes for HTML attribute preservation,
which obsoletes the htmlTagName and htmlAttributes properties.
dm.Annotation subclasses take a reference to such an object and implement
conversion using .static.toDataElement and .static.toDomElements just
like nodes do. The custom .getHash() functions are no longer necessary
because of the way HTML attribute preservation was reimplemented.
CE rendering has been moved out of dm.Annotation (it never made sense to
have CE rendering functions in DM classes, this was bothering me) and into
separate ce.Annotation subclasses. These are very similar to CE nodes in
that they have a this.$ generated based on something in the DM; the main
difference is that nodes listen to events and update themselves, whereas
annotations are static and are simply destroyed and rebuilt when they
change. This change also adds whitelisted HTML attribute rendering for
annotations, as well as class="ve-ce-FooAnnotation" attributes.
Now that annotation classes produce real DOM nodes rather than weird
objects describing HTML tags, we can't generate HTML as a string in
ce.ContentBranchNode anymore. getRenderedContents() has been rewritten
to be much more similar to the way the converter renders annotations;
in fact, significant parts of it were copied from the converter, so that
should be factored out in the future. This change actually fixes an
annotation rendering discrepancy between ce.ContentBranchNode and
dm.Converter; see the diff of ve.ce.ContentBranchNode.test.js.
ve.ce.MWEntityNode.js:
* Remove stray property
ve.dm.MWExternalLinkAnnotation.js:
* Store 'rel' attribute
ve.dm.TextStyleAnnotation.js:
* Put all the conversion logic in the abstract base class
ve.dm.Converter.js:
* Also feed annotations through getDomElementsFromDataElement() and
createDataElement()
ve.dm.Node.js:
* Fix undocumented property
ve.ce.ContentBranchNode.test.js:
* Add descriptive messages for each test case
* Compare DOM trees, not HTML strings
* Compare without all the class="ve-ce-WhateverAnnotation" clutter
ve.ui.LinkInspector.js:
* Replace direct .getHash() calls (evil!) with ve.getHash()
Bug: 46464
Bug: 44808
Change-Id: I31991488579b8cce6d98ed8b29b486ba5ec38cdc
*/index.php
* Added links to new files
VisualEditor.php
* Added links to new files
* Removed keys of non-existent messages
ve.ui.ContentDialog.js, ve.ui.MetaDialog.js
* Removed redundant comments
ve.ui.MediaDialog.js
* New dialog, just for media
icons.ai, picture.png, picture.svg, ve.ui.Icons-*.css
* Added picture icon
ve.ui.MediaButtonTool.js
* New button, just for media (shows up in the context toolbar)
ve.ui.DialogButtonTool.js
* New base class for dialog buttons
ve.ui.Context.js
* Added basic support for showing dialog buttons, in addition to
annotation buttons, in the context toolbar - to test, select only an
image node
ve.ui.Dialog.js
* Prevent clicks on the click-block from changing focus
* Moved initialize to below the event handlers and updated its
documentation
ve.ui.DialogFactory.js
* Added a way to get the names of dialogs that can be used to edit a
node
ve.ui.Inspector.js
* Removed close handler which set focus, this is done already in window
ve.ui.InspectorFactory.js
* Fixed comment so it's not telling lies anymore
ve.ui.Window.js
* Removed auto-focus on frame, it's changing the focus in the parent
document which blows-away the focus in CE, and it really isn't needed
as it turns out
VisualEditor.18n.php
* Added media dialog title message
* Added media tool tooltip message
Bug: 37870
Change-Id: I9150c46b3e292910fed899fa60d6da433049ca45
Depencency tree looked like this
* ext.visualEditor.viewPageTarget
- ve.init.platform
- ve.init.target
** ext.visualEditor.core
- (most ve.* classes)
*** ext.visualEditor.base
- ve.js
Some of the ve classes are calling ve.msg from the global scope
at load time (e.g. in the definition of static properties or in
constructors of classes that were immediately instantiated in
the same file).
Platform needs to be initialised in the base module.
ve.init.Platform.js was already there, but that's just an
abstract base class. The the ve.init.platform property is set
from the implementation classes' files.
Updated makeStaticLoader.php and re-ran for test and demo html.
The fake "Standalone Init" module is now gone, which shows that
this was needed as test/ and demo/ already put their platform
code in/after the 'ext.visualEditor.base' module in the html.
Bug: 45175
Change-Id: I47d7d92495974572194700c98a219d22ecbfaf4b
Created an IndexValueStore class which can store any object and return
an integer index to its hash map.
Linear data is now stored in ve.dm.LinearData instances. Two subclasses
for element and meta data contain methods specific to those data types
(ElementLinearData and MetaLinearData).
The static methods in ve.dm.Document that inspected data at a given
offset are now instance methods of ve.dm.ElementLinearData.
AnnotationSets (which are no longer OrderedHashSets) have been moved
to /dm and also have to be instantiated with a pointer the store.
Bug: 46320
Change-Id: I249a5d48726093d1cb3e36351893f4bff85f52e2
*.php
* Updated links to files
ve.ui.MetaDialog
* Added stack panel that now contains category and language editor panels
* Attached outline widget to stack panel
ve.ui.FlaggableWidget -> ve.ui.FlaggableElement
* Moved to elements
ve.ui.GroupWidget -> ve.ui.GroupElement
* Moved to elements
* Removed invalid event documentation
ve.ui.LabledWidget -> ve.ui.LabledElement
* Moved to elements
ve.ui.StackPanelLayout.js
* New class, mutually exclusive panel container
ve.ui.TitledPanelLayout
* Remvoed, using labeled element instead
ve.ui.Element.css
* Added for elements
* Moved label style here, from widget styles
*.css, ve.ui.ButtonWidget.js, ve.ui.InputLabelWidget, ve.ui.OptionWidget, ve.ui.SelectWidget
* Adjusted class names to reflect widget -> element migration
Change-Id: I32f504c844dba7aae1b286eef06ca046627bdc8d
This will make the popup with callout functionality easy to reuse elsewhere - in the first case most likely the popup menus for the category widget.
*.php
* Added links to the new widget
ve.ui.Context.css, ve.ui.Widget.css
* Moved styles to the widget stylesheet
ve.ui.Context.js, ve.ui.PopupWidget
* Moved "popup" specific stuff to the new popup widget
Change-Id: I823c6e2c5e1ec11088898e9621d93e983c3b76f3