788 Commits
Author SHA1 Message Date
Jos van den Oever 9f35da24d9 Upgrade to latest Closure Compiler
A few annotation errors were uncovered and fixed.
2016-07-24 22:04:45 +02:00
Aditya Bhatt 2c682bb73b Update other references to be aware of getMemberIds
working for all members, and not just cursors

Adds a new OdtDocument.hasMember method
2015-07-17 13:44:40 +02:00
Aditya Bhatt 9537e6d042 Let inserted image dimensions be in centimeters
LibreOffice does not recognize px dimensions for image frames,
despite the spec allowing it. To play safe, always convert the
dimensions into centimeters before inserting the image.

This patch comes with a new ImageControllerTests.js.
2015-07-14 11:35:48 +02:00
Philip Peitsch e6cb30164f Add TODO around TrivialUndoManager bug 2015-06-01 18:00:11 +02:00
Jos van den Oever b8ad5b3889 Upgrade to Closure Compiler 20150505.
We are now using our own copy of the externs to deal with differences
of opinion on best typing of types.
2015-06-01 08:53:35 +02:00
Friedrich W. H. Kossebau 55e856e67a Ending OpRemoveAnnotation, rerender existing annotations, not refresh all 2015-03-31 15:57:20 +02:00
Friedrich W. H. Kossebau f632956f80 In OpRemoveAnnotation just drop markup for the one annotation removed 2015-03-31 15:57:20 +02:00
Friedrich W. H. Kossebau 3947a38385 Support adding annotations to AnnotationViewManager in batches 2015-03-31 15:57:20 +02:00
Friedrich W. H. Kossebau 1d24d462c8 In OpAddAnnotation support annotated ranges with 0 length
Before 0 length was assumed to be an annotation without a range
2015-03-26 13:42:23 +01:00
Friedrich W. H. Kossebau 434a18a90d Add core.DomUtils.removeAllChildNodes() 2015-02-20 23:18:34 +01:00
Friedrich W. H. Kossebau 159e8323b2 Replace some usage of innerHTML 2015-02-20 18:14:43 +01:00
Friedrich W. H. Kossebau b523f784a2 Fix typing to not-nullable 2015-02-20 18:14:07 +01:00
Friedrich W. H. Kossebau bc6b187b24 Make StateId & StateTransition separate classes 2015-01-17 19:34:54 +01:00
Friedrich W. H. Kossebau 28cf41d498 Emit signalDocumentModifiedChanged whenever modified flag changes 2015-01-17 19:34:54 +01:00
Friedrich W. H. Kossebau fa34a33037 Rename consistently property "modified" to "documentModified" 2015-01-17 19:34:54 +01:00
Friedrich W. H. Kossebau 1e7c5d9274 Make UndoState a real object (also rename to Transition) + track the state 2015-01-17 19:34:54 +01:00
Friedrich W. H. Kossebau fb131de8f2 Change method name "set[Document]Unmodified" to "set[Document]Modified" 2015-01-17 19:34:54 +01:00
Friedrich W. H. Kossebau 2ff51f30a4 Extend UndoManager with a modified flag for a certain state 2015-01-17 19:34:54 +01:00
Lukas Reschke 5bd39aba43 Prevent hyperlink handler for potential dangerous URIs
This prevents the user from clicking on URIs starting with `javascript:` or `data:`. The reason behind this is that this may be used to trick users in executing dangerous JS when viewing an untrusted document. (which is the case in our deployment for ownCloud)

I'm not absolutely happy with that patch since it uses a blacklisting instead a whitelisting approach, but I consider it a feasible approach. Especially, considering all the possible values. (`mailto:foo@bar.com`, `ftp://`, `skype://`, etc...)

Conflicts:
	ChangeLog.md
2015-01-07 20:27:20 +01:00
Philip Peitsch 018448d792 Extract ODF field highlighting into standalone view
As per design discussed in issue #816. Extracting this into a separate
view makes it optional for consumers to use (or potentially further
customize).

Fixes #816.
2014-09-18 00:38:28 +10:00
Philip Peitsch c00fe43e77 Prevent focus wars (especially prevalent in Internet Explorer)
Adjusting the selected range in the event trap can trigger a new focus
event under some conditions. Prevent this from going into an infinite
loop by ignoring new focus events that arise while currently processing
a focus event.
2014-09-16 02:45:01 +10:00
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 3812f26f9c Cache commonly used global object variables 2014-09-12 09:21:22 +10:00
Philip Peitsch d6ced212b0 Migrate per-node checks out of TextPositionFilter
Moving these checks into a node filter ensures it is only required
once per node, rather than once per node-position.

This results in a 60% improvement in position iteration speed.
2014-09-12 09:21:22 +10:00
Philip Peitsch 6aa01c682e Optimize all existing uses of getElementsByTagNameNS
Transformed all read-only uses to use node.getElements*. Any loop that
immediately modifies the nodes in the list has been updated to use the
DomUtils.getElements* version.
2014-09-11 15:10:41 +10:00
Philip Peitsch 741ea56a17 Add event subscription tracking object to simplify per-frame subscriptions
A common use-case for UI components is to only update the UI state just
before the next frame is rendered, irrespective of how many times a
signal is fired within a given batch of operations.

