mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 07:46:30 +01:00
feat(note_language): initialize CKEditor with right language
This commit is contained in:
@@ -148,6 +148,9 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
|
||||
typeWidget.spacedUpdate = this.spacedUpdate;
|
||||
typeWidget.setParent(this);
|
||||
|
||||
if (this.noteContext) {
|
||||
typeWidget.setNoteContextEvent({ noteContext: this.noteContext });
|
||||
}
|
||||
const $renderedWidget = typeWidget.render();
|
||||
keyboardActionsService.updateDisplayedShortcuts($renderedWidget);
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
|
||||
this.watchdog.setCreator(async (elementOrData, editorConfig) => {
|
||||
logInfo("Creating new CKEditor");
|
||||
|
||||
const editor = await editorClass.create(elementOrData, {
|
||||
const finalConfig = {
|
||||
...editorConfig,
|
||||
...buildConfig(),
|
||||
...buildToolbarConfig(isClassicEditor),
|
||||
@@ -195,7 +195,17 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
|
||||
classes: true,
|
||||
attributes: true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const contentLanguage = this.note.getLabelValue("language");
|
||||
if (contentLanguage) {
|
||||
finalConfig.language = {
|
||||
ui: (typeof finalConfig.language === "string" ? finalConfig.language : "en"),
|
||||
content: contentLanguage
|
||||
}
|
||||
}
|
||||
|
||||
const editor = await editorClass.create(elementOrData, finalConfig);
|
||||
|
||||
const notificationsPlugin = editor.plugins.get("Notification");
|
||||
notificationsPlugin.on("show:warning", (evt, data) => {
|
||||
|
||||
Reference in New Issue
Block a user