Improved styling of the label dialog editor, so that the appearance is closer to the Label result

This commit is contained in:
Jan Böhmer 2022-09-21 21:49:09 +02:00
parent 9c87202509
commit ab8be58c0d
6 changed files with 33 additions and 4 deletions

View file

@ -188,6 +188,8 @@ Editor.defaultConfig = {
'fontSize': {
options: [
'default',
6,
7,
8,
9,
10,
@ -222,7 +224,7 @@ Editor.defaultConfig = {
'tableCellProperties',
'tableProperties'
]
}
},
};
export default { Editor, EditorWatchdog };

View file

@ -6,6 +6,7 @@ import { default as HTMLLabelEditor } from "../../ckeditor/html_label";
import EditorWatchdog from '@ckeditor/ckeditor5-watchdog/src/editorwatchdog';
import "../../css/ckeditor.css";
/* stimulusFetch: 'lazy' */
export default class extends Controller {
@ -43,6 +44,13 @@ export default class extends Controller {
editor.enableReadOnlyMode("readonly");
}
//Apply additional styles
const editor_div = editor.ui.view.element;
const new_classes = this.element.dataset.ckClass;
if (editor_div && new_classes) {
editor_div.classList.add(...new_classes.split(","));
}
console.log(editor);
})
.catch(error => {

19
assets/css/ckeditor.css Normal file
View file

@ -0,0 +1,19 @@
/********************************************************************
* HTML Label style override
*********************************************************************/
/** Should be the same settings, as in label_style.css */
.ck-html-label .ck-content {
font-family: "DejaVu Sans Mono", monospace;
font-size: 12px;
line-height: 1.0;
font-size-adjust: 1.5;
}
.ck-html-label .ck-content p {
margin: 0;
}
.ck-html-label .ck-content hr {
margin: 2px;
}