Skip to content

Commit

Permalink
Merge branch '2.1' into 2
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 13, 2024
2 parents f616c77 + bc92e1f commit 4a97f0b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion client/src/legacy/HtmlEditorField.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,28 @@ ss.editorWrappers.tinyMCE = (function() {

config.skin = config.skin || 'silverstripe';

const setHeight = (event, height) => {
if (event.target && event.target.iframeElement) {
event.target.iframeElement.height = height !== '' ? 'auto' : height;
const parentDiv = event.target.iframeElement.closest('.tox-sidebar-wrap');
if (parentDiv) {
parentDiv.style.height = height;
}
}
}

const initSetup = (editor) => {
editor.on('init', (event) => {
let height = document.querySelector(config.selector).style.height;
setHeight(event, height);
});
editor.on('ResizeEditor', (event) => {
setHeight(event, '');
});
}

// Bind the floatpanel hide and reposition listener to the closest scrollable panel
tinymce.init(config).then((editors) => {
tinymce.init({...config, setup: initSetup}).then((editors) => {
if(editors.length > 0 && editors[0].container) {
const scrollPanel = $(editors[0].container).closest('.panel--scrollable');
scrollPanel.on('scroll', (e) => hideOnScroll(e));
Expand Down

0 comments on commit 4a97f0b

Please sign in to comment.