Commit graph

83 commits

Author SHA1 Message Date
Christian Williams 6e7588a33b Support for new annotation format
Change-Id: Ib873981792d2cb4d78a3e4805287c48b3de78558
2012-05-04 20:22:05 -07:00
Christian Williams 28eb0c82e5 Adding HTML DOM -> Linear Model converter
Change-Id: Iae109d75e64321a7fe4ee8492d79ef5481716246
2012-05-04 15:47:41 -07:00
Catrope d11af2b687 Queue and deduplicate events in DocumentSynchronizer
Change-Id: I90577cd078c3d0b6706f5f827b66b46a450e7086
2012-05-04 15:42:35 -07:00
Rob Moen d42e738636 - Optimize surface model and write unit tests
Change-Id: I8de24c840c5aa2d4232e6e2cc5f72cbd30be96b4
2012-05-04 15:29:47 -07:00
Inez Korczynski 0562d83f2f Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-04 15:20:47 -07:00
Inez Korczynski bab1a9672c Fix method getDocument in dm.Surface and start using it
Change-Id: I613b1e938cd0d8f3a6ac8a48121901287c8fc5af
2012-05-04 15:20:14 -07:00
Catrope 2baeb5532d Initial stab at DocumentSynchronizer
Change-Id: I7176fd7235a82a6314bf431d00870d9ddb40f370
2012-05-04 15:18:07 -07:00
Trevor Parscal dc27d8acb4 Refactored dom wrapper functionality in ce nodes
* Moved implementation of getting and updating a DOM wrapper to ve.ce.BranchNode
* Updated ve.ce.BranchNode tests
* Renamed ve.NodeFactory.createNode to ve.NodeFactory.create
* Added  ve.NodeFactory.lookup which gets the constructor of a type
* Added attribute pass-through to ve.dm.BranchNodeStub

Change-Id: I8f5b7d3d3ae616cc5f39828b24b655163d782ae5
2012-05-04 13:31:14 -07:00
Trevor Parscal d2480baed0 Removed bubbling update events in dm and ce node trees and splice events from ce branches
The bubbling update events are not needed with ce or dm, but were once upon a time useful for es, this just eliminates some unused cruft that was costing extra function call overhead.

Change-Id: Ia16d0f4cd74c84cded5caecada33ee83d0882f30
2012-05-04 12:28:32 -07:00
Trevor Parscal 9887dbd96f Split Broke DefinitionListNode out of ListNode and DefinitionListItemNode out of ListItemNode
* Makes it simpler in the linear model because we don't have to use style: "item" for regular list items and style: "definition" for definition lists
* Enforces correct nesting through existing node rules systems
* Updates tests accordingly

Change-Id: I64d80af938e325f1961226505bdc386bb35ccdda
2012-05-04 11:56:32 -07:00
Catrope 11a3b6886b Implement basic replace processor
* Implement basic TransactionProcessor.replace(), only does content
  replacements
* Add ve.dm.Document.containsElementData()
* Fix bug in attribute()
* Write basic tests for attribute() and replace()

Change-Id: Ie9c22aec3f2631be5b0bd66790408ad283565491
2012-05-04 11:09:10 -07:00
Trevor Parscal a9b26c8b55 Removed recursive rendering calls in favor of 100% event driven updates
Change-Id: I636222518e4cbeddb1c02901b79a9dcb09eeb952
2012-05-03 17:19:01 -07:00
Rob Moen 0cd31fba2e rename surfaceModel to model in ce.Surface
Change-Id: I5d49915b4645464729ab1e4552982cbd38f712b1
2012-05-03 16:14:54 -07:00
Rob Moen bead2050b9 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-03 16:04:47 -07:00
Rob Moen da65ad48c8 - extend surface model and surface view with event emitter
- added surface view base methods
- enabled toolbar in ve.Surface

Change-Id: Ib6a62ef2509712f812f262283c45bb30c8f97ef1
2012-05-03 16:02:21 -07:00
Christian Williams 99e841d31a Making document contenteditable
Change-Id: If79bb8c69431e07de2a42cc5b565b3093c29c4cd
2012-05-03 15:42:02 -07:00
Inez Korczynski d01d27cc09 Get more tags/nodes working in the demo
Change-Id: I5335fbbe15d010a73a06f24bc56ebb3c3c6bd2d7
2012-05-03 15:00:34 -07:00
Inez Korczynski 6224c60075 Rendering works in very basic version
Change-Id: I8789860fe82f2e7db1e503889e20ce51de57bfa2
2012-05-03 14:02:35 -07:00
Inez Korczynski 06ca808b65 Missing keyword: new
Change-Id: Id65d30d702e991620e0d454fa000c438f4738b41
2012-05-03 13:32:23 -07:00
Rob Moen 7bcb65e036 - Port surface constructor into dmrewrite.
- Create document model object linear model instead of wikidom

