Log in or register to post comments
Last post
Using block element as inline
Is it possible to use block element H1 as inline element (as span for example) in CKEditor?

I have tried to do like this, but it does't work:

CKEDITOR.on('instanceReady',
   function(ev)
   {
      // transform block element to inline
      ev.sender.dtd['p']['h1'] = 1
      ev.sender.dtd.$block['h1'] = 0;
      ev.sender.dtd.$inline['h1'] = 1;
      ev.sender.dtd.$body['h1'] = 0;
      var dtd = CKEDITOR.dtd;
      dtd['p']['h1'] = 1
      dtd.$block['h1'] = 0;
      dtd.$inline['h1'] = 1;
      dtd.$body['h1'] = 0;      
   }
);
Re: Using block element as inline
It may be possible after changing DTD, but I know that there are hardcoded elements list in some places and you'd have to change them too.

If you want to do this you should modify CKEDITOR.DTD object before initializing editor, not on instanceReady (which is fired after that). Also - don't reset values by assigning "0" - just use delete, so "x in DTD" won't be broken. And the last thing - changing DTD may still not be enough, because in some place we're checking also elements styles, to check whether it's inline or block.

Anyway - you're trying to do something very unusual and much probably wasting your time ;).

Piotrek Koszuliński (aka Reinmar)
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+