Skip to content

Commit 1741e21

Browse files
authored
IBX-10402: Missing hover state on richtext field (#263)
1 parent 52ab56d commit 1741e21

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ const VIEWPORT_TOP_OFFSET_DISTRACTION_FREE_MODE = 0;
253253
CKEditor.create(container, config).then((editor) => {
254254
this.editor = editor;
255255

256+
const editableUIView = editor.ui.view.editable;
256257
const editableElement = this.editor.editing.view.getDomRoot();
257258
const editorToolbarPanelInstance = this.editor.ui.view.panel;
258259
const initialData = this.getData();
@@ -328,6 +329,14 @@ const VIEWPORT_TOP_OFFSET_DISTRACTION_FREE_MODE = 0;
328329
}
329330
});
330331

332+
editableUIView.on('change:isFocused', (event) => {
333+
const containerDataSource =
334+
container.closest('.ibexa-field-edit--ezrichtext .ibexa-data-source') ??
335+
container.closest('.ibexa-data-source--richtext');
336+
337+
containerDataSource.classList.toggle('ibexa-data-source--focused', event.source.isFocused);
338+
});
339+
331340
editorToolbarPanelInstance.on('change:isVisible', ({ source: eventBalloonPanelViewInstance }) => {
332341
const fieldEditNode = editableElement.closest('.ibexa-field-edit');
333342

src/bundle/Resources/public/scss/_general.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.ibexa-data-source--richtext {
33
border: calculateRem(1px) solid $ibexa-color-dark-200;
44
border-radius: $ibexa-border-radius;
5+
transition: all $ibexa-admin-transition-duration $ibexa-admin-transition;
56

67
.ck.ck-content {
78
min-height: calculateRem(100px);
@@ -265,6 +266,28 @@
265266
}
266267
}
267268

269+
.ibexa-data-source--richtext.ibexa-data-source,
270+
.ibexa-field-edit--ezrichtext .ibexa-data-source {
271+
&:hover {
272+
border-color: var(--ibexa-input-hover-border-color, #{$ibexa-color-primary});
273+
}
274+
275+
&--focused {
276+
border-color: var(--ibexa-input-focus-border-color, #{$ibexa-color-primary});
277+
box-shadow: 0 0 0 calculateRem(4px) var(--ibexa-input-focus-shadow-color, #{rgba($ibexa-color-primary, 0.25)});
278+
279+
&.is-invalid {
280+
box-shadow: none;
281+
border-color: var(--ibexa-input-invalid-border-color, #{$ibexa-color-danger});
282+
}
283+
284+
.ck.ck-editor__editable.ck-focused:not(.ck-editor__nested-editable) {
285+
border: none;
286+
box-shadow: none;
287+
}
288+
}
289+
}
290+
268291
.ibexa-field-edit--ezrichtext.ibexa-field-edit--nontranslatable .ibexa-data-source {
269292
.ibexa-data-source__richtext {
270293
color: $ibexa-color-dark-300;

src/bundle/Resources/public/scss/variables/vars.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ $ibexa-border-radius-small: calculateRem(5px);
44
$ibexa-text-font-size: calculateRem(16px);
55
$ibexa-text-font-size-small: calculateRem(12px);
66

7+
$ibexa-admin-transition: cubic-bezier(0.25, 0.8, 0.25, 1);
8+
$ibexa-admin-transition-duration: 0.4s;
9+
710
$ibexa-font-family:
811
'Noto Sans',
912
-apple-system,

0 commit comments

Comments
 (0)