Commit graph

2948 commits

Author SHA1 Message Date
Trevor Parscal b58465dead Added categories and language icons
These are not used yet, but will be for inspectors and dialogs to come.

Change-Id: I503c889d137f8a804f627446af861e6b94442e2b
2013-03-15 14:17:42 -07:00
Trevor Parscal 5e7f538a63 Toolbar style fixes
demo.css
* Removed toolbar floating styles, which were out of sync and essentially a duplication of those in ve.Surface.css

ve.Surface.css
* Reorganized rules
* Fixed some CSS syntax issues

Change-Id: I94eb83fa74312266817f8932f54fc9b89332c524
2013-03-15 12:48:49 -07:00
jenkins-bot d73797d087 Merge "Remove 1px left margin from toolbar in Vector" 2013-03-15 18:25:10 +00:00
jenkins-bot 4a27e78813 Merge changes Ieffb108b,I334f7db2
* changes:
  Remove unused .data()
  Link inspector menu not appearing in the right place
2013-03-15 18:24:40 +00:00
Ed Sanders 0e973815ee Remove 1px left margin from toolbar in Vector
Apparently this is left over code from when Vector drew
the left border as a background.

Change-Id: I3a9829ed7ab1bb1f2ad1a1c88aff82b1a2fc456d
2013-03-15 18:14:18 +00:00
jenkins-bot 4565fa5725 Merge "Move toolbar-shadow.png to correct location" 2013-03-15 18:01:29 +00:00
jenkins-bot e915520310 Merge "Disable the save button when there is no past history" 2013-03-15 17:05:22 +00:00
Ed Sanders 9f2fed76d5 Disable the save button when there is no past history
If the user has undone all their actions they should not be able to
save the document. By updating the 'edited' property we also solve
the issue of the onbeforeunload alert displaying if all edits
have been undone.

Bug: 42939
Change-Id: Ib3bc5b0e2f21781166a17a3fdf4f5286e6713859
2013-03-15 15:56:53 +00:00
jenkins-bot 624171a952 Merge "Emit a transact event on the ve.dm.Document when a transaction occurs" 2013-03-15 13:07:54 +00:00
jenkins-bot 7cd0888b3a Merge "Make metadata reaping handle replacement operations more sanely" 2013-03-15 13:03:23 +00:00
jenkins-bot 9e1f517e9d Merge "Change MetaNodes to MetaItems" 2013-03-15 12:23:25 +00:00
Catrope a835c03bc1 Change MetaNodes to MetaItems
Rather than meta-things being special kinds of nodes, they are now a
separate class of things (MetaItems) along with Nodes and Annotations.

* Created a generic ve.dm.MetaItem that meta items inherit from.
  There will be actual instances of this class as well in the upcoming
  meta group code.
* Renamed MetaNode to AlienMetaItem, MWMetaNode to MWMetaItem,
  'metaBlock'/'metaInline' to 'alienMeta'
* Created a MetaItemFactory, handle meta items in the ModelRegistry
* Kill ve.dm.Node.static.isMeta, now obsolete

ve.dm.Converter:
* Pass in the MetaItemFactory
* Look up data element types in the ModelRegistry rather than the
  NodeFactory, because they can be either nodes or meta items
* Document createDataElement() and make explicit that modelClass can be
  either a node or a meta item
* Handle meta items in getDataFromDom()
* In getDomFromData(), check the MetaItemFactory as well as the NodeFactory

Change-Id: I893709c6f3aa00f85c1b905b70f9f4e597bdeada
2013-03-14 23:35:50 -07:00
Catrope dadf005a67 Emit a transact event on the ve.dm.Document when a transaction occurs
We'll need this to let a MetaList observe a Document and adjust to changes.
We should probably also have SurfaceFragment listen to this event instead.

Change-Id: I9e811e242969eb44afe0b4fa8153d0fb1b0071cd
2013-03-14 23:35:50 -07:00
Catrope 031b96dd2a Make metadata reaping handle replacement operations more sanely
Before, replacement operations that both inserted and removed data at
the same time would be treated as removals followed by insertions,
so we'd reap the metadata from the affected range and move it to the
start of the range. For a pure replacement, this doesn't make any sense.

Instead, preserve the first min(insertLength, removeLength) elements in
the metadata array, then perform a pure insertion splice or a pure
removal splice for the length adjustment. Any metadata reaped in a
removal splice is restored at the offset where we started removing,
after the preserved portion.

These changes make the behavior of metadata reaping saner in general
(the previous behavior had the potential to move metadata around if it
was near a paragraph opening or closing and you converted the paragraph
to a heading), and makes the behavior match up with translateOffset(),
which is desirable for MetaList synchronization.

Change-Id: If9a1c6a7cf43ead7e3e1e8f6e081b139ca65fa53
2013-03-14 23:35:50 -07:00
Trevor Parscal c0dcf647ac Move toolbar-shadow.png to correct location
The style was moved, but the image was left behind.

Change-Id: Ib6c22cf652d0ae787030986f0afd262e62d7f610
2013-03-14 17:10:42 -07:00
Trevor Parscal 531d3a7ac6 Remove unused .data()
Just cleaning up the cruft

Change-Id: Ieffb108b234409a1122a984b45bdda688ce2014b
2013-03-14 16:56:36 -07:00
Trevor Parscal ec912dc2d1 Link inspector menu not appearing in the right place
ve.ui.Widget.css
* Adjust menu up a few pixels to match other uses of ve.ui.MenuWidget (the format drop down)

ve.ui.LinkInspector.js
* Moved the form value initialization to a timeout that fires well after the animation of the inspector - this is only important because the first element has a menu that pops up and the menu was rendering in the wrong location

ve.ui.Frame.js
* Added reference to frame within this.$$ by passing it to get$$

ve.ui.Inspector.js
* Removed auto-focus on open from inspector base class - this will be done in a more specific and controlled way instead

ve.ui.js
* Added optional frame argument to get$$ so that it's easy to get the frame from any $$ that's bound to an iframe document

ve.ui.Window.js
* Removed duplicate static member assignments
* Added auto-focus on the window's frame before calling onOpen
* Added auto-blur of anything focused within the iframe after calling onClose

ve.ui.MWLinkTargetInputWidget.js
* Auto-highlight the selected item when populating a menu so that pressing enter always keeps the currently selected item selected

ve.ui.TextInputMenuWidget.js
* Take the frame's position into account when positioning a menu below an input

Change-Id: I334f7db29af6b821bcfc8dc3c0ccba2636d4d9b1
2013-03-14 16:56:04 -07:00
Trevor Parscal 949722c392 Toolbar actions not floating
Spurious semi-colon caused class to not be parsed, making toolbar actions not float right

Change-Id: I1ef88358908002cd7feb8c02b5da80d4f1ffe46d
2013-03-14 16:47:23 -07:00
jenkins-bot 77d29ec51c Merge "Add support for non-Latin scripts to wordBoundaryPattern" 2013-03-14 18:18:38 +00:00
Ed Sanders 47090bd1fd Add support for non-Latin scripts to wordBoundaryPattern
Replacing [a-zA-Z] with a long unicode expression which encompasses
all the characters in the unicode 'letters' category. Similarly replacing
[0-9] with an expression for 'numbers'.

Bug: 44085
Change-Id: Idd403339caa24769ce08133dda06ab6d4b9d694e
2013-03-14 11:17:28 -07:00
jenkins-bot bf6e7a6361 Merge "Correct name of can(Node)HaveGrandchildren functions" 2013-03-14 18:15:43 +00:00
jenkins-bot f53fe28d11 Merge "Add tests for ve.dm.Document.getNearestWordBoundary" 2013-03-14 18:02:27 +00:00
jenkins-bot 6f1216c3bf Merge "Fix Surface constructor in IndentationAction tests" 2013-03-14 18:01:23 +00:00
jenkins-bot 34a792d7b9 Merge "Context, frame, window, dialog and inspector refactor" 2013-03-14 17:41:09 +00:00
Trevor Parscal 1572ec1569 Context, frame, window, dialog and inspector refactor
This is a major refactor of user interface context, frame, dialog
and inspector classes, including adding several new classes which
generalize managing inspectors/dialogs (which are now subclasses
of window).

New classes:
* ve.ui.Window.js - base class for inspector and dialog classes
* ve.ui.WindowSet.js - manages mutually exclusive windows, used
  by surface and context for dialogs and inspectors respectively
* ve.ui.DialogFactory - generates dialogs
* ve.ui.IconButtonWidget - used in inspector for buttons in the head

Refactored classes:
* ve.ui.Context - moved inspector management to window set
* ve.ui.Frame - made iframes initialize asynchronously
* ve.ui.Dialog and ve.ui.Inspector - moved initialization to async
  initialize method

Other interesting bits:

ve.ui.*Icons*.css, *.svg, *.png, *.ai
* Merged icon stylesheets so all icons are available inside windows
* Renamed inspector icon to window

ve.ui.*.css
* Reorganized styles so that different windows can include only
  what they need
* Moved things to where they belonged (some things were in strange places)

ve.init.Target.js, ve.init.mw.ViewPageTarget.js, ve.init.sa.Target.js
* Removed dialog management - dialogs are managed by the surface now

ve.ui.*Dialog.js
* Renamed title message static property
* Added registration

