Hi all!!
I'm making a plugin for CKEditor (v3.5.2) to wrap a selected text into this:
So, how can I make this? Get text from editor.selection and make these hierarchy
I tied with:
But I can't insert this node on anywhere.
I want to make something like:
Somebody can help me?
I hope you can help me, I'm in a hurry
Thanks in advance
Regards Juan Pablo
I'm making a plugin for CKEditor (v3.5.2) to wrap a selected text into this:
<element1> <label>{text selected}</label> <other_element></other_element> <other_element2></other_element2> <other_element3></other_element3> <other_element4></other_element4> ... </element1>
So, how can I make this? Get text from editor.selection and make these hierarchy
I tied with:
var style = new CKEDITOR.style( { element : 'label', attributes : null } ); style.type = CKEDITOR.STYLE_INLINE; style.apply( editor.document );
But I can't insert this node on anywhere.
I want to make something like:
var label = new CKEDITOR.dom.element( 'label', editor.document ); ...{insert in label element the text selected, I CAN'T DO THAT}... var element1 = new CKEDITOR.dom.element( 'element1', editor.document ); element1.append(label); {and the same for the other_element's}
Somebody can help me?
I hope you can help me, I'm in a hurry
Thanks in advance
Regards Juan Pablo
Re: plugin to wrap text with custom element
Thanks for sharing this code!
Thanks for sharing this code!
I was wondering if you could or someone could help me out with the issue I have.
I couldn't get this to work for wrapping text in multiple paragraph.
This is what I would like:
<customelement>
<p>123</p>
<p>456</p>
</customelement>
But instead I got this:
<customelement>
<p>123</p>
</customelement>
<p>456</p>
I am using CKEditor 4.1rc, btw.
Thanks!