2

以下の関数では、列 1 ショートコードの末尾に「\n」文字列を追加しましたが、tinyMCE ビジュアル エディターでは効果がありません。ショートコードを独自の行に区切る改行を期待しています(編集のみで、ライブサイトで処理されたショートコードを参照していません)

<br>そこに実際のhtmlや<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;
}
4

1 に答える 1