0
var care = MediumEditor.selection.getSelectionStart(editor.options.ownerDocument);
care.after("<b>hi</b>");
回報
<b>hi</b>
你需要
喜
var care = MediumEditor.selection.getSelectionStart(editor.options.ownerDocument);
care.after("<b>hi</b>");
回報
<b>hi</b>
你需要
喜
從docs,使用editor.pasteHtml('<b>hi</b>');
這將HTML代碼粘貼在光標或選擇。
after()
函數返回一個字符串,其中<
和>
表示爲<
和>
。一個簡單的解決方案將是各自的符號來代替這些字符串,像這樣:
var after = '<b>hi</b>';
var html = after
.replace(/</g, '<')
.replace(/>/g, '>');
document.write(html);