Change-Id: I16307c290ead3e4b29dfbd1b76759e4c19c3fc8b
2012-05-03 13:23:21 -07:00
Trevor Parscal 7b7ff5a503 Added ve.dm.Surface, ve.ce.Surface, ve.ce.Document
Change-Id: I382730e1a9f1abcb4b42499267c8dcaf76fc64e1
2012-05-03 13:21:13 -07:00
Trevor Parscal b1b9fb5133 Added tests for getDataFromNode
Change-Id: Ic762832dcdda3bdaf92dbd989659235fdff73596
2012-05-03 13:11:36 -07:00
Inez Korczynski 619f10108c Minor fixes to getHtml method in TextNode
Change-Id: I53c873b6e307d53cc87c2e111ab99f694972b17b
2012-05-03 11:11:46 -07:00
Inez Korczynski a1db1537ad Minor fixes to getHtml method in TextNode
Change-Id: I4d0b1a0295071ead413d68945310d3a4ef6fe7e4
2012-05-03 10:11:39 -07:00
Inez Korczynski 09c7393901 Minot fix
Change-Id: If10f9135f9bf33af17be6f8a2db59433d9898944
2012-05-02 22:32:34 -07:00
Inez Korczynski a3b32b6615 Big refactoring to TextNode to make it work with new format of storing
annotations.

Change-Id: If84fcfdd04ff42e9b2449e1c8186d64fec4fb1ac
2012-05-02 22:28:57 -07:00
Inez Korczynski 9f11f437d2 Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-02 19:29:49 -07:00
Inez Korczynski d81b972cdf Very dirty but working version of getHtml method for TextNode (with bunch
of tests that are passing now).

Change-Id: Ie76bd59bc0a5e10e2a3b3e014b2d0e4701fcc368
2012-05-02 19:29:03 -07:00
Trevor Parscal 64d56971a9 Removing unused code
Change-Id: I23213531eeef95110d0a3d1e2476449c580b55b7
2012-05-02 17:05:22 -07:00
Trevor Parscal b7b2fc1179 Made render for ce leaf nodes abstract and added a test for it
Change-Id: Iee228d5f1a18a5c9618680fa81ab132a85472fa6
2012-05-02 15:59:43 -07:00
Trevor Parscal 947c3ddf22 Fixed incorrect class name for method typo
Change-Id: I82390896ef7136bfc8ed8734d8bd9014e756af5e
2012-05-02 15:59:15 -07:00
Trevor Parscal d412c8c159 Removed unused method (using factory instead)
Change-Id: I0ed9260d261b7e4c19e5d57f70331aef1a341cdf
2012-05-02 15:58:40 -07:00
Trevor Parscal 16e12debdc Added ve.getHash and ported ve.Json
Change-Id: I4a5d86426902e0473cdb0f98c3d121eed607f93c
2012-05-02 15:23:01 -07:00
Inez Korczynski ff40652099 Get rid of range parameter in ve.ce.TextNode.prototype.getHtml as it is
not being used anyway.

Change-Id: I7c54d35001fa0db6d7ab9d12f35ab2d841016f0d
2012-05-02 14:21:41 -07:00
Inez Korczynski dd6094842e Created a test file for ve.ce.TextNode and fixed some minor issues.
Change-Id: Ifbf6b7ba2a27eedf6d5d4f6cb06b98c38eb52c5b
2012-05-02 14:18:02 -07:00
Trevor Parscal b4313ae262 Moved getOffsetFromNode to ve.dm.BranchNode
* Also updated a call to getOffsetFromNode in ve.dm.Document

Change-Id: Ief8f9e532e39cd1051d7f3b6df6ed341747098e5
2012-05-02 14:06:35 -07:00
Trevor Parscal fd28fff50f Added test for replaceDomWrapper and onSplice in ve.ce.BranchNode
* Also fixed calls to addListenerMethod
* Also routed adding children in the constructor of ve.dm.BranchNode to the splice method
* Renamed types of ve.dm stub nodes to avoid collisions (since we have to register ce nodes by the same names for them to be generated by onSplice)

