Skip to content

Commit

Permalink
Added a fix for wrong scope in widgetDefinition#upcast.
Browse files Browse the repository at this point in the history
This should be extracted to a separate issue.
  • Loading branch information
mlewand committed Oct 25, 2017
1 parent 08ac6e6 commit 6232b54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/widget/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1967,15 +1967,15 @@
if ( typeof upcast == 'string' ) {
upcasts = upcast.split( ',' );
while ( upcasts.length ) {
addUpcast( widgetDef.upcasts[ upcasts.pop() ], widgetDef.name, priority );
addUpcast( widgetDef.upcasts[ upcasts.pop() ], widgetDef, priority );
}
}
// Single rule which is automatically activated.
else {
addUpcast( upcast, widgetDef.name, priority );
addUpcast( upcast, widgetDef, priority );
}

function addUpcast( upcast, name, priority ) {
function addUpcast( upcast, def, priority ) {
// Find index of the first higher (in terms of value) priority upcast.
var index = CKEDITOR.tools.getIndex( widgetsRepo._.upcasts, function( element ) {
return element[ 2 ] > priority;
Expand All @@ -1985,7 +1985,7 @@
index = widgetsRepo._.upcasts.length;
}

widgetsRepo._.upcasts.splice( index, 0, [ upcast, name, priority ] );
widgetsRepo._.upcasts.splice( index, 0, [ CKEDITOR.tools.bind( upcast, def ), def.name, priority ] );
}
}

Expand Down

0 comments on commit 6232b54

Please sign in to comment.