Commit graph

3482 commits

Author SHA1 Message Date
Ed Sanders edcaaf9edc Use static.name once for ce and dm nodes
Add a static.name property to ce nodes and make sure both ce
and dm nodes always use the static.name property in constructors
and registration calls.

The result of this is that any given node type should now only
appear once in the code as a string.

Bug: 45701
Change-Id: Ibf31de16ab28ad58209c1443cd74f93dda278998
2013-03-07 17:19:39 -08:00
jenkins-bot 49fea58c76 Merge "Fix for incorrect usage of ve.Range" 2013-03-07 23:51:18 +00:00
Inez Korczyński c021445649 Fix for incorrect usage of ve.Range
Properties "from" and "to" of ve.Range should be used when
direction of the range is important.

Change-Id: I73f27abf5c90f9aad8fdd0622f71b09188af9486
2013-03-07 15:49:00 -08:00
Rob Moen 1206d20646 Tweak i18n for meta and content dialog title
Change-Id: I4dc5c07073d1c1b202dbdb2f7c0c9e138d967a22
2013-03-07 15:48:59 -08:00
jenkins-bot 007d221b73 Merge "More work on dialog classes and their mw specific handling." 2013-03-07 22:46:43 +00:00
jenkins-bot 41a4cc2327 Merge "Introduce dialogs" 2013-03-07 22:46:36 +00:00
Rob Moen 7044ec820f More work on dialog classes and their mw specific handling.
Changes include:

VisualEditor.i18n.php, VisualEditor.php
* i18n labels for dialogs

ve.init.mw.ViewPageTarget.js
* Initial go at onOpenDialog and onCloseDialog methods

ve.init.Target.js
* Change calls to dialog hide & show to close & open

ve.ui.MetaDialog.js, ve.ui.ContentDialog.js
* Pass surface when constructing
* Add static title message property

ve.ui.Surface.css
* Set high z-index for toolbar for shadow to overlap dialog.

ve.ui.Dialog.js
* Extends EventEmitter class.
* Changed hide/show method names to open/close.
* Create base ui elements.

ve.Surface.js
* Create instance of meta dialog.

Change-Id: I867ca0546606eeb5e2ab7f612bb5af700ab877ec
2013-03-07 12:47:42 -08:00
Inez Korczyński e9b8021bf3 Fix for IE bug where clearTimeout doesn't clear the timeout
Apparently in IE even after you call clearTimeout, the function passed
to setTimeout might still get invoked (not 100% of the time).

It depends on the time difference between calling clearTimeout and
when that function was supposed to be called.

Change-Id: I050c1ecc51c1d891a028fb777243573487357171
2013-03-07 03:49:39 +00:00
Rob Moen 81c9b72db5 Introduce dialogs
Major changes:

demos/ve/index.php
* Renamed ve-demo-content to ve-demo-editor

ve.init.mw.ViewPageTarget, ve.init.sa.Target
* Added handlers for dialog events

ve.ui.*Dialog.js
* Added skeleton classes for dialogs

ve.init.Target.js
* Create abstract class methods for Target.

ve.init.sa.Target.js
* Create Standalone target view methods.

ve.init.mw.Target.js
* Added MW specific target view methods.
* Integration action buttons are now added to the edit
view in the toolbar.

ve.Surface.js
* Simplified constructor, now requiring a target which contains the container

* Other changes include some documentation and code cleanup.

Bug: 39597
Change-Id: Iff39266bdd3052f34bda254ca407030dbbc81f26
2013-03-06 14:19:15 -08:00
Inez Korczyński b98ee5140a DomRange makes more sense as a name for this class (cause it is not rangy specific).
Change-Id: I670523a0ed2216ebe34dc4b759a4aa429b9da53c
2013-03-05 12:18:59 -08:00
Ed Sanders 0195493099 Pass parsoid server errors through to VisualEditor.
Unfortunately the Http::get wapper provides no data if anything but
an OK status is returned, so ApiVisualEditor now uses MWHttpRequest
directly.

If a non-OK status in encountered the error code and message are
passed through to the JSON output, and rendered in the error
alert by VE.

The error code passed through is parsoidserver-http-NNN although
other suggestions are welcome.

