Skip to content

Commit

Permalink
FIX HTMLEditorField::setRows method (#1588)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabina-talipova authored Jan 11, 2024
1 parent 0755502 commit bc92e1f
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 bc92e1f

Please sign in to comment.