With the event trap now being inside the cursor, any repositioning of
the cursor causes the document.activeElement and window selection to
change. This causes the document to stop being editable after actions
such as bolding current text.
Now, the focus state of the event trap is checked prior to each
operation, and will be reset back to the event trap if disrupted by an
operation. Note, checks are in place to prevent stealing focus if the
document is not active when an operation is executed.
Fixes issue #298
External editing features require some direct access along side the
eventing mechanism currently exposed. Additionally, there are more formatting
options available than DirectTextStyler supports in native functions.
By allowing access to the underlying function used to perform cursor
styling, external editors can easily provide support for custom text style
features (e.g., background colours etc.).
At this point, this is not intended to be open for extension as it is too
easy to break OT logic by incorrectly manipulating the operation groups.
Instead, convert this to use a specific-built extension point under tight
control of WebODF.
This improves the performance by reducing the number of times getAppliedStyles
is called (once per update, rather than once per property to check), and
paves the way for the direct cursor styling to be taken into account.
Cursor styling allows the direct styling properties of the next inserted
text to be set. This means that the user can set text-related properties
(e.g., bold, underline, italic) without having an existing selection,
and the next entered character will have this formatting applied to it.
Known issues
- Undo/redo requires multiple steps. Should only be one. But, the current
undo manager design is not amenable to this type of change.
Taking a sequence of ops also enables to give the guarantee that all
contained operations will be executed directly after each other,
in the given order. So creator of the ops can calculate the spec of each op
by relying on the known effect of the other ops.