Skip to content

Commit 74062b7

Browse files
committed
#628: Page Builder Wysiwyg Editor Element blocks view to content area - Fix position of table toolbar when column is smaller than 4/12
1 parent 036aaf8 commit 74062b7

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/_inline-wysiwyg.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,7 @@
7171
}
7272
}
7373
}
74+
75+
.mce-tinymce-inline.mce-arrow.mce-container.mce-floatpanel:not(.mce-arrow-up) {
76+
transform: translateY(30px); // table toolbar position fix
77+
}

app/code/Magento/PageBuilder/view/adminhtml/web/js/wysiwyg/tinymce4.js

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/wysiwyg/tinymce4.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export default class Wysiwyg implements WysiwygInterface {
168168
.css("min-width", this.config.adapter_config.minToolbarWidth + "px");
169169

170170
this.invertInlineEditorToAccommodateOffscreenToolbar();
171+
this.setStyleOnTableToolbar();
171172
});
172173
}
173174

@@ -177,6 +178,9 @@ export default class Wysiwyg implements WysiwygInterface {
177178
private onChangeContent() {
178179
this.saveContentDebounce();
179180
this.invertInlineEditorToAccommodateOffscreenToolbar();
181+
_.defer(() => {
182+
this.setStyleOnTableToolbar();
183+
});
180184
}
181185

182186
/**
@@ -242,4 +246,37 @@ export default class Wysiwyg implements WysiwygInterface {
242246
private getFixedToolbarContainer() {
243247
return $(`#${this.elementId}`).closest(`${this.config.adapter.settings.fixed_toolbar_container}`);
244248
}
249+
250+
/**
251+
* Get wysiwyg container
252+
*
253+
* @returns {jQuery}
254+
*/
255+
private getEditor() {
256+
return $(`#${this.elementId}`)[0];
257+
}
258+
259+
/**
260+
* Adjust table toolbar position, when editor container is smaller than toolbar
261+
*/
262+
private setStyleOnTableToolbar() {
263+
if (this.config.adapter_config.mode !== "inline") {
264+
return;
265+
}
266+
267+
const $tableToolbar = $(".mce-tinymce-inline.mce-arrow.mce-floatpanel.mce-arrow-up");
268+
269+
if (!!$tableToolbar.length) {
270+
$tableToolbar.css("transform", "translateY(0px)");
271+
}
272+
273+
const $shortTableToolbar = $(".mce-tinymce-inline.mce-arrow.mce-floatpanel:not(.mce-arrow-up)");
274+
275+
if (!$shortTableToolbar.length) {
276+
return;
277+
}
278+
279+
const editorHeight = this.getEditor().clientHeight;
280+
$shortTableToolbar.css("transform", "translateY(" + editorHeight + "px)");
281+
}
245282
}

0 commit comments

Comments
 (0)