TinyMCE按钮U的Wordpress更改功能(下划线) [英] Wordpress change functionality of TinyMCE button U (underline)
本文介绍了TinyMCE按钮U的Wordpress更改功能(下划线)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< span style =text-decoration-line:underline;> ;加下划线的文字< / span>
我需要的是改变此按钮的功能以放入内容:
< u>带下划线的文字< / u>
有人可以帮忙吗?
解决方案
您可以在 init
方法中定义下划线格式后获得此格式。
HTML
< form>
< textarea id ='instance1'>< / textarea>
< / form>
< button id ='get'>测试< /按钮>
< div id ='previewHTML'>< / div>
< div id ='previewFormat'>< / div>
JS
var textArea_id =#instance1;
tinymce.init({
selector:textArea_id,
toolbar:underline,
formats:{
underline:{inline:'u' ,exact:true},
}
});
var button = document.getElementById('get');
button.onclick = function(){
var contentHTML = tinymce.activeEditor.getContent({format:'html'});
document.getElementById('previewHTML')。innerText = contentHTML;
document.getElementById('previewFormat')。innerHTML = contentHTML;
}
请参阅 DEMO
does anybody know how to change functionality of button in wordpress content textarea? There is a "u" button (underline) which makes text
<span style="text-decoration-line: underline;">text underlined</span>
what I need is change functionality of this button to put in content:
<u>text underlined</u>
Can someone help?
解决方案
You can get this formatting once you define the underline format in the init
method.
HTML
<form>
<textarea id='instance1'></textarea>
</form>
<button id='get'>Test</button>
<div id='previewHTML'></div>
<div id='previewFormat'></div>
JS
var textArea_id = "#instance1";
tinymce.init({
selector: textArea_id,
toolbar: "underline",
formats : {
underline : {inline : 'u', exact : true},
}
});
var button = document.getElementById('get');
button.onclick = function(){
var contentHTML = tinymce.activeEditor.getContent({format: 'html'});
document.getElementById('previewHTML').innerText = contentHTML;
document.getElementById('previewFormat').innerHTML = contentHTML;
}
See this DEMO
这篇关于TinyMCE按钮U的Wordpress更改功能(下划线)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文