92 Commits
Author SHA1 Message Date
Philip Peitsch bb56bc684c Convert odf.OdfUtils into a static singleton 2014-09-12 10:33:27 +10:00
Philip Peitsch 3172ad8dec Convert core.DomUtils into a static singleton 2014-09-12 10:17:09 +10:00
Philip Peitsch 06ecc7d8c8 Implement OpMergeParagraph
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.
2014-06-17 03:13:00 +10:00
Philip Peitsch e0b97e1dd4 Split CollapsingRules out of OpRemoveText
This functionality will be shared with the soon-to-exist merge paragraph
operation.
2014-06-17 02:18:02 +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
Philip Peitsch 70f0cbf5dc Apply merged paragraph styles using OpSetParagraphStyle
Reduce the complexity within the remove text operation and push it up to
the controller instead.
2014-05-23 00:34:59 +10:00
Philip Peitsch 8ef0f92b13 Remove obsolete paragraph merge logic
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.
2014-04-28 19:33:36 +10:00
Philip Peitsch eb11fc4df9 Clean-up unnecessary variable name and associated API dox 2014-04-28 11:19:05 +10:00
Aditya Bhatt f9907179f8 Add property mergedParagraphStyleName to OpRemoveText spec.
* 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.
2014-04-24 23:25:11 +02:00
Aditya Bhatt 4199f6c74f Move isEmpty and isODFNode from OpRemoveText.js to OdfUtils. 2014-04-24 23:25:11 +02:00
Philip Peitsch 3014631cbc Harden up OpRemoveText to better cope with empty text nodes
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.
2014-03-05 00:32:37 +11: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 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