Bug: 44354
Change-Id: I166ecf81c40f0f1c62663f2096753269d28f2916
2013-03-05 17:24:51 +00:00
Translation updater bot 9f0474cb71 Localisation updates from http://translatewiki.net.
Change-Id: Ibfabac13df838d583054964d68533f2be227781e
2013-03-04 21:36:20 +00:00
Translation updater bot 83cce843a6 Localisation updates from http://translatewiki.net.
Change-Id: I7a30b371511809c38fd139989d6d90e0c9d6252a
2013-03-01 21:31:52 +00:00
jenkins-bot b3c624f857 Merge "Shift-Enter should add newline in preformatted" 2013-02-28 20:28:57 +00:00
Translation updater bot e7d1abf2ce Localisation updates from http://translatewiki.net.
Change-Id: I449dd66f68534abd4e726579869f49f2984679a5
2013-02-27 21:23:13 +00:00
Trevor Parscal d1a397221e Added validation to ve.inheritClass
I encountered a very difficult to track down error while working on
ve.ui.Dialog where a copy-pasted inheritClass call overwrote the
prototype of ve.ui.Widget.

By adding this check, we can ensure that 2 identical calls to
inheritClass won't silently make the system explode. This check is
lightweight and will save someone down the line a bit of time and head
scratching.

Change-Id: I014d53722fc8d941ec415462d258a79985e0e3d7
2013-02-27 18:41:59 +01:00
Christian Williams 0af149824f Shift-Enter should add newline in preformatted
Modified handleEnter to check for the condition that shift-enter
is being pressed inside of a preformatted block. If so, a break
node is inserted.

Bug: 45355
Change-Id: Iae7b3c88b7cd976e519c09821a064078228acc79
2013-02-26 14:01:23 -08:00
Translation updater bot 3fd8ace016 Localisation updates from http://translatewiki.net.
Change-Id: If262096fc513b30795fb84c81a786740f477cc8c
2013-02-26 20:55:13 +00:00
jenkins-bot 826c6e4d8e Merge "Major UI refactoring and improvements" 2013-02-26 20:38:29 +00:00
Trevor Parscal a5aeca3ff5 Major UI refactoring and improvements
Objective:

Refactor UI widgets, improve usability and accessibility of menus, general cleanup and style improvements.

Extras:
Fixed documentation in a few other files to make descriptions of jQuery event arguments more consistent, classes inherit correctly, and made use of the @cfg functionality in jsduck.

Changes:

.docs/config.json
* Added window, HTMLDocument, HTMLElement, DocumentFragment and XMLHttpRequest to externals, so jsduck doesn't throw warnings when they are used

demos/ve/index.php, modules/ve/test/index.php, VisualEditor.php
* Moved widgets above tools (since tools use widgets)

demos/ve/index.php
* Refactored widget initialization to use options
* Renamed variables to match widget names

