-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IBX-8824: The popup for custom tags with multiple fields is not scrol…
…lable (#183) Co-authored-by: tischsoic <[email protected]>
- Loading branch information
Showing
6 changed files
with
67 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/bundle/Resources/public/js/CKEditor/custom-tags/helpers/panel-helper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const setPanelContentMaxHeight = (balloonView) => { | ||
const MIN_HEIGHT_VALUE = 100; | ||
const MARGIN = 50; | ||
const { innerHeight: windowHeight } = window; | ||
const { element: panelNode } = balloonView; | ||
const panelHeader = panelNode.querySelector('.ibexa-custom-tag-panel-header'); | ||
const panelContent = panelNode.querySelector('.ibexa-custom-tag-panel-content'); | ||
const panelFooter = panelNode.querySelector('.ibexa-custom-tag-panel-footer'); | ||
|
||
if (!panelContent) { | ||
return; | ||
} | ||
|
||
const isBalloonAbovePivot = panelNode.classList.contains('ck-balloon-panel_arrow_s'); | ||
const panelInitialHeight = panelNode.offsetHeight; | ||
const panelTopPosition = parseInt(panelNode.style.top, 10); | ||
const panelHeaderHeight = panelHeader?.offsetHeight ?? 0; | ||
const panelFooterHeight = panelFooter?.offsetHeight ?? 0; | ||
const maxHeightValue = isBalloonAbovePivot | ||
? panelInitialHeight + panelTopPosition - panelHeaderHeight - panelFooterHeight - MARGIN | ||
: windowHeight - panelTopPosition - panelHeaderHeight - panelFooterHeight - MARGIN; | ||
const panelMaxHeight = maxHeightValue < MIN_HEIGHT_VALUE ? MIN_HEIGHT_VALUE : maxHeightValue; | ||
|
||
panelContent.style.maxHeight = `${panelMaxHeight}px`; | ||
|
||
if (isBalloonAbovePivot) { | ||
const panelNewHeight = panelNode.offsetHeight; | ||
const panelHeightChange = panelInitialHeight - panelNewHeight; | ||
const panelNewTopPosition = panelTopPosition + panelHeightChange; | ||
|
||
panelNode.style.top = `${panelNewTopPosition}px`; | ||
} | ||
}; | ||
|
||
export { setPanelContentMaxHeight }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters