I am working on a custom widget. I have everything set up so far, a button in the editor that opens a dialog with a textarea that produces a "widget" with editables.
How do I get the data from the textarea and *INSERT IT INTO* the template!?
Can somebody please help me? I have been searching for days for an answer to this, and cannot find anything mentioned *anywhere*...
The widgets tutorial only covers how to change the style of the *widget itself* and not alter the template in any way.
CKEditor 4 - How to set a widget template to data in a dialog bo
Well, after so many hours of scouring the web and reading the code of other plugins, plus implementing a few of the tricks shown in the Widgets tutorials in the documentation, I have finally succeeded in creating a widget that actually changes the contents of a template!
I am turning the "Youtube" plugin into a widget so it can be moved by the user, and then edited after it's been instantiated:
plugin.js -
Now for the dialog code, found in the /youtube-widget/dialogs/youtube-widget.js file:
Feel free to point out what I'm doing wrong, or if any of this code is stupid. Ha!
Thanks to fonini for the great YouTube plugin!
(fonini - http://ckeditor.com/users/fonini)
(Youtube plugin - http://ckeditor.com/addon/youtube)
For the googlers:
CKEditor 4 - How to set widget template to data in a textbox within a custom dialog box
I created a dialog, now what?
Custom widgets and dialogs explained
Help with creating custom widgets in CKEditor 4
(Disclaimer - this is not the complete script of the YouTube plugin/widget. I only included the parts that are necessary for reading data from an input within a custom dialog and using them within the widget that gets output to the editor. I will try to contact fonini to see if he wants to update the plugin with this code. I do not own, nor did I write the YouTube plugin, just trying to change it to suit our purposes.)
Thanks. We've taken note of
Thanks. We've taken note of your remarks.
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
Quick question... when I hit
Quick question... when I hit the "<> source" button in the toolbar, and then click it again to go back to design view mode, my
replaces itself with "undefined". Is there a better way to prevent this other than to check !typeof this.data.youtubeVideo !== 'undefined'"?
Why would the "data()" function fire when going between the two views? Should I be doing the following somewhere else?
Thanks for your attention to this matter.