Hi, I have a widget that has many fields and I want them to be editable:
<div class="widget-fields">
<div class="fields-label">label 1</div>
<div class="fields-label">label 2</div>
.......
<div class="fields-label">label xyz</div>
</div>
I used the following code in my widget plugin.js:
editables: {
label: {
selector: '.fields-label',
allowedContent: 'br strong em'
},
},
but only the first field "label 1" is editable, how can I achive that all fields can be edited? The number of fields may vary...
I'd also like to know how to
I'd also like to know how to initialize multiple editables that have the same selector. From the source it seems like the problem is that the initEditable method uses findOne instead of using find and iterating through the results.
Is there a technical reason for this limitation, or is it an oversight?
I'm not certain how to work around it- do I need to create unique fake classes for each editable instance?
I'm currently doing this in a
I'm currently doing this in a really hacky way, by manually enumerating the multiple elements and using :nth-of-type pseudo selectors. But there's got to be a better way, right?
I'd really appreciate an answer about why initEditable is limited by just doing findOne().
I think that the reason was
I think that the reason was KISS. It would make things a lot more complex if we tried to initialise more than one editable when only one name for it was defined (in your case "label" is the name). Those names are used in the DOM so we are able to get the editable instance when traversing the tree on many stages (custom nodes data could not be used in the data processor), so editables are also available from the widget instance - widget.editables.label. So if we allowed multiple editables of the same name we would need to use arrays there, what's of course doable but would require significantly more work.
Anyways, this is a valid feature request, because we know that it's expected that multiple editables are supported. Though, I cannot guarantee any ETA.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
I created a ticket on the
I created a ticket on the issue tracker.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+