The event subscriptions object allows these to be easily created and
tracked, and also makes it easier to ensure all subscriptions are cleaned
up at the end.
2014-09-11 12:00:07 +10:00
Philip Peitsch daff6484cf Enabled direct text styling only if current selection is a text range
Prevents the controller advertising things such as bold and underline
are valid operations for an inline image (they are not!).
2014-09-11 12:00:06 +10:00
Philip Peitsch 1d70ef17db Delay signalling of enabled state changes until the op batch is complete
The internal state is reset immediately so any external calls to disabled
features will be correctly disabled. Delaying the signal however ensures
processing of groups of operations remains performant.
2014-09-11 12:00:06 +10:00
Philip Peitsch 05e23e3814 Introduce a proper CC type to hold style selection information 2014-09-11 12:00:06 +10:00
Philip Peitsch f37c59d985 Detect line endings when wrapping occurs between elements
Line ending detection was relying on wrapping occurring near or in a block
of collapsed whitespace. When wrapping occurs between two elements, both
previous and next rectangles may be defined, though the vertical overlap
will be absent.
2014-09-10 21:55:01 +10:00
Friedrich W. H. Kossebau 046323c69e In the comments talk about a master session, not a server 2014-08-20 23:27:59 +02:00
Philip Peitsch 94103545d3 Add alignWithTop flag to indicate rect should be scrolled to top of view
This mirrors the HTML flag of the same name:
https://developer.mozilla.org/en-US/docs/Web/API/element.scrollIntoView
2014-08-15 23:27:41 +10:00
Philip Peitsch 5445b52a7a Use text style from the selection start when splitting a paragraph 2014-08-14 23:16:45 +10:00
Philip Peitsch 36be9398d9 Fix crash if a split paragraph occurs with no text elements selected 2014-08-14 22:33:30 +10:00
Satvik Kumar a714866c52 Removed getParagraphElement from OdtDocument
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.
2014-08-13 23:15:50 +10:00
Philip Peitsch ebac8f5707 Caret no longer needs to be hidden between redraws
Removing layers of timeouts in the CaretManager mean the caret no longer
flickers badly when transitioning between large and small sizes.

See PR #369 for details about why this workaround was put in originally.
2014-08-09 01:29:22 +10:00
Philip Peitsch 369b0f5b4a Bind events directly to caret functions
The Caret itself already has logic to only perform expensive updates once
per redraw. There is no performance gained by CaretManager duplicating
this logic as well.

In addition, bind to any processing batch end. This is because any
type of edit may cause the caret to be pushed off screen including
adding annotations, splitting paragraphs, deleting text, modifying a
paragraph style etc. the most straightforward way to ensure the caret is
up-to-date is to check it's visibility on every edit operation.

Fixes #765
2014-08-09 01:29:21 +10:00
Philip Peitsch 323764898e Put caret register/remove functions side-by-side for clarity 2014-08-09 01:29:21 +10:00
Philip Peitsch 4d84640265 Always update caret location even if it isn't visible
Though the caret visibility may be set to hidden, the caret still has
a client rectangle that can be accessed. It is important to keep this
up-to-date so the scrollIntoView logic works on a range selection even
when blinkOnRangeSelect is false.
2014-08-09 01:29:20 +10:00
Satvik Kumar 865541a3ed Use core.StepsDirection enum for rounding direction
The rounding direction constants in OdtStepsTranslator overlap with the
existing enum in core.StepsDirection. It makes sense to use that enum here
to specify rounding behaviour in converting DOM points to steps so the
constants have been removed and the enum has been substituted for all
usages.
2014-08-07 23:53:05 +10:00
Satvik Kumar 482e98da74 Remove rounding predicate from step conversion
This removes the option to provide a rounding predicate to decide whether
to round up or down from the convertDomPointToCursorStep method. It is replaced
with an enum that specifies whether to round up or down. The predicate was
removed as all callers supplied the same function to indicate they wanted
round up behaviour and this predicate was being duplicated.

The rounding parameter is optional and defaults to rounding down to the
previous step which is the same as before this commit.
2014-08-07 23:07:57 +10:00
Philip Peitsch 26ede808f3 Only scroll to *locally* inserted annotation
Reimplement logic to fix #486
2014-08-07 20:59:03 +10:00
Philip Peitsch 6f5abf29b4 Revert incorrect annotation scroll attempt from 9034648
Implementation would scroll to *any* annotation rather than
just annotations created by the local member.
2014-08-07 20:52:08 +10:00
Friedrich W. H. Kossebau 6570a00096 Hint that code correcly assumes no child elements of style:text-properties 2014-08-06 15:50:07 +02:00
Friedrich W. H. Kossebau d56cef9ac8 more odf.Formatting.StyleData/AppliedStyle typing instead of Object 2014-08-06 15:17:09 +02:00
Philip Peitsch 9034648042 Scroll the annotation node into view after creation
Makes annotation insertion feel cleaner as the user can now see the
complete annotation on insertion.

Fixes #486
2014-08-05 21:26:28 +10:00
Philip Peitsch c845342406 Extract viewport management logic into standalone system
Simplifies the caret class, and allows more exotic view configurations
to be inserted without breaking core code.

As a bonus, the new Viewport class is able to scroll arbitrary
rectangles into view.
2014-08-05 21:26:27 +10:00
Philip Peitsch 08cfde88e9 Move simplified client rect typedef to a common location 2014-08-05 14:22:09 +10:00
Philip Peitsch d18d2b5b8a Migrate SelectionMover.createPositionIterator to OdtDocument
Remove the SelectionMover file entirely as it no longer contains any
functionality.
2014-08-05 10:12:17 +10:00