execCommand requested twice custom plugin definition

34 views
Skip to first unread message

J. Manuel Velasco

unread,
Jul 28, 2016, 2:35:33 PM7/28/16
to cleditor
Hello,

I have wrote a plugin to render <strong></strong> around the selected text.

https://gist.github.com/anonymous/73164de6b36a22e865b10099825fefc5

When I press on the custom button I see the execCommand is requested twice and the second one the parameters are different from the call I do from the plugin, so the result is (null) added to the selected word.

Debug of the first call:
Object { options={...}, $area={...}, $main={...}, more...} inserthtml <strong>gerqg</strong> null <div class="cleditorButton" title="Strong" style="background-image: url("cleditor/images/strong.jpg"); background-color: rgb(255, 255, 255);">

Unknown call following which adds "null" to the selected text:



How can I avoid this double call ?



Thanks in advance.

J. Manuel Velasco

unread,
Jul 28, 2016, 3:33:35 PM7/28/16
to cleditor

The only way i see to avoid this double request of the execCommadn function is modifying the core script becasue the seocnd time the value is undefined, so I return false on that case.

I don't like this solution becasue it breaks the core cleditor, well not breask but I wonder if I can do it without modifying the code.

Any cl -guru aorund know how to fix it withoup tocuh the cleditr js core script ?

I'll appreciate to know. Thanks

J. Manuel Velasco

unread,
Jul 29, 2016, 11:29:39 PM7/29/16
to cleditor
That breaks the functionality of other buttons, I can't find the way to create a plugin without popup. Is that possible?

Reply all
Reply to author
Forward
0 new messages