mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
move mime types loading to avoid race conditions
This commit is contained in:
parent
fab959539a
commit
fdb8959aa1
@ -34,14 +34,6 @@ class NoteDetailText {
|
|||||||
if (!this.textEditor) {
|
if (!this.textEditor) {
|
||||||
await libraryLoader.requireLibrary(libraryLoader.CKEDITOR);
|
await libraryLoader.requireLibrary(libraryLoader.CKEDITOR);
|
||||||
|
|
||||||
// CKEditor since version 12 needs the element to be visible before initialization. At the same time
|
|
||||||
// we want to avoid flicker - i.e. show editor only once everything is ready. That's why we have separate
|
|
||||||
// display of $component in both branches.
|
|
||||||
this.$component.show();
|
|
||||||
|
|
||||||
// textEditor might have been initialized during previous await so checking again
|
|
||||||
// looks like double initialization can freeze CKEditor pretty badly
|
|
||||||
if (!this.textEditor) {
|
|
||||||
const codeBlockLanguages =
|
const codeBlockLanguages =
|
||||||
(await mimeTypesService.getMimeTypes())
|
(await mimeTypesService.getMimeTypes())
|
||||||
.filter(mt => mt.enabled)
|
.filter(mt => mt.enabled)
|
||||||
@ -52,6 +44,14 @@ class NoteDetailText {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// CKEditor since version 12 needs the element to be visible before initialization. At the same time
|
||||||
|
// we want to avoid flicker - i.e. show editor only once everything is ready. That's why we have separate
|
||||||
|
// display of $component in both branches.
|
||||||
|
this.$component.show();
|
||||||
|
|
||||||
|
// textEditor might have been initialized during previous await so checking again
|
||||||
|
// looks like double initialization can freeze CKEditor pretty badly
|
||||||
|
if (!this.textEditor) {
|
||||||
this.textEditor = await BalloonEditor.create(this.$editorEl[0], {
|
this.textEditor = await BalloonEditor.create(this.$editorEl[0], {
|
||||||
placeholder: "Type the content of your note here ...",
|
placeholder: "Type the content of your note here ...",
|
||||||
mention: {
|
mention: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user