mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 09:26:37 +00:00
Zero-width space to avoid empty annotation cursoring bug
Add zero-width space to make span-like tags non-empty, so that the browser won't merge their cursoring positions with the following character. ve.ce.MWNumberedExternalLinkNode: * Insert U+200B ZERO WIDTH SPACE inside span (before 'a' tag). Bug: T96307 Change-Id: Ib07f732043eae4640e3dcfdc06015bcf8897c7b4
This commit is contained in:
parent
04c737bac3
commit
5ce6faf020
|
@ -23,7 +23,19 @@ ve.ce.MWNumberedExternalLinkNode = function VeCeMWNumberedExternalLinkNode( mode
|
||||||
ve.ce.FocusableNode.call( this );
|
ve.ce.FocusableNode.call( this );
|
||||||
|
|
||||||
// DOM changes
|
// DOM changes
|
||||||
this.$element.addClass( 've-ce-mwNumberedExternalLinkNode' );
|
this.$element
|
||||||
|
// TODO: Test to see whether we can get away with adding unicode-bidi
|
||||||
|
// embed/isolate style on $element. unicode-bidi isolate is more conceptually
|
||||||
|
// correct, but not well supported (e.g. it seems to result in unexpected jumping
|
||||||
|
// on Chromium).
|
||||||
|
.addClass( 've-ce-mwNumberedExternalLinkNode' )
|
||||||
|
// Need some content to make span take up a cursor position, but it must be text
|
||||||
|
// with no directionality, else it can break Chromium cursoring (see
|
||||||
|
// https://code.google.com/p/chromium/issues/detail?id=441056 ). Either a
|
||||||
|
// unicorn-like img tag or the actual apparent link text ("[1]", hitherto shown
|
||||||
|
// with CSS generated content) would fall foul of this bug. Use a zero-width
|
||||||
|
// space so it doesn't change the appearance.
|
||||||
|
.text( '\u200B' );
|
||||||
|
|
||||||
// Add link
|
// Add link
|
||||||
this.$link = $( '<a>' )
|
this.$link = $( '<a>' )
|
||||||
|
|
Loading…
Reference in a new issue