Skip to content

Commit

Permalink
Merge pull request #5408 from ckeditor/t/3540
Browse files Browse the repository at this point in the history
Populate widget template with startup data
  • Loading branch information
jacekbogdanski authored Feb 6, 2023
2 parents d2e25a5 + def42b5 commit b9a39af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,8 @@
} else if ( widgetDef.template ) {
// ... or create a brand-new widget from template.
var defaults = typeof widgetDef.defaults == 'function' ? widgetDef.defaults() : widgetDef.defaults,
element = CKEDITOR.dom.element.createFromHtml( widgetDef.template.output( defaults ), editor.document ),
templateData = CKEDITOR.tools.object.merge( defaults || {}, commandData && commandData.startupData || {} ),
element = CKEDITOR.dom.element.createFromHtml( widgetDef.template.output( templateData ), editor.document ),
instance,
wrapper = editor.widgets.wrapElement( element, widgetDef.name ),
temp = new CKEDITOR.dom.documentFragment( wrapper.getDocument() );
Expand Down

0 comments on commit b9a39af

Please sign in to comment.