Skip to content

Commit 0968398

Browse files
committed
Disable bidi trailing/leading whitespace kludge in RTL editor
Since it produces orderings that don't correspond to what the browser does then.
1 parent 9f7ce5a commit 0968398

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/util/bidi.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,15 @@ let bidiOrdering = (function() {
189189
if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i))
190190
}
191191
}
192-
if (order[0].level == 1 && (m = str.match(/^\s+/))) {
193-
order[0].from = m[0].length
194-
order.unshift(new BidiSpan(0, 0, m[0].length))
195-
}
196-
if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
197-
lst(order).to -= m[0].length
198-
order.push(new BidiSpan(0, len - m[0].length, len))
192+
if (direction == "ltr") {
193+
if (order[0].level == 1 && (m = str.match(/^\s+/))) {
194+
order[0].from = m[0].length
195+
order.unshift(new BidiSpan(0, 0, m[0].length))
196+
}
197+
if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
198+
lst(order).to -= m[0].length
199+
order.push(new BidiSpan(0, len - m[0].length, len))
200+
}
199201
}
200202

201203
return direction == "rtl" ? order.reverse() : order

0 commit comments

Comments
 (0)