This is really a question for the CKEditor developers.
I'm assuming there must be a good reason why it is limited to the set of elements that it currently is (defined by CKEditor.dtd.$editable), but I'm going to throw this out there, because I don't think my use case is all that uncommon.
I have the need to allow certain users to create HTML templates, where most of the template is protected from editing by the users of the template, but the template authors can define various areas that can be edited by other users to create a final HTML product. I allow the template authors to specify different types of editable content, where some areas only allow very simple formatting while others allow more extensive things like tables, lists, etc...
I've had to jump through a few hoops to get this working because I needed to dynamically add/remove the contenteditable attributes, and create/destroy the editor instances and remove a bunch of attributes left by the editor on the dom every time I need to retrieve the content, the details of which I will not go into here, however after getting it all working (I thought), I unfortunately overlooked the small but important detail that only certain block elements are actually inline editable). I discovered this when I tried to set a span tag as an inline editable element and it didn't work, which is when I dug into the documentation and found out about the restriction. In fairness, it was in the documentation, so it's my bad for not seeing it.
The problem is I now need to figure out how to handle the case where the user needs to be able to edit a piece of content that is inline, and cannot be defined by a block element. If I could just attach an inline editor to a span tag it would be awesome, but as it is every other solution I can think of either creates a different user experience for editing inline content vs block content, or forces me to use whatever less elegant solution I come up with for editing all content, which probably involves some type of modal dialog and is generally not that appealing.
Before going down a potentially dark and ugly path, I figure I'd throw this out there to the experts to see if you could address why it only supports the block elements it does, and if you have any good suggestions.
In any event, CKEditor is awesome, and I appreciate the great work you guys have done.
Rick
DIV in SPAN:
DIV in SPAN:
Would it work for you with a DIV inside the SPAN?
That is what I did to be able to edit table cells (TDs).
DIV in SPAN will not work in my case.
Thanks, but while that would work in the case of a table cell, it will not solve the case of needing to be able to edit an inline html element. While I could do something like <div style="display: inline">inline content</div>, which works in most browsers, it does not work for html displayed in outlook, and since my primary use case is for creating html emails, this is not a viable option. The limited html/css support in outlook forces the use of some less than optimal html coding to get things to display correctly, which is one reason being able able to allow experienced template builders to create the templates that display correctly on a range of devices is important, and then just allowing normal users to limited ability to modify various content sometimes inline in a controlled manner is important. I do appreciate the suggestion. I thought it might work until I tried it in Outlook.
There's no easy solution
There's no easy solution beside wrapping stuff in <div> and filtering it out. You can always propose new features on the dev site.
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
My workaround for simple text...
It is unfortunate, but understandable that there is not a simple fix. My solution for the moment is to not use the editor at all for simple inline elements like a span, and instead just toggle the contenteditable attribute of those elements on and disable the paste feature, to avoid users pasting a bunch of garbage into those sections, at least until I can figure out a reliable way to let them do a text only paste perhaps with a dialog and a textbox or something. They can only type in text into those sections which I believe is sufficient for now. For all the other elements supported by the editor, I invoke inline editors with custom configs.
I appreciate the response, even if it was no :)
Thanks,
Rick