Commit Graph
23 Commits
Author SHA1 Message Date
Philip Peitsch eca37e6771 Modified Cursor api to allow the selection to be specified directly
This provides better encapsulation and clarifies the usage slightly.
Hopefully, it will decrease the ways to cause the selection & actual
cursor position can get out of sync.

As this was the only use of the Selection stack, the whole class is
now removed
2013-06-12 16:30:48 +10:00
Philip Peitsch d81584cb6a Preserve cursor selection during text insertion 2013-05-28 15:35:57 +10:00
Aditya Bhatt 4cb5d5fb93 * Give rightmost-priority to the cursor with the current memberid, if
specified in getPositionInTextNode. Also, if there is a preferred cursor
node, then return the empty text node as immediately to the left of that
cursor.
* Add the memberid argument to it's call in OpInsertText. Now if many
cursors are at the same position and one cursor inserts text, the others
don't move along.
2013-05-23 14:42:26 +02:00
Aditya Bhatt 59da7fb421 split previousnode before insertion with an offset 2013-05-13 10:18:10 +00:00
Aditya Bhatt db760b568e Check for length of texts[i], not texts. 2013-05-13 10:18:10 +00:00
Aditya Bhatt 60fe6497aa Less textNode creation and faster text insertion. 2013-05-13 10:18:10 +00:00
Aditya Bhatt f6af4ee88a Handle insertion offsets more gracefully 2013-05-13 10:18:10 +00:00
Aditya Bhatt b1f1c261c5 Create text nodes only when necessary during string insertion 2013-05-13 10:18:10 +00:00
Aditya Bhatt b92389c98d * Stop using cursorTextNode, and use the simplest way to delete and
split textNodes for a cursor.
* Delete any empty text nodes that are created and unused during
insertion.
2013-05-13 10:18:10 +00:00
Aditya Bhatt 8d57a04c8e Insert text:s elements instead of spaces in OpInsertText.
Also make the cursor behave properly around such elements.
2013-05-13 10:18:10 +00:00
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 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
Tobias Hintze 3653e13a42 implement OperationFactory and NowjsOperationRouter; add spec() to ops 2012-11-09 12:00:43 +01:00
Friedrich W. H. Kossebau b69a7d94ac Restore old text input state, but now with SessionController and OpInsertText 2012-11-09 11:56:19 +01:00