Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.1' into 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dew326 committed Dec 7, 2020
2 parents 649cc38 + 5b7cc89 commit 66bd770
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ export default class EzConfigFixedBase 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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import AlloyEditor from 'alloyeditor';
import EzConfigButtonsBase from './base-buttons';
import EzConfigFixedBase from './base-fixed';

export default class EzConfigTableBase extends EzConfigButtonsBase {
export default class EzConfigTableBase extends EzConfigFixedBase {
constructor(config) {
super(config);

this.name = this.getConfigName();
this.buttons = this.getButtons(config);

this.getArrowBoxClasses = AlloyEditor.SelectionGetArrowBoxClasses.table;
this.setPosition = AlloyEditor.SelectionSetPosition.table;
}

getConfigName() {
return '';
}

getArrowBoxClasses() {
return 'ae-toolbar-floating';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,29 @@ export default class EzConfigBase extends EzConfigButtonsBase {
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;
}

Expand Down

0 comments on commit 66bd770

Please sign in to comment.