目前我有一个使用 TinyMCE 的文本区域:http://fiddle.tinymce.com/D2gaab
我想突出显示左大括号/右大括号之间的文本。有人知道这是否可行,以及我该如何做到这一点?
最佳答案
您可以考虑插入 <mark>
标签或其他具有内联样式的元素。另外,也许仅在选择具有任意长度时才插入。
editor.addButton('spintax', {
text: 'Spintax',
icon: false,
onclick: function () {
editor.focus();
if (editor.selection.getContent().length) {
editor.selection.setContent("{<mark>" + editor.selection.getContent() + '</mark>}');
}
}
});
关于javascript - 使用 TinyMCE 突出显示文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52976156/