Trevor Parscal
779a63f486
* Switched to using JSON for hashing, allowing us to use the native JSON.stringify where available, which is much faster
...
* Added a bunch of utility functions for working with character data and annotations
* Got toolbar button states to follow selection of more than one character
2011-11-21 22:32:22 +00:00
Gabriel Wicke
d1b0293569
Fix comment token conversion and serialization
2011-11-21 09:22:30 +00:00
Gabriel Wicke
b750ce38b8
Add node.js-compatible HTML5 parser and hook it up to the PEG tokenizer.
...
Builds a DOM tree (jsdom) from the tokens and then serializes that using
document.innerHTML. This is all very experimental, so don't be surprised by
rough edges.
2011-11-18 13:57:07 +00:00
Roan Kattouw
35a99b4be0
Make es.TransactionProcessor.remove() handle deep merges correctly, and add test cases. The code is still a bit rough and ugly and needs a bit more work, but I'll clean that up later; at least it works now.
2011-11-18 10:17:35 +00:00
Trevor Parscal
48e7f4c3c6
Initial checkin of new es.HistoryModel (needs tests)
2011-11-17 22:44:11 +00:00
Trevor Parscal
6fded56cec
Renamed es.Transaction to es.TransactionModel
2011-11-17 22:42:18 +00:00
Roan Kattouw
117c785d85
Improve the merging logic in prepareRemoval() to also allow merging nested nodes, e.g. by deleting </p></li><li><p>
2011-11-17 19:23:15 +00:00
Gabriel Wicke
ea87e7aaee
Convert PEG parser to tokenizer for back-end HTML parser. Now emits a list of
...
tokens, which for now is still completely built before parsing can proceed.
For each top-level block, the source start/end positions are added as
attributes to the top-most tokens. No tracking of wiki vs. html syntax yet.
2011-11-17 15:26:02 +00:00
Roan Kattouw
be994da373
Make selectNodes() also descend (recurse) into child nodes when only the start or only the end is in the middle of a child node. Without this, it was stuff like ranges with only openings and no closings.
2011-11-17 15:01:47 +00:00
Roan Kattouw
2c21250c70
Make selectNodes() not return an empty array when encountering a zero-length selection in a structural location (we don't do this for zero-length selections in content locations either, and the empty array is breaking an assumption I was making in my prepareRemoval rewrite)
2011-11-17 14:50:38 +00:00
Roan Kattouw
ef478bfe7b
Make the selectNodes tests log their failures to the console
2011-11-17 14:42:14 +00:00
Roan Kattouw
e8899405e9
Fix bug in compare() which caused it to return true for arrays of unequal length (!!)
2011-11-17 14:21:39 +00:00
Trevor Parscal
b89d7d7eeb
Removed some accidental globals
2011-11-16 23:32:57 +00:00
Trevor Parscal
cd033e02c4
Renamed es.DocumentNode.test to es.DocumentBranchNode.test to reflect it's contents
2011-11-16 19:35:18 +00:00
Trevor Parscal
607e0fe3ad
Fixed test data in response to r103354
2011-11-16 19:26:16 +00:00
Roan Kattouw
cb8a14b954
Add test cases to illustrate the breakage in r103271
2011-11-16 19:07:17 +00:00
Trevor Parscal
8a2e8b4aab
Rewrote prepareRemoval to support dropping nodes that are considered droppable (not tableCells) and are covered completely by the range - otherwise nodes are stripped of content
2011-11-16 00:03:17 +00:00
Trevor Parscal
79ef19da42
Fixed documentation and use of es.arrayIndexOf to match the actual API of $.inArray (value, array, fromIndex). Renamed function to inArray to reduce confusion about how the function works.
2011-11-15 18:17:26 +00:00
Roan Kattouw
c9d2bd84d1
Rewrite traverseLeafNodes tests using a data provider pattern
2011-11-15 14:35:03 +00:00
Roan Kattouw
2a80194223
Add more tests
2011-11-15 13:50:24 +00:00
Roan Kattouw
fee2d48b2b
Add very basic implementation of traverseNodes(), with tests. This doesn't respect the from parameter (so tests 3-6 fail); I will rewrite it from recursive to iterative so it can support that.
2011-11-15 11:12:06 +00:00
Roan Kattouw
8563e7e451
Add FIXME comment for a failing test and fix a typo in its description
2011-11-15 10:15:52 +00:00
Trevor Parscal
ff07930171
Added test for prepareRemoval which fails atm, because strip doesn't drop nodes that are covered completely. Also cleaned up some comments in prepareRemoval
2011-11-15 01:15:21 +00:00
Trevor Parscal
482d477449
Added test for prepareRemoval which fails atm, because strip doesn't drop nodes that are covered completely.
2011-11-15 01:04:37 +00:00
Trevor Parscal
ba64cfaf46
Moved tests for es.TransactionProcessor to their own file
2011-11-14 23:10:00 +00:00
Trevor Parscal
2494c40297
Moved transaction processing code to new class, es.TransactionProcessor
2011-11-14 23:04:36 +00:00
Trevor Parscal
713a80596d
Added es.DocumentLeafNode, which like es.DocumentBranchNode is a mixin-like class (we may want to switch to using a more natural composition mechanism than es.extendClass in the future) - now es.DocumentNode also has an abstract method called hasChildren which returns a boolean and can indicate if a node is a leaf or a branch.
2011-11-10 19:26:02 +00:00
Roan Kattouw
a4f71ace69
Rewrite the remove() function in es.DocumentModel.operations such that the tests added in r102564 pass now
2011-11-10 15:50:59 +00:00
Roan Kattouw
aa7a6e2605
Add globalRange property to the output of selectNodes(), which translates the range property to be relative to the root rather than to the node. Update tests for this, and fix the test case numbering for selectNodes
2011-11-10 13:15:55 +00:00
Trevor Parscal
4bf41fc3e8
Updated tests and test data to support listItem nodes being branches instead of leafs
2011-11-09 23:39:47 +00:00
Roan Kattouw
25a04133b0
Add test cases for inserting a paragraph break (</p><p>) in the middle of a paragraph. Interestingly, committing this insertion actually works, but rolling it back doesn't.
2011-11-09 20:24:13 +00:00
Trevor Parscal
cd18698bbc
Moved es.DocumentModelBranchNode tests to their own file
2011-11-04 21:16:20 +00:00
Trevor Parscal
add7c23191
Added es.Transaction.optimize and added in a test that neilk sent a patch for
2011-11-04 20:38:47 +00:00
Roan Kattouw
124a36b942
Add a metric ton of (mostly generated) selectNodes tests, and change selectNodes a little bit to make them pass
2011-11-04 20:27:23 +00:00
Roan Kattouw
84c6b8925a
Refactor the large data objects in es.DocumentModel.test.js out to es.testData.js so they can be shared with other tests
2011-11-04 20:11:51 +00:00
Trevor Parscal
04b7e80096
Prepare removal tests are working now that DocumentModelNode objects have a type property
2011-11-04 18:31:22 +00:00
Trevor Parscal
4963b05e14
Split tests up by method
2011-11-04 18:08:51 +00:00
Trevor Parscal
4d7cbded2c
Minor cleanup
2011-11-04 17:54:02 +00:00
Trevor Parscal
b6420fd327
Changed from using the Hype code-name to EditSurface
2011-11-04 17:47:54 +00:00
Trevor Parscal
36c6bee0a8
Moved es tests to their own folder
2011-11-04 17:47:09 +00:00
Trevor Parscal
fcb3644f35
Reorganized a few methods to reduce duplication, improved documentation
2011-11-04 17:07:44 +00:00
Gabriel Wicke
06ca9f12fe
Rename definitiondata to definitiondescription, minor fixes
2011-11-04 12:25:01 +00:00
Gabriel Wicke
63398b5749
Update parserTests to latest serializers
2011-11-04 07:45:05 +00:00
Trevor Parscal
764f2b0e65
Reorganized model nodes into branches and leafs
2011-11-03 21:48:40 +00:00
Trevor Parscal
dc612541b0
Updated tests to work after changing es.DocumentModelNode's constructor arguments
2011-11-03 19:02:37 +00:00
Trevor Parscal
d3e5a6c557
Refactored and updated serializers to use latest version of WikiDom. Also updated tests to use range objects for annotations. Switched to using namespacing for annotations, now there's textStyle/*, link/* and object/* spaces where all types are in.
2011-11-03 18:15:24 +00:00
Gabriel Wicke
a8838dab18
Start by handling paragraphs, at least a bit.
2011-11-03 15:16:05 +00:00
Gabriel Wicke
0d30a5528e
First combination of WikiDom serializers with existing parser in
...
tests/parser/parserTests.js.
* Removed var from es in es.js to allow node.js to access it as global. Only
alternative solution appears to be a node-specific 'exports' construct:
http://nodejs.org/docs/v0.3.1/api/modules.html
* Added es.Document.js and es.Document.Serializer.js in es/bases. Not sure if
this is the desired location.
* Changed es.extend to es.extendClass in the serializers
* Modified the first parser test to include the WikiDom modules and call the
new HTML serializer
2011-11-03 13:55:48 +00:00
Trevor Parscal
a8efbfffc4
Fixed script and style paths in HTML files
2011-11-02 21:35:15 +00:00
Trevor Parscal
af1c4ecd4e
Moving hype tests to VisualEditor extension
2011-11-02 21:21:08 +00:00