Commit Graph
37 Commits
Author SHA1 Message Date
Jos van den Oever eecfa4d201 Remove trailing spaces and tabs. 2013-06-19 16:47:52 +02:00
Philip Peitsch c285bed7c8 Preserve non-odf elements when merging a span into it's parent node
Edit information and other non-odf elements will be moved
to the parent node when the child element contains no further
text content to be removed.
2013-06-17 15:16:35 +02:00
Philip Peitsch 2f63269ae7 Correctly determine whether a span or space element is empty
Only remove span or space elements if the text content is empty
AND there are no character-related children within the text span

* Added more tests to ensure movement around tabs is correct
2013-06-17 15:16:35 +02:00
Philip Peitsch 864cc04d32 Added ability to compare complex objects in unit tests
* Fix test that fails under firefox
2013-06-14 18:05:01 +10:00
Philip Peitsch 311a7ffd0d Improve post-text removal cursor placement
Handle text deletion moving cursor before first walkable position in the
document
2013-06-11 12:18:41 +02:00
Philip Peitsch b46d8690ae Don't return early from OpRemoveText without ensuring all cursors are in walkable positions 2013-06-07 10:20:49 +02:00
Jos van den Oever 3b8a271c82 Compile fix. 2013-06-06 16:07:10 +02:00
Lu Li 77c2901c9f remove empty text:s, text:span and text:list-item after text deletion 2013-06-06 17:08:48 +10:00
Aditya Bhatt 83900c4e7c Upgrade significant whitespaces around deletion region to text:s
elements.
2013-05-29 11:37:25 +02:00
Jos van den Oever b682fb8710 Fix compilation. 2013-05-17 12:11:05 +02:00
Aditya Bhatt 95369193dd Smarter logic for paragraph merging when one of them is an empty
paragraph. Don't let empty paragraphs win. Also - moar tests.
2013-05-16 17:33:01 +00:00
Aditya Bhatt 0d5a04e92b Squashed commit of the following:
commit 5080cb788a9be95fd4a0b756bf6844010a44d9c7
Author: Aditya Bhatt <aditya@adityabhatt.org>
Date:   Thu May 16 13:08:33 2013 +0000

    Emit a signalCursorMoved after text deletion. This signals to the editor
    that it might be time to change the current paragraph style view

commit c0a2230bafd3de8654fcb3e1f1e77d856d00532e
Author: Aditya Bhatt <aditya@adityabhatt.org>
Date:   Thu May 16 12:47:33 2013 +0000

    Better tests: add style attributes to nodes in merge tests

commit ac73c68373b211103af92ea2a4f74f9c95962c93
Author: Aditya Bhatt <aditya@adityabhatt.org>
Date:   Thu May 16 12:34:24 2013 +0000

    Change Remove_deleteMergeBig and move it tofailingtests

commit 98ec814c016e533c39b3dcb533bc55559ae493e5
Author: Aditya Bhatt <aditya@adityabhatt.org>
Date:   Thu May 16 12:21:10 2013 +0000

    Refactor OpRemoveText

commit 6d633d22255eaad488adfa4a15e2aa14de9a6739
Author: Aditya Bhatt <aditya@adityabhatt.org>
Date:   Wed May 15 18:36:24 2013 +0000

    Paragraph merging is here!!!
    * A method in OdtDocument to get the neighboring paragraph in any
    direction.
    * OpRemoveText is rewritten and now does some preprocessing before generating
    neighborhoods. Paragraph merging logic implemented with a new function
    mergeParagraphs.
    * A bunch of nontrivial XML tests for the new paragraph merging, and
    * they all pass
