Commit graph

4584 commits

Author SHA1 Message Date
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 61082fa3c1 Whitespace fix 2011-11-17 14:43:11 +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 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
Inez Korczynski 8f459b5f01 Improve handling for enter, backspace, delete 2011-11-17 00:28:40 +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
Inez Korczynski 17cad00776 Added support for enter key in elements with attributes - like headings, listitems. 2011-11-16 23:34:58 +00:00
Trevor Parscal b89d7d7eeb Removed some accidental globals 2011-11-16 23:32:57 +00:00
Inez Korczynski 62e399ef2e Added splitRules for DocumentView 2011-11-16 23:19:29 +00:00
Inez Korczynski a5a09d42d8 Minor fix. 2011-11-16 23:18:22 +00:00
Inez Korczynski 243189a009 Basic support for enter key in heading and paragraphs 2011-11-16 23:16:02 +00:00
Inez Korczynski 3bf8a244f1 Added basic support for deleting selection with delete key. 2011-11-16 22:01:41 +00:00
Inez Korczynski fe3ef45f56 Improved support for combination of ctrl/alt/metakey + up/down/left/right - especially for mac vs. windows. 2011-11-16 21:59:22 +00:00
Inez Korczynski 13775c5116 Added basic support for deleting selection with backspace. 2011-11-16 21:25:48 +00:00
Trevor Parscal 5f4a2b2141 * Added support for inserting content at a structural offset
* Broke rebuildNodes into 2 parts so insert can use just buildNodes when inserting whole nodes
* Added getIndexFromOffset to es.DocumentModelBranchNode objects, which returns an index of a child node from an offset
2011-11-16 20:39:48 +00:00
Trevor Parscal 5b12384431 Fixed issue in processing removal transactions - globalRange is now defined always, so we need to check for range instead 2011-11-16 20:01:12 +00:00
Inez Korczynski a43288be29 Support for moving cursor up and down by "unit" distance when control key pressed down. 2011-11-16 19:51:02 +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
Roan Kattouw 5de3778803 Drop droppable (oh, how meta!) attribute introduced in r103211. Will convert prepareRemoval() later 2011-11-16 19:28:13 +00:00
Trevor Parscal 607e0fe3ad Fixed test data in response to r103354 2011-11-16 19:26:16 +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
Roan Kattouw cb8a14b954 Add test cases to illustrate the breakage in r103271 2011-11-16 19:07:17 +00:00
Roan Kattouw 27ddd1263f In selectNodes(), also set globalRange for fully-covered nodes. There is no sane value for range in this case, but there sure is a sane value for globalRange so we might as well return it. I also use this in my prepareRemoval() fixes in my next commit 2011-11-16 19:02:23 +00:00
Trevor Parscal 3ac24949ce Fixed incorrect registration object being used 2011-11-16 18:54:05 +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
Alexandre Emsenhuber a2d77301a4 svn:eol-style native 2011-11-16 14:10:03 +00:00
Roan Kattouw 9060cd6161 Fix stupid mistake that broke traverseLeafNodes() in IE 2011-11-16 12:51:31 +00:00
Inez Korczynski ace69887ee Fix typo: "annotation" => "annotations" 2011-11-16 06:13:17 +00:00
Trevor Parscal 3ec0976f5d Made leaf nodes listen for updates from their content views and emit updates themselves in response. 2011-11-16 00:24:46 +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 a7cdee541c Fixed typo - insert/remove operations have a data property, not a content property. 2011-11-16 00:02:27 +00:00
Trevor Parscal cc8e1d02fc Changed nodes to selectedNodes for clarity 2011-11-16 00:01:35 +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
Trevor Parscal 4f1f6699ee Tweaks to make jshint happy 2011-11-15 18:42:34 +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
Trevor Parscal a4e3b3922d Using jQuery.inArray implementation of indexOf instead of our own
Fixed a wrong class name bug
2011-11-15 17:54:52 +00:00
Roan Kattouw 5d619ac6cf Fixed the last array indexOf call that I could find 2011-11-15 16:27:14 +00:00
Roan Kattouw eff198ff1d Move .indexOf() from es.DocumentModelBranchNode to es.DocumentBranchNode and use it in .traverseLeafNodes() 2011-11-15 16:24:33 +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
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 ec8e92029a Followup r103161: make reverse work 2011-11-15 13:23:04 +00:00
Roan Kattouw f7ef40fb7a Rewrite traverseLeafNodes() with an iterative traversal, and add support for from. Support for reverse is not implemented yet. 2011-11-15 12:55:31 +00:00
Roan Kattouw 7d8741e6e3 Add a wrapper for Array.prototype.indexOf(), needed for my traverseLeafNodes() rewrite 2011-11-15 12:54:18 +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 32c04b3e41 Add es.compareArrays(), needed for test cases I'm about to add 2011-11-15 11:10:21 +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 a7c1524fe0 Added empty method to es.DocumentBranchNode called traverseLeafNodes 2011-11-15 01:31:46 +00:00