Commit graph

1250 commits

Author SHA1 Message Date
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
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