Skip to content

Commit

Permalink
imp: Add coherent outline on the TinyMCE editor focus
Browse files Browse the repository at this point in the history
  • Loading branch information
marien-probesys committed Jun 3, 2024
1 parent 50adef8 commit a2d14b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions assets/javascripts/controllers/tinymce_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ export default class extends Controller {
images_upload_handler: this.imagesUploader.bind(this),
relative_urls: false,
remove_script_host: false,
highlight_on_focus: false,

setup: (editor) => {
editor.on('focus', () => {
this.element.dataset.hasFocus = true;
});

editor.on('blur', () => {
this.element.dataset.hasFocus = false;
});
},
};

window.tinymce.init(configuration);
Expand Down
5 changes: 5 additions & 0 deletions assets/stylesheets/components/forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ legend {
border-radius: var(--form-border-radius) var(--form-border-radius) 0 0;
}

.editor:has([data-has-focus="true"]) {
outline: var(--outline-width) solid var(--outline-color);
outline-offset: var(--outline-offset);
}

.form__caption {
color: var(--color-grey11);
font-size: var(--font-size-small);
Expand Down

0 comments on commit a2d14b2

Please sign in to comment.