我正在尝试编写一些插件按钮,这些按钮会在WordPress TinyMce编辑器中生成一些插件。
除了代码之外,一切都有100%的效果:
[accordion_wrap] [accordions]This is where some content goes..[/accordions] [accordions]This is where some content goes..[/accordions] [accordions]This is where some content goes..[/accordions] [/accordion_wrap]
而不是看起来像这样
[accordion_wrap]
[accordions]This is where some content goes...[/accordions]
[accordions]This is where some content goes...[/accordions]
[accordions]This is where some content goes...[/accordions]
[/accordion_wrap]
我这样做的代码如下:
if(p == 'Accordions'){
content = '[accordion_wrap]'+'\n'+'[accordions]This is where some content goes...[/accordions]'+'\n'+'[accordions]This is where some content goes...[/accordions]'+'\n'+'[accordions]This is where some content goes...[/accordions]'+'\n'+'[/accordion_wrap]';
tinymce.execCommand('mceInsertContent', false, content);
} // end of shortcode
有人能指出我做错了什么。
由于