-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Luka Trovic <[email protected]>
- Loading branch information
1 parent
596f67b
commit e80e8b1
Showing
3 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Get instance of Editor component | ||
* Using singleton approach here to avoid duplicate yjs import error | ||
* @return {Promise<*>} | ||
*/ | ||
export default async function getEditorInstance() { | ||
if (!window.EditorInstance) { | ||
if (window.EditorInstanceImporting) { | ||
return await new Promise((resolve) => { | ||
const intervalId = setInterval(() => { | ||
if (!window.EditorInstance) { | ||
return | ||
} | ||
resolve(window.EditorInstance) | ||
clearInterval(intervalId) | ||
}, 200) | ||
}) | ||
} else { | ||
window.EditorInstanceImporting = true | ||
} | ||
const Editor = await import(/* webpackChunkName: "editor" */'./Editor.vue') | ||
window.EditorInstance = Editor.default | ||
} | ||
return window.EditorInstance | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters