diff --git a/Resources/public/js/alloyeditor/buttons/embed.js b/Resources/public/js/alloyeditor/buttons/embed.js index 5e71e3c4..2ce7b751 100644 --- a/Resources/public/js/alloyeditor/buttons/embed.js +++ b/Resources/public/js/alloyeditor/buttons/embed.js @@ -75,9 +75,18 @@ YUI.add('ez-alloyeditor-button-embed', function (Y) { */ _addEmbed: function (e) { var contentInfo = e.selection.contentInfo, - widget; + widget, + scrollY; + + if (navigator.userAgent.indexOf('Chrome') > -1) { + // Workaround for https://jira.ez.no/browse/EZP-28078 + scrollY = window.pageYOffset; + this.execCommand(); + window.scroll(window.pageXOffset, scrollY); + } else { + this.execCommand(); + } - this.execCommand(); this._setContentInfo(contentInfo); widget = this._getWidget().setWidgetContent(''); this._fireUpdatedEmbed(e.selection); diff --git a/Resources/public/js/alloyeditor/buttons/embed.jsx b/Resources/public/js/alloyeditor/buttons/embed.jsx index ec111332..e02445f2 100644 --- a/Resources/public/js/alloyeditor/buttons/embed.jsx +++ b/Resources/public/js/alloyeditor/buttons/embed.jsx @@ -70,9 +70,18 @@ YUI.add('ez-alloyeditor-button-embed', function (Y) { */ _addEmbed: function (e) { var contentInfo = e.selection.contentInfo, - widget; + widget, + scrollY; + + if (navigator.userAgent.indexOf('Chrome') > -1) { + // Workaround for https://jira.ez.no/browse/EZP-28078 + scrollY = window.pageYOffset; + this.execCommand(); + window.scroll(window.pageXOffset, scrollY); + } else { + this.execCommand(); + } - this.execCommand(); this._setContentInfo(contentInfo); widget = this._getWidget().setWidgetContent(''); this._fireUpdatedEmbed(e.selection); diff --git a/Resources/public/js/alloyeditor/buttons/image.js b/Resources/public/js/alloyeditor/buttons/image.js index 22650693..897d2021 100644 --- a/Resources/public/js/alloyeditor/buttons/image.js +++ b/Resources/public/js/alloyeditor/buttons/image.js @@ -78,9 +78,18 @@ YUI.add('ez-alloyeditor-button-image', function (Y) { * @protected */ _addImage: function (e) { - var widget; + var widget, + scrollY; + + if (navigator.userAgent.indexOf('Chrome') > -1) { + // Workaround for https://jira.ez.no/browse/EZP-28078 + scrollY = window.pageYOffset; + this.execCommand(); + window.scroll(window.pageXOffset, scrollY); + } else { + this.execCommand(); + } - this.execCommand(); this._setContentInfo(e.selection.contentInfo); widget = this._getWidget() diff --git a/Resources/public/js/alloyeditor/buttons/image.jsx b/Resources/public/js/alloyeditor/buttons/image.jsx index dde9aff7..c2b332ee 100644 --- a/Resources/public/js/alloyeditor/buttons/image.jsx +++ b/Resources/public/js/alloyeditor/buttons/image.jsx @@ -73,9 +73,18 @@ YUI.add('ez-alloyeditor-button-image', function (Y) { * @protected */ _addImage: function (e) { - var widget; + var widget, + scrollY; + + if (navigator.userAgent.indexOf('Chrome') > -1) { + // Workaround for https://jira.ez.no/browse/EZP-28078 + scrollY = window.pageYOffset; + this.execCommand(); + window.scroll(window.pageXOffset, scrollY); + } else { + this.execCommand(); + } - this.execCommand(); this._setContentInfo(e.selection.contentInfo); widget = this._getWidget() diff --git a/Resources/public/js/alloyeditor/buttons/linkedit.js b/Resources/public/js/alloyeditor/buttons/linkedit.js index 11a7b019..f3b789d0 100644 --- a/Resources/public/js/alloyeditor/buttons/linkedit.js +++ b/Resources/public/js/alloyeditor/buttons/linkedit.js @@ -126,9 +126,18 @@ YUI.add('ez-alloyeditor-button-linkedit', function (Y) { * @protected */ _focusEditedLink: function () { - var editor = this.props.editor.get('nativeEditor'); + var editor = this.props.editor.get('nativeEditor'), + scrollY; + + if (navigator.userAgent.indexOf('Chrome') > -1) { + // Workaround for https://jira.ez.no/browse/EZP-28078 + scrollY = window.pageYOffset; + editor.focus(); + window.scroll(window.pageXOffset, scrollY); + } else { + editor.focus(); + } - editor.focus(); editor.eZ.moveCaretToElement(editor, this.state.element); editor.fire('actionPerformed', this); }, diff --git a/Resources/public/js/alloyeditor/buttons/linkedit.jsx b/Resources/public/js/alloyeditor/buttons/linkedit.jsx index 748c839b..769be76a 100644 --- a/Resources/public/js/alloyeditor/buttons/linkedit.jsx +++ b/Resources/public/js/alloyeditor/buttons/linkedit.jsx @@ -121,9 +121,18 @@ YUI.add('ez-alloyeditor-button-linkedit', function (Y) { * @protected */ _focusEditedLink: function () { - var editor = this.props.editor.get('nativeEditor'); + var editor = this.props.editor.get('nativeEditor'), + scrollY; + + if (navigator.userAgent.indexOf('Chrome') > -1) { + // Workaround for https://jira.ez.no/browse/EZP-28078 + scrollY = window.pageYOffset; + editor.focus(); + window.scroll(window.pageXOffset, scrollY); + } else { + editor.focus(); + } - editor.focus(); editor.eZ.moveCaretToElement(editor, this.state.element); editor.fire('actionPerformed', this); },