Commit graph

230 commits

Author SHA1 Message Date
Rob Moen cc47a4d05c Add Hook for 'watch' event triggered on MW watch link or icon
to update save dialog checkbox with correct watched state.
Call mw.page.watch.updateWatchLink onSave to refresh icon
with watched state.
Patchset 2- updated event name
Change-Id: I23ef1aad9c8ace13df1b9a6bf0bfeddb9d8bcb37
2012-06-20 13:05:56 -07:00
Catrope 3877a0d58d Merge "Rewrote listification" 2012-06-20 19:39:28 +00:00
Trevor Parscal 5df5d8470a Rewrote listification
Now handles wrapping or converting properly, in any combination

Change-Id: If8b573f576555c9129f8316bc9f06557eda06e85
2012-06-20 12:39:03 -07:00
Trevor Parscal d429113eb8 Merge "After creating a page, refresh the page rather than going back" 2012-06-20 19:35:42 +00:00
Trevor Parscal bcf93eb695 Automatically bind and unbind context's window event bindings on documentNode focus and blur
Change-Id: Ie43165da49a36a7d0d13a52318d9c5438dad9605
2012-06-20 12:34:20 -07:00
Trevor Parscal 7a1d74fd18 Change state variable so updates work more than once
Change-Id: I7c701761b09e96e01e26164080d22cafe43019e0
2012-06-20 12:28:01 -07:00
Catrope 427406a0bc After creating a page, refresh the page rather than going back
We can't go back in this case because the action tabs etc. will be wrong

Change-Id: I8e26c43b7735ea8a2ef010bd4141f0ee8d4b1c68
2012-06-20 12:16:27 -07:00
Catrope 9f5f43f18a Fix residual selectNodes() breakage from fc4ba3019a
Change-Id: Icc317eab71d4e360905e902a0ae7cc88deab4cbe
2012-06-20 11:39:20 -07:00
Rob Moen b9eb06349f Switch path from ve2 to ve help with Dmrewrite merge
Change-Id: I8fbbfcb3e47a9319398af7262effc1f7cf3df51f
2012-06-20 10:49:00 -07:00
Catrope 6afed5e5cc Move ve2/ back to ve/
Change-Id: Ie51d8e48171fb1f84045d1560ee603cee62b91f6
2012-06-19 18:20:28 -07:00
Christian Williams 933ff678a4 Focus can now be set in slugs using showCursor or showSelection.
Change-Id: I12ab361a30d277a4752579bf885fd37bc46b32ed
2012-05-24 13:18:30 -07:00
Christian Williams 32b9ccd0bf Moving alien node styling to CSS file
Change-Id: I21e4593b81669b48cec831236398866f89616f9a
2012-05-23 12:03:28 -07:00
Rob Moen b05347ac4e removed margin-top for documentNode
Change-Id: I6e888ca858bc2d9e6772150715b10ab157f84b46
2012-05-03 16:07:51 -07:00
Trevor Parscal f1505a0e62 Merge remote-tracking branch 'origin/master' into dmrewrite
Change-Id: I43a3cd999ec0a5d3d05ee1e5bb71c450d485bc01
2012-05-02 10:17:44 -07:00
Inez Korczynski d6ae8390f5 Get rid of selectionDirection. Introduce getDirection() methdo in
ve.Range.

Change-Id: Iaf11b2dbfb7ae82a7f54ee205cd6cdc8ee235aef
2012-04-27 17:36:55 -07:00
Inez Korczynski af6a9f9ccc Created a named method inside a Surface (instead of anonymouse one) to
handle logic for rangeChange event handler.

Change-Id: Ief32e647f9399e3ea47c5613902cebcbaaf4874c
2012-04-27 17:31:49 -07:00
Trevor Parscal f19897fefa Merge "Build out ve.Surface constructor to support multiple editor instances Now setting up multiple toolbars per config Tools & Modes are now configurable per toolbar per instance Base elements are created on demand and no longer id specific Note: There are some bugs with multiple instances." 2012-04-27 21:01:10 +00:00
Inez Korczynski f188772259 Introduce new method called "proxy" in surfaceView to avoid using the same
construct with anonynous function over and over.

