I was wondering if anyone kn开发者_开发百科ew if there was a toolbar config name you could add to ckeditor that gave you buttons to wrap content in heading tags?
Just like the bold button for example, highlight the word and click 'h1' or 'h2'?
I've looked in the docs but I cant seem to find a comprehensive list of all the possible toolbar buttons.
I think the following will work (hope I havent missed any lines):
var editor = CKEDITOR.instances.editor1;
var selection = editor.getSelection();
var iterator = range.createIterator(),block;
var paragraphs = [];
while ( ( block = iterator.getNextParagraph() ) )
paragraphs.push( block );
var bqBlock = editor.document.createElement( 'div');
bqBlock.setAttribute('style','background-color:#BBBBFF');
bqBlock.setAttribute('id','my_new_div_tag');
bqBlock.insertBefore( paragraphs[0] );
while ( paragraphs.length > 0 )
{
block = paragraphs.shift();
bqBlock.append( block );
}
I realise this is probably not an issue for you anymore, but maybe helpful for anyone else - or if someone can suggest a more streamline solution, it would be welcomed.
精彩评论