Commit Graph
79 Commits
Author SHA1 Message Date
Jos van den Oever 8e0b32525a Fix nullablility in a number of places.
And add a few unrelated clarifying comments.
2014-02-11 09:12:20 +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 a14d2735b2 Make ops.OpRemoveText 100% typed. 2014-02-08 10:37:23 +01:00
Jos van den Oever ed7270442f Remove loadClass calls from class files. The load system reads the dependencies from the manifest.json files now. 2014-02-07 15:38:09 +01:00
Jos van den Oever 8a171bb30f Make gui.TrivialUndoManager and gui.UndoStateRules 100% typed. 2014-02-05 15:28:06 +01:00
Philip Peitsch 7d5b77ce8f Don't re-order non-ODF children when merging paragraphs
Child order of non-ODF nodes should be preserved when merging
paragraphs.
2014-02-05 17:54:07 +11:00
Friedrich W. H. Kossebau d2671e2a00 @returns -> @return 2014-01-31 15:33:43 +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 5fa95cb05a Use cached step translator to speed up text removal operations 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 4a11179b23 Extract StepsTranslator interface to allow a safe interface to start caching improvements 2013-11-14 20:28:32 +11:00
Philip Peitsch 608d144c84 Improve space selection rendering
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.
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
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