2013-05-16 13:35:53 +00:00
Jos van den Oever a1498dd481 Fix removal of spaces. 2013-05-13 14:56:08 +02:00
Jos van den Oever 6cf5bbef1e Insert a new text node at the correct position.
A new PositionIterator function is needed for this: rightNode. For completeness sake, leftNode() is also introduced.
2013-05-06 11:39:48 +02:00
Aditya Bhatt a1e7644aad jsdoc 2013-04-24 16:13:13 +05:30
Aditya Bhatt fcaaeedf18 eject the text nodes that will never be traversed in
getTextNeighborhood, and in OpRemoveText: instead of searching for the
current textNode in the neighborhood, start deleting from position zero.
2013-04-24 16:13:13 +05:30
Aditya Bhatt 327c130e3e Check for text content of the parent node instead of hasChildren 2013-04-24 16:13:13 +05:30
Aditya Bhatt 7f205d2cdf Add asserts and rename firstNode to firstIndex 2013-04-24 16:13:13 +05:30
Aditya Bhatt 2eace53a1a A fixCursorPositions function in OpRemoveText, used to fix cursors that
end up in unwalkable places after text deletion
2013-04-24 16:13:12 +05:30
Aditya Bhatt 7de4ba24e1 An isPositionWalkable method to SelectionMover, used to check the
walkability of the resulting cursor positions in OpRemoveText. If
unwalkable, move the cursor 1 filtered step backward.
2013-04-24 16:11:03 +05:30
Aditya Bhatt 3b69405a4d Make linter happy 2013-04-24 16:07:41 +05:30
Aditya Bhatt 4c80c84e4e Rewritten OpRemoveText, using the new and awesome getTextNeighborhood
method, which can delete text across serveral nodes.
2013-04-24 16:07:41 +05:30
Aditya Bhatt 2ebda70e75 WORKAROUND: let's keep the text node as "" after pressing delete before
the last character. Deleting it breaks things currently because the position
iterator is very much dependent on a 'container' which, because of
having an inline cursor, happens to be the text node that was deleted.
2013-04-24 16:07:39 +05:30
Aditya Bhatt fdc93f721c The paragraphElement for a textNode should be saved in a variable first
because accessing it after the textNode is deleted would not be possible
2013-04-24 16:07:39 +05:30
Friedrich W. H. Kossebau be545658d7 Trigger an update of the canvas size on changes of the content/styles
The root node element of the flat ODF, <document>, is not a direct child of the
variable "sizer" in the odf.OdfCanvas code) which is used to implement the
zooming feature, by using the scale() transformation via the styles.
Problem is that this scaling does not also scale the actual space used by the
element. To fix this there is a method fixContainerSize() which is used to adapt
the size of the canvas element to the actual rendering size of the document
content. This code then sets the width and height properties to fixed values.
But all this results in another problem: the canvas element is not resized
automatically by the usual DOM behaviour if the content below the <document>
 node or the CSS applied to it parts is changed.

The initial plan was to use DOMSubtreeModified & friends, to have the
odf.OdfCanvas care for updates itself. But as it seems outdated and has quite
some overhead on larger changes to the document, in the end it was decided to go
for now with the approach that was chosen for the style changes, to rely on the
document modifying ops to trigger the needed canvas updates themselves. Not
perfect, but seemed consistent at least.
2013-04-24 11:20:08 +02:00
Friedrich W. H. Kossebau 11e1a7666d Make all ops only depend on global ops 2013-04-09 13:45:33 +02:00
Friedrich W. H. Kossebau 263002f70f Update Copyright years of ops code files 2013-04-09 13:45:33 +02:00
Friedrich W. H. Kossebau 16f634ce1a Have ops return the success of their execute 2013-04-09 13:45:33 +02:00
Friedrich W. H. Kossebau 6f5ced4d1e Do not pass session as parameter to the ops contructors, pass odtDocument instead of domroot in the execute method 2013-04-09 13:45:33 +02:00
Friedrich W. H. Kossebau 7868d6bfa3 Move eventNotifier from ops.Session to ops.OdtDocument 2013-04-09 13:45:33 +02:00
Friedrich W. H. Kossebau 54b3a1381c move all DOM manipulation code to the ops
Also:
* merge paragraphEdited event of ops.OdtDocument into paragraphChanged event of ops.Session
* remove any event subscription/emitting from ops.OdtDocument
2013-04-09 13:44:49 +02:00
Aditya Bhatt 9d8bd8e063 Add timestamp fields to operation specs 2013-03-14 18:21:03 +05:30
Friedrich W. H. Kossebau 6a568a8f58 Split ops.OdtCursor from core.Cursor & rename ops.Document to ops.OdtDocument
Also:
* rename gui.CaretTests to ops.OdtCursorTests (as it is testing ops.OdtCursor)
* remove test-less CaretTests.js, had broken setup now
2013-03-06 15:44:28 +01:00
Jos van den Oever 155bf9a4d3 Whitespace fixes. 2012-11-10 11:35:21 +01:00
Friedrich W. H. Kossebau a058242e6b Split ops.Document from ops.Session (initial step)
Idea here is to create abstraction as much as possible for all ODF-related
objects, e.g. the cursor objects now belong to and know the ODF document model
they run around in.

Some avatar tests still need fixing/adaption, but from manually testing it
looks good, so commiting now to prevent too much differences.
2012-11-09 12:19:08 +01:00
Friedrich W. H. Kossebau 8369aacb78 Make closure compiler happy (well, she better than us) 2012-11-09 12:13:22 +01:00
Friedrich W. H. Kossebau a788288991 Create a simple RemoveText operation on backspace 2012-11-09 12:13:04 +01:00