|
1 | 1 | import { buildLineContent } from "../line/line_data.js" |
2 | 2 | import { lineNumberFor } from "../line/utils_line.js" |
3 | 3 | import { ie, ie_version } from "../util/browser.js" |
4 | | -import { elt } from "../util/dom.js" |
| 4 | +import { elt, classTest } from "../util/dom.js" |
5 | 5 | import { signalLater } from "../util/operation_group.js" |
6 | 6 |
|
7 | 7 | // When an aspect of a line changes, a string is added to |
@@ -124,10 +124,10 @@ function updateLineGutter(cm, lineView, lineN, dims) { |
124 | 124 |
|
125 | 125 | function updateLineWidgets(cm, lineView, dims) { |
126 | 126 | if (lineView.alignable) lineView.alignable = null |
| 127 | + let isWidget = classTest("CodeMirror-linewidget") |
127 | 128 | for (let node = lineView.node.firstChild, next; node; node = next) { |
128 | 129 | next = node.nextSibling |
129 | | - if (node.className == "CodeMirror-linewidget") |
130 | | - lineView.node.removeChild(node) |
| 130 | + if (isWidget.test(node)) lineView.node.removeChild(node) |
131 | 131 | } |
132 | 132 | insertLineWidgets(cm, lineView, dims) |
133 | 133 | } |
@@ -157,7 +157,7 @@ function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) { |
157 | 157 | if (!line.widgets) return |
158 | 158 | let wrap = ensureLineWrapped(lineView) |
159 | 159 | for (let i = 0, ws = line.widgets; i < ws.length; ++i) { |
160 | | - let widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget") |
| 160 | + let widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget" + (widget.className ? " " + widget.className : "")) |
161 | 161 | if (!widget.handleMouseEvents) node.setAttribute("cm-ignore-events", "true") |
162 | 162 | positionLineWidget(widget, node, lineView, dims) |
163 | 163 | cm.display.input.setUneditable(node) |
|
0 commit comments