ve.init.mw.ViewPageTarget.css
* Adjusted text sizes to make widgets work normally
* Added margins for buttons in toolbar (since button widgets
don't have any)
* Removed styles for init buttons (button widgets now)

ve.init.mw.ViewPageTarget.js
* Switched to using button widgets (involved moving things around
a bit)

ve.ui.LinkInspector.js, ve.ui.MWLinkInspector.js
* Renamed static property "inputWidget" to
"linkTargetInputWidget" to better reflect the required base class
for the properties value

icons.ai, check.png, check.svg
* Added "check" icon, used in menu right now to show which item
is selected

ve.ui.Icons-raster.css, ve.ui.Icons-vector.css
* Added check icon
* Removed :before pseudo selectors from most of the icon classes (not need by button tool anymore, makes them more reusable now)

ve.ui.Tool.css
* Adjusted drop down tool styles so menu appears below, instead
of on top, of the label
* Adjusted paragraph font size to better match actual content
* Updated class names to still work with menu widget changes
(items are their own widgets now)
* Updated selectors as per changes in the structure of button tools

ve.ui.Widget.css
* Added styles for buttons and menu items
* Adjusted menu styles

ve.ui.*ButtonTool.js
* Added config options argument passthrough

ve.ui.ButtonTool.js
* Moved var statement to the top inside constructor
* Switched to using "a" tag to get cross-browser :active support
* Added icon to inside of button to make icon styles more reusable
* Removed disabled support (now provided by widget parent class)

ve.ui.FormatDropDownTool.js
* Updated options initialization to construct menu item objects
* Modified handling of items to account for changes in menu and
item classes
* Optimized onUpdateState method a bit, adding early exit to
inner loop

ve.ui.ButtonTool.js, ve.ui.DropdownTool.js, ve.ui.Context.js,
ve.ui.Frame, ve.ui.Tool.js, ve.ui.Widget.js
* Added chain ability to non-getter methods

ve.ui.DropdownTool.js
* Removed items argument to constructor
* Updated code as per changes in menu class
* Fixed inconsistent naming of event handler methods
* Removed item event handling (now handled by items directly)
* Made use of this.$$ to ensure tool works in other frames

ve.ui.Tool.js
* Made tools inherit from widget
* Moved trigger registry event handler to a method

ve.ui.Context.js
* Switched from using menu to contain toolbar to a simple wrapper

ve.ui.js
* Added get$$ method, a convenience function for binding jQuery
to a specific document context

ve.ui.*Widget.js
* Switched to using a config options object instead of individual arguments
* Added options
* Factored out flags and labels into their own classes
* Refactored value setting methods for inputs

ve.ui.MenuWidget.js, ve.ui.MenuItemWidget.js
* Broke items out into their own classes
* Redesigned API
* Updated code that uses these classes
* Added support for keyboard interaction
* Made items flash when selected (delaying the hiding of the menu for 200ms)

ve.ui.LinkTargetInputWidget.js, ve.ui.MWLinkTargetInputWidget
* Refactored annotation setting methods

Change-Id: I7769bd5a5b79f1ab36f258ef9f2be583ca503ce6
2013-02-26 12:29:08 -08:00
Timo Tijhof 3d3972e972 Maintenance script: Update header
This is a much simpler pattern and more consistent
with other extensions.

Change-Id: Ia8b31ff0573287325eeb5a878a1eb36bbf6374af
2013-02-26 16:06:16 +01:00
jenkins-bot 86d1f2a35b Merge "Fixing canBeSplit for ListItemNode" 2013-02-26 01:20:15 +00:00
jenkins-bot 9ba823052e Merge "Cleanup: Omit second argument to setTimeout for "nextTick"" 2013-02-26 00:37:44 +00:00
Timo Tijhof 0031725751 Cleanup: Omit second argument to setTimeout for "nextTick"
Not 0 or 1.

Change-Id: Ia6eb985e649c5bd196f87aac98c3919e60be9a86
2013-02-26 00:34:58 +00:00
Christian Williams 3cd0448b33 Fixing canBeSplit for ListItemNode
List items weren't being properly split because of a typo in this file.

Change-Id: Ib275d62156b775bad57624dfdf4b54eb9a925eaa
2013-02-25 16:29:32 -08:00
jenkins-bot db87504269 Merge "Change FormatAction.splitAndUnwrap to use the new SurfaceFrament.isolate method" 2013-02-26 00:23:05 +00:00
Ed Sanders f506e33718 Change FormatAction.splitAndUnwrap to use the new SurfaceFrament.isolate method
Bug: 45246
Change-Id: I6e10ed87b25150cfc9d8e42c0f0bd3733b08fee7
2013-02-26 00:22:19 +00:00
jenkins-bot 8d54ef4135 Merge "Implement SurfaceFragment.rewrapAllNodes" 2013-02-26 00:22:01 +00:00
jenkins-bot e4724553f1 Merge "Modify styles, add disabled and read-only for widgets" 2013-02-26 00:14:08 +00:00
jenkins-bot fbdc0e62ed Merge "Resigning from localStorage" 2013-02-25 23:47:35 +00:00
Trevor Parscal 622180b6fa Fix JSDuck warnings
Follows-up I44bcb79a59 and various other changes.

Please remember to generate documentation and resolve
all warnings before pushing into gerrit.

Change-Id: I8a372443e841308463376d8673ce027a97bbcd30
2013-02-26 00:44:21 +01:00
Christian Williams 6614acc4a0 Resigning from localStorage
Using localStorage for copy and paste between ve instances previously worked, but broke with the introduction of AnnotationSet. After a discussion with James, rich copy and paste from many sources is the real goal, so copy and paste enhancement should work toward that end.

Change-Id: I58c0f4525e486fada997872b40c2317f57034b7a
2013-02-25 15:33:50 -08:00
Ed Sanders b384742103 Implement SurfaceFragment.rewrapAllNodes
rewrapAllNodes is effectively the same as unwrap then wrap
except it operates as one transaction as so avoids a potentially
invalid intermediate state.

Added some more comments for unwrapAllNodes and renamed a varaible
for consistency.

Fixed a typo in Transaction.newFromWrap comment.

Bug: 45242
Change-Id: Ie752a788d087055d97c7c6f75f59c6a2680d26c7
2013-02-25 14:59:39 -08:00
Trevor Parscal 59c67e1e94 Modify styles, add disabled and read-only for widgets
demos/ve/demo.css, demos/ve/index.php
* Style changes for utilities and dump output
* Initially disable the log range button, activate when there's a range to log
* Make range inputs read-only
* Rename some widget variables
* Add extra structure and classes to dump output

ve.ui.Widget.css
* Remove left/right margin for buttons
* Simplify opaque white color
* Modify selector for disabled buttons - see changes in ve.ui.Widget.js
* Added styles for text input widget's readonly and disabled states

ve.ui.Widget.js
* Added disabled state

ve.ui.ButtonWidget.js
* Moved click event handler to method

ve.ui.InputLabelWidget.js
* Moved click event handler to method

ve.ui.InputWidget.js
* Moved input change event handler to method
* Added readOnly state

ve.ui.LinkTargetInputWidget.js
* Corrected documentation

ve.ui.MenuWidget.js
* Blocked interaction while widget is disabled

ve.ui.MWLinkTargetInputWidget.js
* Corrected documentation
* Blocked interaction while widget is disabled

ve.ui.TextInputMenuWidget.js
* Blocked interaction while widget is disabled

Change-Id: I7ea89873b50a98d058d1dd1e309e3e8b7c8e7b2e
2013-02-25 12:10:26 -08:00
jenkins-bot 0d8bc60cc6 Merge "Make translateRange() translate across wrapping transactions correctly" 2013-02-25 19:32:34 +00:00
jenkins-bot c1b25fc8d7 Merge "Add ve.Range.prototype.isBackwards()" 2013-02-25 19:26:18 +00:00
jenkins-bot 86a60faa54 Merge "Combine consecutive remove operations" 2013-02-25 19:26:14 +00:00
jenkins-bot d9fcb114d5 Merge "After creating a ve.Surface in a test, destroy it" 2013-02-25 19:26:09 +00:00
Timo Tijhof a3651cbe0c Use @chainable where appropiate.
Find: @return.*this.*$
Replace: @chainable
Bug: 45264
Change-Id: Ib950422ddb78d7b91545399a6053e82ae2dbd932
2013-02-23 11:11:18 +01:00
Catrope 1a4c60ed17 Make translateRange() translate across wrapping transactions correctly
Previously, we would translate to the right of an insertion, but for
wrapping transactions that means we end up with something like
<ul><li>|<p>...</p></li></ul>|, which doesn't make any sense. This
change changes this to <ul><li>|<p>...</p>|</li></ul>.

* Add parameter to translateOffset() that toggles the behavior for
  the offset before an insertion
* In translateRange(), translate start and end differently
** In some cases this can map them across each other, fix that

Change-Id: Ia2197b08d9f6763be3f2db5a59546ddc3f74a281
2013-02-22 17:33:31 -08:00
Catrope 90114c7a48 Add ve.Range.prototype.isBackwards()
Change-Id: I6f6977cfc9d772239da22ceb779e5e37576c2e0c
2013-02-22 17:33:23 -08:00
Catrope 090e944dd9 Combine consecutive remove operations
We already combine consecutive operations of other types, but didn't do
that for remove. We have to do this, though, because translateOffset()
gets confused otherwise.

Change-Id: I4285a3efd9f2297398f57e2f24adb26adafdf465
2013-02-22 17:33:17 -08:00
jenkins-bot d00486a450 Merge "Cleanup selection displaying related methods in ve.ce.Surface." 2013-02-23 01:18:15 +00:00
jenkins-bot 951b3c78f0 Merge "Introduction of ve.ce.RangyRange class." 2013-02-23 01:16:46 +00:00
Inez Korczyński c3d10e965a Cleanup selection displaying related methods in ve.ce.Surface.
* Deleted blocks of code that are never executed.
* Deleted method (showCursor) that is never used.

Change-Id: I031585b40f384d3e0e5d4cb03f626c9229d97fcf
2013-02-22 17:05:54 -08:00
Inez Korczyński a5e56718cd Introduction of ve.ce.RangyRange class.
Change-Id: I44bcb79a5967c362774603ea27181b9c64d2ea96
2013-02-22 17:02:42 -08:00
Catrope 8b74c70a34 After creating a ve.Surface in a test, destroy it
I was seeing intermittent test failures caused by exceptions in
ce.SurfaceObserver (!!), seems to be caused by the FormatAction test
creating a surface but not destroying it.

Change-Id: I7ab070d3c8db934eb9781ac8a6466475144c214e
2013-02-22 16:22:30 -08:00
Catrope 1463d03f44 Change one last .storeHTMLAttributes to .storeHtmlAttributes
Change-Id: I161b2e8bf22c3784ca660ab0961a528b23601022
2013-02-22 16:13:47 -08:00
jenkins-bot 065e9c8a67 Merge "Make the full document regex hack a bit more robust" 2013-02-22 23:26:38 +00:00
jenkins-bot 60b5c838ad Merge "Make string type matches override regex type matches" 2013-02-22 23:26:27 +00:00