我的 tinymce 編輯器是動態初始化的:
wp.editor.initialize(jQuery(this).attr('id'), {
mode : "exact",
tinymce: {
wpautop: true,
plugins : 'charmap colorpicker hr lists paste tabfocus textcolor fullscreen wordpress wpautoresize wpeditimage wpemoji wpgallery wplink wptextpattern',
toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,wp_more,spellchecker,fullscreen,wp_adv,listbuttons',
toolbar2: 'styleselect,strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help',
textarea_rows : 20
},
quicktags: {buttons: 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close'},
mediaButtons: true,
});
一切都很好,除了當我試圖獲取內容時:
tinymce.editors[ xxxx ].getContent();
所以 tinymce 有兩個選項卡,“visual”和“html”選項卡。上面那行回傳輸入到 VISUAL 選項卡中的文本,但如果我更改為 HTML 選項卡并修改文本,它仍然顯示 VISUAL 選項卡!如何解決?
uj5u.com熱心網友回復:
如果您使用的是 WordPress,則“HTML”選項卡實際上根本沒有使用 TinyMCE,這就是嘗試使用 TinyMCE API 獲取資料失敗的原因。
在 Visual 和 HTML 選項卡之間切換是加載/洗掉 TinyMCE,這就是為什么您的 API 呼叫在可視模式下作業(TinyMCE 已加載)而不是在 HTML 中(TinyMCE 未加載)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/537090.html
標籤:WordPress的微信
