From 40da7b2928af3d8291aded4c52a49473af612dee Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Tue, 15 Nov 2022 22:51:01 +0100 Subject: [PATCH 01/12] fix: Figure widget re-build on alignment change --- src/mediaEditor/plugins/mediaAlignment/helper.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mediaEditor/plugins/mediaAlignment/helper.js b/src/mediaEditor/plugins/mediaAlignment/helper.js index d7d104ac..9da4b3d8 100644 --- a/src/mediaEditor/plugins/mediaAlignment/helper.js +++ b/src/mediaEditor/plugins/mediaAlignment/helper.js @@ -43,12 +43,20 @@ export const positionFloat = function positionFloat(widget, position) { // Update DOM widget.$container.addClass(className); // Update model + const prevClassName = widget.element.attr('class'); if (className) { widget.element.attr('class', className); } else { widget.element.removeAttr('class'); } - + + if ((prevClassName || className.length) && prevClassName !== className) { + if (!className.length) { + widget.element.removeCaption(); + } + // Re-build Figure widget to toggle between inline/block + widget.refresh(widget.$container); + } widget.$original.trigger('contentChange.qti-widget'); }; From c8b6b2cd9b66a089e21254a4310b17f5b0830d15 Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Tue, 15 Nov 2022 22:51:43 +0100 Subject: [PATCH 02/12] fix: add showFigure param in Figcaption panel --- src/figure/FigureStateActive.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/figure/FigureStateActive.js b/src/figure/FigureStateActive.js index 58f658e4..c8532d99 100644 --- a/src/figure/FigureStateActive.js +++ b/src/figure/FigureStateActive.js @@ -102,7 +102,8 @@ const initForm = ({ widget, formElement, formTpl, mediaEditor, togglePlaceholder baseUrl: widget.options.baseUrl || '', src: imageElem.attr('src'), alt: imageElem.attr('alt'), - figcaption: figcaptionElem ? figcaptionElem.body() : '' + figcaption: figcaptionElem ? figcaptionElem.body() : '', + showFigure: widget.element.attr('showFigure') }) ); From f39d0802b000d39d77e1cfb0fcfef20fe3726a1d Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Tue, 15 Nov 2022 23:23:18 +0100 Subject: [PATCH 03/12] fix: add CSS styles to feedback on Figure panel --- scss/inc/_feedback.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scss/inc/_feedback.scss b/scss/inc/_feedback.scss index 3ef7f805..a521c78a 100644 --- a/scss/inc/_feedback.scss +++ b/scss/inc/_feedback.scss @@ -148,3 +148,7 @@ .bg-error { background-color: $errorBgColor; } + +textarea + .feedback-info { + padding: 5px; +} From 475bd622bbca925c0ad0e059e8e5508050134157 Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Wed, 16 Nov 2022 12:55:31 +0100 Subject: [PATCH 04/12] fix: remove caption destroy code --- src/figure/FigureStateActive.js | 3 ++- src/mediaEditor/plugins/mediaAlignment/helper.js | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/figure/FigureStateActive.js b/src/figure/FigureStateActive.js index c8532d99..76f3879e 100644 --- a/src/figure/FigureStateActive.js +++ b/src/figure/FigureStateActive.js @@ -97,13 +97,14 @@ const formCallbacks = ({ widget, formElement, mediaEditor, togglePlaceholder }) const initForm = ({ widget, formElement, formTpl, mediaEditor, togglePlaceholder }) => { const imageElem = getImageElement(widget); const figcaptionElem = getCaptionElement(widget); + const showFigure = widget.element.attr('showFigure'); widget.$form.html( formTpl({ baseUrl: widget.options.baseUrl || '', src: imageElem.attr('src'), alt: imageElem.attr('alt'), figcaption: figcaptionElem ? figcaptionElem.body() : '', - showFigure: widget.element.attr('showFigure') + showFigure: showFigure }) ); diff --git a/src/mediaEditor/plugins/mediaAlignment/helper.js b/src/mediaEditor/plugins/mediaAlignment/helper.js index 9da4b3d8..c402b4fe 100644 --- a/src/mediaEditor/plugins/mediaAlignment/helper.js +++ b/src/mediaEditor/plugins/mediaAlignment/helper.js @@ -51,9 +51,6 @@ export const positionFloat = function positionFloat(widget, position) { } if ((prevClassName || className.length) && prevClassName !== className) { - if (!className.length) { - widget.element.removeCaption(); - } // Re-build Figure widget to toggle between inline/block widget.refresh(widget.$container); } From 7ce1ecb3eeb1e0736a9ce8b5cdc316a7bf59eb5c Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Wed, 16 Nov 2022 19:48:37 +0100 Subject: [PATCH 05/12] fix: rebuild editor on leave Figure --- src/figure/FigureStateActive.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/figure/FigureStateActive.js b/src/figure/FigureStateActive.js index 76f3879e..33b1585c 100644 --- a/src/figure/FigureStateActive.js +++ b/src/figure/FigureStateActive.js @@ -127,7 +127,7 @@ const initForm = ({ widget, formElement, formTpl, mediaEditor, togglePlaceholder ); }; -export default function (stateFactory, ActiveState, formTpl, formElement, inlineHelper) { +export default function (stateFactory, ActiveState, formTpl, formElement, inlineHelper, htmlEditor) { /** * media Editor instance if has been initialized * @type {null} @@ -147,6 +147,7 @@ export default function (stateFactory, ActiveState, formTpl, formElement, inline textareaObserver.unobserve(texareaHTMLElem); } this.widget.$form.empty(); + this.destroyEditor(); } ); @@ -172,5 +173,14 @@ export default function (stateFactory, ActiveState, formTpl, formElement, inline } }; + ImgStateActive.prototype.destroyEditor = function () { + const widget = this.widget; + const $editableContainer = widget.$original.parents('[data-qti-class="_container"]'); + htmlEditor.buildEditor($editableContainer, {}); + _.defer(() => { + htmlEditor.destroyEditor($editableContainer); + }); + }; + return ImgStateActive; } From 640d418003f3d33c9c310d63181d0484632263b8 Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Mon, 21 Nov 2022 15:14:56 +0100 Subject: [PATCH 06/12] fix: refactor function with config param --- src/figure/FigureStateActive.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/figure/FigureStateActive.js b/src/figure/FigureStateActive.js index 33b1585c..06d6424a 100644 --- a/src/figure/FigureStateActive.js +++ b/src/figure/FigureStateActive.js @@ -127,7 +127,18 @@ const initForm = ({ widget, formElement, formTpl, mediaEditor, togglePlaceholder ); }; -export default function (stateFactory, ActiveState, formTpl, formElement, inlineHelper, htmlEditor) { +/** + * + * @param {Object} config + * @param {Object} config.stateFactory + * @param {Object} config.ActiveState + * @param {Object} config.formTpl + * @param {Object} config.formElement + * @param {Object} config.inlineHelper + * @param {Object} config.htmlEditor + * @returns + */ +export default function (config) { /** * media Editor instance if has been initialized * @type {null} @@ -136,8 +147,8 @@ export default function (stateFactory, ActiveState, formTpl, formElement, inline let textareaObserver = null; let texareaHTMLElem = null; - const ImgStateActive = stateFactory.extend( - ActiveState, + const ImgStateActive = config.stateFactory.extend( + config.ActiveState, function () { this.initForm(); }, @@ -154,10 +165,10 @@ export default function (stateFactory, ActiveState, formTpl, formElement, inline ImgStateActive.prototype.initForm = function () { initForm({ widget: this.widget, - formElement, - formTpl, + formElement: config.formElement, + formTpl: config.formTpl, mediaEditor, - togglePlaceholder: inlineHelper.togglePlaceholder + togglePlaceholder: config.inlineHelper.togglePlaceholder }); const figurelem = this.widget.element; const $texarea = this.widget.$form.find('textarea#figcaption'); @@ -176,11 +187,11 @@ export default function (stateFactory, ActiveState, formTpl, formElement, inline ImgStateActive.prototype.destroyEditor = function () { const widget = this.widget; const $editableContainer = widget.$original.parents('[data-qti-class="_container"]'); - htmlEditor.buildEditor($editableContainer, {}); + config.htmlEditor.buildEditor($editableContainer, {}); _.defer(() => { - htmlEditor.destroyEditor($editableContainer); + config.htmlEditor.destroyEditor($editableContainer); }); - }; + }; return ImgStateActive; } From 52d7e92beff003456df9e487fbf8b7e88a37839e Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Tue, 22 Nov 2022 11:30:38 +0100 Subject: [PATCH 07/12] fix: remove unnecesary check --- src/mediaEditor/plugins/mediaAlignment/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mediaEditor/plugins/mediaAlignment/helper.js b/src/mediaEditor/plugins/mediaAlignment/helper.js index c402b4fe..35bd7811 100644 --- a/src/mediaEditor/plugins/mediaAlignment/helper.js +++ b/src/mediaEditor/plugins/mediaAlignment/helper.js @@ -50,7 +50,7 @@ export const positionFloat = function positionFloat(widget, position) { widget.element.removeAttr('class'); } - if ((prevClassName || className.length) && prevClassName !== className) { + if ((prevClassName || className) && prevClassName !== className) { // Re-build Figure widget to toggle between inline/block widget.refresh(widget.$container); } From fdcc7bb4f19afe1f6a3b1273d5eed1a39856395f Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Tue, 22 Nov 2022 11:31:17 +0100 Subject: [PATCH 08/12] fix: set config data to improve redeability --- src/figure/FigureStateActive.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/figure/FigureStateActive.js b/src/figure/FigureStateActive.js index 06d6424a..3e893f14 100644 --- a/src/figure/FigureStateActive.js +++ b/src/figure/FigureStateActive.js @@ -128,17 +128,15 @@ const initForm = ({ widget, formElement, formTpl, mediaEditor, togglePlaceholder }; /** - * - * @param {Object} config - * @param {Object} config.stateFactory - * @param {Object} config.ActiveState - * @param {Object} config.formTpl - * @param {Object} config.formElement - * @param {Object} config.inlineHelper - * @param {Object} config.htmlEditor + * @param {Object} stateFactory + * @param {Object} ActiveState + * @param {Object} formTpl + * @param {Object} formElement + * @param {Object} inlineHelper + * @param {Object} htmlEditor * @returns */ -export default function (config) { +export default function ({ stateFactory, ActiveState, formTpl, formElement, inlineHelper, htmlEditor }) { /** * media Editor instance if has been initialized * @type {null} @@ -147,8 +145,8 @@ export default function (config) { let textareaObserver = null; let texareaHTMLElem = null; - const ImgStateActive = config.stateFactory.extend( - config.ActiveState, + const ImgStateActive = stateFactory.extend( + ActiveState, function () { this.initForm(); }, @@ -165,10 +163,10 @@ export default function (config) { ImgStateActive.prototype.initForm = function () { initForm({ widget: this.widget, - formElement: config.formElement, - formTpl: config.formTpl, + formElement, + formTpl, mediaEditor, - togglePlaceholder: config.inlineHelper.togglePlaceholder + togglePlaceholder: inlineHelper.togglePlaceholder }); const figurelem = this.widget.element; const $texarea = this.widget.$form.find('textarea#figcaption'); @@ -187,9 +185,9 @@ export default function (config) { ImgStateActive.prototype.destroyEditor = function () { const widget = this.widget; const $editableContainer = widget.$original.parents('[data-qti-class="_container"]'); - config.htmlEditor.buildEditor($editableContainer, {}); + htmlEditor.buildEditor($editableContainer, {}); _.defer(() => { - config.htmlEditor.destroyEditor($editableContainer); + htmlEditor.destroyEditor($editableContainer); }); }; From 22d9c24d555d0bedc90e7ff980dd1c9e2976c879 Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Wed, 23 Nov 2022 15:07:08 +0100 Subject: [PATCH 09/12] fix: move the parent rebuild to the change scope --- src/figure/FigureStateActive.js | 13 +------ .../plugins/mediaAlignment/helper.js | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/figure/FigureStateActive.js b/src/figure/FigureStateActive.js index 3e893f14..2e601cb9 100644 --- a/src/figure/FigureStateActive.js +++ b/src/figure/FigureStateActive.js @@ -133,10 +133,9 @@ const initForm = ({ widget, formElement, formTpl, mediaEditor, togglePlaceholder * @param {Object} formTpl * @param {Object} formElement * @param {Object} inlineHelper - * @param {Object} htmlEditor * @returns */ -export default function ({ stateFactory, ActiveState, formTpl, formElement, inlineHelper, htmlEditor }) { +export default function ({ stateFactory, ActiveState, formTpl, formElement, inlineHelper }) { /** * media Editor instance if has been initialized * @type {null} @@ -156,7 +155,6 @@ export default function ({ stateFactory, ActiveState, formTpl, formElement, inli textareaObserver.unobserve(texareaHTMLElem); } this.widget.$form.empty(); - this.destroyEditor(); } ); @@ -182,14 +180,5 @@ export default function ({ stateFactory, ActiveState, formTpl, formElement, inli } }; - ImgStateActive.prototype.destroyEditor = function () { - const widget = this.widget; - const $editableContainer = widget.$original.parents('[data-qti-class="_container"]'); - htmlEditor.buildEditor($editableContainer, {}); - _.defer(() => { - htmlEditor.destroyEditor($editableContainer); - }); - }; - return ImgStateActive; } diff --git a/src/mediaEditor/plugins/mediaAlignment/helper.js b/src/mediaEditor/plugins/mediaAlignment/helper.js index 35bd7811..bed12b81 100644 --- a/src/mediaEditor/plugins/mediaAlignment/helper.js +++ b/src/mediaEditor/plugins/mediaAlignment/helper.js @@ -15,10 +15,39 @@ * * Copyright (c) 2021-2022 (original work) Open Assessment Technologies SA; */ +import _ from 'lodash'; +import htmlEditor from 'taoQtiItem/qtiCreator/editor/ckEditor/htmlEditor'; export const FLOAT_LEFT_CLASS = 'wrap-left'; export const FLOAT_RIGHT_CLASS = 'wrap-right'; +/** + * + * @param {Object} parentElement + * @param {string} serial + * @returns {Object} + */ +const searchRecurse = (parentElement, serial) => { + if (!parentElement) { + return null; + } + if (parentElement.serial === serial) { + return parentElement; + } + let found = null; + _.some(parentElement['elements'], childElement => { + if (childElement.serial === serial) { + found = parentElement; + } else if (childElement['elements']) { + found = searchRecurse(childElement, serial); + } + if (found) { + return true; + } + }); + return found; +}; + export const positionFloat = function positionFloat(widget, position) { if (!position) { return; @@ -53,6 +82,16 @@ export const positionFloat = function positionFloat(widget, position) { if ((prevClassName || className) && prevClassName !== className) { // Re-build Figure widget to toggle between inline/block widget.refresh(widget.$container); + if (widget.element.rootElement.bdy) { + const parent = searchRecurse(widget.element.rootElement.bdy, widget.element.serial); + if (parent) { + htmlEditor.buildEditor(parent.metaData.widget.$container, {}); + _.defer(() => { + htmlEditor.destroyEditor(parent.metaData.widget.$container); + widget.refresh(widget.$container); + }); + } + } } widget.$original.trigger('contentChange.qti-widget'); }; From f4b37a4bd811b00dbf698898a6bbac178cc9f9dd Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Wed, 23 Nov 2022 16:08:07 +0100 Subject: [PATCH 10/12] fix: refactor the library location --- src/figure/FigureStateActive.js | 10 ++++- .../plugins/mediaAlignment/helper.js | 39 +------------------ 2 files changed, 10 insertions(+), 39 deletions(-) diff --git a/src/figure/FigureStateActive.js b/src/figure/FigureStateActive.js index 2e601cb9..82e082cc 100644 --- a/src/figure/FigureStateActive.js +++ b/src/figure/FigureStateActive.js @@ -133,9 +133,10 @@ const initForm = ({ widget, formElement, formTpl, mediaEditor, togglePlaceholder * @param {Object} formTpl * @param {Object} formElement * @param {Object} inlineHelper + * @param {Object} htmlEditor * @returns */ -export default function ({ stateFactory, ActiveState, formTpl, formElement, inlineHelper }) { +export default function ({ stateFactory, ActiveState, formTpl, formElement, inlineHelper, htmlEditor }) { /** * media Editor instance if has been initialized * @type {null} @@ -148,6 +149,13 @@ export default function ({ stateFactory, ActiveState, formTpl, formElement, inli ActiveState, function () { this.initForm(); + $(document).on('positionChange.qti-widget', () => { + const $editableContainer = this.widget.$original.parents('[data-qti-class="_container"]'); + htmlEditor.buildEditor($editableContainer, {}); + _.defer(() => { + htmlEditor.destroyEditor($editableContainer); + }); + }); }, function () { this.widget.$form.find('textarea#figcaption').off('.qti-widget'); diff --git a/src/mediaEditor/plugins/mediaAlignment/helper.js b/src/mediaEditor/plugins/mediaAlignment/helper.js index bed12b81..eaa3a15d 100644 --- a/src/mediaEditor/plugins/mediaAlignment/helper.js +++ b/src/mediaEditor/plugins/mediaAlignment/helper.js @@ -16,38 +16,10 @@ * Copyright (c) 2021-2022 (original work) Open Assessment Technologies SA; */ import _ from 'lodash'; -import htmlEditor from 'taoQtiItem/qtiCreator/editor/ckEditor/htmlEditor'; export const FLOAT_LEFT_CLASS = 'wrap-left'; export const FLOAT_RIGHT_CLASS = 'wrap-right'; -/** - * - * @param {Object} parentElement - * @param {string} serial - * @returns {Object} - */ -const searchRecurse = (parentElement, serial) => { - if (!parentElement) { - return null; - } - if (parentElement.serial === serial) { - return parentElement; - } - let found = null; - _.some(parentElement['elements'], childElement => { - if (childElement.serial === serial) { - found = parentElement; - } else if (childElement['elements']) { - found = searchRecurse(childElement, serial); - } - if (found) { - return true; - } - }); - return found; -}; - export const positionFloat = function positionFloat(widget, position) { if (!position) { return; @@ -82,16 +54,7 @@ export const positionFloat = function positionFloat(widget, position) { if ((prevClassName || className) && prevClassName !== className) { // Re-build Figure widget to toggle between inline/block widget.refresh(widget.$container); - if (widget.element.rootElement.bdy) { - const parent = searchRecurse(widget.element.rootElement.bdy, widget.element.serial); - if (parent) { - htmlEditor.buildEditor(parent.metaData.widget.$container, {}); - _.defer(() => { - htmlEditor.destroyEditor(parent.metaData.widget.$container); - widget.refresh(widget.$container); - }); - } - } + $(document).trigger('positionChange.qti-widget'); } widget.$original.trigger('contentChange.qti-widget'); }; From 9b2b2d6bf836e5994704f3274d7f2cb505d5fcba Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Thu, 24 Nov 2022 19:33:15 +0100 Subject: [PATCH 11/12] fix: refactor rebuild editor --- src/figure/FigureStateActive.js | 20 +++----- .../plugins/mediaAlignment/helper.js | 48 +++++++++++++++++-- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/src/figure/FigureStateActive.js b/src/figure/FigureStateActive.js index 82e082cc..46415494 100644 --- a/src/figure/FigureStateActive.js +++ b/src/figure/FigureStateActive.js @@ -131,12 +131,11 @@ const initForm = ({ widget, formElement, formTpl, mediaEditor, togglePlaceholder * @param {Object} stateFactory * @param {Object} ActiveState * @param {Object} formTpl - * @param {Object} formElement + * @param {Object} formElement * @param {Object} inlineHelper - * @param {Object} htmlEditor - * @returns + * @returns */ -export default function ({ stateFactory, ActiveState, formTpl, formElement, inlineHelper, htmlEditor }) { +export default function ({ stateFactory, ActiveState, formTpl, formElement, inlineHelper }) { /** * media Editor instance if has been initialized * @type {null} @@ -145,17 +144,10 @@ export default function ({ stateFactory, ActiveState, formTpl, formElement, inli let textareaObserver = null; let texareaHTMLElem = null; - const ImgStateActive = stateFactory.extend( + const FigureStateActive = stateFactory.extend( ActiveState, function () { this.initForm(); - $(document).on('positionChange.qti-widget', () => { - const $editableContainer = this.widget.$original.parents('[data-qti-class="_container"]'); - htmlEditor.buildEditor($editableContainer, {}); - _.defer(() => { - htmlEditor.destroyEditor($editableContainer); - }); - }); }, function () { this.widget.$form.find('textarea#figcaption').off('.qti-widget'); @@ -166,7 +158,7 @@ export default function ({ stateFactory, ActiveState, formTpl, formElement, inli } ); - ImgStateActive.prototype.initForm = function () { + FigureStateActive.prototype.initForm = function () { initForm({ widget: this.widget, formElement, @@ -188,5 +180,5 @@ export default function ({ stateFactory, ActiveState, formTpl, formElement, inli } }; - return ImgStateActive; + return FigureStateActive; } diff --git a/src/mediaEditor/plugins/mediaAlignment/helper.js b/src/mediaEditor/plugins/mediaAlignment/helper.js index eaa3a15d..81298f6a 100644 --- a/src/mediaEditor/plugins/mediaAlignment/helper.js +++ b/src/mediaEditor/plugins/mediaAlignment/helper.js @@ -20,6 +20,29 @@ import _ from 'lodash'; export const FLOAT_LEFT_CLASS = 'wrap-left'; export const FLOAT_RIGHT_CLASS = 'wrap-right'; +const searchRecurse = (parentElement, serial) => { + if (!parentElement) { + return null; + } + if (parentElement.serial === serial) { + return parentElement; + } + let found = null; + _.some(parentElement['elements'], childElement => { + if (childElement.serial === serial) { + found = parentElement; + } else if (childElement['elements']) { + found = searchRecurse(childElement, serial); + } else if (childElement['prompt']) { + found = searchRecurse(childElement.prompt.bdy, serial); + } + if (found) { + return true; + } + }); + return found; +}; + export const positionFloat = function positionFloat(widget, position) { if (!position) { return; @@ -44,17 +67,32 @@ export const positionFloat = function positionFloat(widget, position) { // Update DOM widget.$container.addClass(className); // Update model - const prevClassName = widget.element.attr('class'); + const prevClassName = widget.element.attr('class') || ''; if (className) { widget.element.attr('class', className); } else { widget.element.removeAttr('class'); } - - if ((prevClassName || className) && prevClassName !== className) { + + if (prevClassName !== className) { // Re-build Figure widget to toggle between inline/block - widget.refresh(widget.$container); - $(document).trigger('positionChange.qti-widget'); + const parent = searchRecurse(widget.element.bdy.rootElement.bdy, widget.serial); + // avoid changes on Figure in a prompt + if (parent.contentModel && parent.contentModel === 'inlineStatic') { + return; + } + widget.element.data('widget').changeState('sleep'); + _.defer(() => { + if (parent && parent.data('widget')) { + parent.data('widget').changeState('active'); + _.defer(() => { + parent.data('widget').changeState('sleep'); + _.defer(() => { + widget.element.data('widget').changeState('active'); + }); + }); + } + }); } widget.$original.trigger('contentChange.qti-widget'); }; From b888b59afe29902ac89b9971db6da24042cbc790 Mon Sep 17 00:00:00 2001 From: "maria.cano" Date: Fri, 25 Nov 2022 13:55:53 +0100 Subject: [PATCH 12/12] fix: solve toggle position on prompt --- src/mediaEditor/plugins/mediaAlignment/helper.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mediaEditor/plugins/mediaAlignment/helper.js b/src/mediaEditor/plugins/mediaAlignment/helper.js index 81298f6a..3d7f6c80 100644 --- a/src/mediaEditor/plugins/mediaAlignment/helper.js +++ b/src/mediaEditor/plugins/mediaAlignment/helper.js @@ -79,6 +79,9 @@ export const positionFloat = function positionFloat(widget, position) { const parent = searchRecurse(widget.element.bdy.rootElement.bdy, widget.serial); // avoid changes on Figure in a prompt if (parent.contentModel && parent.contentModel === 'inlineStatic') { + _.defer(() => { + widget.element.data('widget').refresh(); + }); return; } widget.element.data('widget').changeState('sleep');