Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-9154: The dropdown for custom class is illegible #193

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import clickOutsideHandler from '@ckeditor/ckeditor5-ui/src/bindings/clickoutsid

import IbexaCustomAttributesFormView from './ui/custom-attributes-form-view';
import IbexaButtonView from '../common/button-view/button-view';
import { setPanelContentMaxHeight } from '../helpers/custom-panel-helper';

import { getCustomAttributesElementConfig, getCustomClassesElementConfig } from './helpers/config-helper';

Expand All @@ -16,6 +17,15 @@ class IbexaAttributesUI extends Plugin {
this.formView = this.createFormView();

this.showForm = this.showForm.bind(this);

let timeoutId = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think new line? Or not, I'm already totally lost :D


this.listenTo(this.balloon.view, 'change:top', () => {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
setPanelContentMaxHeight(this.balloon.view);
}, 0);
});
}

getModelElement() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class IbexaCustomAttributesFormView extends View {
this.setTemplate({
tag: 'div',
attributes: {
class: 'ibexa-ckeditor-balloon-form',
class: 'ibexa-ckeditor-balloon-form ibexa-custom-panel',
},
children: [
{
tag: 'div',
attributes: {
class: 'ibexa-ckeditor-balloon-form__header',
class: 'ibexa-ckeditor-balloon-form__header ibexa-custom-panel__header',
},
children: ['Custom Attributes'],
},
Expand All @@ -63,14 +63,14 @@ class IbexaCustomAttributesFormView extends View {
{
tag: 'div',
attributes: {
class: 'ibexa-ckeditor-balloon-form__fields',
class: 'ibexa-ckeditor-balloon-form__fields ibexa-custom-panel__content ibexa-custom-panel__content--overflow-with-scroll',
},
children: this.children,
},
{
tag: 'div',
attributes: {
class: 'ibexa-ckeditor-balloon-form__actions',
class: 'ibexa-ckeditor-balloon-form__actions ibexa-custom-panel__footer',
},
children: [this.saveButtonView, this.revertButtonView, this.cancelButtonView],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import clickOutsideHandler from '@ckeditor/ckeditor5-ui/src/bindings/clickoutsidehandler';
import ClickObserver from '@ckeditor/ckeditor5-engine/src/view/observer/clickobserver';

import { setPanelContentMaxHeight } from '../helpers/panel-helper';
import { setPanelContentMaxHeight } from '../../helpers/custom-panel-helper';
import IbexaCustomTagFormView from '../ui/custom-tag-form-view';
import IbexaCustomTagAttributesView from '../ui/custom-tag-attributes-view';
import IbexaButtonView from '../../common/button-view/button-view';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class IbexaCustomTagAttributesView extends View {
{
tag: 'div',
attributes: {
class: 'ibexa-custom-tag-attributes__header ibexa-custom-tag-panel-header',
class: 'ibexa-custom-tag-attributes__header ibexa-custom-panel__header',
},
children: [
{
Expand Down Expand Up @@ -91,7 +91,7 @@ class IbexaCustomTagAttributesView extends View {
children.push({
tag: 'div',
attributes: {
class: 'ibexa-custom-tag-attributes__items ibexa-custom-tag-panel-content',
class: 'ibexa-custom-tag-attributes__items ibexa-custom-panel__content',
},
children: items,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ class IbexaCustomTagFormView extends View {
this.setTemplate({
tag: 'div',
attributes: {
class: 'ibexa-ckeditor-balloon-form',
class: 'ibexa-ckeditor-balloon-form ibexa-custom-panel',
},
children: [
{
tag: 'div',
attributes: {
class: 'ibexa-ckeditor-balloon-form__header ibexa-custom-tag-panel-header',
class: 'ibexa-ckeditor-balloon-form__header ibexa-custom-panel__header',
},
children: [label],
},
Expand All @@ -134,14 +134,14 @@ class IbexaCustomTagFormView extends View {
{
tag: 'div',
attributes: {
class: 'ibexa-ckeditor-balloon-form__fields ibexa-custom-tag-panel-content',
class: 'ibexa-ckeditor-balloon-form__fields ibexa-custom-panel__content ibexa-custom-panel__content--overflow-with-scroll',
},
children: this.children,
},
{
tag: 'div',
attributes: {
class: 'ibexa-ckeditor-balloon-form__actions ibexa-custom-tag-panel-footer',
class: 'ibexa-ckeditor-balloon-form__actions ibexa-custom-panel__footer',
},
children: [this.saveButtonView, this.cancelButtonView],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
const setPanelContentMaxHeight = (balloonView) => {
const MIN_HEIGHT_VALUE = 100;
const MARGIN = 50;
const BOTTOM_ARROW_CLASSES = ['ck-balloon-panel_arrow_s', 'ck-balloon-panel_arrow_se', 'ck-balloon-panel_arrow_sw'];
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');
const panelHeader = panelNode.querySelector('.ibexa-custom-panel__header');
const panelContent = panelNode.querySelector('.ibexa-custom-panel__content');
const panelFooter = panelNode.querySelector('.ibexa-custom-panel__footer');

if (!panelContent) {
return;
}

const isBalloonAbovePivot = panelNode.classList.contains('ck-balloon-panel_arrow_s');
const isBalloonAbovePivot = [...panelNode.classList].some((className) => BOTTOM_ARROW_CLASSES.includes(className));
const panelInitialHeight = panelNode.offsetHeight;
const panelTopPosition = parseInt(panelNode.style.top, 10);
const panelHeaderHeight = panelHeader?.offsetHeight ?? 0;
Expand Down
1 change: 0 additions & 1 deletion src/bundle/Resources/public/scss/_balloon-form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
}

&__fields {
overflow: auto;
padding: calculateRem(8px) calculateRem(16px);

&--attributes {
Expand Down
41 changes: 41 additions & 0 deletions src/bundle/Resources/public/scss/_custom-panel.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.ibexa-custom-panel {
min-width: calculateRem(320px);

&__content {
&--overflow-with-scroll {
overflow: auto;

&.ibexa-ckeditor-balloon-form__fields {
.ck.ck-labeled-field-view {
.ck.ck-input {
width: 100%;
}

.ck.ck-dropdown {
width: 100%;

.ck.ck-button {
display: block;

.ck.ck-button__label {
width: calc(100% - calculateRem(20px));
height: fit-content;
white-space: normal;
overflow: hidden;
}
}
}

.ck-dropdown__panel-visible {
position: static;
bottom: 0;
height: fit-content;
max-height: 100%;
border: none;
box-shadow: none;
}
}
}
}
}
}
1 change: 1 addition & 0 deletions src/bundle/Resources/public/scss/ckeditor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@import 'general';
@import 'custom-tag';
@import 'custom-tag-attributes';
@import 'custom-panel';
@import 'elements-path';
@import 'tools';
@import 'character-counter';
Expand Down
Loading