Commit graph

55 commits

Author SHA1 Message Date
Roan Kattouw 5ac817a6f4 Fix bugs in prepareContentAnnotation() related to structural offsets, and add a test. Also add parenthesis to the if statement mixing || and &&, for clarity 2011-11-24 16:27:40 +00:00
Roan Kattouw 815029f6db Fix the prepareContentAnnotation test cases added in r104102 2011-11-24 16:13:19 +00:00
Roan Kattouw d98a7bd373 Refacor things to use getCommonAncestorPaths() 2011-11-24 15:55:54 +00:00
Trevor Parscal c1a3d4095f Got rid of optimize() - now performing consecutive-type operation merging on the fly 2011-11-23 23:54:36 +00:00
Inez Korczynski 1cdd4ed0d3 Fix off by one bug in getRelativeContentOffset 2011-11-23 09:04:06 +00:00
Trevor Parscal 9beda20191 Routed selection through the SurfaceModel 2011-11-23 00:36:46 +00:00
Trevor Parscal 20da830a26 Rewrite of undo/redo - now completely implemented in es.SurfaceModel 2011-11-22 22:59:05 +00:00
Trevor Parscal df88d82181 Using the full word Difference instead of Diff 2011-11-22 22:57:23 +00:00
Trevor Parscal 631323b9bd * Refactored es.HistoryModel to always be working from a single array rather than a buffer and an array
* Added support for associating a selection with a state
2011-11-21 23:51:37 +00:00
Inez Korczynski 392d911c3d States is an array of array of transaction, so one more iteration is needed. 2011-11-21 23:10:31 +00:00
Trevor Parscal e0f746d3d5 Installed HistoryModel into SurfaceView 2011-11-21 22:59:40 +00:00
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
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
Trevor Parscal 284082b5d3 Simplified documentation 2011-11-17 18:26:00 +00:00
Trevor Parscal 5784d5f6f5 Added some new documentation for the new merging rules 2011-11-17 18:23:53 +00:00
Trevor Parscal 43de57840e Commented out some console.log statements 2011-11-17 17:59:15 +00:00
Roan Kattouw 41ace08026 Replace prepareRemoval() with a fixed-up version of my rewrite (which was commented out previously) 2011-11-17 16:44:44 +00:00
Trevor Parscal 566ff61283 Reduced (dramatically) the number of re-renders on insert (but there's still more duplication being done atm, especially on load) 2011-11-17 08:03:14 +00:00
Trevor Parscal a55f52c2c7 Made it so <p>|</p> is not considered to be a structural offset 2011-11-16 23:57:12 +00:00
Roan Kattouw 5de3778803 Drop droppable (oh, how meta!) attribute introduced in r103211. Will convert prepareRemoval() later 2011-11-16 19:28:13 +00:00
Roan Kattouw 17df2a174a Fix breakage in prepareRemoval() from r103271 and demonstrated by the tests in r103356. Also add, in a comment, a somewhat functional rewrite of prepareRemoval() to be used after we drop droppability 2011-11-16 19:17:58 +00:00
Trevor Parscal e559922da0 Fixed incorrect symbolic name being used for nodeRules registration on tableCell and tableRow model nodes. Roan noticed this in r103211 2011-11-16 18:17:24 +00:00
Inez Korczynski ace69887ee Fix typo: "annotation" => "annotations" 2011-11-16 06:13: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 455afe25be Added a "droppable" bit to each model so that prepareRemoval can avoid dropping table cells (for instance) when removing nodes that are completely covered (which it can't do yet) 2011-11-15 19:01:47 +00:00
Roan Kattouw c484afe87a Fix IE-specific test breakages. Two tests were broken because Array.prototype.indexOf() was used, another one because Array.prototype.splice() is broken in IE:
>>[1,2,3].slice(0).length
3
>>[1,2,3].slice(0, undefined).length
0
2011-11-15 16:21:45 +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 2494c40297 Moved transaction processing code to new class, es.TransactionProcessor 2011-11-14 23:04:36 +00:00
Trevor Parscal 96a8598ec5 Added scope function to transaction processing so inserting </p></li><li><p> works
Fixed off-by-one in splicing dom nodes into view branches
2011-11-14 21:54:53 +00:00
Trevor Parscal 773d97cb1d Using splice.apply because it's faster and actually works (the loop was incorrect anyways) 2011-11-14 19:51:00 +00:00
Inez Korczynski c03e5fbc49 Minor fix 2011-11-11 00:28:25 +00:00
Inez Korczynski 662907a5df Make getWordBoundaries returns null if given offset refers to element data. Also if given offset is beginning of the word then search for not beginning of the word offsets around (and other way round). 2011-11-10 21:43:28 +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
Alexandre Emsenhuber fa172d1592 svn:eol-style native 2011-11-10 11:51:42 +00:00
Trevor Parscal 6c745687fc Fixed prepareRemove to work again after getNodeFromOffset was changed. 2011-11-09 23:38:36 +00:00
Inez Korczynski 18b97268fc Fix standard problem when writing backward loops 2011-11-08 01:00:31 +00:00
Inez Korczynski a0acc98bcb Fix for offset being passed within update event. It has to be local - as ContentView operates on local offsets for line ranges. 2011-11-08 00:59:55 +00:00
Inez Korczynski 2fb840236c Basic support for "pre" elements (space at the beginning of the new paragraph in wikitext) 2011-11-07 23:46:30 +00:00
Inez Korczynski 6f5719e736 This is supposed to be a event name, not a variable 2011-11-07 21:34:29 +00:00
Inez Korczynski d01cdd859d ListItem now is a branch instead of being leaf. So it contains children - usually it would be just Paragraph, but in some cases Table as well (as Wikitext allows to have HTML table in list item) 2011-11-07 21:30:13 +00:00
Inez Korczynski 88e964263b This is supposed to be a event name, not a variable 2011-11-07 19:44:56 +00:00
Trevor Parscal 187eca34eb Added render from offset support 2011-11-07 19:42:36 +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 0801ec93a5 Change something that appeared to be a bug in the removal code 2011-11-04 20:17:42 +00:00
Trevor Parscal b13b805f2b Comment cleanup 2011-11-04 18:37:07 +00:00
Trevor Parscal 44ea20c406 Using getElementType instead of relying on .type property of es.DocumentModeNode objects 2011-11-04 18:33:06 +00:00
Trevor Parscal b636d9a52b Refactored some of the tree sync code to be reusable 2011-11-03 23:19:36 +00:00
Trevor Parscal 764f2b0e65 Reorganized model nodes into branches and leafs 2011-11-03 21:48:40 +00:00