diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 28109a392c..e78d93a3d6 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -43,7 +43,6 @@ public function index(): TemplateResponse { Util::addStyle(Application::APP_ID, 'grid'); Util::addStyle(Application::APP_ID, 'modal'); Util::addStyle(Application::APP_ID, 'tiptap'); - Util::addStyle(Application::APP_ID, 'tables-style'); if (class_exists(LoadViewer::class)) { $this->eventDispatcher->dispatchTyped(new LoadViewer()); diff --git a/src/shared/components/ncEditor/NcEditor.vue b/src/shared/components/ncEditor/NcEditor.vue index b9c1aa7837..8e0b7dcb42 100644 --- a/src/shared/components/ncEditor/NcEditor.vue +++ b/src/shared/components/ncEditor/NcEditor.vue @@ -63,6 +63,8 @@ export default { textAppAvailable: !!window.OCA?.Text?.createEditor, editor: null, localValue: '', + observer: null, + initialized: false, } }, @@ -96,16 +98,36 @@ export default { async mounted() { this.localValue = this.text - await this.setupEditor() - this.editor?.setContent(this.localValue, false) + this.setupLazyInitialization() }, beforeDestroy() { - this?.editor?.destroy() + this?.observer?.disconnect?.() + this?.editor?.destroy?.() }, methods: { t, + setupLazyInitialization() { + if (this.initialized) return + + this.observer = new IntersectionObserver((entries) => { + for (const entry of entries) { + if (entry.isIntersecting && !this.initialized) { + this.initialized = true + this.setupEditor().then(() => { + this.editor?.setContent(this.localValue, false) + }) + this.observer?.disconnect?.() + break + } + } + }, { rootMargin: '200px' }) + this.$nextTick(() => { + const el = this.$el + if (el) this.observer.observe(el) + }) + }, async setupEditor() { this?.editor?.destroy() if (this.textAppAvailable) {