ve.ui.*Inspector.js
* Switch to accept surface object rather than context, which conforms
  to the more general window class without losing any functionality
  (in fact, most of the time the surface was what we actually wanted)

ve.ui.MenuWidget.js, ve.ui.MWLinkTargetInputWidget.js
* Using surface overly rather than passing an overlay around
  through constructors

Change-Id: Ifd16a1003ff44c48ee7b2c66928cf9cc858b2564
2013-03-14 00:03:31 +00:00
Ed Sanders 387d8d6d39 Fix Surface constructor in IndentationAction tests
The IndentationAction was created against a version of master which
didn't have the new Surface constructor signature. This commit resolves
that conflict.

Change-Id: Ifc17f95acfa6057963d503448405355831b1ff97
2013-03-13 23:55:25 +00:00
Ed Sanders d22c7f7773 Correct name of can(Node)HaveGrandchildren functions
Bug: 43893
Change-Id: I9fd2a1fd6e3ee0a7bdfc357b5d4e4e0fd3efa0a5
2013-03-13 23:25:33 +00:00
Ed Sanders 981bb3ae7c Add tests for ve.dm.Document.getNearestWordBoundary
Also in this commit is a minor fix to the regular expression so it
behaves as documented (the hyphen needed escaping).

Bug: 44085
Change-Id: Idc315e2dce79be8f028b5681c60f74e175b9d869
2013-03-13 17:21:59 +00:00
jenkins-bot acf72c72c4 Merge "Refactor convert to use isolateAndUnwrap" 2013-03-13 16:37:17 +00:00
jenkins-bot 1d6e1828f3 Merge "Emit apply and close dialog when apply changes is clicked." 2013-03-13 06:56:49 +00:00
Rob Moen 002fa5d40b Fix current annotation being nullified
MWLinkTargetInputWidget annotation property was being killed
on populateMenu.

Other changes:
* Removed calls to sanitize on subclasses setValue methods
  as those methods call the parent class method which already
  sanitizes input.

Bug: 46025
Change-Id: I169dd58a06122122f187f9d751076ef56b255558
2013-03-13 01:41:33 +00:00
Timo Tijhof 2a1a25c580 Fix new lint warnings previously uncaught by jshint
The new jshint (0.9.1 > 1.1.0) is smarter about detecting trailing
whitespace (which enabled in our jshintrc file).
Looks like we did indeed let it slip through a few times in ve.Document.

Also cleaning up comment from * to - for consistency and avoiding
block-comment characters.

Change-Id: Ie1621816d608b5c42028ee945346d872a747c6a4
2013-03-13 01:37:00 +00:00
Ed Sanders a03d0d68cb Refactor convert to use isolateAndUnwrap
isolateAndUnwrap now unwraps to a level determined by a target type
i.e. the type you are going to convert to.

Also in this commit wrap/unwrap/rewrap have been refactored to use
getLengthDifference. unwrap now takes an inner/outer unwrap depth.

Change-Id: I3c6249de43232a9ef64f498a0aaf66b1c44973f2
2013-03-13 01:07:52 +00:00
jenkins-bot 9dfa6945b4 Merge "Only unwrap { generated: wrapper } based on context." 2013-03-13 00:55:14 +00:00
Ed Sanders 9a7b8aacf8 Only unwrap { generated: wrapper } based on context.
Wrapper paragraphs should only be unwrapped if they are the first
element in their parent - or if there is a block level element separating
them from the previous unwrapped paragraph.

Empty paragraphs should only be unwrapped if they are empty and the
last element in their parent.

Also in this commit is a simple test for IndentationAction.decrease().

Bug: 45590
Change-Id: I1f47d12db6d57d984fd4607f667a3b62c53f3dd6
2013-03-13 00:42:16 +00:00
jenkins-bot 34e8a9dbac Merge "Create MediaWiki specific nodes to contain MW specific rules." 2013-03-12 23:46:51 +00:00
Ed Sanders 0ce20b6e16 Create MediaWiki specific nodes to contain MW specific rules.
Heading and Preformatted nodes have rules that should only
exist under a document node in MediaWiki.

Two new node types have been created as has a new DropdownTool which
uses these. The MW init options have been changed to use the new
DropdownTool.

Bug: 45295

Change-Id: I3f47e1ae1f5c1415bde58a75385e4bf5f4b8fffc
2013-03-12 16:28:29 -07:00
Timo Tijhof c13dce97ec Fix JSDuck warnings
Change-Id: Ibc3f49c55ded5490fcb071f0ccf9f25a71a06c97
Warning: categories.json Class 've.NodeFactory' not found in categories file
Warning: ve.ui.ContentDialog.js:8: Unknown type ve.ui.Surface
Warning: ve.ui.MetaDialog.js:8: Unknown type ve.ui.Surface
Warning: ve.ui.Dialog.js:8: Unknown type ve.ui.Surface
2013-03-12 22:05:25 +01:00
Ed Sanders 404ddbf7cc Fix broken FormatAction tests.
The ve.Surface constructor was recently changed, but the instantiation
in the FormatAction tests was not updated accordingly.

The constructor now requires a ve.init.Target object.

Bug: 39597
Change-Id: Ia4193fbab5c63007ed057009bf9a39f1f9d18fb7
2013-03-11 16:53:44 +00:00
jenkins-bot 7b47b2ef03 Merge "Do not display phantoms while dragging mouse over alien nodes." 2013-03-08 23:38:25 +00:00
Inez Korczyński b99192e110 Do not display phantoms while dragging mouse over alien nodes.
It really does screw up selection in IE and does not look good in other supported browsers.

Change-Id: Ie190e86b25c3b253d4cf809594e74094275d0d57
2013-03-08 15:18:38 -08:00
Rob Moen 004f4cdeb7 Emit apply and close dialog when apply changes is clicked.
* Cleanup cancel button click binding.

Change-Id: I959a1b33e06a344a7946de8709f71f9c265a7604
2013-03-08 13:51:58 -08:00
jenkins-bot 8f7f6aefe6 Merge "Adding comments for grep" 2013-03-08 21:47:55 +00:00
shirayuki 17508a2657 Adding comments for grep
Change-Id: Ib20219ccf4409ac24f896c67e695f4155136daeb
2013-03-09 06:46:24 +09:00
Rob Moen ef9fb83685 In MW integration, dialog was overlapping toolbar shadow.
Setting the top to the outerHeight of the toolbar solves this.

Change-Id: I528ce23c88dfe6a3be7d4f7c4f6c90ef608630c1
2013-03-08 11:15:21 -08:00
jenkins-bot 80067f8633 Merge "Use static.name once for ce and dm nodes" 2013-03-08 01:20:35 +00:00
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
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
jenkins-bot b3c624f857 Merge "Shift-Enter should add newline in preformatted" 2013-02-28 20:28:57 +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
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
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
jenkins-bot fa1f760deb Merge "Add MWMetaNode to clean up <meta>/<link> hack in the converter" 2013-02-22 23:26:24 +00:00
jenkins-bot 4e0ebfdba0 Merge "Support RDFa type regexes in ModelRegistry" 2013-02-22 23:26:21 +00:00
jenkins-bot fb11cc8a8c Merge "(bug 45062) Implement the new node API in the converter" 2013-02-22 23:26:18 +00:00
jenkins-bot 482c89a916 Merge "Change context.wrapping to context.inWrapper" 2013-02-22 23:26:15 +00:00
jenkins-bot 950ff37d9b Merge "Add .static.enableAboutGrouping" 2013-02-22 23:26:12 +00:00
jenkins-bot 78232847db Merge "Add .static.storeHtmlAttributes" 2013-02-22 23:26:09 +00:00
Catrope dbd3d2354a Make string type matches override regex type matches
Change-Id: Ic21e27c047d8cb1161a6613bb5232d0d19b37aa6
2013-02-22 15:21:40 -08:00
Catrope 04c72f6871 Add MWMetaNode to clean up <meta>/<link> hack in the converter
Change-Id: I4c69bff4981eef78415b43d31c3fd2ee271450ef
2013-02-22 15:21:40 -08:00
Catrope 314817925a Support RDFa type regexes in ModelRegistry
Change-Id: Id19c3a567140f9e27ba732b6e8d9e25bc7a28a4f
2013-02-22 15:21:40 -08:00
Catrope 2e36f1542b (bug 45062) Implement the new node API in the converter
This changes the node API to work with multiple elements, so we can
support about groups. Instead of passing in and returning single DOM
elements, we use arrays of DOM elements.

ve.dm.Converter:
* Pass modelRegistry into the constructor
* Remove onNodeRegister handler and its data
* Remove getDataElementFromDomElement() and
  getDataAnnotationFromDomElement(). Most logic moved into
  getDataFromDom(), some into createDataElement()
* Remove createAlien(), replaced with
  createDataElement( ve.dm.AlienNode, ... )
* Replace doAboutGrouping() (which wrapped about groups) with
  getAboutGroup() (which returns an array of the nodes in the group)
* Put in a hack so <meta>/<link> elements with an mw: property aren't
  alienated
* Remove about group wrapping behavior in favor of just outputting
  multiple nodes

ve.dm.AlienNode.js:
* For multi-element aliens, only choose inline if all elements are
  inline, not just the first one

