Skip to content

Commit

Permalink
Copied absent CKEDITOR.tools.array.find into local function.
Browse files Browse the repository at this point in the history
  • Loading branch information
engineering-this committed Mar 22, 2019
1 parent 434bd04 commit 145b12b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion plugins/widget/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3891,11 +3891,26 @@
group = styleGroups[ widgetName ][ groupName ];

// Don't push style if it's already stored (#589).
if ( !CKEDITOR.tools.array.find( group, getCompareFn( style ) ) ) {
if ( !find( group, getCompareFn( style ) ) ) {
group.push( style );
}
}

// Copied `CKEDITOR.tools.array` from major branch.
function find( array, fn, thisArg ) {
var length = array.length,
i = 0;

while ( i < length ) {
if ( fn.call( thisArg, array[ i ], i, array ) ) {
return array[ i ];
}
i++;
}

return undefined;
}

function getCompareFn( left ) {
return function( right ) {
return deepCompare( left.getDefinition(), right.getDefinition() );
Expand Down

0 comments on commit 145b12b

Please sign in to comment.