首页 > 解决方案 > 将 html 属性添加到生成的 span(使用 mkt.. 类)

问题描述

我正在使用该deltaDecorations方法来装饰一些范围,您可以在其中添加特定的 css 类。但我还需要添加一些<span class="mkt...">由编辑器生成的 html 属性(data-*)。如果可能的话,最好的方法是什么?IIdentifiedSingleEditOperationused inexecuteEdits方法建议替换一个或文本,IRange但没有用于 domNode。

我会尝试 setValueInRange,希望它能解释在那里输入的 html(我可以添加一个新的标签 + 需要的属性),但是https://github.com/microsoft/monaco-editor/issues/874

标签: monaco-editor

解决方案


推荐阅读