In order to improve the OT-ability of text and paragraph removal
with other operations, the merge behaviour has been extracted.
The logic for building up the necessary remove operations has
been encapsulated in TextController for now as all uses pass
through this point still.
* 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.
As destination & source now never change, there is no need to re-
position the source paragraph. The source paragraph will now always be
checked for possible removal.
* Make TextController specify the mergedParagraphStyleName
when generating a RemoveText operation. No longer let
OpRemoveText decide the merge order from the context.
* Remove the text:style-name attribute on a paragraph
if the aforementioned property is an empty string.
* Add tests for this.
If an auto-collapsing container (e.g., a span) has text with a trailing
empty text node inside the container, the trailing text node is removed
immediately in order to collapse the span. This empty text node may also
appear in the textNodes to be removed, so each subsequent text element
needs to ensure it hasn't already been deleted.
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.
Groups of spaces will be represented with space character elements which
are not considered or returned as part of the fetched text nodes. This
logic has now been adjusted to fetch all text elements, which will return
non-text node character element as well.
Problem with the dipslay:block.
If we don't set a height for text:line-break, then there is no gaps
between sentences. As block element with no height doesn't take any space.
On the other hand if we do set a height for text:line-break, then all the
line breaks takes an empty line which is not exactly what we like. The
very first one should just end the line.
CaretManaer - hide caret if it is image selection; otherwise show and refresh cursor blinking
OdtCursor - introduce seletion type
OpAddAnnotation - reset seletion type to default after moved into annotion
area
OpMoveCursor - set the cursor's selection type
OpRemoveText - reset selecton type to default after deletion
problem: the text 'image description' is left bebind undeleted when trying to remove the image below
<draw:frame>
<draw:image/>
<svg:desc>image description</svg:desc>
</draw:frame>
The fix is: apart from delete all the odf element from target node as we currently doing, we also want to delete all those text nodes that their parent are odf elements.
In addition, i also made small behavior change to getTextElements method of OdfUtils.
Now for character elements such as text:s, text:tab and text:line-break, it returns only the odf element instead of both element and text data.
Eg. if the given range include a <text:s> </test:s> element, it return only the <text:s> element rather than both <text:s> and ' '
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.
Failure to skip insignificant whitespace causes major issues when applying
direct formatting as the operation attempts to style text nodes that
have no parent paragraph (e.g., new line elements between paragraphs).
This causes problems with Flat ODT files, as these are pretty-printed
by LibreOffice, and hence contain a lot of whitespace.
* 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 rewrite fixed 3 failing operation tests related to whitespace
behaviours.
The current implementation supports
* List & list item removal
* Image & frame remove
* Text removal
* Paragraph merging
As part of this, improvements were made to how the cursor positioning
is fixed to attempt to always keep the cursor in the paragraph it starts
in to avoid line jumping near paragraph boundaries.
Note: deleting selected text results anchor node is left behind in the dom
like <anchor></anchor><cursor>...</cursor>. this causes subsequent
OpInsertText to not work as expected due to the current implementation of
OdtDocument.getPositionInTextNode returns position in between the anchor
and cursor node. As a result, the very next character typed after deletion
will be highlighted, and any subsequent character typed will keep replacing
previously entered the character.
In order to address the above situation, call cursor.move(0) to reset its
selection to collapsed after remove the text