Commit Graph
66 Commits
Author SHA1 Message Date
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
lli 96cf60649a Make the text:line-break elements behave like <br>
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.
2013-10-18 16:47:50 +11:00
lli d7a1dbc2f5 Refactoring a few classes for supporting selection type
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
2013-10-15 21:42:20 +11:00
Lu Li 2ff463610f Fix an image deletion issue where frame with svg:desc text is not properly deleted
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 ' '
2013-10-09 15:03:50 +11:00
Lu Li 894920b3da Remove getTextElements and getParagraphElements from OdtDocument as they can be accessed directly from OdfUtils 2013-10-09 14:29:24 +11:00
Friedrich W. H. Kossebau 0f92792955 Fix wrong usage of NodeFilter.FILTER_ACCEPT on position filter result in OpRemoveText 2013-10-08 16:01:37 +02:00
Friedrich W. H. Kossebau 5386f93c1b Default mergeForward to false, not undefined (to balance that it only might get set to true) 2013-10-01 15:20:09 +02:00
Friedrich W. H. Kossebau 1f5428993c Brush up types in API dox of OpRemoveText internal functions 2013-10-01 15:18:39 +02:00
Lu Li 477d7fd8e8 fix image removing issue where draw:frame is removed but draw:image is left behind in the document 2013-10-01 13:10:27 +10:00
Friedrich W. H. Kossebau ff27d79d80 Workaround EditInfo not being cleaned up on resolving of its paragraph, thus failing in its destroy() 2013-09-27 17:39:18 +02: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
Friedrich W. H. Kossebau fa7be37994 Remove unused text property from the OpRemoveText spec 2013-08-15 21:00:37 +02:00
Philip Peitsch 3b35911d3d Skip insignificant whitespace nodes when applying direct formatting
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.
2013-08-05 16:34:00 +10: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
Lu Li b4f90174dc fixCursorPositions improvement 2013-07-24 12:25:39 +02:00
Philip Peitsch 6fcbe0c71c Re-implemented OpRemoveText to make better use of iterators and filters
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.
2013-07-24 01:45:48 +02:00
Philip Peitsch b472470524 Re-added commit 0c811f2404
* Fixed broken operation tests
2013-07-22 16:47:41 +02:00
Aditya Bhatt d95774f11e Revert "when pasting or typing, removes the selected text before inserting new text"
This reverts commit 0c811f2404.
2013-07-18 16:14:06 +02:00
Lu Li 0c811f2404 when pasting or typing, removes the selected text before inserting new text
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
2013-07-17 16:11:42 +10:00
Philip Peitsch 2af09cc034 Refactored out common DOM utility methods 2013-07-15 09:40:50 +02: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
Philip Peitsch 203ae9ae84 Simplify getTextNeighborhood by only allowing positive lengths 2013-07-03 13:19:05 +02:00
Friedrich W. H. Kossebau e32bc7c9c9 Simplify OpRemoveText by only allowing positive length 2013-07-02 23:11:21 +02:00
Philip Peitsch 6687b092a6 Allow deletion of tabs by OpRemoveText
OpRemoveText depends heavily on there being text present
for the node to be considered for removal. A simple way
to allow deletion of tabs is to add some basic text content
(e.g., a tab char) so the text node is then considered and
the containing tab can be cleaned up.

* Modify css to preserve whitespace in tab elements
* Added assert to OperationsTest to ensure correct tab data
* Updated all tests to specify the correct tab text content
2013-06-27 00:40:19 +10:00
Philip Peitsch ff6ef29524 Deletion fixes
* Move all non-odt children across when merging paragraphs
* Recursively merge into parents when cleaning up empty nodes
2013-06-27 00:05:04 +10:00
Lu Li 11118e868a fix an issue with deleting list item 2013-06-26 13:44:07 +10:00
Jos van den Oever eecfa4d201 Remove trailing spaces and tabs. 2013-06-19 16:47:52 +02:00
Philip Peitsch c285bed7c8 Preserve non-odf elements when merging a span into it's parent node
Edit information and other non-odf elements will be moved
to the parent node when the child element contains no further
text content to be removed.
2013-06-17 15:16:35 +02:00
Philip Peitsch 2f63269ae7 Correctly determine whether a span or space element is empty
Only remove span or space elements if the text content is empty
AND there are no character-related children within the text span