ve.dm.example.js:
* Add html/0 stuff for meta nodes
* Fix test case to reflect new alien behavior

Change-Id: I40dcc27430f778bc00a44b91b7d824bfb2718be6
2013-02-22 15:21:40 -08:00
Catrope 5e16141750 Change context.wrapping to context.inWrapper
It's what the docs say it should be, so let's call it that :)

Change-Id: Ia10861ce77872243beb3d3a1886877824103f6c9
2013-02-22 15:21:40 -08:00
Catrope cf9e5dd953 Add .static.enableAboutGrouping
Defaults to false, nodes can opt into about grouping. Not being used
yet, will be used in the converter rewrite.

Change-Id: Ic2a529241e69fb07ac926c826ead0108193b3050
2013-02-22 15:21:40 -08:00
Catrope bbe3783d58 Add .static.storeHtmlAttributes
Defaults to true, but set to false, so we don't do redundant work for
aliens.

Change-Id: If35db3a67afd78124b4b2b46bb78ad60cbac46f5
2013-02-22 15:21:31 -08:00
jenkins-bot 26e623940a Merge "Implement SurfaceFragment.unwrapAllNodes and fix wrapAllNodes." 2013-02-22 22:36:03 +00:00
jenkins-bot 5c78ba9b6a Merge "Fix bug with replacements in translateOffset()" 2013-02-22 22:33:48 +00:00
jenkins-bot 8e0348c803 Merge "Fix ModelRegistry stupidities" 2013-02-22 22:31:03 +00:00
Ed Sanders 4f0ac479ed Implement SurfaceFragment.unwrapAllNodes and fix wrapAllNodes.
wrapAllNodes was calulating the new selection incorrectly. This has
been fixed and a test added.

unwrapAllNodes takes a depth as its argument and unwraps that many
elements from inside the selection.

Tests for wrap/unwrap apply also now check that applying a wrap
and then its inverse as an unwrap result in the document reverting
to its original state.

Change-Id: I7dcacdfb5894be59ffad69b369d7b32933a25b61
2013-02-22 13:37:42 -08:00
Catrope 8f84982e0d Fix bug with replacements in translateOffset()
In our test case, offset 12 was mapped to 16, but that should be 11.
The problem here was that the offset right before the removal was
mapped to right after the removal, but that's only valid if we're
dealing with a removal, not when we're dealing with a replacement
where we're both removing and inserting data.

Change-Id: Ibf3c1463c0de009578cd50736f19bae82669ced8
2013-02-22 13:35:33 -08:00
jenkins-bot eae2529064 Merge "(bug 43461) Hide Phantoms" 2013-02-22 21:19:37 +00:00
jenkins-bot 1ef5c07a93 Merge "(bug 45423) Create SurfaceFragment.isolate method" 2013-02-22 20:40:32 +00:00
Ed Sanders feaa422495 (bug 45423) Create SurfaceFragment.isolate method
This method will take a selection of siblings and ensure they
are the only chlidren in their first parent which can be placed anywhere
(for example the first parent of a tableCell which can be placed anywhere
is a table, and for a listItem is a list).

The method ensures no redundant empty tags are created, so if
the selection encompasses all siblings then no action is taken.

Also in this commit are two test cases run against ve.dm.example.isolationData.

Change-Id: I783bd5ecd9d43d61f9b2685985409b4d746cbe94
2013-02-22 12:38:06 -08:00
jenkins-bot ab718eef32 Merge "Create tests for ve.FormatAction.convert" 2013-02-22 19:55:54 +00:00
Ed Sanders c05b5d13cd Create tests for ve.FormatAction.convert
These 3 tests convert different selections of list items to headings.

Bug: 45216
Change-Id: I6cf042d9d5aa4afb68c0992f444b600ed69f0c04
2013-02-22 11:52:12 -08:00
Christian Williams 7e74f0aa70 (bug 43461) Hide Phantoms
This fixes a problem that phantoms would remain visible if moving the mouse quickly. Now binding to mousemove and also mouseout.

Change-Id: I4f5e3319038828f83b108e9f5a45f54ebfeb7027
2013-02-21 23:02:05 +00:00
Catrope 4b086b94d7 Make the full document regex hack a bit more robust
Anchor the regex and make it look for doctype too

Change-Id: I43abb6f214a28801642bde46b50f4ac12614d1e4
2013-02-21 14:59:19 -08:00
jenkins-bot 502a2a2e53 Merge "Change {Boolean} to {boolean} throughout" 2013-02-21 00:42:44 +00:00
Inez Korczyński 0c73aa012e Introduce ve.Keys based on DOM Level 3 KeyEvent
Change-Id: I6abee2c0c49e355aef39089c7c94e51aaee01929
2013-02-20 16:15:59 -08:00
jenkins-bot ddbc0343b7 Merge "Make ve.copyArray() / copyObject() work with booleans" 2013-02-20 18:24:31 +00:00
Catrope a095c0ab06 Change {Boolean} to {boolean} throughout
Change-Id: Ibbbaed3762efa6a6928ba6e4611b1f1fef91ad8f
2013-02-20 10:03:55 -08:00
jenkins-bot 1d0a383968 Merge "Very small cleanup of onCut method in ve.ce.Surface." 2013-02-20 17:36:48 +00:00
Inez Korczyński 2d9c5d5628 Very small cleanup of onCut method in ve.ce.Surface.
Use ve.bind in order to change context within which
callback is called - reduces a need of introducing
new local variable.

Change-Id: I75ece695548c87073dd22e5e7ec80057d7132d22
2013-02-20 17:35:30 +00:00
Catrope b553cb9f21 Fix ModelRegistry stupidities
* Register mw: as an extension-specific type
* Include 'property' as an RDFa type attribute

Change-Id: Ia70708b76294815eb8eb8132048c33b0636380e9
2013-02-20 09:30:15 -08:00
Catrope 477cec43d6 Make ve.copyArray() / copyObject() work with booleans
This should really be fixed to not enumerate all types but be nicer.
Timo said he'd do that.

Change-Id: I15807696a7324d3fb207ed41b442a83dc83a75ec
2013-02-20 09:30:09 -08:00
James D. Forrester 82114467f1 Bump copyright notice year range to -2013 over -2012
199 files touched. Whee!

Change-Id: Id82ce4a32f833406db4a1cc585674f2bdb39ba0d
2013-02-19 15:37:34 -08:00
jenkins-bot a6fc5ab0ac Merge "Upstream: Update QUnit from v1.10.0 to v1.11.0" 2013-02-19 21:52:30 +00:00
Timo Tijhof 0538841366 Upstream: Update QUnit from v1.10.0 to v1.11.0
* Code:
  http://code.jquery.com/qunit/qunit-1.11.0.js
  http://code.jquery.com/qunit/qunit-1.11.0.css
* Tree:
  https://github.com/jquery/qunit/tree/v1.11.0
* Changes:
  https://github.com/jquery/qunit/compare/v1.10.0...v1.11.0
* Release notes:
  https://github.com/jquery/qunit/blob/v1.11.0/History.md

Change-Id: I3591455f0096471d073c94eaab424d151203b297
2013-02-19 19:50:02 +01:00
Catrope 3035c311ec Make the converter work with full HTML documents rather than fragments
The Parsoid output will also be expected to be a full HTML document. For
backwards compatibility, we allow for the Parsoid output to be a
document fragment as well. We don't send a full document back yet, also
for b/c -- we'll change this later once Parsoid has been updated in
production.

ve.dm.Converter.js:
* Make getDataFromDom() accept a document rather than a node
** Split off the recursion (which does use nodes) into its own function
** For now we just convert the <body>. In the future, we'll want to do
   things with the <head> as well
* Pass the document around so we can use it when creating elements
* Make getDomFromData() return a document rather than a <div>

ve.init.mw.Target.js:
* Store a document (this.doc) rather than a DOM node (this.dom)
* Pass around documents rather than DOM nodes
* Detect whether the Parsoid output is an HTML document or a fragment
  using a hacky regex
* When submitting to Parsoid, submit the innerHTML of the <body>

ve.init.mw.ViewPageTarget.js:
* s/dom/doc/
* Store body.innerHTML in this.originalHtml

ve.Surface.js:
* s/dom/doc/

demos/ve/index.php:
* Don't wrap HTML in <div>
* Pass HTML document rather than DOM node to ve.Surface

ve.dm.Converter.test.js:
* Construct a document from the test HTML, rather than a <div>

ve.dm.example.js:
* Wrap the HTML in the converter test cases in <body> tags to prevent
  misinterpretation (HTML fragments starting with comments, <meta>,
  <link> and whitespace are problematic)

Change-Id: I82fdad0a099febc5e658486cbf8becfcdbc85a2d
2013-02-19 10:38:39 -08:00
Catrope d36e6851d5 Add ve.createDocumentFromHTML()
Converts an HTML string to a brand new document using an iframe hack
(proper ways to do this exist, but don't work cross-browser).

Parsoid will serve us full HTML documents rather than document fragments
soon, so we'll need this functionality (along with some other changes
that I'm working on now) to deal with that change.

This doesn't currently work quite right in IE8 (although we have lots of
other issues in IE8) as well. It's not that hard to fix up though: we
just have to leave the iframe attached to the main document (should
probably provide a destroy function in that case) and the tests have to
deal with the fact that IE normalizes <head></head> to
<head><title></title></head> .