Change-Id: I1e96cf1efaa6fa5d551fdfa8bb5a80c31e519579
2012-04-26 14:49:12 -07:00
Rob Moen 94479bd79d Build out ve.Surface constructor to support multiple editor instances
Now setting up multiple toolbars per config
Tools & Modes are now configurable per toolbar per instance
Base elements are created on demand and no longer id specific
Note: There are some bugs with multiple instances.

Change-Id: Id0bbbca2d1b76fd2db3f3b0f9abd90194930b610
2012-04-26 11:56:47 -07:00
Demon 5feb5ebcbf Merge "Fix typo" 2012-04-25 14:51:47 +00:00
Trevor Parscal 8ce68e1ac8 Merge "Modify rangeChange event to save selection direction. Renamed Selection method to more suitable name. Misc cleanup Patchset 2, whitespace cleanup Patchset 3: Change values used with selection direction to -1 or 1 1 for left to right (normal) -1 for right to left (opposite) Change-Id: If9ecc721ace1c7550903170f92395947f1ccc22c" 2012-04-20 23:29:21 +00:00
Rob Moen 5fc9f1c7e4 Modify rangeChange event to save selection direction.
Renamed Selection method to more suitable name.
Misc cleanup
Patchset 2, whitespace cleanup
Patchset 3: Change values used with selection direction to -1 or 1
1 for left to right (normal)
-1 for right to left (opposite)
Change-Id: If9ecc721ace1c7550903170f92395947f1ccc22c
2012-04-20 16:27:26 -07:00
Trevor Parscal 29d1ebeca7 Merge "Put a space in the toolbarDropdownTool-label div for default Addresses dropdown tool ui inconsistency on load" 2012-04-20 22:56:36 +00:00
Rob Moen 8398696fe0 Put a space in the toolbarDropdownTool-label div for default
Addresses dropdown tool ui inconsistency on load

Change-Id: I855ac15e939fa895adb67daaeb45aadbac01f10b
2012-04-19 15:31:09 -07:00
Rob Moen 1a68c42049 Modify VE constructor to have the default set of tool configuration
Configuration options are to extend base options in the constructor.

Change-Id: Ic430a6489d8cf9a703e374c3f416feaf0e3d2521
2012-04-19 15:14:57 -07:00
Trevor Parscal 7ea475ebcf Initial commit of data model rewrite
Ground-up rewrite of the data model. Putting this in the ve2 directory for now so we still have the old code floating around.

Main changes so far in this rewrite:
* Renamed hasChildren() to canHaveChildren()
* Added canHaveGrandchildren()
* Added a new node type TwigNode that can have children but not grandchildren (so all of its children must be LeafNodes)
* Implemented push/pop/shift/unshift as wrappers around splice()
* Renamed getElementType() to getType(). Nodes now take a string as a type, and the element stuff is gone and won't be back
* Removed clearRoot(), replaced it with setRoot( this ) where needed

Change-Id: I23f3bb1b4a2473575e5446e87fdf17af107bacf6
2012-04-19 13:54:34 -07:00
Catrope 4b6e1401a3 Fix typo
Function was renamed but error message wasn't updated

Change-Id: I61a9effa8dedcbdbc75c5c6842fb05f909561327
2012-04-16 12:20:16 -07:00
Trevor Parscal 387b3160ca Merge "Add and update an offset map in DocumentNode" 2012-04-13 23:48:57 +00:00
Catrope 7465b670e1 Add and update an offset map in DocumentNode
This has some TODOs still but I want to land it now anyway, and fix the
TODOs later.

* Add this.offsetMap which maps each linear model offset to a model tree node
* Refactor createNodesFromData()
** Rename it to buildSubtreeFromData()
** Have it build an offset map as well as a node subtree
** Have it set the root on the fake root node so that when the subtree
   is attached to the main tree later, we don't get a rippling root
   update all the way down
** Normalize the way the loop processes content, that way adding offsets
   for content is easier
* Add rebuildNodes() which uses buildSubtreeFromData() to rebuild stuff
* Use rebuildNodes() in DocumentSynchronizer
* Use pushRebuild() in TransactionProcessor
* Optimize setRoot() for the case where the root is already set correctly

Change-Id: I8b827d0823c969e671615ddd06e5f1bd70e9d54c
2012-04-13 16:46:02 -07:00
Rob Moen d37a325f44 Cleanup terms used in annotation method
Change-Id: I509a1f1b680cc8a2973188f0ed7c7d67b8a15f4f
2012-04-12 16:37:23 -07:00
Rob Moen 1fa462ce92 Fix up FormatDropdownTool
Effectively stopping & starting polling prior to conversion
Getting Selection from model
Reselecting after conversion (TODO: modify selection to entire block ?)

