Because scroll events cannot be canceled or prevented from bubbling
up, the only way to prevent the scrolling is to cancel the actual key
and mouse wheel events.
PhantomJs -= 2
Change-Id: I540738459181c37d11caf5db07345703e7000ef9
Objective:
* Make all text inputs have the ability to be "pending", not just ones
with a special mixin
Changes:
* Delete pending input widget
* Move pending input widget implementation to text input widget
* Update all uses of pending input widget
* Make pending image a reusable "texture"
* Update styles of text input widget for pending state
* Get rid of checking for mixin since all text inputs can be pending now
Bonus:
* Get rid of unused images, including .psd and .ai files
* Add transparency texture
* Fix input widget not using documented config value
* Fix documentation in select widget (lies!)
Change-Id: Ib46ab01dc39d706e5c25fd473dee0edce51b7e44
This makes the 'category' section of the meta-data panel less lonely, and
prompts us to actually do this at some point quite soon (or encourage others
so to do).
Bug: 48814
Change-Id: I5b8fdfb78a2117839277a683db47fe97107d87b0
Adding a fairly loose .csslintrc file so that our code
passes it.
The following options cause warnings in our code and have been
disabled for now:
* adjoining-classes
> Don't use adjoining classes.
> .ve-ui-widget-disabled.ve-ui-textInputWidget textarea:focus {
* box-sizing
> The box-sizing property isn't supported in IE6 and IE7.
> box-sizing: border-box;
* box-model
> Using width with border can sometimes make elements larger than you expect.
> border: solid 1px #ccc;
> Using width with padding can sometimes make elements larger than you expect.
> padding: 0 0.75em 0 0.75em;
> Using width with border-right can sometimes make elements larger than you expect.
> border-right: 1px solid #eee;
* fallback-colors
> Fallback background-color (hex or RGB) should precede RGBA background-color.
> background-color: rgba(104,171,255,0.1);
* important
> Use of !important
> position: relative !important;
* outline-none
> Outlines shouldn't be hidden unless other visual changes are made.
> .ve-ce-documentNode[contenteditable="true"]:focus {
* qualified-headings
> Heading (h1) should not be qualified.
> .ve-ce-branchNode h1:empty:before,
* universal-selector
> The universal selector (*) is known to be slow.
> .ve-ce-protectedNode * {
* unqualified-attributes
> Unqualified attribute selectors are known to be slow.
> .ve-ce-documentNode[contenteditable="true"]:focus {
Fixes made:
* modules/ve/ce/styles/ve.ce.Surface.css:
[L66:C2] margin can't be used with display: inline.
* modules/ve/ui/styles/ve.ui.css: Unknown @ rule: @-ms-keyframes
Internet Explorer < 10 doesn't support keyframes. IE10+ supports
the standard property. I don't think ms-keyframes ever existed
http://caniuse.com/css-animation. ms-transform did exist
http://caniuse.com/transform.
Change-Id: I728a48e489c079e1c94a506bb00c245de9551eb6
Due to the "es5: true" jshint option we enabled, these
warnings were surpressed. I've disabled the option since
we no longer require it. It was enabled in 07c86fc to fix
a bug with jshint. This bug has now been fixed.
Change-Id: I55b7d031eb5581af5f733f050cf2ea98dacb2af6
Clean up of logic implemented during the template-sprint:
* Store spec inside the content model, directly associated
with the content-part. This allowed fixing the bug where
two spec-less template invocations overwrote each other's
made-up template data due to it using "target.wt" as key.
The opener now provides the fetcher with a "specId" which
is set to "part/<id>" for wt-generated template targets.
* Batching is now implemented inside the fetcher instead
of outside. This allows calling "getTemplateSpecs" inside
the loop with a dedicated callback for each spec to store
it in the content.parts[i] object passed by reference.
It also makes it easier to use by different code paths.
You call it as much as you like and it will queue up
naturally through javascript yielding and then make a batch
request. This is based on the pattern I used in MediaWiki core
for mw.loader#addEmbeddedCSS.
Follows-up e7af635, da679b7.
Change-Id: I4d7121229d060a96d927585c987a1a81a474b922
Changes:
ve.ui.Widget.css
* Add styles for decorated text input widgets and their icon elements
ve.ui.TextInputWidget.js
* Add icon option which adds an icon before input text
Change-Id: Ib48d795391cb5d110e7dc05658d51129792dfc33
Objectives:
* Break template page creation into it's own method
* Get rid of styling being applied in JavaScript
* Fix styling issues
Changes:
ve.ui.MWTemplateDialog.js
* Add method for adding a template page
* Replace css calls with addition of classes for styling
* Cleanup of append calls
ve.ui.Dialog.css
* Make inputs in the template dialog full width and a reasonable height
ve.ui.Widget.css
* Swap margins with padding in labels to prevent layout issues
* Prevent textareas from being resized in safari/chrome
Change-Id: I4030d8605aad865251ecd0aeb8cc72d333bed6a4
Objectives:
* Refactor template dialog to support loading template data for, and
editing multiple templates and interleaved content in a template node
* Update template node model to generate multi-template wikitext
Changes:
ve.dm.MWTemplateNode.js
* Rewrite getWikitext method to work with multi-template formats
ve.dm.MWTemplateDialog.js
* Retain information about the node and template calls
* Break AJAX handler into its own method
* Attach event handlers to inputs directly so template values are
edited directly on the fly
* Refactor page building to support multiple templates
* Add multi-template support for template data API call
* Add support for editing plain text content
Change-Id: I92ff8a9e186701a3f8da88def92a5b7dcb607897
Objectives;
* Cleanup the addPage API
* Add optional index param to addPage method
Changes:
ve.ui.MWMetaDialog.js, ve.ui.MWTemplateDialog.js
* Update uses of addPage
ve.ui.PagedDialog.js
* Bundle existing optional arguments into object
* Add index option for inserting a specific index
Change-Id: Idcef4d0a52fb817c7d888990920b2c12224a3392
Trevor tweaked the pixel grid snapping on my previous commit
but it appears that introduced some errors as well. The horizontal
lines in underline-a and strikethrough-s no longer have integer
x-coordinates, and on underline-u the whole object is offset
by (0.166, 0.166).
Bug: 47780
Change-Id: I51f2605e7d8e2bab1d641f02244d5cd24f505676
MW meta is close to being moved out of experimental, but language
editing is not in line for the beta release.
Bug: 48561
Change-Id: Ie87a3c7dde2f29c3898c08d4cade5c0ba2f937dd
Also remove the exception thrown when we try to add an non-existent
toolbar button, as it may just be experimental and not loaded.
Change-Id: I0a60421f45d7a3941c510defc60d1fbf9469e784
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
On wikis where certain "topicons" exist the toolbar showed a
weird blank space pushing the entire toolbar down and
ve-ui-toolbar-actions to the left.
Bug: 48734
Change-Id: Ic5f73ac1eb8c41b891dd1c67b71795cb6c456141
Don't suggest a "new page" (redlink) for values that are
strictly different but the same as a suggestion according
to mw.Title (e.g. input "foo" with an existing "Foo" page
should not suggest a redlink to inexistant page "foo").
Bug: 48476
Change-Id: I66f5fc56554984af58d6223dc6cd76b3ab9940bd
Fetch
* Added basic name expansion logic since bug 48663 is not yet
resolved in Parsoid.
* Fetch info from template data API.
Clean up (follows-up 97157a1c, de203cb8, 718db58)
* Remove redundant initialize method.
* Pass the entire target object to #getTemplateData
because `target.wt` is *not* the template name.
* Reorganise #createPage to be more logical and rename
to #createParamPage.
* Add todo comments for things currently missing.
* Implement error handling of promise to prevent UI from
going stale if the promise is not resolved.
* Fix documentation in ve.ui.MWCategoryInputWidget.
Change-Id: Ie0114a81eead86d7a3b3e3a7a5b10d25c457b524
Rather than using namespaced linmod attributes, store the preserved
HTML attributes in the .htmlAttributes property of the linear model
element, in a nested structure to allow for easier treatment of child
nodes. Also added attribute order preservation by storing attributes
as an object plus an array of keys.
ve.ce.Node.js:
* Remove html/* attribute synchronization. Doesn't make sense any more
because these things aren't in the attributes object any more. I don't
think it ever made sense because these attributes were never supposed
to be changed anyway.
ve.ce.View.js:
* Replace renderAttributes() with a simple wrapper around
renderHtmlAttributeList()
ve.dm.Converter.js:
* Add buildHtmlAttributeList() and renderHtmlAttributes() for building
and rendering HTML attribute lists
ve.dm.Model.js:
* Add getter for .htmlAttributes
ve.dm.Node.js:
* Drop .htmlAttributes on clone, and remove logic dropping html/*
ve.ui.MWCategoryWidget.js:
* Remove html/0/about hack, was already unnecessary and now doesn't
work any more
tests/:
* UPDATE ALL THE TESTS
Change-Id: I620573afd70d36ade6b80413075b6e1f4a435abe
Objective:
* Context popup would stop opening sometimes "mysteriously" which ended
up having to do with the automatic closing on blur functionality
added to popups for use in the category popup widget
* Mousedown event canceling was being applied a little too widely, and
was causing popup widgets to not allow child elements to be focused
(unless they contained an iframe, like an inspector)
Changes:
ve.ui.Context.js
* Make use of the popup's show and hide methods within the inspector
ve.ui.MWCategoryPopupWidget.js
* Override autoClose option for category popup widgets
ve.ui.PopupWidget.js
* Add autoClose option to popup widgets
* Move event handler to the top of the methods (convention)
* Only bind blur event if autoClose is enabled
* Inline the getFocusedChild method
Change-Id: I22aedb5fbd51b327ea7ce2ecdd6123e79cbebb9c
Objectives:
* Make the context menu display in the top right corner of the currently
focused inspectable node (if there is one)
* Prevent clicking on anything to do with the toolbar or popup from doing
anything at all, ever
Bonus:
* While we are using the clever feature in jQuery's on method which allows
passing boolean false to cancel the event - may as well do that in
ve.ui.Dialog as well
Changes:
ve.ui.FocusableNode
* Add ability to specify the focusable element so that dimensions can be
derived from it
ve.ce.Surface
* Add quotes to object keys
ve.ui.MediaDialog
* Change association from being MW specific to handling images in general
ve.ui.Context
* Add embedded styles for context
* Add embedded mode, which is triggered when the context is a single
focusable node, and the node is large enough to fit the context
reasonably
ve.ui.Dialog
* Inline mousedown handler
ve.ui.Toolbar, ve.ui.PopupWidget
* Cancel stray mousedown events
Change-Id: I4b25d33f64b4bcb8a3ecfd7e9728f54a2d4886f3
Objective:
* Add multiline option to text input widget which uses a text area instead of a text input
Changes:
ve.ui.Widget.css
* Add text area support for styles otherwise only targeting input elements
ve.ui.InputWidget.js
* Initialize input element using a method, so it can be fully customized (like making a text area or select input
* Use val() to set the initial value, using jQuery's abstraction around inputs of various types
ve.ui.TextInputWidget.js
* Add multiline option which uses a text area instead of an input
Change-Id: I1bf17c8c76b7f1708c57ee5e95160c071ddd00e9
The existing default sort key was being cached when the dialog was
constructed, but on the 2nd time launching it the reference was broken.
This change gets rid of the caching and always grabs a fresh copy when
we need one.
Also, the flag indicating the default sort key has changed wasn't being
reset properly.
Change-Id: I8fb3b088f25212b8c542df65bb5a248550ff6f27
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
Objectives:
* Ensure items don't get moved to the end when their sort-key is edited
* Add placeholder text and pending styling to input
* Auto-expand input to the end of the line
* Make the minimum input width smaller
Changes:
ve.ui.MWMetaDialog.js
* Added calls to fitInput on initialize
* Fixed sort key update and insert handlers to maintain item position when updating
ve.ui.GroupElement.js
* Added index argument to addItems, allowing items to be inserted at a specific location
ve.ui.PagePanelLayout.js
* Fixed CSS class name
ve.ui.StackPanelLayout.js, ve.ui.MenuWidget.js, ve.ui.SelectWidget.js
* Passed index argument through to group element
ve.ui.PanelLayout.js
* Fixed overflow direction for scrolling option
ve.ui.Inspector.css
* Moved border-box properties to text input widget class
* Set input widget within inspectors to be 100% by default
ve.ui.Layout.css
* Updated CSS class name
* Whitespace fixes
ve.ui.Widget.css
* Made text input widgets's wrapper default to 20em wide and the input inside it be 100%, using border-box to ensure proper sizing
* Adjusted category list item and input styles to make input appear more like a category item
* Whitespace fixes
ve.ui.MWCategoryInputWidget.js
* Made category input widget inherit text input widget, rather than just input widget
ve.ui.MWCategoryWidget.js
* Replaced group functionality by mixing in group element
* Added fitInput, which automatically make the input fill the rest of the line or take up the entire next line depending on how much space is left
VisualEditor.i18n.php
* Adjusted placeholder text for category input
Change-Id: I79a18a7b849804027473084a42c36133fdacad57
The EventEmitter API we inherited from Node.js and then bastardized was
getting awkward and cumbersome. The number of uses of ve.bind was getting
out of control, and removing events meant caching the bound method in a
property. Many of the "features" of EventEmitter wasn't even being used,
some causing overhead, others just causing bloat. This change cleans up
how EventEmitter is used throughout the codebase.
The new event emitter API includes:
* emit - identical to the previous API, no longer throws an error if you
emit error without a handler
* once - identical to the previous API, still introduces a wrapper* on -
compatible with the previous API but has some new features
* off - identical to removeListener in the previous API
* connect - very similar to addListenerMethods but doesn't wrap callbacks
in closures anymore
* disconnect - new, basically the opposite of addListenerMethods
Another change that is made in this commit is mixing in rather than
inheriting from EventEmitter.
Finally, there are changes throughout the codebase anywhere
connect/disconnect could be used.
Change-Id: Ic3085d39172a8a719ce7f036690f673e59848d3a
The purpose is to flip the direction of the input inside
the link widget for RTL wikis, but flip it again to LTR
if the user inserts an external URL. This is my first VE
fix, I tried to follow conventions and avoid touching the
parent objects that are unrelated to URLs.
Bug: 47717
Change-Id: Ic13b9c3b155ce2979298cac9518c7419b9d45bac
Modifications:
VisualEditor.php
* Added links to new widgets
VisualEditor.i18n.php
* Added placeholder text for category input
ve.ui.Widget.css
* Added styles for new widgets
New:
ve.ui.MWMetaDialog.js
* Create category widget with categories from dm.
* Listen to metaList for insert and remove events
** insert / remove bound methods to be improved upon additional meta groups
* Add listeners to mwCategoryWidget for new categories and updates
ve.ui.MWCategoryWidget.js
* Top-level category editing widget
ve.ui.MWCategoryItemWidget.js
* Items within a category widget
ve.ui.MWCategoryInputWidget.js
* Input for new categories, handles menu and API requests
ve.ui.MWCategoryPopupWidget.js
* Mini-inspector for a category item
Bug: 39597
Change-Id: I5eafaa484a1924a566d3a1ee1d869293089d0ecf
By making the API for adding/removing/clearing always plural, it greatly
simplifies the interfaces and reduces function call overhead in most
situations.
Change-Id: Ia8f23a373a01a8f6d5081587a591563e4f25ea42
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
Remove all manual changes to SF ranges as these are not
undoable. Instead change translate range to default to
outer expand and build functionality around that behaviour
never changing.
As translate range is always outer I don't think we need to
check for start and end crossing over?
Added more undo tests to assert these selections are maintained
properly, and added the test case to 'update' for when and undo
point is overwritten.
Insert content now results in a selection over the inserted
content. Most usages were expecting this anyway and were
followed up with an adjustRange(-length,0) which is no longer
necessary.
Noticed that the link inspector case was never being triggered
as word boundary was always expanding to at least one char (mainly
for Hanzi selection). This doesn't make much sense as single
spaces get auto selected so removed this functionality.
Split collapseRange out into collapseRangeToStart and
collapseRangeToEnd as this may be required to get the old
behaviour (range moves to end after insert).
Change-Id: I3dc0b4d00d37bad1ca3076a69b41c5f0b3fa0570
The toolbar has a high z-index when being floated, it doesn't need one
otherwise. This was causing an issue where the Vector actions drop-down
menu was being obscured.
Change-Id: I3c0ff7c4cf3b4a6c3d94f00ef56d7f299aeb6020
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
Reuse the existing internal link annotation builder instead of using a
constructor directly, and incorrectly (it's meant to be passed an
element, not an attributes object)
Change-Id: I4cda6a9c3442cb10ebbc0844630fedba403adc91
ve.ce.Node.css
* Added prefixes for use of box-sizing
ve.ui.MWLinkInspector.js
* Whitespace
ve.ui.Inspector.css
* Corrected input width, always 100% wide now by using box-sizing
ve.ui.DialogButtonTool.js, ve.ui.Context.js
* Updated use of getViewsForNode
ve.ui.ViewRegistry.js
* Added inheritance-based prioritization for matching views with annotations and nodes
Bug: 47413
Change-Id: I286a28002c1691e58bbd7de04ed08cceb8b3bb07
Turns out, the context property of a jQuery selection isn't always
there.
For example:
$( 'body' ).context === document
$( '<div>' ).context === undefined
Even if you later attach that div, so long as you have the old
selection around, the cached `context` property won't magically be
updated. This makes sense (although it's poorly documented in the
jQuery API) but causes issues for us, and pretty much makes the
context property useless.
Instead, we can just use the standard `ownerDocument` property,
available on all DOM elements.
This change also add support for passing in a DOM element directly, in
addition to the existing support of passing jQuery or Document objects
in.
Change-Id: Ib8a31b74f2a4f455b1318be9f5c7805a2a193c79
By removing the transaction listeners from surface fragments we
no longer have to make sure they are always manually destroyed.
In order to retain the functionality of having fragments update
with transactions elsewhere we keep a pointer to a place in the
new complete history stack in the surface. The complete history
stack records all transactions, even undone ones.
Whenever getRange is called we replay all transactions in the
complete history (in the correct order) since the fragment was
last updated.
Also in this commit:
* Updated Format/IndentationAction to test undo(). This increases
coverage of surface fragment behaviour.
* .range is always accessed by .getRange now, although as an
optimisation we can use the noCopy mode when we a sure the
returned range will not be modified.
* Added undo test to .update (previously .onTransact)
Bug: 47343
Change-Id: I9e9818da1baa8319a3002f6d74fd1aad6732a8f5
*.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
Don't call initialize inside the try-catch, it ends up sending exceptions thrown inside that method to /dev/null.
Change-Id: I8e0945f35c639ec156ee9a163b86fddfaed0ea7b
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
So. It turns out that the design of SurfaceFragment is a little -
shall we say - wonky.
One of the best things about ve.dm.SurfaceFragment is its magical
ability to retain the intention of its range, even as transactions
are being processed. This ability is granted by each fragment
listening to the surface's change event, and responding by using
translateRange for each transaction that gets processed. Surface
fragments also have these clever methods that allow you to get a
fragment based on another, which makes adjusting the range easy to do
inline without having to manually store multiple fragments or
modifying the original.
This sounded good, and we seemed to all be convinced it was well
designed. But if you add a console.log( 'hello' ); to the first line
of ve.dm.SurfaceFragment.prototype.onTransact, and then start using
the bold tool on various selections of text, you will find that there
may indeed be a flaw. What you will probably realize is that the
number of times that particular line of code is being called is
disturbingly large, and increases each time you do just about anything
in the editor. What's going on? How did we get here? Read on…
It turns out that fragments are immortal. We create them, they listen
to the surface's transact event, we are done with them, but the
surface keeps on emitting events to the now long forgotten about
fragments. They continue to build up over time, never go out of scope,
and bloat the hell out of our program.
The same ended up being true of toolbars - and each time the context
menu fired up a new one the old one was left in limbo, still
responding to events, still taking up memory, but not being visible to
the user.
All of this immortality was causing strange and difficult to track
down problems. This patch fixes this by introducing a destroy method.
This method unbinds events, allowing the object to finally fall out of
scope and die - and more importantly stop receiving notifications of
changes.
This is a hack, but Ed will no doubt get this situation sorted out
properly by making fragments lazy-evaluate their selections by only
storing an identifier of the most recent transaction they were based
on, see bug 47343.
Change-Id: I18bb986001a44732a7871b9d79dc3015eedfb168
This helps with some differences between browsers, specifically Firefox,
where e.which would be "1" even if the mouse button was not pressed.
Change-Id: Ia88449c2bc84073d903dc702bb586127618d86f2
Rather than attach a function to the window and trigger it from a script
tag in the document body, it's much simpler to just use the references
we already have to execute the code immediately and directly.
This also fixes issues in Firefox where reaching in and adding functions
to the window wasn't allowed.
Change-Id: If7a84edf6ae4549b19ce36a3477311c46dbadea7
Added filter for nodes being passed to update state event - this
ensures that nodes are not being included with zero-length coverage, a
side effect of how selectNodes handles the virtual boundaries of text
nodes.
Change-Id: I6362114b57469b1108da11f94dc345a2bcdfc7cd
ve.ui.MetaDialog.js
* Added scrolling to outline panel
ve.ui.css
* Added reusable animation keyframes
ve.ui.Dialog.css
* Changed dialog head style
* Changed dialog cancel button to close icon button
* Added animation of dialog opening
* Increased min-height of dialog to always show a little content
ve.ui.Icons-*.css
* Added close icon (not sure why it was missing)
ve.ui.Window.css
* Moved head padding out of window and into implementations of window
ve.ui.Dialog.js
* Moved apply button to footer
* Renamed cancel button to close button
* Overrode close method with triggers a closing animation and then calls the parent close method after an animation is complete
* Added classes to close and apply buttons to make styling less ambiguous
* Converted cancel button (now the close button) to an icon button
ve.ui.Window.js
* Added footer to dialog
VisualEditor*.php
* Added close message
Change-Id: Iededbc54b287328b3047b05efad6ca3cc152caa5
window.close( true ) thing sucked, and was being named and used
inconsistently throughout the code.
The new approach uses an action string, so it looks more like
window.close( 'accept' ) or window.close( 'back' ). This makes it easy
to steer the behavior at any point in the window close code path.
Most importantly for the link inspector, this allows us to now restore
the previous selection when the user presses escape or clicks the back
button, while still moving the cursor to the end and collapsing the
selection upon pressing enter and allowing removal by clicking the
trash can.
This commit also cleans some things up, like the various ways we have
to close an inspector which all seem useless because we wouldn't want
to just randomly close an inspector on someone. An inspector should
be closed only when the user has dealt with it.
ve.InspectorAction.js
* Removed close method
ve.ui.LinkInspector.js
* Updated documentation
* Passing action to parent method
* Updated logic to deal with change from "remove" to "action" argument
* Added selection restauration on "back" action
ve.ui.Context.js
* Added action to call to close
* Removed closeInspector method
ve.ui.Dialog.js
* Moved event handlers to the top
* Added actions to calls to close
* Added click block event handler to prevent focus changes
ve.ui.Inspector.js
* Added actions to calls to close
* Added storing of previous selection - this is different from
initialSelection because it's captured before the selection is
modified by setup
ve.ui.Window.js
* Updated documentation
* Updated argument name from "remove" to "action"
ve.ui.WindowSet.js
* Updated documentation
* Removed auto-close, replaced it with error if trying to open a window
when another is already open
* Removed close method
Change-Id: Ie8f72504177dd6ba169fdddbb776fd5397b831c4
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
As described in the bug, ve.getHash performs JSON.stringify so to
customise a hash the object should just return an object to be
hashed, not the hash string itself.
Bug: 46895
Change-Id: If11071d4b04a01e25102ffb57240882f650ee10d
This is one of the blockers for splitting VE up into separate
repositories or extending VE with an extension.
ve.ui.Frame.js
It's critical that we don't emit initialize from ve.ui.Frame until
it's completely loaded, especially its styles, because we will
begin measuring it straight away.
Involved loading the stylesheets using $.ajax and setting base
URL of the iframe to the ve.ui styles directory so all the image
URLs still worked. This won't work for stylesheets from multiple
locations, so we needed a more robust solution.
The new solution uses some trickery described in the code
documentation, but essentially no longer depends on all
stylesheets being located in the same folder.
ve.ui.Dialog.js, ve.ui.Inspector.js, ve.ui.Window.js
Static methods are now being used to extend a window class to
include different stylesheets rather than simple array
concatenation.
Change-Id: I619238732f975d41305f81f8f818a577a40f49da
*/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
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
Also removed a few redundant headings in class documentation
comments. There is already an @class and it looks a bit odd in
the generated pages:
<h2>TextString</h2>
<p>TextString</p>
<p>This class provides a ...</p>
Change-Id: Ie311c6993ed02e79272dbde71f6a1bc252ef3037
*.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
Better comments for:
* ve.ce.Document.getRelativeOffset,
* ve.ce.Document.getSiblingWordBoundary.
Convert ve.ce.Surface.getSelectionRect to a static method.
Moved getNodeAndOffset from ve.ce.Surface to ve.ce.Document.
Change-Id: Ic00221fa463205d04c9b52150c0dd15904493b1e
ve.ui.Widget.css
* Made sections use a default cursor - they aren't clickable so they shouldn't appear to be
Change-Id: Id74288040080c18b8595f2903239bc82e8bc1ab2
ve.ui.Dialog.css
* Fix issue where the use of margin auto on the outer dialog wrapper
would expose parts of the underlying content - this is resolved by
making the outer wrapper cover the whole screen and making the
window frame use margin auto
ve.ui.Icons*.css
* Added missing settings icon rule
ve.ui.Layout.css
* Added styles for editor panel
ve.ui.Window.css
* Removed default height, setting it specifically in inspector now
ve.ui.EditorPanelLayout.js
* New layout, adds a title and icon above the content
ve.ui.TitledEditorLayout.js
* Similar to labeled widget, but for panels
ve.ui.MetaDialog.js
* Using settings icon now
* Switched to using a specific layout - still hard-coded for
categories
ve.ui.Frame.js
* Modified style loader to guarantee order of style rules, no matter
what order they load in
*.php
* Moved layouts to be included after widgets so they can use widgets
* Added links to new layouts
Change-Id: I7ff5f5f095460fd4f6cf841f4182bfb92bf034da
@emits, @returns, @chainable & @throws should always appear
in that order, according to CODING.md.
Change-Id: I9b192e018a028a8b32730c288cc4e3108800fb58
Objective: Refactor menu widgets so that the majority of their code can be reused, and then add an outline widget which shares the same base classes.
ve.ui.Dialog.css
* Make dialog a fixed width and have a minimum and maximum height while always being centered in the window.
* Add style for the outline panel
* Add border below the title
* Move font-size adjustment to child elements to preserve layout scale
ve.ui.Inspector.css
* Make inspectors fade in when being opened (will happen after the size transition is complete)
* Add initial size for inspector to prevent the default size of the unfinished contents from making it too large while loading
ve.ui.Tool.css
* Update classes according to changes in labeled widgets
ve.ui.Widget.css
* Add display: block to widget labels to support use of autoEllipsis on them
* Update classes according to changes in labeled widgets
* Add styles for new select, option and outline item widgets
* Remove unused group and items classes for menu widgets (which are now subclasses of the select widget and no longer have grouping built-in)
ve.ui.Window.css.js
* Moved selection disabling rules up to the head to prevent selection drawing around the title
ve.ui.GroupWidget.js
* New widget that manages "items", allowing getting, adding, removing and clearing
ve.ui.MenuSectionItemWidget.js
* New widget that can be used inside a menu to create an unselectable, unhighlightable item that describes a section of the menu
ve.ui.OptionWidget.js
* New widget to be used with select widgets, provides select and highlight functionality
ve.ui.OutlineItemWidget.js
* New widget to be used with outline widgets, extends option and adds support for an icon to be rendered to the left of the label
ve.ui.OutlineWidget.js
* New widget that provides a vertically stacked list of mutually exclusive options, extends select
ve.ui.SelectWidget.js
* New widget that implements most of what menu once did, only now it also handles all the events for it's child elements internally
ve.ui.MetaDialog.js
* Hacked in support for an outline widget in the outline pane
* Added classes for styling purposes
ve.ui.FormatDropDownTool.js
* Modified call to menu item constructor as per changes therein
* Reorganized options config to make construction simpler
* Changed to setLabel after selecting the item to prevent the label from being changed to the wrong value as a side-effect of setting the item
ve.ui.DropDownTool.js
* Added $$ in config for menu widget - just in case later on we use a drop-down inside of a frame
* Using jQuery .text() method to propagate the selected item's text to the label rather than keeping around a plain text copy of the label in a property
ve.ui.Context.js
* Improve context/inspector behavior in regards to initial sizing
ve.ui.js
* Added context property to $$ returned by get$$ so it's easy to get the document object (for event binding) wherever you have a $$
ve.ui.Window.js
* Fixed incorrect case for boolean type in comment
* Added getFrame method
ve.ui.ButtonWidget.js
* Removed extra class being set on label
ve.ui.LabeledWidget.js
* Added class on label
* Added fitLabel method which uses autoEllipsis internally
ve.ui.MenuItemWidget.js
* Moved nearly all of the implementation to option so it could be reused
ve.ui.Menu.js
* Moved most of the implementation to select and group
ve.ui.MWLinkTargetInputWidget
* Prevent aborting and re-querying if the value hasn't actually changed
* Updated populateMenu method as per changes in menu class
*.php
* Added links to new files
Change-Id: I2271b5cc0554973b13cfbff94caf16901c02caa5
This removes the "grow from nothing" effect (which may have been a
little overkill) but fixes the situation where the inspector is open
and you click to a new location and it moves to the new location and
then transitions down to the menu (which looks bad).
Change-Id: I19d27da6fea7c36965c83aa73836b1bc870c9bcc
* Document them consistently between secetions Inheritance and
Static Properties under their own (new) section Events.
* Removed any quotes or brackets around the event name in existing
@emit annotations
Search: @emit.*['"{}(){}]
* For every call to this.emit() anywhere, added @emits.
* Fixed all warnings for references to undefined events
(introduced as a result of the previous point).
Event handler parameter documented based on the emit() call
and actual handlers using the event. Usually the latter is
more elaborate.
* Extend coverage of jQuery as needed
(copied from mwcore/maintenance/jsduck/external.js
written by me, hereby implicitly and explicitly released under MIT).
Specifics
* ve.ce.Surface#onContentChange: Fixed type of range from Object to ve.Range.
* ve.ce.SurfaceObserver#poll: Fix syntax for code from {} to `backticks`.
* ve.ui.Toolbar#onContextChange: Doesn't actually emit "clearState" event.
Removed #onClearState in Tool, ButtonTool and DropdownTool.
Bug: 45872
Change-Id: Id879aa769b2c72d86a0322e75dddeb868211ce28
Layouts
* Makes widget inherit from element
* Adds layout which also inherits from element
* Adds grid and panel layouts
* Uses grid layout in meta dialog
Other changes
* Corrects issues with several of the stand-alone files by fixing and using makeStaticLoader.php
Change-Id: I6b92c0204e176c914c26eff8c03ea417578e080c