Using the ::after pseudo-element with text content provides a more
consistent box height with non-empty paragraphs. This prevents table
cell heights from shifting when the caret iterates through them.
Screen readers tend to read input text elements as single lines, and do
not pause on new lines. Using a text area instead encourages some of these
to pause more naturally on paragraph boundaries.
The event trap is no longer made visible during composition. As a result,
the overflow and width settings are no longer required, and the height is
never overridden.
f78a30a introduced a regression that caused the IME menu to appear to
follow the caret across the screen as new characters are entered, rather
than remaining anchored at the beginning of the composed text.
This patch adds some width calculations, and aligns parts of the caret
overlay to either left or right side of the container. As the caret
overlay is widened, the event trap will remain fixed to the left, and the
caret + avatar handle will remain fixed to the right.
Historically, the avatar styling was split between the avatar class,
webodf.css and the editor's own CSS. This now all lives within WebODF,
so the !important tags are no longer necessary as the style attributes
being set on the handle and image elements can simply be removed.
The cursor element is now only visible when it contains either text
or the caret-size helper. In addition, there are no longer any fixed
widths being applied to the cursor element, so the inline-block is not
necessary.
In the specific situation where there are no visible rectangles nearby
from which to calculate the caret position and size, the cursor node itself
will be made visible with some hidden internal text as a substitute.
This ensures the caret is correctly aligned in empty paragraphs that are
not left-aligned, or in an area surround by non-visible rects such as near
multiple annotations.
The cursor node is now completely hidden when not in use, so there is no
need to touch the height or width properties of the composer or cursor.
In addition, the new overlay caret no longer requires the composer to be
displayed as an inline-block in order to function.
Having the caret and avatar display inside the cursor node causes text
wrapping and other element shifts to occur in some browsers (mainly FF)
due to there being layout impacts from the almost-but-not-quite 0-width
cursor element.
Moving to non-inline overlays for these bits of chrome allows the cursor
to be hidden completely.
TODO
This commit introduces a regression when composing text using an IME
as the overlay doesn't advance properly during composition.
Fixes#86
The avatar was not staying well centred over the caret, and wouldn't move
vertically when the caret grew to match the text size. The easiest way to
ensure these stay properly aligned is to wrap both inside a sub-container.
Each css file contained some of the rules required for the avatar display.
There are enough stylistic elements in webodf.css the avatars look strange
if the editor.css rules are not present.
Clean up this problem by merging all the rules into webodf core.
Toggling a custom attribute on a custom XML element doesn't properly
update the visual state on some browsers (e.g., WebKit on OSX). Using
CSS classes instead seems to be better handled in these browsers,
correctly updating the mouse cursor icon on the fly.
This is required because webkit on mobile
does not seem to show any scrollbars if
`-webkit-overflow-scrolling: touch` is not
enabled -- and we cannot enable that because
it's kinetic scrolling is not controllable
or trackable.
Enable virtual scrollbars when in scroll mode,
othwerwise disable them. This is done because
the scrollbar size/position makes no sense
immediately after a removeScroll() call, because
the perceived panning is done through CSS.
Fixes an issue where clicking on the middle of
the character to the right of the caret would
cause the cursor to move to the start or end
of the document.
This commit pulls the event trap outside the cursor,
and as a child of the canvas,
and makes the Caret track the cursor's position and
position the trap above the cursor.
This means that there is no need to manually
blur and focus the eventManager whenever an
operation is executed.
Elements that are simply display:inline, but have no visible content can
do strange things to the browser selections in Chrome. They will actually
stop other preceding nodes in the same container from being selectable,
instead causing the selection to climb to the parent container.
Fixes issue #30
0px height elements are not able to receive an active selection in most
browsers. Setting a minimum height ensures the event trap is still able
to be selected when in an empty paragraph.
Inline blocks will cause the browser to allow word-wrapping to occur
either side of the node, an effect that is VERY undesirable for a
caret.
Making the event trap absolute, but expanded to the full height of the
cursor shows the composition menu displays in the same place as if
the trap was an inline-block. The cursor and trap are switched to inline
blocks during composition so the contained characters take up space in
the document.
This change extends the use of the event trap to allow in-line character addition
using the OS's IME. The event trap will now be moved to within the local user's
cursor block, and will become visible when a composition start event is detected.
This has been tested on Chrome, FF & Safari on all platforms. In addition, this
enables support in FF on Android.
Known issues
- No IME support on Chrome under Linux. The compositionend event emitted by Chrome
contains no data, so the input character can't be detected.
Previous implementation was using the element type (span or div) to
determine if the element was a handle or caret. This is problematic if
additional elements are placed inside the cursor node (as necessary for
proper IME support)
Current behaviour:
Left click causes navigation in both edit and view mode
After the change:
Same as current behaviour in view mode.
In edit mode, left click will just move the cursor to desired position. In order to navigate, user need to hold control key and then click
Adds an SVG overlay that takes no pointer-events,
and uses a polygon element inside to it draw
selections with stroke and fill of the user's
color.
Removes the 3 divs used previously.
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.
The recent shadow cursor implementation hides the native browser selection
highlights. However, the shadow cursor itself only starts being drawn
after edit-mode is enabled, meaning for a readonly document the selection
is invisible (#119)
This is a simple workaround that allows the native selection to be drawn
in circumstances where the shadow cursor is not active. Long term, the
shadow cursor should be also used on non-editable documents as detailed
in solution ideas for #119.