Change-Id: I9ba331b5393bf568cc8d137646b43244ae2640a8
2012-04-12 16:21:10 -07:00
Rob Moen 961f83d326 Elminiated isSelection method
Determine actual selection from model by checking length

Change-Id: I1c58a4de31b26d49b55c7a2c55c9c6462741bdfb
2012-04-12 14:05:14 -07:00
Rob Moen 28e86c8688 New Method isSelection() in Surface View
Used to properly hide/show Context menu and UI elements.

Change-Id: I8b3750c270651498b7e6c54a1921f5012cf33ea6
2012-04-12 10:22:42 -07:00
Rob Moen b5befb1d57 On annotate, get current selection from model
Fixes link annotation, and any annotation that pops up an inspector as selection is lost.

Change-Id: Idd8812b05f4fddfa4e613dea28a1a8421792656d
2012-04-11 14:15:52 -07:00
Rob Moen 224cc1f9a0 Migrate tools from SurfaceObserver Class
ContextView positioning, Italic, and Bold annotations working

Change-Id: Ifc68bd61c8f27b6a14d314dc2999753af6e0ee04
2012-04-11 13:19:58 -07:00
Rob Moen 01e02e888d Fix copy / paste errors for setStyle method in ListNode and ListeItemNode
Change-Id: Ifc8183e047398fd7f4b0436e61768992a3a94612
2012-04-06 11:37:53 -07:00
Robmoen 8a06ea5adc Merge "Changed to using structured lists" 2012-04-06 18:28:04 +00:00
Inez Korczynski 50acc0c785 Make toolbar and context menu works
Change-Id: Ice981390b22a257158b3417dda3a1945d777cb14
2012-04-06 17:43:14 +02:00
Inez Korczynski 68cf13fb1e getLeafNode is now a static method and should be called as a static method
Change-Id: I4f079523add81ef14537c950b29436422e1de850
2012-04-06 17:13:43 +02:00
Inez Korczynski 5827843182 Merge changes from branch ce-poll
Change-Id: Id7602ed33a09720c53310a032d2824395b82ff7f
2012-04-06 17:11:35 +02:00
Inez Korczynski a57ae2692e Merge changes from branch ce-poll
Change-Id: Ibb6da1ac5229ed5afeda1a3944fe7deff3bfb9a7
2012-04-06 17:10:30 +02:00
Inez Korczynski 090e42c8d9 Just a test
Change-Id: I74fb371a26b4b6068fee593bf7e6ee950080bca8
2012-04-06 16:49:30 +02:00
Trevor Parscal 85b807ed5d Changed to using structured lists
This makes it possible to get identical rendering in the editor, but may make other things more complex. The Wikitext serializer is no longer compatible for rendering lists so it's been stubbed out. Also the way the toolbar works with lists is broken, so that's been disabled. The HTML serializer has been fixed to work correctly and no-longer-used styles have been removed.

Change-Id: If156f55068b1f6d229b3fa789164f28b2e3dfc76
2012-04-05 14:32:08 -07:00
Trevor Parscal a2eee63525 Updated CSS classes and rules for CE, which for the most part uses native elements
Also:
* Simplified ve.ce.Surface.getLeafNode, which may be better to just be removed and be used inline in the few places it's being used.
* Removed method wrapper for static function ve.ce.Surface.getLeafNode

Change-Id: I1d4cf0bb7ecc8f07f030753e40a13ebef7d02daa
2012-04-04 11:54:06 -07:00
Trevor Parscal 519d225d2f Cleanup of white space, missing semi-colons, line breaks, etc.
Change-Id: Ifa96a9f70fa8d149a4c403521aaa88a3e0546ef0
2012-04-02 15:28:26 -07:00
Rob Moen d8de26d7e9 On selection, update selection in the model. Fixes selection.clone() error.
Change-Id: Ibd5cf0398002e5fbb2c50549e4a7043ba8fd00a7
2012-04-02 14:19:53 -07:00
Rob Moen c1300ba949 Fixed surfaceView undefined error
Change-Id: Iba3ae54b4e508afbfa132e0f0b2b0b237e685395
2012-04-02 13:49:45 -07:00
Trevor Parscal 19f3d5c107 Added ve.Surface, a wrapper around an editor instance
* This high level surface object is responsible for creating & managing editor instances
* Revised Sandbox demo to invoke in this way.

