TinyMCE 按钮 U(下划线)的 Wordpress 更改功能
Wordpress change functionality of TinyMCE button U (underline)
有人知道如何更改 wordpress 内容文本区域中按钮的功能吗?有一个 "u" 按钮(下划线),它使文本
<span style="text-decoration-line: underline;">text underlined</span>
我需要的是更改此按钮的功能以放入内容:
<u>text underlined</u>
有人可以帮忙吗?
只要在init
方法中定义下划线格式,就可以得到这种格式。
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;
}
看到这个DEMO
有人知道如何更改 wordpress 内容文本区域中按钮的功能吗?有一个 "u" 按钮(下划线),它使文本
<span style="text-decoration-line: underline;">text underlined</span>
我需要的是更改此按钮的功能以放入内容:
<u>text underlined</u>
有人可以帮忙吗?
只要在init
方法中定义下划线格式,就可以得到这种格式。
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;
}
看到这个DEMO