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.
* 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
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.
Downgrade whitespace now follows the same logic as upgrade, and will
downgrade a whitespace element just to the left of the step, and to the
left of the next step to the right.
Using step iterators instead of position iterators also fixes some failing
operation tests by ensuring one step to the right is checked irrespective
of how many positions there are between steps.
If an insert text operation is created that contains non-tab non-space
whitespace characters (e.g, \r\n etc.), these will now be treated as if
they were simply space characters and inserted accordingly. A warning
is logged for diagnostics purposes.
This prevents crashing on unexpected behaviour because the number of
inserted steps is consistent with the operation's text length.
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.
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.
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.
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.
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.
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.
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.
* 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.
annotation in html containers, adds connector elements, and a text
highlight.
Trigger OdfCanvas's anntationManager instance whenever any text
modification operation occurs.
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
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.
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.
Also:
* merge paragraphEdited event of ops.OdtDocument into paragraphChanged event of ops.Session
* remove any event subscription/emitting from ops.OdtDocument