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.
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.
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.
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.
Recent changes to Formatting.getAppliedStyles return type were not correctly
spread through the DirectFormattingController. Update the CC types and fix
incorrect type usages in this controller.
To help preserve future sanity, some rough unit tests have been added for
the specifically fixed branches ONLY.
Fixes#723.
The returned object from the applied styles calculation did not have
specific type information for Closure Compiler so I have added some
typedefs that describe the returned object.
contain text.
This divides the `isEnabled` information of DirectFormattingController
into two parts, `directTextStyling` and `directParagraphStyling`.
The widgets are accordingly updated.
Operation batches that modify a large number of paragraphs (or repeatedly
modify the same paragraph) can cause numerous unnecessary style change
events to be triggered. Rather than reporting these instantly, track them
as they occur and emit the style change summary on batch end.
Related to #610.
It lazily computes required information and caches it
for further use -- an initial method inside it is
isLocalCursorWithinOwnAnnotation, which contains the logic
moved from DirectFormattingController. It would have been
expensive to perform this check separately everytime the
cursor moves in each controller.
Let DirectFormattingController obey this "edit.reviewMode"
constraint by not creating any operations or processing any
action to format text when the cursor is not within the local
user's annotation.
Signals are exposed to toolbar widgets so they may
enable/disable themselves on the fly depending on the cursor
context.
DirectFormattingController reads only the styling on text nodes
within the selected range. This causes wrong style information
to be communicated via signalling when the selection is an image.
This commit changes this behavior to read the style info of all
character/text elements and text nodes in the selection.
Fixes the issue where all direct and paragraph style buttons
are toggled to 'on'.
* 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
runtime.loadClass(...) no longer expects that eval(fileContent) yields
the constructor, and a few loaded files rely on that (e.g. all singletons/namespaces),
so let's be consistent
We only create a new paragraph style once per unique paragraph style
name. This vastly reduces the number of new styles created when
formatting a number of paragraphs that all share the same existing
paragraph style.
When selecting or modifying large areas of content, the multiple
style information lookup becomes quite expensive. These can be greatly
sped up by using a common cached value + associated query object
instead.
PositionFilterChains no longer have any need to allow adding or removal
of named filters. In practice, filters are only ever added just after
construction, and remain unchanged beyond this point. This allows a
slight simplification of the PositionFilterChain interface.
At the moment, splitting at the end of the following paragraph
<p style-name="standard">hello <span style-name="bold">world|</span></p>
will create a new paragraph like below
<p style-name="standard">|<span style-name="bold"></span></p>
The cursor is moved out of the span due to empty span is not considered as
a valid cursor position in the current design. this causes newly entered
text are not formatted correctly.
Merged DirectTextStyler and DirectParagraphStyler into
DirectFormattingController. These have become closely related concepts as
a result of changes in this patch.