mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 16:20:52 +00:00
Fix conversion of byte to grapheme offsets/lengths
Missed one case in ve.ce.Docuemnt#getNodeAndOffset. Bug: 49246 Change-Id: Iff1dfb90130685bb710821f8386cfa2f296f2f95
This commit is contained in:
parent
8039b1c2f8
commit
348d2355c6
|
@ -1,5 +1,5 @@
|
|||
<p>12𨋢456789𨋢bc</p>
|
||||
<p>「𨋢」字響<tt>香港</tt>衍生出好多新詞,好似:𨋢</p>
|
||||
<p>「𨋢」字響<tt>香港</tt>衍生出好多新詞,好似:𨋢<tt>香港</tt> abc</p>
|
||||
<p>abc</p>
|
||||
<p>one c̀ombining accent</p>
|
||||
<p>two ç̀ombining accents</p>
|
||||
|
|
|
@ -146,7 +146,8 @@ ve.ce.Document.prototype.getNodeAndOffset = function ( offset ) {
|
|||
}
|
||||
item = current[0][current[1]];
|
||||
if ( item.nodeType === Node.TEXT_NODE ) {
|
||||
length = item.textContent.length;
|
||||
// offset, startOffset and length are all data model lengths (not byte lengths)
|
||||
length = ve.getClusterOffset( item.textContent, item.textContent.length );
|
||||
if ( offset >= startOffset && offset <= startOffset + length ) {
|
||||
return {
|
||||
node: item,
|
||||
|
|
Loading…
Reference in a new issue