diff --git a/src/components/Editor.singleton.js b/src/components/Editor.singleton.js new file mode 100644 index 00000000000..647251f6acc --- /dev/null +++ b/src/components/Editor.singleton.js @@ -0,0 +1,17 @@ +/** + * Get instance of Editor component + * @return {Promise<*>} + */ +export default async function getEditorInstance() { + if (!window.EditorInstance) { + if (window.EditorInstanceImporting) { + await new Promise((resolve) => setTimeout(resolve, 500)) + return getEditorInstance() + } else { + window.EditorInstanceImporting = true + } + const Editor = await import(/* webpackChunkName: "editor" */'./Editor.vue') + window.EditorInstance = Editor.default + } + return window.EditorInstance +} diff --git a/src/components/ViewerComponent.vue b/src/components/ViewerComponent.vue index 6ddb359ae4f..43fa7530fba 100644 --- a/src/components/ViewerComponent.vue +++ b/src/components/ViewerComponent.vue @@ -32,11 +32,12 @@