Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable CKEditor4 inline on span and other inline tags

I'd like to know if it's possible and how to enable the CKEditor4 inline/contenteditable editing feature on <span> and other inline elements. This is something which I cannot find in the official docs.

With this markup:

<span id="editable" contenteditable="true"></span>

And either the standard configuration (AutoInline enabled) or this configuration:

<script>
    CKEDITOR.disableAutoInline = true;
    CKEDITOR.inline('editable'); // ID of the element to edit
</script>

An error is reported: The specified element mode is not supported on element: "span". The same error is reported for <a> tags.

like image 211
mnorrish Avatar asked Jan 29 '13 03:01

mnorrish


2 Answers

Hack way to allow support for un supported tags:

CKEDITOR.dtd.$editable.span = 1
CKEDITOR.dtd.$editable.a = 1

Win.

like image 83
BenO Avatar answered Nov 11 '22 21:11

BenO


Nope. It is not possible to create editor on inline elements. Here you can find list of accepted names.

However, I checked that after modifying that list I was able to initialize editor on strong element and it even works... Unless you paste or do other unsupported action :).

like image 24
Reinmar Avatar answered Nov 11 '22 23:11

Reinmar