MCPcopy Create free account
hub / github.com/TruthHun/BookStack / buildTokenBadBidi

Function buildTokenBadBidi

static/editor.md/lib/codemirror/lib/codemirror.js:6838–6855  ·  view source on GitHub ↗
(inner, order)

Source from the content-addressed store, hash-verified

6836 // Work around nonsense dimensions being reported for stretches of
6837 // right-to-left text.
6838 function buildTokenBadBidi(inner, order) {
6839 return function(builder, text, style, startStyle, endStyle, title) {
6840 style = style ? style + " cm-force-border" : "cm-force-border";
6841 var start = builder.pos, end = start + text.length;
6842 for (;;) {
6843 // Find the part that overlaps with the start of this text
6844 for (var i = 0; i < order.length; i++) {
6845 var part = order[i];
6846 if (part.to > start && part.from <= start) break;
6847 }
6848 if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title);
6849 inner(builder, text.slice(0, part.to - start), style, startStyle, null, title);
6850 startStyle = null;
6851 text = text.slice(part.to - start);
6852 start = part.to;
6853 }
6854 };
6855 }
6856
6857 function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
6858 var widget = !ignoreWidget && marker.widgetNode;

Callers 1

buildLineContentFunction · 0.70

Calls 1

innerFunction · 0.85

Tested by

no test coverage detected