使用 TinyMCE 突出显示文本 [英] Highlight text with TinyMCE
本文介绍了使用 TinyMCE 突出显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前我有一个使用 TinyMCE 的文本区域:http://fiddle.tinymce.com/D2gaab
Currently I have a textarea using TinyMCE: http://fiddle.tinymce.com/D2gaab
我想突出显示左/右大括号之间的文本.有人知道这是否可行,我该怎么做?
I want to highlight the text between the opening/closing braces. Does someone know if this is possible, and how I can do this?
推荐答案
您可以考虑插入 标签,或其他具有内联样式的元素.另外,也许只有在选择有任何长度时才插入.
You could consider inserting a <mark>
tag, or another element with inline styling. Also, maybe only insert when the selection has any length.
editor.addButton('spintax', {
text: 'Spintax',
icon: false,
onclick: function () {
editor.focus();
if (editor.selection.getContent().length) {
editor.selection.setContent("{<mark>" + editor.selection.getContent() + '</mark>}');
}
}
});
http://fiddle.tinymce.com/E2gaab
这篇关于使用 TinyMCE 突出显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文