我正在使用 TinyMCE 进行文本格式化。我有如下 HTML 代码:
<span class="ps_bonus_text_wide_t" style="font-family: Michroma;">
my text
</span>
当我选择该文本并且class="ps_bonus_text_wide_t"
我需要将其更改为
<div class="effect">
<span class="ps_bonus_text_wide_t" style="font-family: Michroma;">
my text
</span>
</div>
我该如何验证class="ps_bonus_text_wide_t"
?
我的插件代码是:
// Creates a new plugin class and a custom listbox
tinymce.create('tinymce.plugins.fonteffect', {
createControl: function(n, cm) {
switch (n) {
case 'fonteffect':
var mlb = cm.createListBox('fonteffect', {
title : 'Font effects',
onselect : function(v) {
// n.selection.setContent(v);
var ed=this.control_manager.editor;
ed.focus();
//to do something here
}
});
// Add some values to the list box
mlb.add('anaglyph', 'anaglyph');
mlb.add('brick-sign', 'brick-sign');
mlb.add('canvas-print', 'canvas-print');
mlb.add('crackle', 'crackle');
mlb.add('decaying', 'decaying');
mlb.add('destruction', 'destruction');
// Return the new listbox instance
return mlb;
}
return null;
}
});