Change-Id: Ia2e75cf0a62186cc0e214683feb25c619590318a
2012-05-02 13:58:50 -07:00
Trevor Parscal 8bd0d385eb Added test for whitespacePattern, getDomText and getDomHash in ce
* Also fixed some naming typos in the units under test

Change-Id: I17f753a122f94dd16f7783f60b5c0eb1c6d3e480
2012-05-02 12:54:42 -07:00
Trevor Parscal fee375cf4e Removed global variable introduction
Change-Id: I331b19cafeb20610f7b42bacaff20757a342dffc
2012-05-02 12:37:30 -07:00
Trevor Parscal 676ffa4dbc Ported getDomText and getDomHtml from ve to ve2
Change-Id: I3547d95c2749543eae745722ceddaa0a969e4e80
2012-05-02 12:28:27 -07:00
Trevor Parscal 1d94af144a Added update handlers to heading, list, list item and image ce nodes
* Also renamed convertDomElement to replaceDomWrapper in ve.ce.BranchNode
* Also added extra documentation for node rules

Change-Id: Ia8ac6be34e2b021be96974ac1ba9119bd8077d60
2012-05-02 11:30:37 -07:00
Trevor Parscal 94f53dc6c7 Made text nodes not rely on a wrapper
By using this.$ as a selection of contiguous top-level nodes (text or otherwise) we can avoid wrapping each text node in a span

Change-Id: I141c2df8f13646db3fff0da93d218c2dcf154c8a
2012-05-02 10:58:14 -07:00
Trevor Parscal 158c9f7692 Consolidated before/after attach/detach events
Change-Id: I4220715ac4505152fb30ac2d5664a0ffb2b846f5
2012-04-30 19:50:45 -07:00
Trevor Parscal dcd0fa38c6 Fix variable name typo
Change-Id: Icfd42a5ee00e14f2485a93a5817f0f7f3e701234
2012-04-30 19:48:54 -07:00
Trevor Parscal cac3c6efd0 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-04-30 19:39:02 -07:00
Trevor Parscal 370070dfa2 Lots of ce porting, got text nodes fully supported
* Fixed constructor of ve.ce.BranchNode which was calling the wrong method to perform an onSplice and with the wrong arguments
* Removed/renamed events emitted from ve.ce.BranchNode.onSplice
* Reintroduced .$ to all ce nodes
* Ported over functionality for DOM node type variance used in headings, lists and list items
* Moved the old ve.ce.Content guts to ve.ce.TextNode
* Added getOffsetFromNode and getDataFromNode to ve.dm.DocumentFragment
* Added setDocument and getDocument to dm nodes

Change-Id: I185423ba2f1a858dde562cb2f5bc3852aec930db
2012-04-30 19:38:42 -07:00
Catrope d9cd1392fc Add TransactionProcessor tests, and fix TP to make them pass
* Add .process() and its helpers from ve1
* Fix applyAnnotations()
** Use data[i] rather than data[j]
** Don't add empty annotation objects for no reason
** Remove empty annotation objects
*** I thought this wasn't needed, but it is needed for clean rollbacks
* Remove unused second parameter in applyAnnotations() call

Change-Id: Ia338f62d2eaf2a76f8ef653eead05bc44757a122
2012-04-30 19:06:20 -07:00
Trevor Parscal 35af704173 Added initial ce nodes
Change-Id: Ibdcb4502a8fdc5b1a6c22ae0e9c42c86b3a7d4dc
2012-04-30 17:36:22 -07:00
Trevor Parscal c2d4a2d928 Added basic ve.ce nodes
* Also removed beforeSplice and afterSplice in favor of just plain splice which is the same as afterSplice used to be - beforeSplice was never used and it was making things more complex looking than needed

Change-Id: Icbbc57eac73a2a206ba35409ab57b3d1a49ab1a5
2012-04-30 16:58:41 -07:00
Trevor Parscal aaa322642b Added ve.ce.NodeFactory and tests
Also added tests for initialization of factories at ve.ce.factory and ve.dm.factory

Change-Id: Ic6ac74aab86ecdfd4f094d9bb1fa16de930387b7
2012-04-30 16:36:02 -07:00