diff -u b/core/modules/ckeditor/js/plugins/drupalimage/plugin.es6.js b/core/modules/ckeditor/js/plugins/drupalimage/plugin.es6.js --- b/core/modules/ckeditor/js/plugins/drupalimage/plugin.es6.js +++ b/core/modules/ckeditor/js/plugins/drupalimage/plugin.es6.js @@ -327,16 +327,16 @@ widget.on('data', (event) => { // If a link has been set, move the caret from the previous location // to select the image. - if (this.data.link) { - this.focus(); + if (event.data.link) { + event.focus(); // Adding a link through setData('link') may affect the unlink // button, so refresh the button state to enable/disable it. if (editor.plugins.drupallink) { editor .getCommand('drupalunlink') - .refresh(editor, editor.elementPath(this.element)); + .refresh(editor, editor.elementPath(event.element)); } - } + } }); widget.on('edit', (event) => { diff -u b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js --- b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js @@ -50,8 +50,6 @@ icons: 'drupalimage', hidpi: true, beforeInit: function beforeInit(editor) { - var _this = this; - editor.on('widgetDefinition', function (event) { var widgetDefinition = event.data; @@ -196,11 +194,11 @@ } widget.on('data', function (event) { - if (_this.data.link) { - _this.focus(); + if (event.data.link) { + event.focus(); if (editor.plugins.drupallink) { - editor.getCommand('drupalunlink').refresh(editor, editor.elementPath(_this.element)); + editor.getCommand('drupalunlink').refresh(editor, editor.elementPath(event.element)); } } });