在编辑器可视化模式下,在短码标签后强制换行



在下面的函数中,我在第1列短代码的末尾添加了一个"n"字符串,但是它在tinyMCE可视化编辑器中不起作用。我希望用换行符将短代码分隔到它们自己的行上(仅在编辑时,我不是指在活动站点上处理过的短代码)

我怎么能强迫它没有添加一个实际的html <br><p>标签那里?

function tinyMCEshortcode() {
    var tagtext;
    var customid = getCheckedValue(document.getElementsByName('customstyle'));
        if (customid != 0 ){
            tagtext = "["+ customid + "]Insert Your Text Here[/" + customid + "]";
        }
        if (customid != 0 && customid == 'two_columns' ){
            tagtext = "["+ customid + "_1]<p>Content 1 Here</p>[/" + customid + "_1]" + "n";
            tagtext += "["+ customid + "_2]<p>Content 2 Here</p>[/" + customid + "_2]";
        }
    if(window.tinyMCE) {
        window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, '<p>'+tagtext+'</p>');
        //Peforms a clean up of the current editor HTML.
        //tinyMCEPopup.editor.execCommand('mceCleanup');
        //Repaints the editor. Sometimes the browser has graphic glitches.
        tinyMCEPopup.editor.execCommand('mceRepaint');
        tinyMCEPopup.close();
    }
    return;
}

由于tinyMCE内容在HTML中,因此不会有任何视觉效果。这就像你在你的网页上编辑一个页面,然后在某个地方插入"n"一样。HTML忽略了这一点,您需要插入<br>标记-没有其他方法。

最新更新