* Added more tests to ensure movement around tabs is correct
2013-06-17 15:16:35 +02:00
Philip Peitsch 864cc04d32 Added ability to compare complex objects in unit tests
* Fix test that fails under firefox
2013-06-14 18:05:01 +10:00
Philip Peitsch 311a7ffd0d Improve post-text removal cursor placement
Handle text deletion moving cursor before first walkable position in the
document
2013-06-11 12:18:41 +02:00
Philip Peitsch b46d8690ae Don't return early from OpRemoveText without ensuring all cursors are in walkable positions 2013-06-07 10:20:49 +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
Aditya Bhatt 83900c4e7c Upgrade significant whitespaces around deletion region to text:s
elements.
2013-05-29 11:37:25 +02:00
Jos van den Oever b682fb8710 Fix compilation. 2013-05-17 12:11:05 +02:00
Aditya Bhatt 95369193dd Smarter logic for paragraph merging when one of them is an empty
paragraph. Don't let empty paragraphs win. Also - moar tests.
2013-05-16 17:33:01 +00:00
Aditya Bhatt 0d5a04e92b Squashed commit of the following:
commit 5080cb788a9be95fd4a0b756bf6844010a44d9c7
Author: Aditya Bhatt <aditya@adityabhatt.org>
Date:   Thu May 16 13:08:33 2013 +0000

    Emit a signalCursorMoved after text deletion. This signals to the editor
    that it might be time to change the current paragraph style view

commit c0a2230bafd3de8654fcb3e1f1e77d856d00532e
Author: Aditya Bhatt <aditya@adityabhatt.org>
Date:   Thu May 16 12:47:33 2013 +0000

    Better tests: add style attributes to nodes in merge tests

commit ac73c68373b211103af92ea2a4f74f9c95962c93
Author: Aditya Bhatt <aditya@adityabhatt.org>
Date:   Thu May 16 12:34:24 2013 +0000

    Change Remove_deleteMergeBig and move it tofailingtests

commit 98ec814c016e533c39b3dcb533bc55559ae493e5
Author: Aditya Bhatt <aditya@adityabhatt.org>
Date:   Thu May 16 12:21:10 2013 +0000

    Refactor OpRemoveText

commit 6d633d22255eaad488adfa4a15e2aa14de9a6739
Author: Aditya Bhatt <aditya@adityabhatt.org>
Date:   Wed May 15 18:36:24 2013 +0000

    Paragraph merging is here!!!
    * A method in OdtDocument to get the neighboring paragraph in any
    direction.
    * OpRemoveText is rewritten and now does some preprocessing before generating
    neighborhoods. Paragraph merging logic implemented with a new function
    mergeParagraphs.
    * A bunch of nontrivial XML tests for the new paragraph merging, and
    * they all pass
2013-05-16 13:35:53 +00:00
Jos van den Oever a1498dd481 Fix removal of spaces. 2013-05-13 14:56:08 +02:00
Jos van den Oever 6cf5bbef1e Insert a new text node at the correct position.
A new PositionIterator function is needed for this: rightNode. For completeness sake, leftNode() is also introduced.
2013-05-06 11:39:48 +02:00
Aditya Bhatt a1e7644aad jsdoc 2013-04-24 16:13:13 +05:30
Aditya Bhatt fcaaeedf18 eject the text nodes that will never be traversed in
getTextNeighborhood, and in OpRemoveText: instead of searching for the
current textNode in the neighborhood, start deleting from position zero.
2013-04-24 16:13:13 +05:30
Aditya Bhatt 327c130e3e Check for text content of the parent node instead of hasChildren 2013-04-24 16:13:13 +05:30
Aditya Bhatt 7f205d2cdf Add asserts and rename firstNode to firstIndex 2013-04-24 16:13:13 +05:30
Aditya Bhatt 2eace53a1a A fixCursorPositions function in OpRemoveText, used to fix cursors that
end up in unwalkable places after text deletion
2013-04-24 16:13:12 +05:30
Aditya Bhatt 7de4ba24e1 An isPositionWalkable method to SelectionMover, used to check the
walkability of the resulting cursor positions in OpRemoveText. If
unwalkable, move the cursor 1 filtered step backward.
2013-04-24 16:11:03 +05:30
Aditya Bhatt 3b69405a4d Make linter happy 2013-04-24 16:07:41 +05:30