Change-Id: I4043779af9a2ab964deaf26079a992e82ebeef27
2012-03-29 15:55:33 -07:00
Catrope 7a726b0278 Add tree synchronization for replace
To handle replace operations that are not themselves consistent (these
are common, for instance when replacing an opening element in one place,
then replacing the closing element somewhere else), we process
subsequent replace operations inside the first one until things are
balanced again, then issue a single rebuild for the whole thing.

Change-Id: Ide4613f046fabfeeef383138c39e350b1b710033
2012-03-26 02:51:30 -07:00
Catrope 826437950c adding clearState function for tools and using clearState if no selection exists
Originally committed in SVN as r114418 by Christian, missed the git
conversion

Change-Id: I56e91c170670519fa2b482a4b7f30cdcbc8ff163
2012-03-22 14:22:15 -07:00
Rob Moen e5df79229d make clear button tool work with annotate method in ce surface 2012-03-16 22:20:16 +00:00
Inez Korczynski 299c77db84 Make LinkInspector works (using annotate method in SurfaceView) 2012-03-16 22:16:15 +00:00
Inez Korczynski b2f4b48a9a Use on and off insteaf of bind and unbind. 2012-03-16 22:01:09 +00:00
Rob Moen 277e239796 CE surface has no hidden input, removed input focus 2012-03-16 22:00:42 +00:00
Inez Korczynski 6ef8ac182a No more endless looping! And fix getSelectionRect to return document relative coordiantes instead of viewport relative. 2012-03-16 21:52:17 +00:00
Rob Moen cde7a3bf7e adapt LinkInspector to use surfaceObserver for selection 2012-03-16 20:18:26 +00:00
Rob Moen 93376d68eb add surfaceObserver on select methods to ui toolbar and surfaceView for responding to select event. tools now updating to selected node annotations. revise getSelectionRect to return actual start & end pos. context icon properly showing on range selection 2012-03-15 22:06:40 +00:00
Roan Kattouw 05333b1f3d Put the invert state / method (commit or rollback) in the TransactionProcessor object and no longer pass it as a parameter to each operation. This makes it easier for operations to execute other operations. 2012-03-14 21:02:36 +00:00
Roan Kattouw bf5ea06db5 Factor out process() into nextOperation() and executeOperation() 2012-03-14 21:02:34 +00:00
Roan Kattouw 2c43a34f74 Rewrite the rebuild action to take two ranges rather than a node and some data. 2012-03-14 21:02:31 +00:00
Roan Kattouw 37a59016e8 Break out pushAction() into separate functions for each action. This will allow me to change the rebuild action to take totally different parameters. 2012-03-14 21:02:29 +00:00
Roan Kattouw bd9a86dd55 Remove the offset adjustment feature from DocumentSynchronizer. It gets in the way when I try to use this class in TransactionProcessor. 2012-03-14 21:02:27 +00:00
Roan Kattouw 1e17285afb Move computation of missing offset from pushAction() to synchronize(), and only compute offsets for actions that require them. This also fixes an issue where offsets computed by pushAction() would be adjusted incorrectly by pushAction(). 2012-03-14 21:02:26 +00:00
Roan Kattouw 7dd2b8b725 Make DocumentSynchronizer clear the queue after it's done with it 2012-03-14 21:02:24 +00:00
Inez Korczynski f87709d6bb Use <h[1-6]> tags for rendering headings (instead of divs) 2012-03-14 00:51:04 +00:00
Rob Moen d77c0b91dc fix dropdown tool to use selection from ce surfaceView 2012-03-14 00:29:41 +00:00
Inez Korczynski 294d474c54 Replace CursorObserver and ContentObserver with SurfaceObserver 2012-03-14 00:04:24 +00:00
christian d174809b54 replacing showCursorAt calls with correct showCursor method 2012-03-13 18:12:57 +00:00
christian 010c97acc8 removing min height attribute to fix IE bug 2012-03-12 23:31:08 +00:00
christian ba437744b3 preventing native contenteditable resizing tools 2012-03-12 23:06:47 +00:00
Rob Moen 350a53fd93 rework context icon positioning for CE surface using new getSelectionRect method 2012-03-12 22:14:43 +00:00
Rob Moen 22a351e855 small fix: getSelectionRange was breaking the surface layer, changed to saved state member 2012-03-12 22:04:29 +00:00
Rob Moen 65170e13df port over select event listener, and updateSelection methods for setting and removing context icon, add getSelectionRect method for context icon position 2012-03-12 21:50:22 +00:00
christian 56b9068d03 switch to getSelectionRange and fixing IME native menu 2012-03-12 20:39:08 +00:00
Alexandre Emsenhuber 99a31bacbc svn:eol-style native 2012-03-11 18:38:27 +00:00
Roan Kattouw 29f416937e Fix some usages of splice.apply in the data model to use
ve.batchedSplice(). Added FIXME comments for occurrences outside of DM
2012-03-10 00:31:28 +00:00
Inez Korczynski 9a8f7059fc Make ContentObserver pass information about content when emiting change event. 2012-03-09 23:15:23 +00:00
Trevor Parscal 02592b3ec0 More cleanup 2012-03-09 22:55:49 +00:00
Trevor Parscal 60c9c484aa More cleanup (jshint complaints) 2012-03-09 22:51:00 +00:00
Trevor Parscal ce824d6299 Cleanup 2012-03-09 22:45:22 +00:00
Inez Korczynski 4bc7dbbe5e Initial import of CursorObserver and ContentObserver (not being used yet). 2012-03-09 22:18:24 +00:00
Trevor Parscal 2f9fcde16e Removed duplicate static methods and members that were copied to ve.dm - lets just leave them in ve.dm.DocumentNode for now. 2012-03-09 21:54:00 +00:00
Roan Kattouw b13d0a849d Add a check for the length of unwrapOuter, and add a test for each
exception
2012-03-09 01:44:31 +00:00
Roan Kattouw bc600b34be Make prepareWrap() use the data from the model rather than the unwrap
parameters. This fixes the case where rolling back a list unwrap would
restore the list items without their attributes
2012-03-09 01:14:41 +00:00
Roan Kattouw 04910777d9 Fix stupid typos so wrapEach actually works 2012-03-09 00:38:34 +00:00
Roan Kattouw ab26581b2e Fix cursor adjustment in replace() 2012-03-08 23:21:28 +00:00
Roan Kattouw 5054ed320e Implement prepareWrap and add tests for it 2012-03-08 23:21:26 +00:00
Roan Kattouw 9b66749575 Add documentation for to-be-written prepareWrap function 2012-03-08 23:21:24 +00:00
Roan Kattouw d978797fca Add a very simple transaction builder for content replacements 2012-03-08 23:21:21 +00:00
Roan Kattouw cac9971299 Implement the replace operation for the linear model 2012-03-08 23:21:20 +00:00
Roan Kattouw 46dbb30b7a Factor the batched splice code out from ve.insertIntoArray() into a
separate function
2012-03-08 23:21:18 +00:00
Roan Kattouw 93deba7b5c Add replace operation 2012-03-08 23:21:17 +00:00
Trevor Parscal becb1daa39 Added more tests for ve.dm.DocumentSynchronizer and fixed some bugs along the way 2012-03-08 19:35:51 +00:00
Alexandre Emsenhuber 62e8312535 svn:eol-style native 2012-03-08 12:27:02 +00:00
Trevor Parscal 459c4fa271 Added some basic tests for resize and insert. Fixed some bugs in both of those code paths along the way. 2012-03-08 00:52:30 +00:00
Trevor Parscal de0f83643b Typo in file name 2012-03-07 23:48:58 +00:00
christian df4f017b21 preserve range after applying annotation 2012-03-07 23:35:38 +00:00
Inez Korczynski ab496f7bc9 Get rid of showCursorAt method. And replace calls to it with calls to showCursor. 2012-03-07 23:33:41 +00:00
Inez Korczynski 8e56acbaca Added getDOMNodeAndOffset and showSelection methods to Surface. Ohhh and little wrapper around it - showCursor. 2012-03-07 23:32:26 +00:00
christian 76b7127e29 removing usage of rangy anchornode for determining rendering scope - using model and autoRender 2012-03-07 21:41:53 +00:00