Commit Graph
43 Commits
Author SHA1 Message Date
Philip Peitsch b17147ed47 New cursor re-arrangement behaviour for OdtDocument.getTextNodeAtStep
The new logic no longer provides special behaviour for the requested member's
cursor. Instead, all inserted data will occur after any cursors occupying
that particular step.
2013-12-05 17:26:19 +01:00
Aditya Bhatt 47db07fb99 * Add an additional flag moveCursor to OpInsertText,
and obey it to explicitly move the cursor to the
desired resultant position.
When doing this, take care to specify the correct
textnode position for text insertion (i.e. before
or after the cursor).
* Adapt the rest of the code that uses OpInsertText
to pass the correct moveCursor flag (true).
* Remove the 'return null' from the transform of
InsertText vs InsertText.
2013-12-05 17:26:19 +01:00
Jos van den Oever 619e47b1d5 Add types to operations and operation matrix. 2013-11-26 16:56:00 +01:00
Aditya Bhatt bfdc14b907 Add isEdit properties to all operation classes
to make life easier by avoiding the need to listen
to various signals or look at optypes when you just
want to know whether any edits have taken place.
2013-11-22 20:35:29 +01:00
Philip Peitsch dd166cb00c Refactor getPostionInTextNode to use cached step information
The new implementation should be equivalent in every way, except
it now is able to benefit from the cached step information to be
significantly more faster.

This patch also addresses parts of issue #3.
2013-11-14 20:28:36 +11:00
Philip Peitsch 410280fe14 Add signals necessary to keep a caching implementation in sync with the document 2013-11-14 20:28:33 +11:00
Philip Peitsch e4e7618a84 Always upgrade the final whitespace in inserted text
The final character of inserted text must always be upgraded
on insertion, and conditionally downgraded post-insertion.
This covers the situation where a space is inserted as the last
character in a paragraph. In this instance, the space must be
a space character so it isn't discarded as trailing insignificant
whitespace.
2013-11-06 23:03:52 +11:00
Philip Peitsch 367a5a0d94 Call Node.insertBefore with null rather than undefined
IE10 will throw an error if Node.insertBefore is called with the second
argument
as null rather than undefined.
2013-10-25 00:34:19 +11:00
Friedrich W. H. Kossebau c2a795e668 Update link to repo: now https://github.com/kogmbh/WebODF/ 2013-10-23 18:20:30 +02:00
Friedrich W. H. Kossebau 508570dab8 Add copy of the AGPL3 to sources (+ add to created zip files) 2013-10-21 17:55:16 +02:00
Friedrich W. H. Kossebau 4f584a5efe Fix inserting text at positions with other cursors, but not the one of the same member 2013-09-23 13:34:52 +02:00
Philip Peitsch b09acfc983 Correctly calculate nodeOffset when joining text nodes together
* Downgrade all positions that are potentially upgraded
2013-09-20 00:05:33 +10:00
Philip Peitsch bc09db181c Upgrade/downgrade whitespace around boundaries near inserted and removed text
Under various conditions inserting or removing text should cause existing
whitespace to be upgraded, or allow it to be downgraded. Note, OpSplitParagraph
doesn't require downgrade checks as a split paragraph always requires
any leading or trailing spaces to be upgraded.
2013-09-19 12:16:53 +02:00
Philip Peitsch 476c487318 Make OpInsertText only add space elements when necessary
Overuse of space elements when pasting text causes the "justified"
paragraph alignment to appear to not function. Both LO and a standard
web browser do not expand the spacing inside space elements when the
paragraph is justified, resulting in it appearing to be simply left-aligned.
2013-09-19 12:16:53 +02:00
Philip Peitsch d40c02f444 Remove unnecessary cursor workaround
The cursor range is now automatically reset every time the cursor's
getSelectedRange method is called. This negates the need for this
workaround.
2013-09-19 12:16:53 +02:00
Friedrich W. H. Kossebau decaaeaf4e use OdtDocument.getDOM() consistently 2013-08-13 00:22:22 +02:00
Aditya Bhatt 374ffc2fbc * Allow annotations to be enabled/disabled via OdfCanvas
* Documentation++
* Enable annotations by default in editor and viewer.
* Detach range in highlighter after use

Also: Annotation handling is broken when annotations overlap. Add TODO for
that.
2013-08-01 16:17:08 +02:00
Aditya Bhatt 7d6c95d9f2 A new AnnotationManager class in gui that handles wrapping the
annotation in html containers, adds connector elements, and a text
highlight.
Trigger OdfCanvas's anntationManager instance whenever any text
modification operation occurs.
2013-08-01 16:17:00 +02:00
Jos van den Oever 967e5c0ba0 Update closure compiler and fix ensuing problems. 2013-07-24 17:56:39 +02:00
Lu Li 03915b2896 handle Tab key 2013-07-24 12:08:38 +02:00
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