(For backwards compatibility, we'll have to deal with document fragments
as well; this will be implemented as an MW-specific hack in the
integration in the next commit.)

Change-Id: I15f877583c39124ba1c5e8e22585297ff3bac8d6
2013-02-19 10:30:25 -08:00
jenkins-bot a7030a5148 Merge "Abort activation when changing to view mode." 2013-02-16 01:04:52 +00:00
Rob Moen 3070d0c56e Abort activation when changing to view mode.
Resolves (Bug 44838)

Changes:
* onLoad: Setup only if activating.  Prevents ve from loading after aborted
while activating.

* onViewTabClick: add clause for activating mode.  Calls deactivate with an
override, and exits activating mode.

Change-Id: Ia61cd1d576b63098419474ad58bc01362c08541e
2013-02-11 11:38:50 -08:00
Catrope 98a914e9fe Optimize ve.filterArray a bit
Change-Id: I8fc9c8d5f57a4af3b5421c65664351f21e488c53
2013-02-07 17:16:18 -08:00
Catrope 591f2e7396 Change the HTML attribute prefix from html/ to html/0/
This means that <p data-foo="bar"> will now be converted to a paragraph
with attributes {"html/0/data-foo":"bar"} rather than {"html/foo":"bar"}

This paves the way for multi-element node (about group) handling in the
node API: nodes representing multiple DOM elements will have html/i/attr
to represent an attribute of the i'th DOM element.

Change-Id: Iea52bdccd721942ca708c8f9f47e934524809845
2013-02-06 12:00:43 -08:00
Rob Moen 78a99fb0a3 Check for instance of generic LinkAnnotation when querying target.
Resolves (Bug 44686)

Change-Id: I0ff962330e061aea66a25a923f46d6759e5ff6af
2013-02-05 11:55:27 -08:00
jenkins-bot 7ea4b94604 Merge "Fix bug where inline nodes didn't trigger wrapping" 2013-02-02 00:28:07 +00:00
jenkins-bot 6c5d83449d Merge "Remove trailing commas" 2013-02-02 00:26:59 +00:00
jenkins-bot 9a96f894ff Merge "Node cleanup" 2013-02-02 00:23:03 +00:00
Catrope 57ad316988 Fix bug where inline nodes didn't trigger wrapping
When encountering an inline node (i.e. content node that's not a text
node) within a branch node that's not a content branch node, the
converter should start a wrapper. But it doesn't do this, it only opens
wrappers for text nodes and annotations.

Fixed this in the converter, added a test for it, and fixed an existing
test that asserted the broken behavior.

Change-Id: I6e143e21e68b68f0d85b8772e24a2d3a5d465410
2013-02-01 16:06:17 -08:00
Trevor Parscal 363961a9e2 Node cleanup
ve.Node.js
* Removed unused emitUpdate property
* Made traverseUpstream a dynamic method rather than static

ve.ce.Node.js, ve.ce.Surface.js
* Updated calls to traverseUpstream

Change-Id: I28a2dac61aa32668d35854fbdb7712401c42336a
2013-02-01 15:35:48 -08:00
jenkins-bot 7155bcea16 Merge "i18n icons" 2013-02-01 23:34:15 +00:00
Trevor Parscal f49d80d27a i18n icons
Graphics (*.ai, *.png, *.svg)
* Took a pass on all images making them sharper and clearer
* Renamed bold and italic to bold-b and bold-a
* Added bold-f, italic-k, bold-a and italic-a
* Reorganized illustrator file

ve.ui.Icons-raster.css, ve.ui.Icons-vector.css
* Added classes for new icons
* Appended bullet, number, indent and outdent class names with "list"

ve.ui.*ButtonTool.js
* Added definitions for static icon property
* For bold and italic, added i18n style definitions

ve.ui.ButtonTool.js
* Switched from re-using the name property (which is intended to be the symbolic name of the tool used when registering with the tool factory) to using an static icon property for defining the icon

Change-Id: I43e7c35835a1e6dfb06f2a70226fac0d395008e8
2013-02-01 15:29:18 -08:00
Catrope 46957736a4 Remove trailing commas
JSHint doesn't detect this (this is an open bug against jshint), but
Eclipse does

Change-Id: Iebfc0f9c6263f60898739c9d19400357a65da0e9
2013-02-01 14:45:35 -08:00
Catrope a97f777685 Introduce context object in getDataFromDom()
* Introduce context object as specified for
  ve.dm.Node.static.toDataElement()
* Remove wrapping variable in favor of context.wrapping
* Remove wrappingIsOurs in favor of context.canCloseWrapper
* Introduce originallyExpectingContent and use it to repopulate
  context.expectingContent after closing a wrapper
* Replace most uses of branchHasContent with context.expectingContent
** Except for two cases where we need originallyExpectingContent

These changes fix a case where a metaBlock was generated in an inline
position. Updated the tests to reflect this.

Change-Id: I6baf6053f8a3a0b7d91487f812b9235a7b2b3db1
2013-01-31 15:00:00 -08:00
Catrope 1927330352 Use AnnotationSet rather than array in getDataFromDom()
Change-Id: Ie5f1f94bd62739ccf74c027dd0ba418fe2d91fa6
2013-01-31 15:00:00 -08:00
Catrope e083afb029 Hybrid-ify MetaBlock/MetaInline
Change-Id: I7b7a2d50637e2009742b290cb1bd0f4fc0395934
2013-01-31 15:00:00 -08:00
Catrope c0690634ee Hybrid-ify AlienBlock/AlienInline
Change-Id: Ieda8383c0c04df208f4c5f2aa7380427467049b7
2013-01-31 14:59:59 -08:00
Catrope ac6c9b2418 Specify (but do not implement) the context parameter to toDataElement()
This allows the converter to provide the node handlers with context
information, which hybrid nodes (such as alien and meta) need to decide
which shape to take.

