refactor(editor): reduce dependency to doc collection (#9492)

This commit is contained in:
Saul-Mirone
2025-01-03 01:59:25 +00:00
parent eb15b3cb39
commit 8b6c81f76d
70 changed files with 185 additions and 210 deletions
@@ -4,12 +4,11 @@ import { unsafeCSSVar } from '@blocksuite/affine-shared/theme';
import { type BlockStdScope, ShadowlessElement } from '@blocksuite/block-std';
import { noop, SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
import { DoneIcon } from '@blocksuite/icons/lit';
import type { Y } from '@blocksuite/store';
import { DocCollection } from '@blocksuite/store';
import { effect, type Signal, signal } from '@preact/signals-core';
import { css, html } from 'lit';
import { property } from 'lit/decorators.js';
import { codeToTokensBase, type ThemedToken } from 'shiki';
import * as Y from 'yjs';
import { InlineManagerExtension } from '../../../../extension/index.js';
import { LatexEditorUnitSpecExtension } from '../../affine-inline-specs.js';
@@ -111,7 +110,7 @@ export class LatexEditorMenu extends SignalWatcher(
override connectedCallback(): void {
super.connectedCallback();
const doc = new DocCollection.Y.Doc();
const doc = new Y.Doc();
this.yText = doc.getText('latex');
this.yText.insert(0, this.latexSignal.value);