45 Commits
Author SHA1 Message Date
Philip Peitsch bb56bc684c Convert odf.OdfUtils into a static singleton 2014-09-12 10:33:27 +10:00
Satvik Kumar a714866c52 Removed getParagraphElement from OdtDocument
This function only redirected to the OdfUtils version and many callers
already had an existing instance of OdfUtils to use. Any callers who did
not have an instance of OdfUtils now create one to continue using the
function.
2014-08-13 23:15:50 +10:00
Philip Peitsch 466a828303 Change OT to handle new paragraphStyleName property in SplitParagraph
In particular, to allow SplitParagraph to transform with SetParagraphStyle,
the source paragraph boundaries for the split paragraph op also need to
be recorded.
2014-06-13 23:50:13 +10:00
Philip Peitsch ff97ac053e Make SplitParagraph op specify the new paragraph style
In order to allow convergence between collaborative clients, the split
paragraph op needs to specify what the resulting style of the new
paragraph will be.
2014-06-13 22:46:48 +10:00
Friedrich W. H. Kossebau 1e2a4a8323 Normalize license headers of the webodf.js source files
* remove @license tag (to prevent Closure compiler keeping the comment)
* use copyright@kogmbh.com email address everywhere
* remove "additional permission", to be added only to released webodf.js
* separate license header by empty line from following content
2014-06-02 12:19:05 +02:00
Philip Peitsch 4f631ac8f1 Remove obsolete length parameter from step insert/remove cache signals
The length parameter is incorrect under many circumstances, and has
proven so difficult to get correct that the cache implementation now
ignores it entirely. Remove this tech debt to simplify future ops.
2014-05-23 00:44:06 +10:00
Jos van den Oever b3c77bf307 Move signals CursorAdded, CursorRemoved and CursorMoved to ops.Document.
This makes SvgSelectionView independent from ops.OdtDocument.
2014-02-24 15:13:13 +01:00
Jos van den Oever ddcb6009eb Add a number of more precise types and remove unneeded casts. 2014-02-10 15:59:37 +01:00
Jos van den Oever 72a99e5a63 Make ops.OpSplitParagraph 100% typed. 2014-02-08 10:37:23 +01:00
Jos van den Oever 8a171bb30f Make gui.TrivialUndoManager and gui.UndoStateRules 100% typed. 2014-02-05 15:28:06 +01:00
Aditya Bhatt 5dfd3438d1 * Add moveCursor flag to OpSplitParagraph.
* Adapt places where OpSplitParagraph is initialized
to also add the moveCursor flag.
* Let SplitParagraph vs SplitParagraph execute normally
at the same position.
2013-12-06 12:37:34 +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 2dd6875705 Ensure reported step changes are accurate when splitting paragraphs
Paragraph splitting carried a very slight optimisation that would insert
the new paragraph before the current one if the current paragraph was
empty. This would cause the reported step position start to be incorrect
as the actual step that changed was position−1.

This alternate code path has been removed to ensure the reported step
changes are always correct.
2013-11-14 20:28:37 +11: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
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
Philip Peitsch 1e874e07c9 Remove unnecessary local member id parameter
All consumers of this event check the memberid associated with the cursor
regardless. This filter therefore does nothing.
2013-10-14 11:09:24 +11:00
Friedrich W. H. Kossebau 127cd24e9b clean up a potential empty text node in OpSplitParagraph 2013-09-23 15:27:54 +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
Philip Peitsch fe7fbefe4c Properly preserve leading space when splitting a paragraph
Splitting a paragraph just before whitespace was causing the cursor to
incorrectly reset, and the leading space to be discarded.

* Re-aligned OdfUtils.isSignificantWhitespace to match description in
README_cursorpositions
* Fixed operationtest "DeleteExposesSpace2" which incorrectly specified
trailing whitespace should be treated as significant
* Reduced number of introduced empty text nodes. This causes issues with
OdtDocument.getPositionInTextNode
2013-07-24 10:31:38 +10:00
Philip Peitsch 2d5a84d85e Fix cursor positions after splitting a paragraph
If the cursor position isn't fixed, attempting to add text when starting
a new paragraph at the end of the document may result in no text appearing
2013-07-15 09:23:00 +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
Lu Li 89a8dcf382 split the parent list-item node if the paragraph node has one 2013-05-31 09:34:13 +02:00
Lu Li 3402897ce6 refactor the SplitParagraph to reduce nesting 2013-05-31 09:34:13 +02:00
Aditya Bhatt 1960820ee9 Don't move the other cursors at the same position into the new paragraph
when paragraph splitting.

Comments++

Jsdoc + tests for multicursor inserion and paragraph splitting.
2013-05-23 14:42:26 +02:00
Aditya Bhatt 6c79731995 Remove paragraph splitting fix now that the cursorTextNode optimization
is gone
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 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
Friedrich W. H. Kossebau 2a46022a5c unbreak paragraph splitting 2013-02-20 12:44:29 +01:00
Friedrich W. H. Kossebau 6e80cacefc Use the canvas element to grab all input, ensure caret visibility ourselves 2013-02-11 17:59:59 +01:00
Friedrich W. H. Kossebau 0b12a44568 Fix OpSplitParagraph to also now emit the signal 'highlightEdit' instead of using the old method
Fixup for 7d4a0ba063
2013-02-05 13:05:15 +01:00
Friedrich W. H. Kossebau 94e5408106 improve OpSplitParagraph to also handle any text:spans
also moves implementation from Document to the op class

unsolved: own cursor loses focus if moved into split paragraph
2012-12-28 13:21:40 +01:00
Jos van den Oever 2d11ccdd65 Add very buggy implementation of SplitParagraph.
There is more work ahead.
2012-11-16 18:55:19 +01:00
Jos van den Oever 9f1658a806 Add boilerplate for the operation to split a paragraph. 2012-11-16 17:51:49 +01:00