Change-Id: I36860bee560a38ee39a149109be3706e39258edc
2013-01-31 14:59:59 -08:00
Trevor Parscal 100e67c128 Fixed documentation warning
Please use backtick (it's to the left of the 1 key) around HTML elements in comments.

Change-Id: I473e88a2cb1f7fb725f21cd0e8b3f659189c15a0
2013-01-30 12:52:03 -08:00
Catrope 36d99ad901 Add Iceweasel to supported browsers list
Depends on https://gerrit.wikimedia.org/r/46666

Change-Id: I1192ce6687ba69504d0c4be484e479ddebedbc87
2013-01-29 17:53:09 -08:00
jenkins-bot 602d01e461 Merge "Added tests and fixed inconsistencies for empty text node handling" 2013-01-29 23:16:30 +00:00
jenkins-bot 9bf5eb5b5b Merge "Added support for passing data into annotation constructors" 2013-01-29 23:15:21 +00:00
Trevor Parscal 16310f7535 Added tests and fixed inconsistencies for empty text node handling
Continues where Ibb682332a6084e357104183641a104e3ae1e253f left off, adding tests and removing inconsistencies between the behavior of the document constructor, which was adding empty text nodes to empty paragraphs, and correcting other tests which expected empty text nodes to be there as well.

Change-Id: I414d061cdd494b8023f14e944eda2910a4dab0d4
2013-01-29 15:13:17 -08:00
jenkins-bot a9b7c5c5e3 Merge "Trigger refactor" 2013-01-29 22:03:53 +00:00
Trevor Parscal ea4b42b2b2 Automatically prune empty text nodes
When there's 2 entities or inline content nodes (like aliens) with text between them, removing that text should remove the node too. If you don't remove the node then CE won't think to make a slug between the two inline nodes.

Change-Id: Ibb682332a6084e357104183641a104e3ae1e253f
2013-01-28 17:09:56 -08:00
Trevor Parscal 294db5e3ef Trigger refactor
Objective: Simplify the registration and use of triggers

Changes:

* Renamed ve.Command to ve.Trigger
* Renamed command demo to trigger demo
* Removed language prefixing of triggers
* Generating trigger tooltips rather than hard-coding them in i18n
* Added documentation to clarify that only 'mac' and 'pc' are supported platforms, and how the default is chosen
* Simplified trigger registry's register command
* Updated trigger registrations

Change-Id: Ibab6ad5b5c86f24707f064967dc2119a81125392
2013-01-28 17:06:13 -08:00
Trevor Parscal 280c85d8e7 Added support for passing data into annotation constructors
This resolves a TODO

* Added logic to support passing an argument into annotation constructor which is used as the data property (reusing the element argument)
* Updated documentation
* Simplified instantiation of annotations

Change-Id: I142b8fa3883bf70c896a2a568088d833814ef2dc
2013-01-28 11:01:52 -08:00
Catrope d73d6e9bf0 Add extension-specific types functionality to ModelRegistry
Extension-specific types are RDFa types (or type regexes) that are
registered with the ModelRegistry separately. If an element has a type
that is extension-specific, then that element can only be matched by a
rule that asserts one of its extension-specific types.

For MediaWiki, we would call
ve.dm.modelRegistry.registerExtensionSpecificType(/^mw:/ ) .
So then an element like <span typeof="mw:foobar"> would either match a
rule specifically for mw:foobar, if one exists, or no rule at all; even
the rule for <span> would not match. The consequence of this is that
elements with unrecognized mw:-prefixed RDFa types are alienated.

Change-Id: Ia8ab1fe5dffb9f813689324372a168e8e4a3e0bc
2013-01-22 18:12:35 -08:00
Catrope 99df776543 Allow matchTagNames = null in ve.dm.Converter
This won't usefully register the node with the converter right now, but
we need to allow this because the ModelFactory tests will need to have
stub nodes with tag-only matches.

Change-Id: I023cc8ff647363ab55c73dff39b17ca47e9e6681
2013-01-22 17:45:43 -08:00
Catrope 47b728bed9 Add wrapper for Array.prototype.filter
Change-Id: Ie7d8dd4193a81bedbb75258494bd78e8236bd0e8
2013-01-22 15:55:11 -08:00
Catrope aa372b6c16 Actually use this.nodeFactory and this.annotationFactory in ve.dm.Converter
Change-Id: I138a437d2e64577ad905ff70ecedf1eb7e6c8360
2013-01-22 15:55:11 -08:00
Catrope 5a5b4b577a Drop name parameter from ModelRegistry.register(), use .static.name
Change-Id: I74eeab1195455072ae48ac0655582f2bf01806d6
2013-01-22 15:55:11 -08:00
Catrope 819b3ded33 Move matching code from AnnotationFactory to ModelRegistry
ModelRegistry registers both annotations and nodes, and performs
matching on both at the same time. It also registers annotations with
the AnnotationFactory, and nodes with the NodeFactory.

Change-Id: I5e68e506a0e573cc0afe6304ccea058ffc20d1c8
2013-01-22 15:51:37 -08:00
Trevor Parscal bf5ba1ea2b Fixed documentation errors
Many of these problems were introduced in I859b5871a9d2f17d970c002067c8ff24f3513e9f

Change-Id: Ifc2dc4934f782c4ce5107e3a356e357aef754083
2013-01-22 23:38:01 +00:00
jenkins-bot 721e69cd9e Merge changes I8ee4796a,I2629c5fd
* changes:
  Make defaultAttributes a static property as well
  Replace nodeFactory invocations with direct static access
2013-01-22 23:23:13 +00:00
jenkins-bot d15b02a374 Merge "Convert node rules to static properties" 2013-01-22 23:22:33 +00:00
jenkins-bot 12b25cc6e8 Merge "Add annotation-like static properties to nodes" 2013-01-22 23:21:17 +00:00
Rob Moen 464471b538 Enable VisualEditor in MediaWiki integration for IE 9 and up.
Change-Id: I987223589c2a6b61dde5e2db8234cca40e237eec
2013-01-22 12:59:03 -08:00
Catrope c1b6e95042 Make defaultAttributes a static property as well
Change-Id: I8ee4796a93d55db9be6e43c78f3ac7bb29a65c6f
2013-01-18 14:51:40 -08:00
Catrope 51f4b4be54 Convert node rules to static properties
Change-Id: If7d0159e984d9ccb4d5c31effb62bb9612260fda
2013-01-18 14:51:40 -08:00
Catrope de6193734d Add annotation-like static properties to nodes
Add static properties for matching, data<->DOM conversion, and name. Use
matchTagNames, toDataElement and toDOMElement. name isn't used yet.

Change-Id: I5e7df3303bbd65e6968e931b568c23d76003a9a4
2013-01-18 14:51:40 -08:00
Catrope 12544c9e82 Replace nodeFactory invocations with direct static access
Change-Id: I2629c5fd659bca166237cef425f7cc3aff13ba0e
2013-01-18 14:51:40 -08:00
jenkins-bot 9cd96cd253 Merge "Fix naming of phantoms" 2013-01-18 21:39:46 +00:00
jenkins-bot 7f22c8b0d1 Merge "Inline ve.dm.Document.offsetContainsAnnotation" 2013-01-18 21:39:22 +00:00
Christian Williams 55b025fb1a Fix naming of phantoms
Change-Id: I60e925ee83fa2670eeabc5b690928f6f029b2eb4
2013-01-18 13:32:15 -08:00
jenkins-bot c6bc26ebe3 Merge "Fixes for typos and some missing documentation" 2013-01-18 21:05:13 +00:00
jenkins-bot 8a8a731a34 Merge "Convert "var\t" to "var "" 2013-01-18 21:03:55 +00:00
Catrope 594222c81d Add TriggerRegistry to tests
Fixes tests broken by 8ba81f4d67

Change-Id: Idd53d5c28941fa738b3a790977c0e7f0e65faaa9
2013-01-18 11:42:36 -08:00
Inez Korczyński 94642c797d Introduced method replacePhantoms in ve.ce.Surface in order to avoid accessing ve.ce.Surface local variable ($phantoms) from ve.ce.AlienNode
Change-Id: I9754d98175c7353f6db5306bc2ce35d6c57fdedb
2013-01-17 17:02:02 -08:00
Trevor Parscal 5cc93b288f Convert "var\t" to "var "
Partially reverts I45ee3fd5b2131131f3d10e05a1cc2f32a3e091cc (I read the diff backwards)

Change-Id: I5a638b8d13ed27a78586ff5507a421d7c49c9679
2013-01-17 16:55:09 -08:00
Trevor Parscal fcf08e4212 Fixes for typos and some missing documentation
Lots of fixes for "it's" being used incorrectly.

ve.ce.Document.js
* Filled in documentation for missing params

ve.FormatAction.js
* Fixed incorrect tag for returns documentation

Change-Id: Ic256cc6952c31f5e6ae8be92919a0799cfe6188b
2013-01-17 15:47:34 -08:00
jenkins-bot 4aeb00dcbc Merge "Slug Todos" 2013-01-17 23:41:34 +00:00
Christian Williams 8ec2276bb5 ImageNode Todos
* Removed mousedown handler (dragging is handled in ve.ce.surface)
* Added attribute change handler to ve.ce.Node to keep attribute changes on the model in sync with the DOM

Change-Id: I1d6a7f3dc3136439ce511a4f3eb5a54797c8f996
2013-01-17 15:40:06 -08:00
jenkins-bot 96b0d8698a Merge "Add interplatform, i18n shortcuts to ui buttons." 2013-01-17 23:30:43 +00:00
Rob Moen 8ba81f4d67 Add interplatform, i18n shortcuts to ui buttons.
Objective:
* Put command shortcuts in button title attributes. (Bug 42919)
* Provide a registry for platform specific command triggers and their
corresponding i18n messages. (Bug 44012)
* Enable loading of triggers after ve.Surface is created. (lazy load)

Changes:

VisualEditor.i18n.php
* Add default trigger i18n messags for mac and pc system platforms

VisusalEditor.php, demos/ve/index.php
* Add links to files

ve.init.mw.Platform.js
* Define getUserLanguage and getSystemPlatform methods.

ve.init.sa.Platform.js
* Define getUserLanguage and getSystemPlatform methods.

ve.init.Platform.js
* Define abstract methods: getUserLangauge, getSystemPlatform

ve.ui.BoldBUttonTool.js, ve.ui.IndentButtonTool.js, ve.ui.ItalicButtonTool.js,
ve.ui.LinkButtonTool.js, ve.ui.OutdentButtonTool.js, ve.ui.RedoButtonTool.js,
ve.ui.UndoButtonTool.js
* Add registration for command triggers.

ve.Surface.js
* Methodize loading of triggers.
* Bind register event to ve.triggerRegistry to allow lazy loading of triggers.

ve.ui.Tool.js
* Init pre-registered tooltip messages.
* Update tool titles when new triggers are loaded.

ve.CommandRegistry.js
* Remove command registration ( moved to buttons themselves )

ve.TriggerRegistry.js
* New class for registering triggers.

ve.init.mw.ViewPageTarget.js
* Changed instance of unindent command to outdent.

Change-Id: Id8580a3f81aac751db0b7482422a73912648dfed
2013-01-17 15:28:32 -08:00
Christian Williams e4ef6163a0 Double spaces optimization
Moved the sequential space check into the whitespaceHtmlChars and htmlChars loop

Change-Id: I835cccf868fed851f25f5ccbba1386697b0ea66b
2013-01-17 15:16:33 -08:00
Christian Williams b80f2ef7dd Reorganization of ve.ce.Surface methods
Logical grouping for Init, Browser Events, Custom Events, Utilities, Helpers, Getters, and Setters. This may be a precursor to a future, larger refactoring.

Change-Id: I059f88a604f0b5bc383eb3ae274bab0fe2dc476b
2013-01-17 15:12:03 -08:00
jenkins-bot 4167b7c638 Merge "Cleaned up paste target and surface styles" 2013-01-17 23:04:37 +00:00
Trevor Parscal a30e4c325b Cleaned up paste target and surface styles
Resolves a TODO related to the paste target div.

VisualEditor.php
* Added link to ve.Surface.css

ve.Surface.js
* Cleaned up initialization of .ve-surface element
* Removed float clearing div (see ve.Surface.css)
* Removed paste div (moved to ve.ce.Surface)

ve.Surface.css
* Added rule which adds an ":after" element to handle clearing floats

ve.ce.Surface.js
* Cleaned up initialization of DOM elements
* Added paste target div
* Replaced paste element selectors with direct references to this.$pasteTarget

ve.ce.Surface.css
* Changed paste div styles to use a namespaced class instead of a generic ID

demos/ve/index.php
* Added link to ve.Surface.css

Change-Id: Ib93d45ac82ae643fc8e659f5a063c02a8ddacdde
2013-01-17 15:02:47 -08:00
Christian Williams 81e061eb9d Slug Todos
Setting display of block slugs with CSS.

Change-Id: I249015618f934f8c162912883dbd4452fa266b3f
2013-01-17 15:00:11 -08:00
jenkins-bot 391760fbc0 Merge "Minor cleanup." 2013-01-17 22:14:16 +00:00
Inez Korczyński 52ce01e3d0 Fix minor bug (typo - was: ve.ve, is: ve.ce)
Change-Id: I588d7237fb57be28fcfbb8aa3b0ff2288c3bdae6
2013-01-17 14:13:11 -08:00
Inez Korczyński d84b02610a Minor cleanup.
Change-Id: I45ee3fd5b2131131f3d10e05a1cc2f32a3e091cc
2013-01-17 14:05:31 -08:00
Trevor Parscal 113c670305 Inline ve.dm.Document.offsetContainsAnnotation
Resolves TODO

ve.dm.Document.js
* Removed offsetContainsAnnotation method
* Inlined uses of removed method

ve.dm.Transaction.js
* Inlined uses of removed method

ve.dm.Document.test.js
* Removed test for removed method

Change-Id: Ie970234ad5d8c0417389b8a45defec9fd5be6a79
2013-01-17 12:07:14 -08:00
Trevor Parscal 6f8b0965f2 Remove range.normalize (not needed), use range.isCollapsed more often
The normalize method doesn't need to be explicitly called anymore because there's not any code that changes the properties of a range directly anymore.

A good way to prove it's not needed anymore is to move the normalization logic to the constructor and then add "console.log(this.from <= this.to );" to the normalize method - you will find that it's never actually doing anything at all because the range was normalized by the constructor.

ve.Range
* Moved normalization logic to constructor
* Removed calls to normalize method
* Removed normalize method
* Simplified documentation for flip method
* Whitespace fixes

ve.Document, ve.dm.Transaction, ve.dm.Surface, ve.dm.Document, ve.ce.Surface
* Removed calls to range.normalize
* Switched to using range.isCollapsed instead of comparing properties directly

Change-Id: I80bfd06f88579c34dce2083c2b70d63ab92f1275
2013-01-16 15:38:07 -08:00
Trevor Parscal 8d33a3de0d Major Documentation Cleanup
* Made method descriptions imperative: "Do this" rather than "Does this"
* Changed use of "this object" to "the object" in method documentation
* Added missing documentation
* Fixed incorrect documentation
* Fixed incorrect debug method names (as in those VeDmClassName tags we add to functions so they make sense when dumped into in the console)
* Normalized use of package names throughout
* Normalized class descriptions
* Removed incorrect @abstract tags
* Added missing @method tags
* Lots of other minor cleanup

Change-Id: I4ea66a2dd107613e2ea3a5f56ff54d675d72957e
2013-01-16 15:37:59 -08:00
Catrope b062691deb Make ve.dm.AnnotationFactory a named function rather than an anonymous function
Trevor, this could be another target for a cleanup spree, maybe?

Change-Id: Id37903ef452ff9758ac6c70c9e21faaff66c6f0b
2013-01-15 17:36:47 -08:00
Trevor Parscal f31dc45da8 (bug 43841) Major ve.ui rewrite, especially ve.ui.LinkInspector
Objectives:

* Make the link inspector easier to use
* Try to resolve a few bugs (bug 43841, bug 43063, bug 42986)
* Stop using jquery.multiSuggest (which didn't really understand annotations)
* Better divide MediaWiki specifics from generic implementations

Changes:

VisualEditor.php, modules/ve/test/index.php, demos/ve/index.php
* Updated links to files

ve.Registry
* Fixed mistake where registry was initialized as an array - this didn't cause any errors because you can add arbitrary properties to an array and use it like any other object

ve.Factory
* Removed duplicate initialization of registry property
* Added entries property, which is an array that's appended to for tracking the order of registrations

ve.CommandRegistry
* Added mwLink command which opens the mwLink inspector

ve.ui.TextInputWidget
* Added basic widget class for text inputs

ve.ui.TextInputMenuWidget
* Added widget that provides a menu of options for a text input widget

ve.ui.MWLinkTargetInputWidget
* Added MediaWiki specific link target widget

ve.ui.MenuWidget
* Converted ve.ui.Menu into a widget
* Moved the body of onSelect to onMouseUp

ve.ui.LinkTargetInputWidget
* Added link target widget which adds link annotation functionality to a normal text input

ve.ui.InputWidget
* Added generic input widget which emits reliable and instant change events and synchronizes a value property with the DOM value

ve.ui.Widget
* Added base widget class
* Widgets can be used in any frame

ve.ui.Tool
* Fixed line length issues

ve.ui.InspectorFactory
* Made use of new entries property for factories to select the most recently added inspector if more than one match a given annotation

ve.ui.Inspector
* Added auto-focus on the first visible input element on open
* Moved afterClose event to after re-focus on document on close
* Added documentation

ve.ui.Frame
* Adjusted documentation
* Added binding of $$ to the frame context so it can be passed around
* Added documentation

ve.ui.Context
* Added ve.ui.Widget.css to iframes
* Updated code as per moving of ve.ui.Menu to ve.ui.MenuWidget
* Removed unused positionBelowOverlay method
* Added CSS settings to set overlay left and width properties according to context size
* Added documentation

ve.ui.DropdownTool
* Updated code as per moving of ve.ui.Menu to ve.ui.MenuWidget

ve.ui.FormatDropdownTool
* Added documentation

ve.ui.MWLinkButtonTool
* Added MediaWiki specific version of ve.ui.LinkButtonTool, which opens the mwLink inspector

ve.ui.Widget.css
* Added styles for all widgets

ve.ui.Tool.css, ve.init.sa.css, ve.init.mw.ViewPageTarget.css, ve.init.mw.ViewPageTarget-apex.css
* Updated code as per moving of ve.ui.Menu to ve.ui.MenuWidget

ve.ui.Menu.css
* Deleted (merged into ve.ui.Widget.css)

ve.ui.Menu.css
* Deleted suggest styles (no longer used)

pending.gif, pending.psd
* Added diagonal stripe animation to indicate a pending request to the API

ve.ui.MWLinkInspector
* Added MediaWiki specific inspector which uses MediaWiki specific annotations and widgets

ve.ui.LinkInspector
* Removed mw global hint (not needed anymore)
* Switched from comparing targets to annotations (since the target text is ambiguous in some situations)
* Switched to using input widget, which is configured using a static property
* Removed use of jquery.multiSuggest
* Moved MediaWiki specifics to their own class (ve.ui.MWLinkInspector)

ve.init.mw.ViewPageTarget
* Added MediaWiki specific toolbar and command options

Change-Id: I859b5871a9d2f17d970c002067c8ff24f3513e9f
2013-01-15 15:05:11 -08:00
Timo Tijhof d4b24865a7 JSDuck: Fix warnings
Warning: modules/ve/test/ve.qunit.js:5: Class QUnit not found
Warning: .docs/categories.json No class found matching a pattern 've.Position' in categories file
Warning: modules/ve/ce/ve.ce.Surface.js:1297: Unknown type MouseEvent
Warning: modules/ve/ce/ve.ce.Surface.js:1297: Unknown type int

Follows-up:
* Ic21c9d3f
* Ib521eaa6

Change-Id: I8e371a2d4d91a1f03bd4ef59d18b7df715f23238
2013-01-15 21:15:17 +01:00
jenkins-bot 1e7df79c01 Merge "MetaBlockNode should be a BranchNode, not a LeafNode" 2013-01-15 09:16:03 +00:00
jenkins-bot 3100e914f1 Merge "Make stub nodes inherit correctly" 2013-01-15 09:15:29 +00:00
jenkins-bot 81cb7b2671 Merge "Fix test breakage in 90f046799" 2013-01-15 09:14:50 +00:00
Catrope 52549e41d0 MetaBlockNode should be a BranchNode, not a LeafNode
Change-Id: Id6f99ffce553d45cb2bc0250721ceec25333e1dd
2013-01-11 20:19:17 -08:00
Catrope 131b83831f Make stub nodes inherit correctly
Some of these stubs didn't inherit Node at all. Made them all inherit
LeafNode because their rules specify they can't have children.

Change-Id: If4afc8de350f67ee78a41307c426ec2aceeb884f
2013-01-11 20:18:10 -08:00
Catrope a8e3b59141 Fix test breakage in 90f046799
The title attribute should only be rendered. It should not be put in the
HTML that is sent back to Parsoid.

Change-Id: I63c0373c71c3bf01a4238af3ccd02c835a118e2f
2013-01-11 20:18:09 -08:00
Trevor Parscal 7d09e0671e Removed code for and links to unused libraries
Removes:
* ve.Position
* jquery.multiSuggest
* jquery.json

Change-Id: Ic21c9d3f5fe8a71d37a1a3633baa6325ca5d51b3
2013-01-10 13:25:33 -08:00
jenkins-bot b248cc3db9 Merge "More {String} -> {string} conversions in documentation" 2013-01-08 21:04:52 +00:00
Trevor Parscal a379e0f91e More {String} -> {string} conversions in documentation
Follow up for I6a7c9e8ee8f995731bc205d666167874eb2ebe23

The first pass that Timo took missed the following cases

* "{Array|String}": string is just one of the values
* "{String[]}": string is followed by [] to indicate an array of strings

Change-Id: I65e595e8d37fb624802d84af9536a2d3c5d73c7d
2013-01-08 13:02:12 -08:00
jenkins-bot 90f2d9f1ba Merge "Initialization error when canceling load" 2013-01-08 20:58:35 +00:00
Catrope 080dfd7d07 (bug 42398) Kill ve.ce.Meta{Block,Inline}Node, not needed.
CE doesn't actually render meta nodes anymore now that we split them out
into the meta-linmod.

I took a stab at consolidating metaBlock and metaInline (into simply
'meta'), but we can't do that with the current node API unless we put a
lot of meta-specific hacks in the converter. So I'm leaving this for the
node API rewrite.

Change-Id: Ie83413df718eabcaeb504316a2db0d24a1be2226
2013-01-08 12:45:25 -08:00
jenkins-bot 4aec0f6d0d Merge "Triple-Click Detection for IE" 2013-01-08 20:43:52 +00:00
Christian Williams f934d91b97 Triple-Click Detection for IE
IE does not properly support MouseEvent.detail for reporting the number of clicks in a user action. The new clickCounter() function takes a mousedown event and returns the detail property if non-IE or calculates the detail by comparing to a recent history (up to 3) of mousedowns.

Change-Id: Ib521eaa695d7e436d67ebb49106159daadc2ee38
2013-01-08 12:43:09 -08:00
jenkins-bot d349f18d4b Merge "(bug 43056) Inline tags like <span> are block-alienated sometimes" 2013-01-08 20:41:28 +00:00
jenkins-bot 879a07511a Merge "BugID 43076 - Fixes to alien and phantom corner cases" 2013-01-08 20:39:34 +00:00
jenkins-bot 23ca3fcd34 Merge "Set title attributes for internal and external links." 2013-01-08 20:35:44 +00:00
Trevor Parscal ec5333030b Initialization error when canceling load
Added check for the existence of the surface before the save dialog is hidden. This oversight caused errors when there was a load error and the user clicked cancel.

Change-Id: I3b6d8d4d9f4c81ffcbd7996d6b17ac04f33bf6d7
2013-01-08 12:29:54 -08:00
Timo Tijhof b11bbed7a6 JSDuck: Generated code documentation!
See CODING.md for how to run it.

Mistakes fixed:
* Warning: Unknown type function
  -> Function
* Warning: Unknown type DOMElement
  -> HTMLElement
* Warning: Unknown type DOM Node
  -> HTMLElement
* Warning: Unknown type Integer
  -> Mixed
* Warning: Unknown type Command
  -> ve.Command
* Warning: Unknown type any
  -> number
* Warning: Unknown type ve.Transaction
  -> ve.dm.Transaction
* Warning: Unknown type ve.dm.AnnotationSet
  -> ve.AnnotationSet
* Warning: Unknown type false
  -> boolean
* Warning: Unknown type ve.dm.AlienNode
  ve.dm doesn't have a generic AlienNode like ve.ce
  -> Unknown type ve.dm.AlienInlineNode|ve.dm.AlienBlockNode
* Warning: Unknown type ve.ve.Surface
  -> ve.ce.Surface
* ve.example.lookupNode:
  -> Last @param should be @return
* ve.dm.Transaction.prototype.pushReplace:
  -> @param {Array] should be @param {Array}
* Warning: ve.BranchNode.js:27: {@link ve.Node#hasChildren} links to non-existing member
  -> (removed)
* Warning: ve.LeafNode.js:21: {@link ve.Node#hasChildren} links to non-existing member
  -> (removed)

Differences fixed:
* Variadic arguments are like @param {Type...} [name]
  instead of @param {Type} [name...]
* Convert all file headers from /** to /*! because JSDuck tries
  to parse all /** blocks and fails to parse with all sorts of
   errors for "Global property", "Unnamed property", and
  "Duplicate property".
  Find: \/\*\*([^@]+)(@copyright)
  Replace: /*!$1$2
* Indented blocks are considered code examples.
  A few methods had documentation with numbered lists that were
  indented, which have now been updated to not be intended.
* The free-form text descriptions are parsed with Markdown,
  which requires lists to be separated from paragraphs by an
  empty line.
  And we should use `backticks` instead of {braces} for inline
  code in text paragraphs.
* Doc blocks for classes and their constructor have to be
  in the correct order (@constructor, @param, @return must be
  before @class, @abstract, @extends etc.)
* `@extends Class` must not have Class {wrapped}
* @throws must start with a {Type}
* @example means something else. It is used for an  inline demo
  iframe, not code block. For that simply indent with spaces.
* @member means something else.
  Non-function properties are marked with @property, not @member.
* To create a link to a class or member, in most cases the name
  is enough to create a link. E.g. Foo, Foo.bar, Foo.bar#quux,
  where a hash stands for "instance member", so Foo.bar#quux,
  links to Foo.bar.prototype.quux (the is not supported, as
  "prototype" is considered an implementation detail, it only
  indexes class name and method name).
  If the magic linker doesn't work for some case, the
  verbose syntax is {@link #target label}.
* @property can't have sub-properties (nested @param and @return
  values are supported, only @static @property can't be nested).
  We only have one case of this, which can be worked around by
  moving those in a new virtual class. The code is unaltered
  (only moved down so that it isn't with the scope of the main
  @class block). ve.dm.TransactionProcessor.processors.

New:
* @mixins: Classes mixed into the current class.
* @event: Events that can be emitted by a class. These are also
  inherited by subclasses. (+ @param, @return and @preventable).
  So ve.Node#event-attach is inherited to ve.dm.BreakNode,
  just like @method is.
* @singleton: Plain objects such as ve, ve.dm, ve.ce were missing
  documentation causing a tree error. Documented those as a
  JSDuck singleton, which they but just weren't documented yet.
  NB: Members of @singleton don't need @static (if present,
  triggers a compiler warning).
* @chainable: Shorthand for "@return this". We were using
  "@return {classname}" which is ambiguous (returns the same
  instance or another instance?), @chainable is specifically
  for "@return this". Creates proper labels in the generated
  HTML pages.

Removed:
* @mixin: (not to be confused with @mixins). Not supported by
  JSDuck. Every class is standalone anyway. Where needed marked
  them @class + @abstract instead.

Change-Id: I6a7c9e8ee8f995731bc205d666167874eb2ebe23
2013-01-05 01:16:32 +01:00
Catrope 7bcf35e0e8 (bug 43056) Inline tags like <span> are block-alienated sometimes
This happens when the <span> is the start of unwrapped content. The
converter logic to look at the tag name in wrapping mode doesn't kick in
because we're not yet in wrapping mode at that point.

The core issue was that previously, we relied on the document
structure/state to choose between alienBlock and alienInline, and only
used the tag name where the document structure was ambiguous (wrapping).
Changed this to be the other way around: we now rely primarily on the
tag name, and if that doesn't match what we expect based on the document
structure, we work around that if possible. Specifically:
* inline tag in our wrapper --> inline alien
* block tag in our wrapper --> close wrapper, block alien
* inline tag in wrapper that's not ours --> inline alien
* block tag in wrapper that's not ours --> *inline* alien
* inline tag in structural location --> open wrapper, inline alien
* block tag in structural location --> block alien
* inline tag in content location --> inline alien
* block tag in content location --> *inline* alien
only in the fourth and the last case do we need to use the "wrong" alien type to
preserve document validity, and it will always be inline where block was
expected, which should reduce UI issues.

The condensed version of the above, which is used in the code, is:
* If in a non-wrapper content location, use inline
* If in a wrapper that's not ours, use inline
* Otherwise, decide based on tag name
* Open or close wrapper if needed

ve.dm.Converter:
* Replace isInline logic in createAlien() with the above
* Factor out code to start wrapping (was duplicated) into startWrapping()
* Call startWrapping() if createAlien() returns an alienInline and we're
  in a structural location

Tests:
* Add test cases with aliens at the start and end of unwrapped content
** The first one failed prior to these changes and now passes, the
   second one was already passing
* Fix about group test case, was exhibiting the bug that this commit fixes

Change-Id: I657aa0ff5bc2b57cd48ef8a99c8ca930936c03b8
2012-12-22 12:27:11 +01:00
Christian Williams b740e694b9 BugID 43076 - Fixes to alien and phantom corner cases
The {{coords}} template is correctly rendered as an inlineAlien, which previously did not have shields. However, the template has a deeply nested span that is positioned and floated. The fix is to shift shielding logic up to AlienNode (from AlienBlockNode) and to show phantoms on all shields (both block and inline). I've also updated the aliens demo to exhibit this corner case.

Change-Id: Ifce60c7762c0ead5c6fe29d6eabf601c1565cbfa
2012-12-21 15:20:15 -08:00
jenkins-bot b5edb71467 Merge "Fix outdent tooltip calling for a non-existant message" 2012-12-19 18:35:24 +00:00
Rob Moen 041359ba01 (bug 43098) Prevent alien node contents from floating above phantoms.
* Sets z-index of alien blocks to 0.
* Simplify alienNode css
* Add missing -ms-user-select: none;
* Add missing [-moz-|-ms-|]user-select: element
  (webkit doesn't support element, auto is closest)

Change-Id: I889074a659483ce3d48380be5f50f80abb573286
2012-12-15 00:58:52 +01:00
James D. Forrester 851bd1a76e Fix outdent tooltip calling for a non-existant message
Change-Id: I8b39f116181310b86d804a567eedf9c68bde594f
2012-12-14 15:53:53 -08:00
Rob Moen 90f046799f Set title attributes for internal and external links.
Fixes (Bug 37904)

Change-Id: Ib987f74fa9f326fe583683401424c79ba9651caf
2012-12-13 14:04:00 -08:00
jenkins-bot cf5f2ae0f5 Merge "(bug 43040) All edits were being marked as minor" 2012-12-13 04:46:25 +00:00
Catrope 892990ef17 (bug 43040) All edits were being marked as minor
&minor=false doesn't work, but &minor=0 does

Change-Id: I73e18e7b58a151d78d56aa199cdfadb6d7150f1d
2012-12-12 17:51:47 -08:00
jenkins-bot df359ce829 Merge "Typo from I65447da8." 2012-12-13 01:12:13 +00:00
Timo Tijhof de4e12367f Typo from I65447da8.
Change-Id: I27cce9784149cf1e98c4ed144ead4718978a74ae
2012-12-13 02:11:25 +01:00
jenkins-bot eca19a1618 Merge "Handle a null response in onLoad()" 2012-12-13 01:02:37 +00:00
jenkins-bot c3c2dca9f2 Merge "Close suggestions when escape key pressed." 2012-12-13 01:00:42 +00:00
jenkins-bot e5e4dafe2e Merge "Only call showSelecton on undo and redo if there is a returned range." 2012-12-13 01:00:35 +00:00
Catrope 803001d652 Handle a null response in onLoad()
Change-Id: I6ce6c3b313c4785db1bad47c8822cca5114d17a3
2012-12-12 16:58:06 -08:00
Rob Moen c9da8f61dd Close suggestions when escape key pressed.
Fixes (Bug 43051)

Change-Id: I5e6baeec62da49b10793f2ebe7d341697a63f9c4
2012-12-12 16:54:11 -08:00
jenkins-bot 8b50543b6d Merge "Save dialog: Fix too-wide diff box." 2012-12-13 00:51:25 +00:00
jenkins-bot 74b874c1fa Merge "(bug 43013) Exclude edit notices with no visible text." 2012-12-13 00:39:10 +00:00
jenkins-bot 9ad0328b56 Merge "Phase out $.toJSON, use JSON.stringify directly." 2012-12-13 00:36:54 +00:00
Timo Tijhof 4fa57b469a Phase out $.toJSON, use JSON.stringify directly.
Although $.toJSON optimises heavily for modern browsers (it
becomes a direct reference to JSON.stringify), we still load the
extra plugin.

JSON is specified as part of ECMAScript 5, but most browsers
supported this one before they supported the rest of ES5.

http://caniuse.com/#search=JSON

Cut off for native JSON is IE7, Firefox 3.0 (3.6 supports it) and
Safari 3. Not any of our concern as VE will most likely never
support those (certainly not at this point in time, and less
likely as time goes on).

Change-Id: I4e8f26ac94763fa38d29e41264de0247f53a21e5
2012-12-13 01:33:46 +01:00
Timo Tijhof 18ab361a43 (bug 43013) Exclude edit notices with no visible text.
en.wikipedia.org has a template gala for edit notices with a whole
bunch of html framework outputted by default from
MediaWiki:Editnotice-0 (even if their underlying system has no
matches for the current page).

In the core editor from EditPage.php this isn't a problem as the
element is just idling hidden above the editor.

In the case of VisualEditor (where we have a custom delivery for
the edit notices) we don't want to say "1 notice available" on
every page, so we need to be smart and quickly walk the dom of the
notice, filter out invisible nodes, and if the resulting nodes
have no contents, ignore the notice all together.

Change-Id: I65447da8b88a9bae9c24ff155544ff66b3fe9100
2012-12-13 01:26:11 +01:00
Trevor Parscal 718e72d534 Disabled VisualEditor section edit link overrides by default
Server config: $wgVisualEditorEnableSectionEditLinks
Client config: mw.config.get( 'wgVisualEditor' ).enableSectionEditLinks

Change-Id: I859546475a32a686e318aa7108396606b5a0a78d
2012-12-12 15:35:33 -08:00
Rob Moen a09ab4d70a Only call showSelecton on undo and redo if there is a returned range.
Fixes (Bug 43033)

Change-Id: I36745a01fad135b8eb02ee0da22d74ebf0a4c118
2012-12-12 12:07:02 -08:00
Timo Tijhof 0cec349074 Save dialog: Fix too-wide diff box.
The rules have changed, these constraints are no longer needed
and actually causing the table.diff to ignore the restrictions
and bump out of the container beyond the width of the window.

This restores the condition under which table.diff is displayed
by core EditPage.php.

Follows-up I5f59482f4db.

Change-Id: I456644bf14efab7dac351818d5c3bb69b9b3c993
2012-12-12 04:32:55 +01:00
jenkins-bot 0ca661345f Merge "Remove cruft from suggestion tool." 2012-12-12 01:59:08 +00:00
jenkins-bot 20dd91423a Merge "Save dialog: Implement new "Review and Save" model." 2012-12-12 01:57:36 +00:00
Timo Tijhof cdee18dae8 Save dialog: Implement new "Review and Save" model.
Basically saveDialog-body now has three slides:
* review
* report
* save

There is a viewPage.swapSaveDialog method that is called like this
 viewPage.swapSaveDialog( 'review' );
initially called from showSaveDialog.

Misc:
 * Replaced more reused core message with a ve ones:
   savearticle => visualeditor-savedialog-label-save
   showdiff => (removed)

 * Removed min-height from saveDialog. When slide-review is
   load, it is very short and there shouldn't be 10em's of
   whitespace below the loader + buttons.

To avoid problems with diff cache being cleared while looking
at the save dialog, we lock and unlock the surface.
We could later remove this as and optimise it as feature, but for
now this fixes a bug.

Change-Id: I5f59482f4db16264014720b199d7652843c36108
2012-12-11 17:52:48 -08:00
jenkins-bot 8e7593dd0a Merge "Store HTML before the converter messes with it" 2012-12-12 01:31:21 +00:00
Rob Moen fd4775e1ee Remove cruft from suggestion tool.
-Prevents previously inspected link suggestions from showing prior
to rebuild.
-Ability for onInput to be executed immediately.
-Removed duplicated logic from open method.
-No longer calling onInput on enter key.

Change-Id: I11792b03ec01cc1929009fb76089adcc86c97629
2012-12-11 17:30:20 -08:00
Catrope 541aa0d3d6 Store HTML before the converter messes with it
Change-Id: I51f0a97a266522e46f415fd7618c3ef26a8924cd
2012-12-11 17:20:18 -08:00
Trevor Parscal 5e50f6de2c Added disable/enable methods to ve.Surface
Change-Id: I65a93c590ace58b666adcb792bc825174a3f95c6
2012-12-11 16:28:39 -08:00
Timo Tijhof 95742d65f6 Save dialog: Various clean up.
Drop "-down" class in favour of :active CSS pseudo-class.
* http://kimblim.dk/css-tests/selectors/
* http://www.quirksmode.org/css/contents.html
* http://caniuse.com/#search=css%202.1

Rename methods consistently to enableFoo and disableFoo.

Use mw.notify instead of mw.util.jsMessage (the latter takes a
string of html and parses it, instead of taking text).
Also, jsMessage is obsolete (legacy wrapper around mw.notify).

Rename slide-main to slide-save in preparation of other slides
and introduction of multi-step save dialog.

Re-introduce "disabled" state (not css, but actual state) so that
pressing "Show changes" multiple times will not spawn multiple
async operations. The save function guards against this by keeping
a static property in the internal helper method, but there are
still some operations happening between the button and that method
this should be guarded in the UI instead. Follows-up I67819168.

Change-Id: Idf0331377e6be814ccae853228d6159b4ad5a159
2012-12-11 23:13:54 +01:00
jenkins-bot ffc8ec5e50 Merge "Re-apply fixes made in a patch set that were accidentally reverted on rebase" 2012-12-11 21:35:31 +00:00
Catrope 3f903adb09 Add .reportProblem() to submit reports
Change-Id: I55ffd8bfc7664ead3827ef6be178a0b6f3b991a1
2012-12-11 13:19:51 -08:00
Trevor Parscal baa5754b2f Re-apply fixes made in a patch set that were accidentally reverted on rebase
In the change: I6781916822b4173ba906b9bc4c341219fbf10d82

71b97ec45b was reversed when I submitted 1789545284

Change-Id: I6cc59a27817bfbe55c7cbf45bba746a4bd6c375f
2012-12-11 13:06:40 -08:00
jenkins-bot 6460df5cff Merge "Improve truncate and truncateRange to allow negative values" 2012-12-11 19:34:07 +00:00
jenkins-bot 49bd56ffe9 Merge "Move the cursor to the end of newly inserted links" 2012-12-11 19:34:02 +00:00