diff --git a/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base-fixed.js b/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base-fixed.js index aa9965e20a..8526561236 100644 --- a/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base-fixed.js +++ b/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base-fixed.js @@ -10,8 +10,9 @@ export default class EzConfgiFixedBase extends EzConfigBase { const editorRect = editor.element.getClientRect(); const toolbarHeight = toolbar ? toolbar.getBoundingClientRect().height : 0; const shouldBeFixed = editorRect.top - toolbarHeight - 2 * TOOLBAR_OFFSET < 0; + const header = document.querySelector('.ez-edit-header__content-type-name'); const top = shouldBeFixed - ? TOOLBAR_OFFSET + ? TOOLBAR_OFFSET + (header ? header.offsetHeight : 0) : editorRect.top + editor.element.getWindow().getScrollPosition().y - toolbarHeight - TOOLBAR_OFFSET; if (toolbar) { diff --git a/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base-table.js b/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base-table.js index 1441029047..5ba1a659b8 100644 --- a/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base-table.js +++ b/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base-table.js @@ -1,7 +1,9 @@ -import AlloyEditor from 'alloyeditor'; +import EzConfgiFixedBase from './base-fixed'; -export default class EzConfigTableBase { +export default class EzConfigTableBase extends EzConfgiFixedBase { constructor(config) { + super(config); + this.name = this.getConfigName(); const editAttributesButton = config.attributes[this.name] || config.classes[this.name] ? `${this.name}edit` : ''; @@ -16,12 +18,13 @@ export default class EzConfigTableBase { 'eztableremove', ...config.extraButtons[this.name], ]; - - this.getArrowBoxClasses = AlloyEditor.SelectionGetArrowBoxClasses.table; - this.setPosition = AlloyEditor.SelectionSetPosition.table; } getConfigName() { return ''; } + + getArrowBoxClasses() { + return 'ae-toolbar-floating'; + } } diff --git a/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base.js b/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base.js index 1385954b82..03a642b78e 100644 --- a/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base.js +++ b/src/bundle/Resources/public/js/alloyeditor/src/toolbars/config/base.js @@ -80,16 +80,29 @@ export default class EzConfigBase { const path = editor.elementPath(); let block = path.block; - if (!block || isWidgetElement) { + if (isWidgetElement) { const inlineCustomTag = path.elements.find((element) => element.$.dataset.ezelement === 'eztemplateinline'); block = inlineCustomTag || targetElement; } + if (!block ) { + block = path.lastElement; + } + if (block.is('li')) { block = block.getParent(); } + if (block.is('td') || block.is('th')) { + for (let parent of block.getParents()) { + if (parent.getName() === 'table') { + block = parent; + break; + } + } + } + return block; }