@dou-ui/editor 0.1.0-alpha.21 → 0.1.0-alpha.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"editor.js","names":[],"sources":["../src/editor.ts"],"sourcesContent":["import type { EditorState, Command, Plugin } from 'prosemirror-state'\nimport type { EditorView } from 'prosemirror-view'\nimport type { CommentAction, CommentAuthor, CommentThread } from 'dou-ui'\nimport {\n inject,\n onBeforeUnmount,\n provide,\n shallowReactive,\n shallowRef,\n type ComputedRef,\n type InjectionKey,\n type ShallowRef,\n} from 'vue'\nimport type { CommentAnchor, CommentRange } from './core/comments'\nimport type { EditorExtension, ResolvedEditorExtensions } from './core/extension'\nimport type { BlockChanges } from './core/changes'\nimport type { Block, EditorDocument, PartialBlock } from './core/model'\nimport type { EditorSearchQuery } from './core/search'\nimport type {\n BlockEdge,\n BlockPatch,\n BlockPlacement,\n EditorTransaction,\n EditorTransactionMeta,\n} from './core/transaction'\nimport type { EditorMessages, EditorMessagesOverride } from './locale'\n\nexport interface EditorProps {\n /**\n * The document, bound with `v-model`. With collaboration the shared\n * document is the source of truth: leave `v-model` out and read changes\n * from the `change` event.\n */\n modelValue?: EditorDocument<PartialBlock>\n /**\n * Blocks, marks, shortcuts and menu entries. Defaults to `[editorKit()]`;\n * read once, when the editor mounts.\n */\n extensions?: (EditorExtension | EditorExtension[])[]\n /** Show the document without editing it. Links stay clickable. */\n readonly?: boolean\n /** The built-in find panel (`Ctrl/⌘+F`). Off, the keys are left to the browser. On by default. */\n searchable?: boolean\n /** The hint in the empty block under the cursor. */\n placeholder?: string\n /** Replace any of the built-in texts. */\n messages?: EditorMessagesOverride\n /** The accessible name of the editing area. */\n ariaLabel?: string\n /** Focus the editor once it is mounted. */\n autofocus?: boolean\n /**\n * Extra ProseMirror plugins, e.g. for collaboration. They run before\n * the built-in ones, so their keys win.\n */\n plugins?: Plugin[]\n /** Leave out the built-in undo history (collaboration brings its own). */\n history?: boolean\n /** Undo and redo commands to replace the built-in ones. */\n undo?: Command\n redo?: Command\n /**\n * The comment threads, bound with `v-model:comments`. The text a thread\n * is about carries its id in the document; leave this out to turn\n * comments off.\n */\n comments?: CommentThread[]\n /** Who is commenting. Without it comments can be read but not written. */\n author?: CommentAuthor\n /** The id of the thread shown beside its text, bound with `v-model:activeComment`. */\n activeComment?: string | null\n /** Whether threads can be started and answered; also while `readonly`. Defaults to `true`. */\n commentable?: boolean\n /**\n * An older version of the document, e.g. one the app saved. The editor\n * then shows the document read-only, with what changed since marked:\n * blocks added and removed, and in each changed block the text added\n * and removed. Blocks are matched by `id`; a block without one shows as\n * removed.\n */\n compare?: EditorDocument<PartialBlock> | null\n /**\n * The block with the cursor and the selected blocks, bound with\n * `v-model:selection`. Setting it puts the cursor at the end of `block`,\n * or selects `blocks` when there are several siblings, without focusing.\n */\n selection?: EditorSelection\n}\n\n/**\n * Who made a change: `'external'` for a new `v-model` value or\n * `setBlocks`, `'remote'` for a collaborator's, `'restore'` for `restore`,\n * `'undo'` and `'redo'`, or\n * the `origin` given to `transact`. Typing and the editor's own commands\n * leave it out.\n */\nexport type EditorOrigin = 'external' | 'remote' | 'restore' | 'undo' | 'redo' | (string & {})\n\n/** What a change to the document did, as the `transaction` event hands it over. */\nexport interface EditorTransactionResult {\n /** The document after the change, as `update:modelValue` gets it next. */\n blocks: Block[]\n /** The blocks the change touched, by id. */\n changes: BlockChanges\n meta: {\n origin?: EditorOrigin\n /** Whether undo can take the change back: not for others' changes, nor for undo and redo themselves. */\n history: boolean\n }\n}\n\n/** Where the selection is, by block. */\nexport interface EditorSelection {\n /** The innermost block at the cursor (the moving end of a selection); `null` while none is. */\n block: string | null\n /**\n * The blocks the selection covers: the selected blocks, or the blocks a\n * text selection runs across, at the level they share.\n */\n blocks: string[]\n}\n\nexport interface EditorEmits {\n 'update:modelValue': [document: EditorDocument]\n /** The document changed: typing, formatting, moving blocks. */\n change: [document: EditorDocument]\n /** Every change to the document, with what it touched; `update:modelValue` follows. */\n transaction: [result: EditorTransactionResult]\n /** The cursor moved to another block, or other blocks were selected. */\n 'update:selection': [selection: EditorSelection]\n /** Before a link opens (Ctrl / ⌘ + click, or a click while read-only); `preventDefault()` keeps it from opening in a new tab. */\n linkOpen: [event: EditorLinkOpenEvent]\n focus: [event: FocusEvent]\n blur: [event: FocusEvent]\n 'update:comments': [threads: CommentThread[]]\n 'update:activeComment': [id: string | null]\n /** A change to the comments made here: to send to a server, notify people, keep a log. */\n commentAction: [action: CommentAction]\n}\n\n/**\n * Before a link is followed. `preventDefault()` stops the editor from\n * opening it in a new tab, e.g. to use the app's router or ask first.\n */\nexport interface EditorLinkOpenEvent {\n /** The address as the text's `link` holds it. */\n link: string\n /** The id of the block the link is in. */\n block: string\n defaultPrevented: boolean\n preventDefault: () => void\n}\n\nexport interface EditorExpose {\n /** The ProseMirror view, once mounted. */\n readonly view: EditorView | null\n focus: () => void\n blur: () => void\n /** The current document. */\n getBlocks: () => Block[]\n /** Replace the document. The change does not go into the undo history. */\n setBlocks: (blocks: PartialBlock[]) => void\n /** The current document as HTML, written by the extensions (see `blocksToHTML`). */\n getHTML: () => string\n /** Replace the document with HTML, read like pasted HTML. */\n setHTML: (html: string) => void\n /** Run a ProseMirror command, e.g. one of the exported ones. */\n run: (command: Command) => boolean\n /**\n * Opens the find panel (`Ctrl/⌘+F`), with a query put in; with `replace`\n * in it, the replace box opens too. `false` when `searchable` is off or\n * the editor is not mounted.\n */\n openSearch: (query?: Partial<EditorSearchQuery>) => boolean\n /** Closes the find panel; `false` when it was not open. */\n closeSearch: () => boolean\n /**\n * Make changes by blocks and ids, applied together as one undo step.\n * Returns what happened, or `null` when nothing changed. Works while\n * read-only too.\n */\n transact: (\n fn: (tr: EditorTransaction) => void,\n meta?: EditorTransactionMeta,\n ) => EditorTransactionResult | null\n /** One block, or `null` when there is none with that id. */\n getBlock: (id: string) => Block | null\n /**\n * Insert blocks, by default after the block with the cursor. Returns the\n * new blocks' ids (an id already in use is replaced). One undo step.\n */\n insertBlocks: (blocks: PartialBlock[], placement?: BlockPlacement) => string[]\n /** Change a block's type, props (merged), content or children. One undo step. */\n updateBlock: (id: string, patch: BlockPatch) => boolean\n /** Remove blocks with their children. One undo step. */\n removeBlocks: (ids: string[]) => boolean\n /** Move blocks, in the order given, before, after or into another block. One undo step. */\n moveBlocks: (ids: string[], placement: BlockPlacement) => boolean\n /** Focus the editor with the cursor at the start or end (the default) of a block, scrolled into view. */\n focusBlock: (id: string, edge?: BlockEdge) => boolean\n /** The selection by block, as `v-model:selection` has it. */\n getSelection: () => EditorSelection\n undo: () => boolean\n redo: () => boolean\n readonly canUndo: boolean\n readonly canRedo: boolean\n /**\n * Start a thread on the selected text and open the box for its first\n * comment; with the cursor on commented text, open that thread to reply.\n */\n comment: () => boolean\n /** Where each thread is anchored; `null` for a thread whose text was deleted. */\n getCommentAnchors: () => Record<string, CommentAnchor | null>\n /**\n * Replace the document with `doc`, e.g. an older version, as one\n * change undo takes back. With collaboration only the blocks that differ\n * are written, and everyone sees it. The `transaction` event has origin\n * `'restore'`. Like the other methods it works while `readonly`; it is\n * the one change allowed while comparing. Returns `false` when nothing\n * differs.\n */\n restore: (doc: EditorDocument<PartialBlock>) => boolean\n /** With `compare`: scroll to the next change after the one last shown; `false` when there is none. */\n nextChange: () => boolean\n /** With `compare`: scroll to the change before the one last shown. */\n previousChange: () => boolean\n}\n\n/** The comments, as the parts around the editing area see them. */\nexport interface EditorComments {\n /** Comments are on: there are threads to show. */\n enabled: ComputedRef<boolean>\n /** Threads can be started and answered. */\n writable: ComputedRef<boolean>\n threads: ComputedRef<readonly CommentThread[]>\n author: ComputedRef<CommentAuthor | undefined>\n /** The thread shown beside its text. */\n active: ComputedRef<string | null>\n /** The text a new thread is being started on. */\n pending: ShallowRef<CommentRange | null>\n /** Goes up when the open thread's reply box should take focus. */\n focusRequest: ShallowRef<number>\n /** The selected text, also in a read-only editor; `null` when there is none. */\n selection: () => CommentRange | null\n /** Start a thread on the selected text, or open the one the cursor is in. */\n start: () => boolean\n /**\n * Make a change to the threads. A new thread goes on the text being\n * commented on; with `anchored`, its block already put it inside (see\n * `BlockCommentsSpec`). A removed thread is taken off its text or block.\n */\n apply: (action: CommentAction, options?: { anchored?: boolean }) => void\n /** Open a thread: beside its text, or inside its block, which watches `active`. */\n open: (id: string | null) => void\n /** Close the card, dropping a thread not yet started. */\n close: () => void\n}\n\n/** What the parts around the editing area (menus, handle, toolbar) share. */\nexport interface EditorContext {\n view: ShallowRef<EditorView | null>\n /** Updated on every transaction, so computeds follow the selection too. */\n state: ShallowRef<EditorState | null>\n focused: ShallowRef<boolean>\n /** Blocks are being dragged by the handle. */\n dragging: ShallowRef<boolean>\n editable: ComputedRef<boolean>\n messages: ComputedRef<EditorMessages>\n /** What the extensions contribute: schema, menu entries, toolbar toggles. */\n kit: ResolvedEditorExtensions\n /** The element the overlays are positioned against. */\n root: ShallowRef<HTMLElement | null>\n comments: EditorComments\n}\n\nexport const editorKey: InjectionKey<EditorContext> = Symbol('DouEditor')\n\nconst toolbarMenusKey: InjectionKey<Set<ShallowRef<boolean>>> = Symbol('DouEditorToolbarMenus')\n\n/** For the formatting toolbar: the open state of the menus in it. */\nexport function provideToolbarMenus(): Set<ShallowRef<boolean>> {\n const menus = shallowReactive(new Set<ShallowRef<boolean>>())\n provide(toolbarMenusKey, menus)\n return menus\n}\n\n/**\n * The open state for a menu in the formatting toolbar (an extension's\n * `toolbar` component), to bind with `v-model:open`: the toolbar stays\n * while the menu is open, though the focus has left the editor.\n */\nexport function useToolbarMenu(): ShallowRef<boolean> {\n const open = shallowRef(false)\n const menus = inject(toolbarMenusKey, null)\n if (menus) {\n menus.add(open)\n onBeforeUnmount(() => menus.delete(open))\n }\n return open\n}\n\n/** The editor around a block component, for its messages, state and view. */\nexport function useEditor(): EditorContext {\n const context = inject(editorKey, null)\n if (!context) throw new Error('[@dou-ui/editor] useEditor() must be called inside <DouEditor>')\n return context\n}\n"],"mappings":";;AAmRA,IAAa,YAAyC,OAAO,WAAW;AAExE,IAAM,kBAA0D,OAAO,uBAAuB;;AAG9F,SAAgB,sBAAgD;CAC9D,MAAM,QAAQ,gCAAgB,IAAI,IAAyB,CAAC;CAC5D,QAAQ,iBAAiB,KAAK;CAC9B,OAAO;AACT;;;;;;AAOA,SAAgB,iBAAsC;CACpD,MAAM,OAAO,WAAW,KAAK;CAC7B,MAAM,QAAQ,OAAO,iBAAiB,IAAI;CAC1C,IAAI,OAAO;EACT,MAAM,IAAI,IAAI;EACd,sBAAsB,MAAM,OAAO,IAAI,CAAC;CAC1C;CACA,OAAO;AACT;;AAGA,SAAgB,YAA2B;CACzC,MAAM,UAAU,OAAO,WAAW,IAAI;CACtC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,gEAAgE;CAC9F,OAAO;AACT"}
1
+ {"version":3,"file":"editor.js","names":[],"sources":["../src/editor.ts"],"sourcesContent":["import type { EditorState, Command, Plugin } from 'prosemirror-state'\nimport type { EditorView } from 'prosemirror-view'\nimport type { CommentAction, CommentAuthor, CommentThread } from 'dou-ui'\nimport {\n inject,\n onBeforeUnmount,\n provide,\n shallowReactive,\n shallowRef,\n type ComputedRef,\n type InjectionKey,\n type ShallowRef,\n} from 'vue'\nimport type { CommentAnchor, CommentRange } from './core/comments'\nimport type { EditorExtension, ResolvedEditorExtensions } from './core/extension'\nimport type { BlockChanges } from './core/changes'\nimport type { Block, EditorDocument, PartialBlock } from './core/model'\nimport type { EditorSearchQuery } from './core/search'\nimport type {\n BlockEdge,\n BlockPatch,\n BlockPlacement,\n EditorTransaction,\n EditorTransactionMeta,\n} from './core/transaction'\nimport type { EditorMessages, EditorMessagesOverride } from './locale'\n\nexport interface EditorProps {\n /**\n * The document, bound with `v-model`. With collaboration the shared\n * document is the source of truth: leave `v-model` out and read changes\n * from the `change` event.\n */\n modelValue?: EditorDocument<PartialBlock>\n /**\n * Blocks, marks, shortcuts and menu entries. Defaults to `[editorKit()]`;\n * read once, when the editor mounts.\n */\n extensions?: (EditorExtension | EditorExtension[])[]\n /** Show the document without editing it. Links stay clickable. */\n readonly?: boolean\n /** The built-in find panel (`Ctrl/⌘+F`). Off, the keys are left to the browser. On by default. */\n searchable?: boolean\n /** The hint in the empty block under the cursor. */\n placeholder?: string\n /** Replace any of the built-in texts. */\n messages?: EditorMessagesOverride\n /** The accessible name of the editing area. */\n ariaLabel?: string\n /** Focus the editor once it is mounted. */\n autofocus?: boolean\n /**\n * Extra ProseMirror plugins, e.g. for collaboration. They run before\n * the built-in ones, so their keys win.\n */\n plugins?: Plugin[]\n /** Leave out the built-in undo history (collaboration brings its own). */\n history?: boolean\n /** Undo and redo commands to replace the built-in ones. */\n undo?: Command\n redo?: Command\n /**\n * The comment threads, bound with `v-model:comments`. The text a thread\n * is about carries its id in the document; leave this out to turn\n * comments off.\n */\n comments?: CommentThread[]\n /** Who is commenting. Without it comments can be read but not written. */\n author?: CommentAuthor\n /** The id of the thread shown beside its text, bound with `v-model:activeComment`. */\n activeComment?: string | null\n /** Whether threads can be started and answered; also while `readonly`. Defaults to `true`. */\n commentable?: boolean\n /**\n * An older version of the document, e.g. one the app saved. The editor\n * then shows the document read-only, with what changed since marked:\n * blocks added and removed, and in each changed block the text added\n * and removed. Blocks are matched by `id`; a block without one shows as\n * removed.\n */\n compare?: EditorDocument<PartialBlock> | null\n /**\n * The block with the cursor and the selected blocks, bound with\n * `v-model:selection`. Setting it puts the cursor at the end of `block`,\n * or selects `blocks` when there are several siblings, without focusing.\n */\n selection?: EditorSelection\n}\n\n/**\n * Who made a change: `'external'` for a new `v-model` value or\n * `setBlocks`, `'remote'` for a collaborator's, `'restore'` for `restore`,\n * `'undo'` and `'redo'`, or\n * the `origin` given to `transact`. Typing and the editor's own commands\n * leave it out.\n */\nexport type EditorOrigin = 'external' | 'remote' | 'restore' | 'undo' | 'redo' | (string & {})\n\n/** What a change to the document did, as the `transaction` event hands it over. */\nexport interface EditorTransactionResult {\n /** The document after the change, as `update:modelValue` gets it next. */\n blocks: Block[]\n /** The blocks the change touched, by id. */\n changes: BlockChanges\n meta: {\n origin?: EditorOrigin\n /** Whether undo can take the change back: not for others' changes, nor for undo and redo themselves. */\n history: boolean\n }\n}\n\n/** Where the selection is, by block. */\nexport interface EditorSelection {\n /** The innermost block at the cursor (the moving end of a selection); `null` while none is. */\n block: string | null\n /**\n * The blocks the selection covers: the selected blocks, or the blocks a\n * text selection runs across, at the level they share.\n */\n blocks: string[]\n}\n\nexport interface EditorEmits {\n 'update:modelValue': [document: EditorDocument]\n /** The document changed: typing, formatting, moving blocks. */\n change: [document: EditorDocument]\n /** Every change to the document, with what it touched; `update:modelValue` follows. */\n transaction: [result: EditorTransactionResult]\n /** The cursor moved to another block, or other blocks were selected. */\n 'update:selection': [selection: EditorSelection]\n /** Before a link opens (Ctrl / ⌘ + click, or a click while read-only); `preventDefault()` keeps it from opening in a new tab. */\n linkOpen: [event: EditorLinkOpenEvent]\n focus: [event: FocusEvent]\n blur: [event: FocusEvent]\n 'update:comments': [threads: CommentThread[]]\n 'update:activeComment': [id: string | null]\n /** A change to the comments made here: to send to a server, notify people, keep a log. */\n commentAction: [action: CommentAction]\n}\n\n/**\n * Before a link is followed. `preventDefault()` stops the editor from\n * opening it in a new tab, e.g. to use the app's router or ask first.\n */\nexport interface EditorLinkOpenEvent {\n /** The address as the text's `link` holds it. */\n link: string\n /** The id of the block the link is in. */\n block: string\n defaultPrevented: boolean\n preventDefault: () => void\n}\n\nexport interface EditorExpose {\n /** The ProseMirror view, once mounted. */\n readonly view: EditorView | null\n focus: () => void\n blur: () => void\n /** The current document. */\n getBlocks: () => Block[]\n /** Replace the document. The change does not go into the undo history. */\n setBlocks: (blocks: PartialBlock[]) => void\n /** The current document as HTML, written by the extensions (see `blocksToHTML`). */\n getHTML: () => string\n /** Replace the document with HTML, read like pasted HTML. */\n setHTML: (html: string) => void\n /** Run a ProseMirror command, e.g. one of the exported ones. */\n run: (command: Command) => boolean\n /**\n * Opens the find panel (`Ctrl/⌘+F`), with a query put in; with `replace`\n * in it, the replace box opens too. `false` when `searchable` is off or\n * the editor is not mounted.\n */\n openSearch: (query?: Partial<EditorSearchQuery>) => boolean\n /** Closes the find panel; `false` when it was not open. */\n closeSearch: () => boolean\n /**\n * Make changes by blocks and ids, applied together as one undo step.\n * Returns what happened, or `null` when nothing changed. Works while\n * read-only too.\n */\n transact: (\n fn: (tr: EditorTransaction) => void,\n meta?: EditorTransactionMeta,\n ) => EditorTransactionResult | null\n /** One block, or `null` when there is none with that id. */\n getBlock: (id: string) => Block | null\n /**\n * Insert blocks, by default after the block with the cursor. Returns the\n * new blocks' ids (an id already in use is replaced). One undo step.\n */\n insertBlocks: (blocks: PartialBlock[], placement?: BlockPlacement) => string[]\n /** Change a block's type, props (merged), content or children. One undo step. */\n updateBlock: (id: string, patch: BlockPatch) => boolean\n /** Remove blocks with their children. One undo step. */\n removeBlocks: (ids: string[]) => boolean\n /** Move blocks, in the order given, before, after or into another block. One undo step. */\n moveBlocks: (ids: string[], placement: BlockPlacement) => boolean\n /** Focus the editor with the cursor at the start or end (the default) of a block, scrolled into view. */\n focusBlock: (id: string, edge?: BlockEdge) => boolean\n /** The selection by block, as `v-model:selection` has it. */\n getSelection: () => EditorSelection\n undo: () => boolean\n redo: () => boolean\n readonly canUndo: boolean\n readonly canRedo: boolean\n /**\n * Start a thread on the selected text and open the box for its first\n * comment; with the cursor on commented text, open that thread to reply.\n */\n comment: () => boolean\n /** Where each thread is anchored; `null` for a thread whose text was deleted. */\n getCommentAnchors: () => Record<string, CommentAnchor | null>\n /**\n * Scroll the anchor of comment thread `id` into view (opening any collapsed\n * toggles around it). Returns `false` when comments are off or `id` has no\n * anchor in the document.\n */\n scrollToComment: (id: string, options?: ScrollIntoViewOptions) => boolean\n /**\n * Replace the document with `doc`, e.g. an older version, as one\n * change undo takes back. With collaboration only the blocks that differ\n * are written, and everyone sees it. The `transaction` event has origin\n * `'restore'`. Like the other methods it works while `readonly`; it is\n * the one change allowed while comparing. Returns `false` when nothing\n * differs.\n */\n restore: (doc: EditorDocument<PartialBlock>) => boolean\n /** With `compare`: scroll to the next change after the one last shown; `false` when there is none. */\n nextChange: () => boolean\n /** With `compare`: scroll to the change before the one last shown. */\n previousChange: () => boolean\n}\n\n/** The comments, as the parts around the editing area see them. */\nexport interface EditorComments {\n /** Comments are on: there are threads to show. */\n enabled: ComputedRef<boolean>\n /** Threads can be started and answered. */\n writable: ComputedRef<boolean>\n threads: ComputedRef<readonly CommentThread[]>\n author: ComputedRef<CommentAuthor | undefined>\n /** The thread shown beside its text. */\n active: ComputedRef<string | null>\n /** The text a new thread is being started on. */\n pending: ShallowRef<CommentRange | null>\n /** Goes up when the open thread's reply box should take focus. */\n focusRequest: ShallowRef<number>\n /** The selected text, also in a read-only editor; `null` when there is none. */\n selection: () => CommentRange | null\n /** Start a thread on the selected text, or open the one the cursor is in. */\n start: () => boolean\n /**\n * Make a change to the threads. A new thread goes on the text being\n * commented on; with `anchored`, its block already put it inside (see\n * `BlockCommentsSpec`). A removed thread is taken off its text or block.\n */\n apply: (action: CommentAction, options?: { anchored?: boolean }) => void\n /** Open a thread: beside its text, or inside its block, which watches `active`. */\n open: (id: string | null) => void\n /** Close the card, dropping a thread not yet started. */\n close: () => void\n}\n\n/** What the parts around the editing area (menus, handle, toolbar) share. */\nexport interface EditorContext {\n view: ShallowRef<EditorView | null>\n /** Updated on every transaction, so computeds follow the selection too. */\n state: ShallowRef<EditorState | null>\n focused: ShallowRef<boolean>\n /** Blocks are being dragged by the handle. */\n dragging: ShallowRef<boolean>\n editable: ComputedRef<boolean>\n messages: ComputedRef<EditorMessages>\n /** What the extensions contribute: schema, menu entries, toolbar toggles. */\n kit: ResolvedEditorExtensions\n /** The element the overlays are positioned against. */\n root: ShallowRef<HTMLElement | null>\n comments: EditorComments\n}\n\nexport const editorKey: InjectionKey<EditorContext> = Symbol('DouEditor')\n\nconst toolbarMenusKey: InjectionKey<Set<ShallowRef<boolean>>> = Symbol('DouEditorToolbarMenus')\n\n/** For the formatting toolbar: the open state of the menus in it. */\nexport function provideToolbarMenus(): Set<ShallowRef<boolean>> {\n const menus = shallowReactive(new Set<ShallowRef<boolean>>())\n provide(toolbarMenusKey, menus)\n return menus\n}\n\n/**\n * The open state for a menu in the formatting toolbar (an extension's\n * `toolbar` component), to bind with `v-model:open`: the toolbar stays\n * while the menu is open, though the focus has left the editor.\n */\nexport function useToolbarMenu(): ShallowRef<boolean> {\n const open = shallowRef(false)\n const menus = inject(toolbarMenusKey, null)\n if (menus) {\n menus.add(open)\n onBeforeUnmount(() => menus.delete(open))\n }\n return open\n}\n\n/** The editor around a block component, for its messages, state and view. */\nexport function useEditor(): EditorContext {\n const context = inject(editorKey, null)\n if (!context) throw new Error('[@dou-ui/editor] useEditor() must be called inside <DouEditor>')\n return context\n}\n"],"mappings":";;AAyRA,IAAa,YAAyC,OAAO,WAAW;AAExE,IAAM,kBAA0D,OAAO,uBAAuB;;AAG9F,SAAgB,sBAAgD;CAC9D,MAAM,QAAQ,gCAAgB,IAAI,IAAyB,CAAC;CAC5D,QAAQ,iBAAiB,KAAK;CAC9B,OAAO;AACT;;;;;;AAOA,SAAgB,iBAAsC;CACpD,MAAM,OAAO,WAAW,KAAK;CAC7B,MAAM,QAAQ,OAAO,iBAAiB,IAAI;CAC1C,IAAI,OAAO;EACT,MAAM,IAAI,IAAI;EACd,sBAAsB,MAAM,OAAO,IAAI,CAAC;CAC1C;CACA,OAAO;AACT;;AAGA,SAAgB,YAA2B;CACzC,MAAM,UAAU,OAAO,WAAW,IAAI;CACtC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,gEAAgE;CAC9F,OAAO;AACT"}
@@ -114,7 +114,7 @@ var editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
114
114
  return Array.isArray(blocks) ? docToBlocks(blocksToDoc(kit.schema, blocks)) : null;
115
115
  });
116
116
  const editable = computed(() => !props.readonly && !comparing.value);
117
- const { comments, plugin: commentPlugin, anchors } = useEditorComments({
117
+ const { comments, plugin: commentPlugin, anchors, scrollToComment } = useEditorComments({
118
118
  props,
119
119
  emit,
120
120
  view,
@@ -487,6 +487,7 @@ var editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
487
487
  },
488
488
  comment: () => comments.start(),
489
489
  getCommentAnchors: anchors,
490
+ scrollToComment,
490
491
  restore,
491
492
  nextChange: () => goToChange(1),
492
493
  previousChange: () => goToChange(-1)
@@ -499,7 +500,7 @@ var editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
499
500
  if (!comments.enabled.value) return "";
500
501
  const open = comments.threads.value.filter((thread) => !thread.resolved);
501
502
  if (!open.length) return "";
502
- let css = `${open.map((thread) => highlighted(thread.id)).join(",")}{background-color:var(--dou-editor-comment-bg);border-bottom-color:var(--dou-editor-comment-line)}`;
503
+ let css = `${open.map((thread) => highlighted(thread.id)).join(",")}{background-color:var(--dou-editor-comment-bg);border-bottom-color:var(--dou-editor-comment-line);--dou-editor-code-py:0;--dou-editor-code-bg:var(--dou-editor-comment-code-bg);--dou-editor-code-border:var(--dou-editor-comment-code-border)}`;
503
504
  const active = comments.active.value;
504
505
  if (active && open.some((thread) => thread.id === active)) css += `${highlighted(active)}{background-color:var(--dou-editor-comment-bg-active)}`;
505
506
  return css;
@@ -1 +1 @@
1
- {"version":3,"file":"editor.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createVNode","SearchBar","_createCommentVNode","_createElementVNode","_Fragment","BlockHandle","SlashMenu","BubbleToolbar","_renderList","_createBlock","_resolveDynamicComponent","_toDisplayString","CommentButton","CommentCard"],"sources":["../src/editor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { isApplePlatform, useGlobalConfig, useNamespace } from 'dou-ui'\nimport { keymap } from 'prosemirror-keymap'\nimport { Plugin, type EditorState, type Transaction } from 'prosemirror-state'\nimport type { EditorView } from 'prosemirror-view'\nimport {\n computed,\n getCurrentInstance,\n nextTick,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n toRaw,\n useTemplateRef,\n watch,\n h,\n useId,\n type Component,\n} from 'vue'\nimport BlockHandle from './components/block-handle.vue'\nimport BubbleToolbar from './components/bubble-toolbar.vue'\nimport SearchBar from './components/search-bar.vue'\nimport CommentButton from './components/comment-button.vue'\nimport CommentCard from './components/comment-card.vue'\nimport SlashMenu from './components/slash-menu.vue'\nimport { setFallbackHighlighter, type CodeHighlighter } from './core/highlight'\nimport { comparePlugin, compareKey } from './core/compare'\nimport {\n createEditorView,\n getBlocks,\n historyCommands,\n originKey,\n replaceBlocks,\n restoreBlocks,\n runCommand,\n setEditable,\n} from './core/editor'\nimport { diffBlocks } from './core/changes'\nimport { isRemote } from './core/plugins'\nimport { selectionOf, sameSelection } from './core/selection'\nimport { selectBlocks } from './core/block-selection'\nimport { applyEditorTransaction, EditorTransaction } from './core/transaction'\nimport {\n blocksToDoc,\n docToBlocks,\n type Block,\n type EditorDocument,\n type PartialBlock,\n} from './core/model'\nimport { resolveEditorExtensions } from './core/extension'\nimport {\n previewMatch,\n searchKey,\n searchPlugin,\n setSearch,\n type EditorSearchQuery,\n} from './core/search'\nimport { slashPlugin, type SlashState } from './core/slash'\nimport { writeHTML } from './core/output'\nimport { parseHTML } from './core/prepare'\nimport { componentMounter, vueNodeView } from './define-block'\nimport { editorKit } from './extensions/editor-kit'\nimport { readBlocks } from './document'\nimport {\n editorKey,\n type EditorEmits,\n type EditorExpose,\n type EditorProps,\n type EditorOrigin,\n type EditorLinkOpenEvent,\n type EditorSelection,\n type EditorTransactionResult,\n} from './editor'\nimport { useEditorMessages } from './locale'\nimport { useEditorComments } from './use-comments'\n\ndefineOptions({ name: 'DouEditor' })\n\nconst props = withDefaults(defineProps<EditorProps>(), {\n modelValue: undefined,\n extensions: undefined,\n readonly: false,\n searchable: true,\n placeholder: undefined,\n messages: undefined,\n ariaLabel: undefined,\n autofocus: false,\n plugins: undefined,\n history: true,\n undo: undefined,\n redo: undefined,\n selection: undefined,\n comments: undefined,\n author: undefined,\n activeComment: undefined,\n commentable: true,\n compare: undefined,\n})\nconst emit = defineEmits<EditorEmits>()\n\n// read once: changing the schema of a live editor would invalidate its document\nconst messages = useEditorMessages(() => props.messages)\nconst kit = resolveEditorExtensions(props.extensions ?? [editorKit()], () => messages.value)\n// say so once, instead of silently keeping the old extensions\nconst stopWatchingExtensions = watch(\n () => props.extensions,\n () => {\n console.warn(\n '[@dou-ui/editor] `extensions` changed after mount and is ignored: it is read once. Create the list once outside the template, or give the editor a new `key` to rebuild it.',\n )\n stopWatchingExtensions()\n },\n)\n\nconst ns = useNamespace('editor')\nconst config = useGlobalConfig()\nconst root = useTemplateRef<HTMLElement>('root')\nconst mount = useTemplateRef<HTMLElement>('mount')\nconst view = shallowRef<EditorView | null>(null)\nconst state = shallowRef<EditorState | null>(null)\nconst focused = shallowRef(false)\nconst dragging = shallowRef(false)\n/** Showing what changed since an older version: read-only, without comments. */\nconst comparing = computed(() => !!props.compare)\n/**\n * The older version as whole blocks, matched to the current ones by id. A\n * block saved without an id gets a new one, so it shows as removed.\n */\nconst compareBlocks = computed(() => {\n const blocks = props.compare?.blocks\n return Array.isArray(blocks) ? docToBlocks(blocksToDoc(kit.schema, blocks)) : null\n})\nconst editable = computed(() => !props.readonly && !comparing.value)\n\nconst {\n comments,\n plugin: commentPlugin,\n anchors,\n} = useEditorComments({\n props,\n emit,\n view,\n provider: kit.comments,\n})\n\nconst context = { view, state, focused, dragging, editable, messages, root, kit, comments }\nprovide(editorKey, context)\n\n// block components render outside this component's tree: hand them the context\nconst appContext = getCurrentInstance()?.appContext ?? null\nconst mountComponent = componentMounter(appContext, [[editorKey, context]])\nconst componentViews = {\n ...Object.fromEntries(\n Object.entries(kit.schema.nodes)\n .filter(([, type]) => type.spec.component)\n .map(([name, type]) => [\n name,\n vueNodeView(type.spec.component as Component, appContext, [[editorKey, context]]),\n ]),\n ),\n ...Object.fromEntries(\n Object.entries(kit.componentViews).map(([name, create]) => [name, create(mountComponent)]),\n ),\n}\n\n// find and replace: the panel over the text, the matches marked in it\nconst searchOpen = ref(false)\nconst searchReplacing = ref(false)\nconst searchBar = useTemplateRef<InstanceType<typeof SearchBar>>('searchBar')\n/** Blocks that draw their own text, such as a code block in the code editor, are not searched. */\nconst searchSkip = (node: { type: { name: string } }) => node.type.name in kit.componentViews\n\n/** Opens the panel, with the replace box for `replace`. A selection on one line becomes the search. */\nfunction openSearch(replace = false, given?: Partial<EditorSearchQuery>) {\n const v = view.value\n if (!v || !props.searchable) return false\n const old = searchKey.getState(v.state)?.query ?? { search: '' }\n const query = { ...old, ...given }\n const { from, to, empty } = v.state.selection\n if (given?.search === undefined && !empty) {\n const text = v.state.doc.textBetween(from, to, '\\n')\n if (text && !text.includes('\\n')) query.search = text\n }\n if ((replace || given?.replace !== undefined) && editable.value) searchReplacing.value = true\n searchOpen.value = true\n v.dispatch(setSearch(v.state.tr, { query, active: true }))\n const preview = previewMatch(v.state)\n if (preview) v.dispatch(preview)\n void nextTick(() => searchBar.value?.focus(replace && editable.value ? 'replace' : 'find'))\n return true\n}\n\nfunction closeSearch() {\n const v = view.value\n if (!searchOpen.value || !v) return false\n searchOpen.value = false\n v.dispatch(setSearch(v.state.tr, { active: false }))\n v.focus()\n return true\n}\n\n/** Goes to the next (or previous) match; with the panel shut, opens it on the last search. */\nfunction findAgain(step: 1 | -1) {\n if (!searchOpen.value) {\n const v = view.value\n if (!v || !searchKey.getState(v.state)?.query.search || !openSearch()) return false\n }\n void nextTick(() => (step > 0 ? searchBar.value?.next() : searchBar.value?.previous()))\n return true\n}\n\nconst replaceKey = isApplePlatform() ? 'Mod-Alt-f' : 'Mod-h'\nconst searchKeys = keymap({\n 'Mod-f': () => openSearch(),\n [replaceKey]: () => openSearch(true),\n F3: () => findAgain(1),\n 'Mod-g': () => findAgain(1),\n 'Shift-F3': () => findAgain(-1),\n 'Mod-Shift-g': () => findAgain(-1),\n Escape: () => closeSearch(),\n})\n\nconst slash = shallowRef<SlashState | null>(null)\nconst slashMenu = useTemplateRef<InstanceType<typeof SlashMenu>>('slashMenu')\nconst bubble = useTemplateRef<InstanceType<typeof BubbleToolbar>>('bubble')\n\n// The document last sent through `v-model`: when the same object comes back,\n// it is not loaded again (that would move the cursor).\nlet emitted: EditorDocument | undefined\n\n// the result of the last change, for `transact` to hand back\nlet lastResult: EditorTransactionResult | null = null\n\nfunction onChange(current: EditorView, tr: Transaction, before: EditorState) {\n const blocks = getBlocks(current)\n const doc: EditorDocument = { version: 1, blocks }\n emitted = doc\n const history = tr.getMeta('history$') as { redo: boolean } | undefined\n const origin =\n (tr.getMeta(originKey) as EditorOrigin | undefined) ??\n (history ? (history.redo ? 'redo' : 'undo') : isRemote(tr) ? 'remote' : undefined)\n const meta: EditorTransactionResult['meta'] = {\n history:\n tr.getMeta('addToHistory') !== false &&\n origin !== 'remote' &&\n origin !== 'undo' &&\n origin !== 'redo',\n }\n if (origin !== undefined) meta.origin = origin\n lastResult = { blocks, changes: diffBlocks(before.doc, current.state.doc), meta }\n emit('transaction', lastResult)\n emit('update:modelValue', doc)\n emit('change', doc)\n}\n\nlet selection: EditorSelection = { block: null, blocks: [] }\n\nconst warn = (message: string) => {\n if (process.env.NODE_ENV !== 'production') console.warn(`[@dou-ui/editor] ${message}`)\n}\n\nconst lacksId = (blocks: PartialBlock[]): boolean =>\n blocks.some((block) => !block.id || lacksId(block.children ?? []))\n// until the editor is focused (or a block is, by the program) its selection is no cursor\nlet cursorKnown = false\n\nfunction onUpdate(current: EditorView) {\n state.value = current.state\n if (!cursorKnown) {\n if (!focused.value) return\n cursorKnown = true\n }\n const next = selectionOf(current.state)\n if (sameSelection(next, selection)) return\n selection = next\n emit('update:selection', next)\n}\n\n// a click on a link places the cursor; with Ctrl or ⌘ held, or while read-only, it opens the link\nconst openLinks = new Plugin({\n props: {\n handleDOMEvents: {\n click(clicked, event) {\n const link = (event.target as HTMLElement).closest<HTMLAnchorElement>('a.dou-editor__link')\n if (!link?.href || !(event.metaKey || event.ctrlKey || !clicked.editable)) return false\n event.preventDefault()\n const $pos = clicked.state.doc.resolve(clicked.posAtDOM(link, 0))\n let block = ''\n for (let depth = $pos.depth; depth > 0; depth--)\n if ($pos.node(depth).type.name === 'block') {\n block = $pos.node(depth).attrs.id as string\n break\n }\n const opening: EditorLinkOpenEvent = {\n link: link.getAttribute('href') ?? link.href,\n block,\n defaultPrevented: false,\n preventDefault() {\n this.defaultPrevented = true\n },\n }\n emit('linkOpen', opening)\n if (!opening.defaultPrevented) window.open(link.href, '_blank', 'noopener,noreferrer')\n return true\n },\n },\n },\n})\n\nonMounted(() => {\n const instance = createEditorView({\n element: mount.value!,\n kit,\n nodeViews: componentViews,\n // with collaboration the document comes from the shared document\n blocks: kit.externalDocument ? [] : readBlocks(props.modelValue),\n editable: editable.value,\n placeholder: {\n text: () => props.placeholder ?? messages.value.placeholder,\n heading: () => messages.value.headingPlaceholder,\n empty: () => props.placeholder ?? messages.value.emptyPlaceholder,\n },\n plugins: [\n ...(props.plugins ?? []),\n slashPlugin({\n onChange: (value) => (slash.value = value),\n onKey: (event) => slashMenu.value?.onKey(event) ?? false,\n }),\n keymap({\n 'Mod-k': () => bubble.value?.editLink() ?? false,\n 'Mod-Alt-m': () => comments.start(),\n // with the thread card open, Escape in the text closes it, and only that\n Escape: () => {\n if (!comments.pending.value && !comments.active.value) return false\n comments.close()\n return true\n },\n }),\n commentPlugin,\n comparePlugin({\n before: () => compareBlocks.value,\n label: () => messages.value.removedBlock,\n }),\n openLinks,\n searchPlugin({ skip: searchSkip }),\n ],\n keymaps: [searchKeys],\n history: props.history,\n undo: props.undo,\n redo: props.redo,\n attributes: () => {\n const attrs: Record<string, string> = {}\n if (props.ariaLabel) attrs['aria-label'] = props.ariaLabel\n if (!editable.value) attrs['aria-readonly'] = 'true'\n return attrs\n },\n onChange,\n onUpdate,\n })\n view.value = instance\n state.value = instance.state\n // code blocks without their own highlighter use the one DouCodeBlock uses\n watch(\n () =>\n (config.value.defaults as { DouCodeBlock?: { highlight?: CodeHighlighter } }).DouCodeBlock\n ?.highlight ?? null,\n (highlight) => setFallbackHighlighter(instance, highlight),\n { immediate: true },\n )\n instance.dom.addEventListener('focus', onFocus)\n instance.dom.addEventListener('blur', onBlur)\n if (props.autofocus) instance.focus()\n // blocks given without ids got them now: hand those back, so events' ids can be looked up\n const given = kit.externalDocument ? undefined : readBlocks(props.modelValue)\n if (given && lacksId(given)) {\n const doc: EditorDocument = { version: 1, blocks: getBlocks(instance) }\n emitted = doc\n emit('update:modelValue', doc)\n }\n})\n\nfunction onFocus(event: FocusEvent) {\n focused.value = true\n if (!cursorKnown && view.value) {\n cursorKnown = true\n const next = selectionOf(view.value.state)\n if (!sameSelection(next, selection)) {\n selection = next\n emit('update:selection', next)\n }\n }\n emit('focus', event)\n}\n\nfunction onBlur(event: FocusEvent) {\n focused.value = false\n emit('blur', event)\n}\n\nonBeforeUnmount(() => {\n view.value?.destroy()\n view.value = null\n})\n\nwatch(\n () => props.modelValue,\n (value) => {\n const current = view.value\n if (!current || value === undefined || kit.externalDocument || toRaw(value) === emitted) return\n replaceBlocks(current, readBlocks(value) ?? [])\n },\n)\n\nwatch(editable, (value) => view.value && setEditable(view.value, value))\nwatch(compareBlocks, () => view.value?.dispatch(view.value.state.tr.setMeta(compareKey, true)))\n\n/** The change last scrolled to, by its place among them. */\nlet changeIndex = -1\nwatch(\n () => props.compare,\n () => (changeIndex = -1),\n)\nfunction goToChange(step: 1 | -1) {\n const dom = view.value?.dom\n if (!dom || !props.compare) return false\n // a block's own mark, or the first piece of text changed in it\n const marks = [\n ...dom.querySelectorAll<HTMLElement>(\n '.dou-editor__diff-added, .dou-editor__diff-changed, .dou-editor__diff-removed-block, .dou-editor__diff-added-text, .dou-editor__diff-removed',\n ),\n ].filter((el, index, list) => {\n const block = el.closest('[data-block-id]')\n const previous = list[index - 1]\n return !previous || previous.closest('[data-block-id]') !== block || !block\n })\n const next = changeIndex + step\n const target = marks[next]\n if (!target) return false\n changeIndex = next\n target.scrollIntoView({ block: 'center' })\n const m = messages.value\n // a block added or removed, or one whose text or kind changed\n const kind = target.matches('.dou-editor__diff-added')\n ? m.changeAdded\n : target.matches('.dou-editor__diff-removed-block')\n ? m.changeRemoved\n : m.changeChanged\n announce(`${kind} ${changeText(target)}`)\n return true\n}\n\n/** The text of a change: what was removed, or its block as it is now. */\nfunction changeText(target: HTMLElement) {\n if (target.matches('.dou-editor__diff-removed-block')) return target.textContent ?? ''\n const block = (target.closest('[data-block-id]') ?? target).cloneNode(true) as HTMLElement\n for (const el of block.querySelectorAll('[data-diff=\"removed\"]')) el.remove()\n return block.textContent ?? ''\n}\n\n/** What the live region reads out: a version restored, the change gone to. */\nconst spoken = ref('')\nfunction announce(text: string) {\n // the same words twice still get read\n spoken.value = ''\n void nextTick(() => (spoken.value = text))\n}\n\nfunction restore(doc: EditorDocument<PartialBlock>) {\n // like the other methods it works while `readonly`, and it is the change comparing allows\n if (!view.value || !restoreBlocks(view.value, readBlocks(doc) ?? [])) return false\n announce(messages.value.restored)\n return true\n}\n\n// a selection from outside: the cursor goes to the block, or the blocks are selected\nwatch(\n () => props.selection,\n (value) => {\n const current = view.value\n if (!current || !value || sameSelection(value, selection)) return\n const known = cursorKnown\n cursorKnown = true\n let applied = false\n if (value.blocks.length > 1) {\n applied = selectBlocks(value.blocks[0]!, value.blocks.at(-1)!)(\n current.state,\n current.dispatch,\n )\n if (!applied) warn('`selection.blocks` must be sibling blocks that exist in the document')\n } else {\n const id = value.block ?? value.blocks[0]\n const transaction = new EditorTransaction(current.state)\n if (id && transaction.focusBlock(id)) {\n current.dispatch(transaction.tr)\n applied = true\n } else if (!id) warn('a selection without blocks cannot be set; the cursor stays where it is')\n }\n if (applied) return\n cursorKnown = known\n // hand back where the selection really is, so the binding doesn't keep a value that never applied\n emit('update:selection', { ...selection, blocks: [...selection.blocks] })\n },\n)\n\nfunction transact(\n fn: (tr: EditorTransaction) => void,\n meta?: EditorTransaction['meta'],\n): EditorTransactionResult | null {\n const current = view.value\n // comparing shows a version: nothing changes it but `restore`\n if (!current || props.compare) return null\n const transaction = new EditorTransaction(current.state, meta, cursorKnown)\n fn(transaction)\n lastResult = null\n // `focusBlock` places the cursor\n if (transaction.focused) cursorKnown = true\n applyEditorTransaction(current, transaction)\n if (transaction.focused) current.focus()\n const result = lastResult\n lastResult = null\n return result\n}\n\nconst history = (action: 'undo' | 'redo', dispatch: boolean) => {\n const current = view.value\n if (!current || props.compare) return false\n const command = historyCommands(current.state)[action]\n return dispatch ? runCommand(current, command) : command(current.state)\n}\n\ndefineExpose<EditorExpose>({\n get view() {\n return view.value\n },\n focus: () => view.value?.focus(),\n blur: () => (view.value?.dom as HTMLElement | undefined)?.blur(),\n getBlocks: () => (view.value ? getBlocks(view.value) : []),\n setBlocks: (blocks: PartialBlock[]) => view.value && replaceBlocks(view.value, blocks),\n getHTML: () => (view.value ? writeHTML(getBlocks(view.value), kit) : ''),\n setHTML: (html: string) => view.value && replaceBlocks(view.value, parseHTML(html, kit)),\n run: (command) => (view.value ? runCommand(view.value, command) : false),\n openSearch: (query) => openSearch(query?.replace !== undefined, query),\n closeSearch,\n transact,\n getBlock: (id) => (view.value ? new EditorTransaction(view.value.state).getBlock(id) : null),\n insertBlocks: (blocks, placement) => {\n let ids: string[] = []\n transact((tr) => (ids = tr.insertBlocks(blocks, placement)))\n return ids\n },\n updateBlock: (id, patch) => {\n let ok = false\n transact((tr) => (ok = tr.updateBlock(id, patch)))\n return ok\n },\n removeBlocks: (ids) => {\n let ok = false\n transact((tr) => (ok = tr.removeBlocks(ids)))\n return ok\n },\n moveBlocks: (ids, placement) => {\n let ok = false\n transact((tr) => (ok = tr.moveBlocks(ids, placement)))\n return ok\n },\n focusBlock: (id, edge) => {\n let ok = false\n transact((tr) => (ok = tr.focusBlock(id, edge)))\n return ok\n },\n getSelection: () => ({ ...selection, blocks: [...selection.blocks] }),\n undo: () => history('undo', true),\n redo: () => history('redo', true),\n get canUndo() {\n return !!state.value && history('undo', false)\n },\n get canRedo() {\n return !!state.value && history('redo', false)\n },\n comment: () => comments.start(),\n getCommentAnchors: anchors,\n restore,\n nextChange: () => goToChange(1),\n previousChange: () => goToChange(-1),\n})\n\n/*\n * Highlights for the threads that are open: by thread id, in one rule,\n * so a thread resolved or opened restyles its text without redrawing it.\n */\nconst scope = useId()\n/** An id as a CSS identifier: no quotes or `<`, which server rendering would escape. */\nconst ident = (id: string) =>\n id.replace(/[^a-zA-Z0-9_]|^[\\d-]/gu, (char) => `\\\\${char.codePointAt(0)!.toString(16)} `)\nconst highlighted = (id: string) => `[data-dou-editor=${ident(scope)}] [data-comment=${ident(id)}]`\nconst highlightCSS = computed(() => {\n if (!comments.enabled.value) return ''\n const open = comments.threads.value.filter((thread) => !thread.resolved)\n if (!open.length) return ''\n let css = `${open.map((thread) => highlighted(thread.id)).join(',')}{background-color:var(--dou-editor-comment-bg);border-bottom-color:var(--dou-editor-comment-line)}`\n const active = comments.active.value\n if (active && open.some((thread) => thread.id === active))\n css += `${highlighted(active)}{background-color:var(--dou-editor-comment-bg-active)}`\n return css\n})\nconst HighlightStyle = () => (highlightCSS.value ? h('style', highlightCSS.value) : null)\n</script>\n\n<template>\n <div\n ref=\"root\"\n :class=\"[\n ns.b(),\n {\n // comparing takes a narrow gutter for the bars beside changed blocks\n 'is-readonly': readonly,\n 'is-comparing': comparing,\n 'is-focused': focused,\n 'is-dragging': dragging,\n },\n ]\"\n :data-dou-editor=\"scope\"\n >\n <div v-if=\"searchOpen && view\" :class=\"ns.e('search')\">\n <SearchBar\n ref=\"searchBar\"\n v-model:replacing=\"searchReplacing\"\n :readonly=\"!editable\"\n :skip=\"searchSkip\"\n @close=\"closeSearch\"\n />\n </div>\n <HighlightStyle />\n <div ref=\"mount\" :class=\"ns.e('mount')\" />\n <template v-if=\"editable && view\">\n <BlockHandle />\n <SlashMenu ref=\"slashMenu\" :slash=\"slash\" />\n <BubbleToolbar ref=\"bubble\" />\n <component :is=\"overlay\" v-for=\"(overlay, index) in kit.overlays\" :key=\"index\" />\n </template>\n <div :class=\"ns.e('live')\" aria-live=\"polite\">{{ spoken }}</div>\n <template v-if=\"view && comments.enabled.value && !comparing\">\n <CommentButton v-if=\"readonly\" />\n <CommentCard />\n </template>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgFA,MAAM,QAAQ;EAoBd,MAAM,OAAO;EAGb,MAAM,WAAW,wBAAwB,MAAM,QAAQ;EACvD,MAAM,MAAM,wBAAwB,MAAM,cAAc,CAAC,UAAU,CAAC,SAAS,SAAS,KAAK;EAE3F,MAAM,yBAAyB,YACvB,MAAM,kBACN;GACJ,QAAQ,KACN,6KACF;GACA,uBAAuB;EACzB,CACF;EAEA,MAAM,KAAK,aAAa,QAAQ;EAChC,MAAM,SAAS,gBAAgB;EAC/B,MAAM,OAAO,eAA4B,MAAM;EAC/C,MAAM,QAAQ,eAA4B,OAAO;EACjD,MAAM,OAAO,WAA8B,IAAI;EAC/C,MAAM,QAAQ,WAA+B,IAAI;EACjD,MAAM,UAAU,WAAW,KAAK;EAChC,MAAM,WAAW,WAAW,KAAK;;EAEjC,MAAM,YAAY,eAAe,CAAC,CAAC,MAAM,OAAO;;;;;EAKhD,MAAM,gBAAgB,eAAe;GACnC,MAAM,SAAS,MAAM,SAAS;GAC9B,OAAO,MAAM,QAAQ,MAAM,IAAI,YAAY,YAAY,IAAI,QAAQ,MAAM,CAAC,IAAI;EAChF,CAAC;EACD,MAAM,WAAW,eAAe,CAAC,MAAM,YAAY,CAAC,UAAU,KAAK;EAEnE,MAAM,EACJ,UACA,QAAQ,eACR,YACE,kBAAkB;GACpB;GACA;GACA;GACA,UAAU,IAAI;EAChB,CAAC;EAED,MAAM,UAAU;GAAE;GAAM;GAAO;GAAS;GAAU;GAAU;GAAU;GAAM;GAAK;EAAS;EAC1F,QAAQ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CAAA;IACvC,KAAA,SAAQZ,MAAA,QAAA,CAAQ,CAAC,QAAQ,SAAK,CAAK,UAAA,SAAnDH,UAAA,GAAAC,mBAGWO,UAAA,EAAA,KAAA,EAAA,GAAA,CAFY,QAAA,YAArBR,UAAA,GAAAa,YAAiCG,wBAAA,EAAA,KAAA,EAAA,CAAA,K,8BACjCZ,YAAea,oBAAA,C"}
1
+ {"version":3,"file":"editor.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createVNode","SearchBar","_createCommentVNode","_createElementVNode","_Fragment","BlockHandle","SlashMenu","BubbleToolbar","_renderList","_createBlock","_resolveDynamicComponent","_toDisplayString","CommentButton","CommentCard"],"sources":["../src/editor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { isApplePlatform, useGlobalConfig, useNamespace } from 'dou-ui'\nimport { keymap } from 'prosemirror-keymap'\nimport { Plugin, type EditorState, type Transaction } from 'prosemirror-state'\nimport type { EditorView } from 'prosemirror-view'\nimport {\n computed,\n getCurrentInstance,\n nextTick,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n toRaw,\n useTemplateRef,\n watch,\n h,\n useId,\n type Component,\n} from 'vue'\nimport BlockHandle from './components/block-handle.vue'\nimport BubbleToolbar from './components/bubble-toolbar.vue'\nimport SearchBar from './components/search-bar.vue'\nimport CommentButton from './components/comment-button.vue'\nimport CommentCard from './components/comment-card.vue'\nimport SlashMenu from './components/slash-menu.vue'\nimport { setFallbackHighlighter, type CodeHighlighter } from './core/highlight'\nimport { comparePlugin, compareKey } from './core/compare'\nimport {\n createEditorView,\n getBlocks,\n historyCommands,\n originKey,\n replaceBlocks,\n restoreBlocks,\n runCommand,\n setEditable,\n} from './core/editor'\nimport { diffBlocks } from './core/changes'\nimport { isRemote } from './core/plugins'\nimport { selectionOf, sameSelection } from './core/selection'\nimport { selectBlocks } from './core/block-selection'\nimport { applyEditorTransaction, EditorTransaction } from './core/transaction'\nimport {\n blocksToDoc,\n docToBlocks,\n type Block,\n type EditorDocument,\n type PartialBlock,\n} from './core/model'\nimport { resolveEditorExtensions } from './core/extension'\nimport {\n previewMatch,\n searchKey,\n searchPlugin,\n setSearch,\n type EditorSearchQuery,\n} from './core/search'\nimport { slashPlugin, type SlashState } from './core/slash'\nimport { writeHTML } from './core/output'\nimport { parseHTML } from './core/prepare'\nimport { componentMounter, vueNodeView } from './define-block'\nimport { editorKit } from './extensions/editor-kit'\nimport { readBlocks } from './document'\nimport {\n editorKey,\n type EditorEmits,\n type EditorExpose,\n type EditorProps,\n type EditorOrigin,\n type EditorLinkOpenEvent,\n type EditorSelection,\n type EditorTransactionResult,\n} from './editor'\nimport { useEditorMessages } from './locale'\nimport { useEditorComments } from './use-comments'\n\ndefineOptions({ name: 'DouEditor' })\n\nconst props = withDefaults(defineProps<EditorProps>(), {\n modelValue: undefined,\n extensions: undefined,\n readonly: false,\n searchable: true,\n placeholder: undefined,\n messages: undefined,\n ariaLabel: undefined,\n autofocus: false,\n plugins: undefined,\n history: true,\n undo: undefined,\n redo: undefined,\n selection: undefined,\n comments: undefined,\n author: undefined,\n activeComment: undefined,\n commentable: true,\n compare: undefined,\n})\nconst emit = defineEmits<EditorEmits>()\n\n// read once: changing the schema of a live editor would invalidate its document\nconst messages = useEditorMessages(() => props.messages)\nconst kit = resolveEditorExtensions(props.extensions ?? [editorKit()], () => messages.value)\n// say so once, instead of silently keeping the old extensions\nconst stopWatchingExtensions = watch(\n () => props.extensions,\n () => {\n console.warn(\n '[@dou-ui/editor] `extensions` changed after mount and is ignored: it is read once. Create the list once outside the template, or give the editor a new `key` to rebuild it.',\n )\n stopWatchingExtensions()\n },\n)\n\nconst ns = useNamespace('editor')\nconst config = useGlobalConfig()\nconst root = useTemplateRef<HTMLElement>('root')\nconst mount = useTemplateRef<HTMLElement>('mount')\nconst view = shallowRef<EditorView | null>(null)\nconst state = shallowRef<EditorState | null>(null)\nconst focused = shallowRef(false)\nconst dragging = shallowRef(false)\n/** Showing what changed since an older version: read-only, without comments. */\nconst comparing = computed(() => !!props.compare)\n/**\n * The older version as whole blocks, matched to the current ones by id. A\n * block saved without an id gets a new one, so it shows as removed.\n */\nconst compareBlocks = computed(() => {\n const blocks = props.compare?.blocks\n return Array.isArray(blocks) ? docToBlocks(blocksToDoc(kit.schema, blocks)) : null\n})\nconst editable = computed(() => !props.readonly && !comparing.value)\n\nconst {\n comments,\n plugin: commentPlugin,\n anchors,\n scrollToComment,\n} = useEditorComments({\n props,\n emit,\n view,\n provider: kit.comments,\n})\n\nconst context = { view, state, focused, dragging, editable, messages, root, kit, comments }\nprovide(editorKey, context)\n\n// block components render outside this component's tree: hand them the context\nconst appContext = getCurrentInstance()?.appContext ?? null\nconst mountComponent = componentMounter(appContext, [[editorKey, context]])\nconst componentViews = {\n ...Object.fromEntries(\n Object.entries(kit.schema.nodes)\n .filter(([, type]) => type.spec.component)\n .map(([name, type]) => [\n name,\n vueNodeView(type.spec.component as Component, appContext, [[editorKey, context]]),\n ]),\n ),\n ...Object.fromEntries(\n Object.entries(kit.componentViews).map(([name, create]) => [name, create(mountComponent)]),\n ),\n}\n\n// find and replace: the panel over the text, the matches marked in it\nconst searchOpen = ref(false)\nconst searchReplacing = ref(false)\nconst searchBar = useTemplateRef<InstanceType<typeof SearchBar>>('searchBar')\n/** Blocks that draw their own text, such as a code block in the code editor, are not searched. */\nconst searchSkip = (node: { type: { name: string } }) => node.type.name in kit.componentViews\n\n/** Opens the panel, with the replace box for `replace`. A selection on one line becomes the search. */\nfunction openSearch(replace = false, given?: Partial<EditorSearchQuery>) {\n const v = view.value\n if (!v || !props.searchable) return false\n const old = searchKey.getState(v.state)?.query ?? { search: '' }\n const query = { ...old, ...given }\n const { from, to, empty } = v.state.selection\n if (given?.search === undefined && !empty) {\n const text = v.state.doc.textBetween(from, to, '\\n')\n if (text && !text.includes('\\n')) query.search = text\n }\n if ((replace || given?.replace !== undefined) && editable.value) searchReplacing.value = true\n searchOpen.value = true\n v.dispatch(setSearch(v.state.tr, { query, active: true }))\n const preview = previewMatch(v.state)\n if (preview) v.dispatch(preview)\n void nextTick(() => searchBar.value?.focus(replace && editable.value ? 'replace' : 'find'))\n return true\n}\n\nfunction closeSearch() {\n const v = view.value\n if (!searchOpen.value || !v) return false\n searchOpen.value = false\n v.dispatch(setSearch(v.state.tr, { active: false }))\n v.focus()\n return true\n}\n\n/** Goes to the next (or previous) match; with the panel shut, opens it on the last search. */\nfunction findAgain(step: 1 | -1) {\n if (!searchOpen.value) {\n const v = view.value\n if (!v || !searchKey.getState(v.state)?.query.search || !openSearch()) return false\n }\n void nextTick(() => (step > 0 ? searchBar.value?.next() : searchBar.value?.previous()))\n return true\n}\n\nconst replaceKey = isApplePlatform() ? 'Mod-Alt-f' : 'Mod-h'\nconst searchKeys = keymap({\n 'Mod-f': () => openSearch(),\n [replaceKey]: () => openSearch(true),\n F3: () => findAgain(1),\n 'Mod-g': () => findAgain(1),\n 'Shift-F3': () => findAgain(-1),\n 'Mod-Shift-g': () => findAgain(-1),\n Escape: () => closeSearch(),\n})\n\nconst slash = shallowRef<SlashState | null>(null)\nconst slashMenu = useTemplateRef<InstanceType<typeof SlashMenu>>('slashMenu')\nconst bubble = useTemplateRef<InstanceType<typeof BubbleToolbar>>('bubble')\n\n// The document last sent through `v-model`: when the same object comes back,\n// it is not loaded again (that would move the cursor).\nlet emitted: EditorDocument | undefined\n\n// the result of the last change, for `transact` to hand back\nlet lastResult: EditorTransactionResult | null = null\n\nfunction onChange(current: EditorView, tr: Transaction, before: EditorState) {\n const blocks = getBlocks(current)\n const doc: EditorDocument = { version: 1, blocks }\n emitted = doc\n const history = tr.getMeta('history$') as { redo: boolean } | undefined\n const origin =\n (tr.getMeta(originKey) as EditorOrigin | undefined) ??\n (history ? (history.redo ? 'redo' : 'undo') : isRemote(tr) ? 'remote' : undefined)\n const meta: EditorTransactionResult['meta'] = {\n history:\n tr.getMeta('addToHistory') !== false &&\n origin !== 'remote' &&\n origin !== 'undo' &&\n origin !== 'redo',\n }\n if (origin !== undefined) meta.origin = origin\n lastResult = { blocks, changes: diffBlocks(before.doc, current.state.doc), meta }\n emit('transaction', lastResult)\n emit('update:modelValue', doc)\n emit('change', doc)\n}\n\nlet selection: EditorSelection = { block: null, blocks: [] }\n\nconst warn = (message: string) => {\n if (process.env.NODE_ENV !== 'production') console.warn(`[@dou-ui/editor] ${message}`)\n}\n\nconst lacksId = (blocks: PartialBlock[]): boolean =>\n blocks.some((block) => !block.id || lacksId(block.children ?? []))\n// until the editor is focused (or a block is, by the program) its selection is no cursor\nlet cursorKnown = false\n\nfunction onUpdate(current: EditorView) {\n state.value = current.state\n if (!cursorKnown) {\n if (!focused.value) return\n cursorKnown = true\n }\n const next = selectionOf(current.state)\n if (sameSelection(next, selection)) return\n selection = next\n emit('update:selection', next)\n}\n\n// a click on a link places the cursor; with Ctrl or ⌘ held, or while read-only, it opens the link\nconst openLinks = new Plugin({\n props: {\n handleDOMEvents: {\n click(clicked, event) {\n const link = (event.target as HTMLElement).closest<HTMLAnchorElement>('a.dou-editor__link')\n if (!link?.href || !(event.metaKey || event.ctrlKey || !clicked.editable)) return false\n event.preventDefault()\n const $pos = clicked.state.doc.resolve(clicked.posAtDOM(link, 0))\n let block = ''\n for (let depth = $pos.depth; depth > 0; depth--)\n if ($pos.node(depth).type.name === 'block') {\n block = $pos.node(depth).attrs.id as string\n break\n }\n const opening: EditorLinkOpenEvent = {\n link: link.getAttribute('href') ?? link.href,\n block,\n defaultPrevented: false,\n preventDefault() {\n this.defaultPrevented = true\n },\n }\n emit('linkOpen', opening)\n if (!opening.defaultPrevented) window.open(link.href, '_blank', 'noopener,noreferrer')\n return true\n },\n },\n },\n})\n\nonMounted(() => {\n const instance = createEditorView({\n element: mount.value!,\n kit,\n nodeViews: componentViews,\n // with collaboration the document comes from the shared document\n blocks: kit.externalDocument ? [] : readBlocks(props.modelValue),\n editable: editable.value,\n placeholder: {\n text: () => props.placeholder ?? messages.value.placeholder,\n heading: () => messages.value.headingPlaceholder,\n empty: () => props.placeholder ?? messages.value.emptyPlaceholder,\n },\n plugins: [\n ...(props.plugins ?? []),\n slashPlugin({\n onChange: (value) => (slash.value = value),\n onKey: (event) => slashMenu.value?.onKey(event) ?? false,\n }),\n keymap({\n 'Mod-k': () => bubble.value?.editLink() ?? false,\n 'Mod-Alt-m': () => comments.start(),\n // with the thread card open, Escape in the text closes it, and only that\n Escape: () => {\n if (!comments.pending.value && !comments.active.value) return false\n comments.close()\n return true\n },\n }),\n commentPlugin,\n comparePlugin({\n before: () => compareBlocks.value,\n label: () => messages.value.removedBlock,\n }),\n openLinks,\n searchPlugin({ skip: searchSkip }),\n ],\n keymaps: [searchKeys],\n history: props.history,\n undo: props.undo,\n redo: props.redo,\n attributes: () => {\n const attrs: Record<string, string> = {}\n if (props.ariaLabel) attrs['aria-label'] = props.ariaLabel\n if (!editable.value) attrs['aria-readonly'] = 'true'\n return attrs\n },\n onChange,\n onUpdate,\n })\n view.value = instance\n state.value = instance.state\n // code blocks without their own highlighter use the one DouCodeBlock uses\n watch(\n () =>\n (config.value.defaults as { DouCodeBlock?: { highlight?: CodeHighlighter } }).DouCodeBlock\n ?.highlight ?? null,\n (highlight) => setFallbackHighlighter(instance, highlight),\n { immediate: true },\n )\n instance.dom.addEventListener('focus', onFocus)\n instance.dom.addEventListener('blur', onBlur)\n if (props.autofocus) instance.focus()\n // blocks given without ids got them now: hand those back, so events' ids can be looked up\n const given = kit.externalDocument ? undefined : readBlocks(props.modelValue)\n if (given && lacksId(given)) {\n const doc: EditorDocument = { version: 1, blocks: getBlocks(instance) }\n emitted = doc\n emit('update:modelValue', doc)\n }\n})\n\nfunction onFocus(event: FocusEvent) {\n focused.value = true\n if (!cursorKnown && view.value) {\n cursorKnown = true\n const next = selectionOf(view.value.state)\n if (!sameSelection(next, selection)) {\n selection = next\n emit('update:selection', next)\n }\n }\n emit('focus', event)\n}\n\nfunction onBlur(event: FocusEvent) {\n focused.value = false\n emit('blur', event)\n}\n\nonBeforeUnmount(() => {\n view.value?.destroy()\n view.value = null\n})\n\nwatch(\n () => props.modelValue,\n (value) => {\n const current = view.value\n if (!current || value === undefined || kit.externalDocument || toRaw(value) === emitted) return\n replaceBlocks(current, readBlocks(value) ?? [])\n },\n)\n\nwatch(editable, (value) => view.value && setEditable(view.value, value))\nwatch(compareBlocks, () => view.value?.dispatch(view.value.state.tr.setMeta(compareKey, true)))\n\n/** The change last scrolled to, by its place among them. */\nlet changeIndex = -1\nwatch(\n () => props.compare,\n () => (changeIndex = -1),\n)\nfunction goToChange(step: 1 | -1) {\n const dom = view.value?.dom\n if (!dom || !props.compare) return false\n // a block's own mark, or the first piece of text changed in it\n const marks = [\n ...dom.querySelectorAll<HTMLElement>(\n '.dou-editor__diff-added, .dou-editor__diff-changed, .dou-editor__diff-removed-block, .dou-editor__diff-added-text, .dou-editor__diff-removed',\n ),\n ].filter((el, index, list) => {\n const block = el.closest('[data-block-id]')\n const previous = list[index - 1]\n return !previous || previous.closest('[data-block-id]') !== block || !block\n })\n const next = changeIndex + step\n const target = marks[next]\n if (!target) return false\n changeIndex = next\n target.scrollIntoView({ block: 'center' })\n const m = messages.value\n // a block added or removed, or one whose text or kind changed\n const kind = target.matches('.dou-editor__diff-added')\n ? m.changeAdded\n : target.matches('.dou-editor__diff-removed-block')\n ? m.changeRemoved\n : m.changeChanged\n announce(`${kind} ${changeText(target)}`)\n return true\n}\n\n/** The text of a change: what was removed, or its block as it is now. */\nfunction changeText(target: HTMLElement) {\n if (target.matches('.dou-editor__diff-removed-block')) return target.textContent ?? ''\n const block = (target.closest('[data-block-id]') ?? target).cloneNode(true) as HTMLElement\n for (const el of block.querySelectorAll('[data-diff=\"removed\"]')) el.remove()\n return block.textContent ?? ''\n}\n\n/** What the live region reads out: a version restored, the change gone to. */\nconst spoken = ref('')\nfunction announce(text: string) {\n // the same words twice still get read\n spoken.value = ''\n void nextTick(() => (spoken.value = text))\n}\n\nfunction restore(doc: EditorDocument<PartialBlock>) {\n // like the other methods it works while `readonly`, and it is the change comparing allows\n if (!view.value || !restoreBlocks(view.value, readBlocks(doc) ?? [])) return false\n announce(messages.value.restored)\n return true\n}\n\n// a selection from outside: the cursor goes to the block, or the blocks are selected\nwatch(\n () => props.selection,\n (value) => {\n const current = view.value\n if (!current || !value || sameSelection(value, selection)) return\n const known = cursorKnown\n cursorKnown = true\n let applied = false\n if (value.blocks.length > 1) {\n applied = selectBlocks(value.blocks[0]!, value.blocks.at(-1)!)(\n current.state,\n current.dispatch,\n )\n if (!applied) warn('`selection.blocks` must be sibling blocks that exist in the document')\n } else {\n const id = value.block ?? value.blocks[0]\n const transaction = new EditorTransaction(current.state)\n if (id && transaction.focusBlock(id)) {\n current.dispatch(transaction.tr)\n applied = true\n } else if (!id) warn('a selection without blocks cannot be set; the cursor stays where it is')\n }\n if (applied) return\n cursorKnown = known\n // hand back where the selection really is, so the binding doesn't keep a value that never applied\n emit('update:selection', { ...selection, blocks: [...selection.blocks] })\n },\n)\n\nfunction transact(\n fn: (tr: EditorTransaction) => void,\n meta?: EditorTransaction['meta'],\n): EditorTransactionResult | null {\n const current = view.value\n // comparing shows a version: nothing changes it but `restore`\n if (!current || props.compare) return null\n const transaction = new EditorTransaction(current.state, meta, cursorKnown)\n fn(transaction)\n lastResult = null\n // `focusBlock` places the cursor\n if (transaction.focused) cursorKnown = true\n applyEditorTransaction(current, transaction)\n if (transaction.focused) current.focus()\n const result = lastResult\n lastResult = null\n return result\n}\n\nconst history = (action: 'undo' | 'redo', dispatch: boolean) => {\n const current = view.value\n if (!current || props.compare) return false\n const command = historyCommands(current.state)[action]\n return dispatch ? runCommand(current, command) : command(current.state)\n}\n\ndefineExpose<EditorExpose>({\n get view() {\n return view.value\n },\n focus: () => view.value?.focus(),\n blur: () => (view.value?.dom as HTMLElement | undefined)?.blur(),\n getBlocks: () => (view.value ? getBlocks(view.value) : []),\n setBlocks: (blocks: PartialBlock[]) => view.value && replaceBlocks(view.value, blocks),\n getHTML: () => (view.value ? writeHTML(getBlocks(view.value), kit) : ''),\n setHTML: (html: string) => view.value && replaceBlocks(view.value, parseHTML(html, kit)),\n run: (command) => (view.value ? runCommand(view.value, command) : false),\n openSearch: (query) => openSearch(query?.replace !== undefined, query),\n closeSearch,\n transact,\n getBlock: (id) => (view.value ? new EditorTransaction(view.value.state).getBlock(id) : null),\n insertBlocks: (blocks, placement) => {\n let ids: string[] = []\n transact((tr) => (ids = tr.insertBlocks(blocks, placement)))\n return ids\n },\n updateBlock: (id, patch) => {\n let ok = false\n transact((tr) => (ok = tr.updateBlock(id, patch)))\n return ok\n },\n removeBlocks: (ids) => {\n let ok = false\n transact((tr) => (ok = tr.removeBlocks(ids)))\n return ok\n },\n moveBlocks: (ids, placement) => {\n let ok = false\n transact((tr) => (ok = tr.moveBlocks(ids, placement)))\n return ok\n },\n focusBlock: (id, edge) => {\n let ok = false\n transact((tr) => (ok = tr.focusBlock(id, edge)))\n return ok\n },\n getSelection: () => ({ ...selection, blocks: [...selection.blocks] }),\n undo: () => history('undo', true),\n redo: () => history('redo', true),\n get canUndo() {\n return !!state.value && history('undo', false)\n },\n get canRedo() {\n return !!state.value && history('redo', false)\n },\n comment: () => comments.start(),\n getCommentAnchors: anchors,\n scrollToComment,\n restore,\n nextChange: () => goToChange(1),\n previousChange: () => goToChange(-1),\n})\n\n/*\n * Highlights for the threads that are open: by thread id, in one rule,\n * so a thread resolved or opened restyles its text without redrawing it.\n */\nconst scope = useId()\n/** An id as a CSS identifier: no quotes or `<`, which server rendering would escape. */\nconst ident = (id: string) =>\n id.replace(/[^a-zA-Z0-9_]|^[\\d-]/gu, (char) => `\\\\${char.codePointAt(0)!.toString(16)} `)\nconst highlighted = (id: string) => `[data-dou-editor=${ident(scope)}] [data-comment=${ident(id)}]`\nconst highlightCSS = computed(() => {\n if (!comments.enabled.value) return ''\n const open = comments.threads.value.filter((thread) => !thread.resolved)\n if (!open.length) return ''\n let css = `${open.map((thread) => highlighted(thread.id)).join(',')}{background-color:var(--dou-editor-comment-bg);border-bottom-color:var(--dou-editor-comment-line);--dou-editor-code-py:0;--dou-editor-code-bg:var(--dou-editor-comment-code-bg);--dou-editor-code-border:var(--dou-editor-comment-code-border)}`\n const active = comments.active.value\n if (active && open.some((thread) => thread.id === active))\n css += `${highlighted(active)}{background-color:var(--dou-editor-comment-bg-active)}`\n return css\n})\nconst HighlightStyle = () => (highlightCSS.value ? h('style', highlightCSS.value) : null)\n</script>\n\n<template>\n <div\n ref=\"root\"\n :class=\"[\n ns.b(),\n {\n // comparing takes a narrow gutter for the bars beside changed blocks\n 'is-readonly': readonly,\n 'is-comparing': comparing,\n 'is-focused': focused,\n 'is-dragging': dragging,\n },\n ]\"\n :data-dou-editor=\"scope\"\n >\n <div v-if=\"searchOpen && view\" :class=\"ns.e('search')\">\n <SearchBar\n ref=\"searchBar\"\n v-model:replacing=\"searchReplacing\"\n :readonly=\"!editable\"\n :skip=\"searchSkip\"\n @close=\"closeSearch\"\n />\n </div>\n <HighlightStyle />\n <div ref=\"mount\" :class=\"ns.e('mount')\" />\n <template v-if=\"editable && view\">\n <BlockHandle />\n <SlashMenu ref=\"slashMenu\" :slash=\"slash\" />\n <BubbleToolbar ref=\"bubble\" />\n <component :is=\"overlay\" v-for=\"(overlay, index) in kit.overlays\" :key=\"index\" />\n </template>\n <div :class=\"ns.e('live')\" aria-live=\"polite\">{{ spoken }}</div>\n <template v-if=\"view && comments.enabled.value && !comparing\">\n <CommentButton v-if=\"readonly\" />\n <CommentCard />\n </template>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgFA,MAAM,QAAQ;EAoBd,MAAM,OAAO;EAGb,MAAM,WAAW,wBAAwB,MAAM,QAAQ;EACvD,MAAM,MAAM,wBAAwB,MAAM,cAAc,CAAC,UAAU,CAAC,SAAS,SAAS,KAAK;EAE3F,MAAM,yBAAyB,YACvB,MAAM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A,OAAA,OAAA,MAAA,WAAA,gBAAe,QAAA;KACjC,UAAQ,CAAG,SAAA;KACX,MAAM;KACN,SAAO;;IAGZD,YAAkB,cAAA;IAClBG,mBAA0C,OAAA;KAAjC,SAAA;KAAJ,KAAI;KAAS,OAAKL,eAAEC,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;;IACb,SAAA,SAAY,KAAA,SAA5BH,UAAA,GAAAC,mBAKWO,UAAA,EAAA,KAAA,EAAA,GAAA;KAJTJ,YAAeK,oBAAA;KACfL,YAA4CM,oBAAA;MAA7B,SAAA;MAAJ,KAAI;MAAa,OAAO,MAAA;;KACnCN,YAA8BO,wBAAA;MAAX,SAAA;MAAJ,KAAI;;MACnBX,UAAA,IAAA,GAAAC,mBAAiFO,UAAA,MAAAI,WAA7BT,MAAA,GAAA,CAAG,CAAC,WAAvB,SAAS,UAAK;MAA/C,OAAAH,UAAA,GAAAa,YAAiFC,wBAAjE,OAAO,GAAA,EAA4C,KAAK,MAAK,CAAA;;;IAE/EP,mBAAgE,OAAA;KAA1D,OAAKL,eAAEC,MAAA,EAAA,CAAE,CAAC,EAAC,MAAA,CAAA;KAAU,aAAU;IAAY,GAAAY,gBAAA,OAAA,KAAM,GAAA,CAAA;IACvC,KAAA,SAAQZ,MAAA,QAAA,CAAQ,CAAC,QAAQ,SAAK,CAAK,UAAA,SAAnDH,UAAA,GAAAC,mBAGWO,UAAA,EAAA,KAAA,EAAA,GAAA,CAFY,QAAA,YAArBR,UAAA,GAAAa,YAAiCG,wBAAA,EAAA,KAAA,EAAA,CAAA,K,8BACjCZ,YAAea,oBAAA,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"editor2.js","names":["_sfc_main"],"sources":["../src/editor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { isApplePlatform, useGlobalConfig, useNamespace } from 'dou-ui'\nimport { keymap } from 'prosemirror-keymap'\nimport { Plugin, type EditorState, type Transaction } from 'prosemirror-state'\nimport type { EditorView } from 'prosemirror-view'\nimport {\n computed,\n getCurrentInstance,\n nextTick,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n toRaw,\n useTemplateRef,\n watch,\n h,\n useId,\n type Component,\n} from 'vue'\nimport BlockHandle from './components/block-handle.vue'\nimport BubbleToolbar from './components/bubble-toolbar.vue'\nimport SearchBar from './components/search-bar.vue'\nimport CommentButton from './components/comment-button.vue'\nimport CommentCard from './components/comment-card.vue'\nimport SlashMenu from './components/slash-menu.vue'\nimport { setFallbackHighlighter, type CodeHighlighter } from './core/highlight'\nimport { comparePlugin, compareKey } from './core/compare'\nimport {\n createEditorView,\n getBlocks,\n historyCommands,\n originKey,\n replaceBlocks,\n restoreBlocks,\n runCommand,\n setEditable,\n} from './core/editor'\nimport { diffBlocks } from './core/changes'\nimport { isRemote } from './core/plugins'\nimport { selectionOf, sameSelection } from './core/selection'\nimport { selectBlocks } from './core/block-selection'\nimport { applyEditorTransaction, EditorTransaction } from './core/transaction'\nimport {\n blocksToDoc,\n docToBlocks,\n type Block,\n type EditorDocument,\n type PartialBlock,\n} from './core/model'\nimport { resolveEditorExtensions } from './core/extension'\nimport {\n previewMatch,\n searchKey,\n searchPlugin,\n setSearch,\n type EditorSearchQuery,\n} from './core/search'\nimport { slashPlugin, type SlashState } from './core/slash'\nimport { writeHTML } from './core/output'\nimport { parseHTML } from './core/prepare'\nimport { componentMounter, vueNodeView } from './define-block'\nimport { editorKit } from './extensions/editor-kit'\nimport { readBlocks } from './document'\nimport {\n editorKey,\n type EditorEmits,\n type EditorExpose,\n type EditorProps,\n type EditorOrigin,\n type EditorLinkOpenEvent,\n type EditorSelection,\n type EditorTransactionResult,\n} from './editor'\nimport { useEditorMessages } from './locale'\nimport { useEditorComments } from './use-comments'\n\ndefineOptions({ name: 'DouEditor' })\n\nconst props = withDefaults(defineProps<EditorProps>(), {\n modelValue: undefined,\n extensions: undefined,\n readonly: false,\n searchable: true,\n placeholder: undefined,\n messages: undefined,\n ariaLabel: undefined,\n autofocus: false,\n plugins: undefined,\n history: true,\n undo: undefined,\n redo: undefined,\n selection: undefined,\n comments: undefined,\n author: undefined,\n activeComment: undefined,\n commentable: true,\n compare: undefined,\n})\nconst emit = defineEmits<EditorEmits>()\n\n// read once: changing the schema of a live editor would invalidate its document\nconst messages = useEditorMessages(() => props.messages)\nconst kit = resolveEditorExtensions(props.extensions ?? [editorKit()], () => messages.value)\n// say so once, instead of silently keeping the old extensions\nconst stopWatchingExtensions = watch(\n () => props.extensions,\n () => {\n console.warn(\n '[@dou-ui/editor] `extensions` changed after mount and is ignored: it is read once. Create the list once outside the template, or give the editor a new `key` to rebuild it.',\n )\n stopWatchingExtensions()\n },\n)\n\nconst ns = useNamespace('editor')\nconst config = useGlobalConfig()\nconst root = useTemplateRef<HTMLElement>('root')\nconst mount = useTemplateRef<HTMLElement>('mount')\nconst view = shallowRef<EditorView | null>(null)\nconst state = shallowRef<EditorState | null>(null)\nconst focused = shallowRef(false)\nconst dragging = shallowRef(false)\n/** Showing what changed since an older version: read-only, without comments. */\nconst comparing = computed(() => !!props.compare)\n/**\n * The older version as whole blocks, matched to the current ones by id. A\n * block saved without an id gets a new one, so it shows as removed.\n */\nconst compareBlocks = computed(() => {\n const blocks = props.compare?.blocks\n return Array.isArray(blocks) ? docToBlocks(blocksToDoc(kit.schema, blocks)) : null\n})\nconst editable = computed(() => !props.readonly && !comparing.value)\n\nconst {\n comments,\n plugin: commentPlugin,\n anchors,\n} = useEditorComments({\n props,\n emit,\n view,\n provider: kit.comments,\n})\n\nconst context = { view, state, focused, dragging, editable, messages, root, kit, comments }\nprovide(editorKey, context)\n\n// block components render outside this component's tree: hand them the context\nconst appContext = getCurrentInstance()?.appContext ?? null\nconst mountComponent = componentMounter(appContext, [[editorKey, context]])\nconst componentViews = {\n ...Object.fromEntries(\n Object.entries(kit.schema.nodes)\n .filter(([, type]) => type.spec.component)\n .map(([name, type]) => [\n name,\n vueNodeView(type.spec.component as Component, appContext, [[editorKey, context]]),\n ]),\n ),\n ...Object.fromEntries(\n Object.entries(kit.componentViews).map(([name, create]) => [name, create(mountComponent)]),\n ),\n}\n\n// find and replace: the panel over the text, the matches marked in it\nconst searchOpen = ref(false)\nconst searchReplacing = ref(false)\nconst searchBar = useTemplateRef<InstanceType<typeof SearchBar>>('searchBar')\n/** Blocks that draw their own text, such as a code block in the code editor, are not searched. */\nconst searchSkip = (node: { type: { name: string } }) => node.type.name in kit.componentViews\n\n/** Opens the panel, with the replace box for `replace`. A selection on one line becomes the search. */\nfunction openSearch(replace = false, given?: Partial<EditorSearchQuery>) {\n const v = view.value\n if (!v || !props.searchable) return false\n const old = searchKey.getState(v.state)?.query ?? { search: '' }\n const query = { ...old, ...given }\n const { from, to, empty } = v.state.selection\n if (given?.search === undefined && !empty) {\n const text = v.state.doc.textBetween(from, to, '\\n')\n if (text && !text.includes('\\n')) query.search = text\n }\n if ((replace || given?.replace !== undefined) && editable.value) searchReplacing.value = true\n searchOpen.value = true\n v.dispatch(setSearch(v.state.tr, { query, active: true }))\n const preview = previewMatch(v.state)\n if (preview) v.dispatch(preview)\n void nextTick(() => searchBar.value?.focus(replace && editable.value ? 'replace' : 'find'))\n return true\n}\n\nfunction closeSearch() {\n const v = view.value\n if (!searchOpen.value || !v) return false\n searchOpen.value = false\n v.dispatch(setSearch(v.state.tr, { active: false }))\n v.focus()\n return true\n}\n\n/** Goes to the next (or previous) match; with the panel shut, opens it on the last search. */\nfunction findAgain(step: 1 | -1) {\n if (!searchOpen.value) {\n const v = view.value\n if (!v || !searchKey.getState(v.state)?.query.search || !openSearch()) return false\n }\n void nextTick(() => (step > 0 ? searchBar.value?.next() : searchBar.value?.previous()))\n return true\n}\n\nconst replaceKey = isApplePlatform() ? 'Mod-Alt-f' : 'Mod-h'\nconst searchKeys = keymap({\n 'Mod-f': () => openSearch(),\n [replaceKey]: () => openSearch(true),\n F3: () => findAgain(1),\n 'Mod-g': () => findAgain(1),\n 'Shift-F3': () => findAgain(-1),\n 'Mod-Shift-g': () => findAgain(-1),\n Escape: () => closeSearch(),\n})\n\nconst slash = shallowRef<SlashState | null>(null)\nconst slashMenu = useTemplateRef<InstanceType<typeof SlashMenu>>('slashMenu')\nconst bubble = useTemplateRef<InstanceType<typeof BubbleToolbar>>('bubble')\n\n// The document last sent through `v-model`: when the same object comes back,\n// it is not loaded again (that would move the cursor).\nlet emitted: EditorDocument | undefined\n\n// the result of the last change, for `transact` to hand back\nlet lastResult: EditorTransactionResult | null = null\n\nfunction onChange(current: EditorView, tr: Transaction, before: EditorState) {\n const blocks = getBlocks(current)\n const doc: EditorDocument = { version: 1, blocks }\n emitted = doc\n const history = tr.getMeta('history$') as { redo: boolean } | undefined\n const origin =\n (tr.getMeta(originKey) as EditorOrigin | undefined) ??\n (history ? (history.redo ? 'redo' : 'undo') : isRemote(tr) ? 'remote' : undefined)\n const meta: EditorTransactionResult['meta'] = {\n history:\n tr.getMeta('addToHistory') !== false &&\n origin !== 'remote' &&\n origin !== 'undo' &&\n origin !== 'redo',\n }\n if (origin !== undefined) meta.origin = origin\n lastResult = { blocks, changes: diffBlocks(before.doc, current.state.doc), meta }\n emit('transaction', lastResult)\n emit('update:modelValue', doc)\n emit('change', doc)\n}\n\nlet selection: EditorSelection = { block: null, blocks: [] }\n\nconst warn = (message: string) => {\n if (process.env.NODE_ENV !== 'production') console.warn(`[@dou-ui/editor] ${message}`)\n}\n\nconst lacksId = (blocks: PartialBlock[]): boolean =>\n blocks.some((block) => !block.id || lacksId(block.children ?? []))\n// until the editor is focused (or a block is, by the program) its selection is no cursor\nlet cursorKnown = false\n\nfunction onUpdate(current: EditorView) {\n state.value = current.state\n if (!cursorKnown) {\n if (!focused.value) return\n cursorKnown = true\n }\n const next = selectionOf(current.state)\n if (sameSelection(next, selection)) return\n selection = next\n emit('update:selection', next)\n}\n\n// a click on a link places the cursor; with Ctrl or ⌘ held, or while read-only, it opens the link\nconst openLinks = new Plugin({\n props: {\n handleDOMEvents: {\n click(clicked, event) {\n const link = (event.target as HTMLElement).closest<HTMLAnchorElement>('a.dou-editor__link')\n if (!link?.href || !(event.metaKey || event.ctrlKey || !clicked.editable)) return false\n event.preventDefault()\n const $pos = clicked.state.doc.resolve(clicked.posAtDOM(link, 0))\n let block = ''\n for (let depth = $pos.depth; depth > 0; depth--)\n if ($pos.node(depth).type.name === 'block') {\n block = $pos.node(depth).attrs.id as string\n break\n }\n const opening: EditorLinkOpenEvent = {\n link: link.getAttribute('href') ?? link.href,\n block,\n defaultPrevented: false,\n preventDefault() {\n this.defaultPrevented = true\n },\n }\n emit('linkOpen', opening)\n if (!opening.defaultPrevented) window.open(link.href, '_blank', 'noopener,noreferrer')\n return true\n },\n },\n },\n})\n\nonMounted(() => {\n const instance = createEditorView({\n element: mount.value!,\n kit,\n nodeViews: componentViews,\n // with collaboration the document comes from the shared document\n blocks: kit.externalDocument ? [] : readBlocks(props.modelValue),\n editable: editable.value,\n placeholder: {\n text: () => props.placeholder ?? messages.value.placeholder,\n heading: () => messages.value.headingPlaceholder,\n empty: () => props.placeholder ?? messages.value.emptyPlaceholder,\n },\n plugins: [\n ...(props.plugins ?? []),\n slashPlugin({\n onChange: (value) => (slash.value = value),\n onKey: (event) => slashMenu.value?.onKey(event) ?? false,\n }),\n keymap({\n 'Mod-k': () => bubble.value?.editLink() ?? false,\n 'Mod-Alt-m': () => comments.start(),\n // with the thread card open, Escape in the text closes it, and only that\n Escape: () => {\n if (!comments.pending.value && !comments.active.value) return false\n comments.close()\n return true\n },\n }),\n commentPlugin,\n comparePlugin({\n before: () => compareBlocks.value,\n label: () => messages.value.removedBlock,\n }),\n openLinks,\n searchPlugin({ skip: searchSkip }),\n ],\n keymaps: [searchKeys],\n history: props.history,\n undo: props.undo,\n redo: props.redo,\n attributes: () => {\n const attrs: Record<string, string> = {}\n if (props.ariaLabel) attrs['aria-label'] = props.ariaLabel\n if (!editable.value) attrs['aria-readonly'] = 'true'\n return attrs\n },\n onChange,\n onUpdate,\n })\n view.value = instance\n state.value = instance.state\n // code blocks without their own highlighter use the one DouCodeBlock uses\n watch(\n () =>\n (config.value.defaults as { DouCodeBlock?: { highlight?: CodeHighlighter } }).DouCodeBlock\n ?.highlight ?? null,\n (highlight) => setFallbackHighlighter(instance, highlight),\n { immediate: true },\n )\n instance.dom.addEventListener('focus', onFocus)\n instance.dom.addEventListener('blur', onBlur)\n if (props.autofocus) instance.focus()\n // blocks given without ids got them now: hand those back, so events' ids can be looked up\n const given = kit.externalDocument ? undefined : readBlocks(props.modelValue)\n if (given && lacksId(given)) {\n const doc: EditorDocument = { version: 1, blocks: getBlocks(instance) }\n emitted = doc\n emit('update:modelValue', doc)\n }\n})\n\nfunction onFocus(event: FocusEvent) {\n focused.value = true\n if (!cursorKnown && view.value) {\n cursorKnown = true\n const next = selectionOf(view.value.state)\n if (!sameSelection(next, selection)) {\n selection = next\n emit('update:selection', next)\n }\n }\n emit('focus', event)\n}\n\nfunction onBlur(event: FocusEvent) {\n focused.value = false\n emit('blur', event)\n}\n\nonBeforeUnmount(() => {\n view.value?.destroy()\n view.value = null\n})\n\nwatch(\n () => props.modelValue,\n (value) => {\n const current = view.value\n if (!current || value === undefined || kit.externalDocument || toRaw(value) === emitted) return\n replaceBlocks(current, readBlocks(value) ?? [])\n },\n)\n\nwatch(editable, (value) => view.value && setEditable(view.value, value))\nwatch(compareBlocks, () => view.value?.dispatch(view.value.state.tr.setMeta(compareKey, true)))\n\n/** The change last scrolled to, by its place among them. */\nlet changeIndex = -1\nwatch(\n () => props.compare,\n () => (changeIndex = -1),\n)\nfunction goToChange(step: 1 | -1) {\n const dom = view.value?.dom\n if (!dom || !props.compare) return false\n // a block's own mark, or the first piece of text changed in it\n const marks = [\n ...dom.querySelectorAll<HTMLElement>(\n '.dou-editor__diff-added, .dou-editor__diff-changed, .dou-editor__diff-removed-block, .dou-editor__diff-added-text, .dou-editor__diff-removed',\n ),\n ].filter((el, index, list) => {\n const block = el.closest('[data-block-id]')\n const previous = list[index - 1]\n return !previous || previous.closest('[data-block-id]') !== block || !block\n })\n const next = changeIndex + step\n const target = marks[next]\n if (!target) return false\n changeIndex = next\n target.scrollIntoView({ block: 'center' })\n const m = messages.value\n // a block added or removed, or one whose text or kind changed\n const kind = target.matches('.dou-editor__diff-added')\n ? m.changeAdded\n : target.matches('.dou-editor__diff-removed-block')\n ? m.changeRemoved\n : m.changeChanged\n announce(`${kind} ${changeText(target)}`)\n return true\n}\n\n/** The text of a change: what was removed, or its block as it is now. */\nfunction changeText(target: HTMLElement) {\n if (target.matches('.dou-editor__diff-removed-block')) return target.textContent ?? ''\n const block = (target.closest('[data-block-id]') ?? target).cloneNode(true) as HTMLElement\n for (const el of block.querySelectorAll('[data-diff=\"removed\"]')) el.remove()\n return block.textContent ?? ''\n}\n\n/** What the live region reads out: a version restored, the change gone to. */\nconst spoken = ref('')\nfunction announce(text: string) {\n // the same words twice still get read\n spoken.value = ''\n void nextTick(() => (spoken.value = text))\n}\n\nfunction restore(doc: EditorDocument<PartialBlock>) {\n // like the other methods it works while `readonly`, and it is the change comparing allows\n if (!view.value || !restoreBlocks(view.value, readBlocks(doc) ?? [])) return false\n announce(messages.value.restored)\n return true\n}\n\n// a selection from outside: the cursor goes to the block, or the blocks are selected\nwatch(\n () => props.selection,\n (value) => {\n const current = view.value\n if (!current || !value || sameSelection(value, selection)) return\n const known = cursorKnown\n cursorKnown = true\n let applied = false\n if (value.blocks.length > 1) {\n applied = selectBlocks(value.blocks[0]!, value.blocks.at(-1)!)(\n current.state,\n current.dispatch,\n )\n if (!applied) warn('`selection.blocks` must be sibling blocks that exist in the document')\n } else {\n const id = value.block ?? value.blocks[0]\n const transaction = new EditorTransaction(current.state)\n if (id && transaction.focusBlock(id)) {\n current.dispatch(transaction.tr)\n applied = true\n } else if (!id) warn('a selection without blocks cannot be set; the cursor stays where it is')\n }\n if (applied) return\n cursorKnown = known\n // hand back where the selection really is, so the binding doesn't keep a value that never applied\n emit('update:selection', { ...selection, blocks: [...selection.blocks] })\n },\n)\n\nfunction transact(\n fn: (tr: EditorTransaction) => void,\n meta?: EditorTransaction['meta'],\n): EditorTransactionResult | null {\n const current = view.value\n // comparing shows a version: nothing changes it but `restore`\n if (!current || props.compare) return null\n const transaction = new EditorTransaction(current.state, meta, cursorKnown)\n fn(transaction)\n lastResult = null\n // `focusBlock` places the cursor\n if (transaction.focused) cursorKnown = true\n applyEditorTransaction(current, transaction)\n if (transaction.focused) current.focus()\n const result = lastResult\n lastResult = null\n return result\n}\n\nconst history = (action: 'undo' | 'redo', dispatch: boolean) => {\n const current = view.value\n if (!current || props.compare) return false\n const command = historyCommands(current.state)[action]\n return dispatch ? runCommand(current, command) : command(current.state)\n}\n\ndefineExpose<EditorExpose>({\n get view() {\n return view.value\n },\n focus: () => view.value?.focus(),\n blur: () => (view.value?.dom as HTMLElement | undefined)?.blur(),\n getBlocks: () => (view.value ? getBlocks(view.value) : []),\n setBlocks: (blocks: PartialBlock[]) => view.value && replaceBlocks(view.value, blocks),\n getHTML: () => (view.value ? writeHTML(getBlocks(view.value), kit) : ''),\n setHTML: (html: string) => view.value && replaceBlocks(view.value, parseHTML(html, kit)),\n run: (command) => (view.value ? runCommand(view.value, command) : false),\n openSearch: (query) => openSearch(query?.replace !== undefined, query),\n closeSearch,\n transact,\n getBlock: (id) => (view.value ? new EditorTransaction(view.value.state).getBlock(id) : null),\n insertBlocks: (blocks, placement) => {\n let ids: string[] = []\n transact((tr) => (ids = tr.insertBlocks(blocks, placement)))\n return ids\n },\n updateBlock: (id, patch) => {\n let ok = false\n transact((tr) => (ok = tr.updateBlock(id, patch)))\n return ok\n },\n removeBlocks: (ids) => {\n let ok = false\n transact((tr) => (ok = tr.removeBlocks(ids)))\n return ok\n },\n moveBlocks: (ids, placement) => {\n let ok = false\n transact((tr) => (ok = tr.moveBlocks(ids, placement)))\n return ok\n },\n focusBlock: (id, edge) => {\n let ok = false\n transact((tr) => (ok = tr.focusBlock(id, edge)))\n return ok\n },\n getSelection: () => ({ ...selection, blocks: [...selection.blocks] }),\n undo: () => history('undo', true),\n redo: () => history('redo', true),\n get canUndo() {\n return !!state.value && history('undo', false)\n },\n get canRedo() {\n return !!state.value && history('redo', false)\n },\n comment: () => comments.start(),\n getCommentAnchors: anchors,\n restore,\n nextChange: () => goToChange(1),\n previousChange: () => goToChange(-1),\n})\n\n/*\n * Highlights for the threads that are open: by thread id, in one rule,\n * so a thread resolved or opened restyles its text without redrawing it.\n */\nconst scope = useId()\n/** An id as a CSS identifier: no quotes or `<`, which server rendering would escape. */\nconst ident = (id: string) =>\n id.replace(/[^a-zA-Z0-9_]|^[\\d-]/gu, (char) => `\\\\${char.codePointAt(0)!.toString(16)} `)\nconst highlighted = (id: string) => `[data-dou-editor=${ident(scope)}] [data-comment=${ident(id)}]`\nconst highlightCSS = computed(() => {\n if (!comments.enabled.value) return ''\n const open = comments.threads.value.filter((thread) => !thread.resolved)\n if (!open.length) return ''\n let css = `${open.map((thread) => highlighted(thread.id)).join(',')}{background-color:var(--dou-editor-comment-bg);border-bottom-color:var(--dou-editor-comment-line)}`\n const active = comments.active.value\n if (active && open.some((thread) => thread.id === active))\n css += `${highlighted(active)}{background-color:var(--dou-editor-comment-bg-active)}`\n return css\n})\nconst HighlightStyle = () => (highlightCSS.value ? h('style', highlightCSS.value) : null)\n</script>\n\n<template>\n <div\n ref=\"root\"\n :class=\"[\n ns.b(),\n {\n // comparing takes a narrow gutter for the bars beside changed blocks\n 'is-readonly': readonly,\n 'is-comparing': comparing,\n 'is-focused': focused,\n 'is-dragging': dragging,\n },\n ]\"\n :data-dou-editor=\"scope\"\n >\n <div v-if=\"searchOpen && view\" :class=\"ns.e('search')\">\n <SearchBar\n ref=\"searchBar\"\n v-model:replacing=\"searchReplacing\"\n :readonly=\"!editable\"\n :skip=\"searchSkip\"\n @close=\"closeSearch\"\n />\n </div>\n <HighlightStyle />\n <div ref=\"mount\" :class=\"ns.e('mount')\" />\n <template v-if=\"editable && view\">\n <BlockHandle />\n <SlashMenu ref=\"slashMenu\" :slash=\"slash\" />\n <BubbleToolbar ref=\"bubble\" />\n <component :is=\"overlay\" v-for=\"(overlay, index) in kit.overlays\" :key=\"index\" />\n </template>\n <div :class=\"ns.e('live')\" aria-live=\"polite\">{{ spoken }}</div>\n <template v-if=\"view && comments.enabled.value && !comparing\">\n <CommentButton v-if=\"readonly\" />\n <CommentCard />\n </template>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"editor2.js","names":["_sfc_main"],"sources":["../src/editor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { isApplePlatform, useGlobalConfig, useNamespace } from 'dou-ui'\nimport { keymap } from 'prosemirror-keymap'\nimport { Plugin, type EditorState, type Transaction } from 'prosemirror-state'\nimport type { EditorView } from 'prosemirror-view'\nimport {\n computed,\n getCurrentInstance,\n nextTick,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n toRaw,\n useTemplateRef,\n watch,\n h,\n useId,\n type Component,\n} from 'vue'\nimport BlockHandle from './components/block-handle.vue'\nimport BubbleToolbar from './components/bubble-toolbar.vue'\nimport SearchBar from './components/search-bar.vue'\nimport CommentButton from './components/comment-button.vue'\nimport CommentCard from './components/comment-card.vue'\nimport SlashMenu from './components/slash-menu.vue'\nimport { setFallbackHighlighter, type CodeHighlighter } from './core/highlight'\nimport { comparePlugin, compareKey } from './core/compare'\nimport {\n createEditorView,\n getBlocks,\n historyCommands,\n originKey,\n replaceBlocks,\n restoreBlocks,\n runCommand,\n setEditable,\n} from './core/editor'\nimport { diffBlocks } from './core/changes'\nimport { isRemote } from './core/plugins'\nimport { selectionOf, sameSelection } from './core/selection'\nimport { selectBlocks } from './core/block-selection'\nimport { applyEditorTransaction, EditorTransaction } from './core/transaction'\nimport {\n blocksToDoc,\n docToBlocks,\n type Block,\n type EditorDocument,\n type PartialBlock,\n} from './core/model'\nimport { resolveEditorExtensions } from './core/extension'\nimport {\n previewMatch,\n searchKey,\n searchPlugin,\n setSearch,\n type EditorSearchQuery,\n} from './core/search'\nimport { slashPlugin, type SlashState } from './core/slash'\nimport { writeHTML } from './core/output'\nimport { parseHTML } from './core/prepare'\nimport { componentMounter, vueNodeView } from './define-block'\nimport { editorKit } from './extensions/editor-kit'\nimport { readBlocks } from './document'\nimport {\n editorKey,\n type EditorEmits,\n type EditorExpose,\n type EditorProps,\n type EditorOrigin,\n type EditorLinkOpenEvent,\n type EditorSelection,\n type EditorTransactionResult,\n} from './editor'\nimport { useEditorMessages } from './locale'\nimport { useEditorComments } from './use-comments'\n\ndefineOptions({ name: 'DouEditor' })\n\nconst props = withDefaults(defineProps<EditorProps>(), {\n modelValue: undefined,\n extensions: undefined,\n readonly: false,\n searchable: true,\n placeholder: undefined,\n messages: undefined,\n ariaLabel: undefined,\n autofocus: false,\n plugins: undefined,\n history: true,\n undo: undefined,\n redo: undefined,\n selection: undefined,\n comments: undefined,\n author: undefined,\n activeComment: undefined,\n commentable: true,\n compare: undefined,\n})\nconst emit = defineEmits<EditorEmits>()\n\n// read once: changing the schema of a live editor would invalidate its document\nconst messages = useEditorMessages(() => props.messages)\nconst kit = resolveEditorExtensions(props.extensions ?? [editorKit()], () => messages.value)\n// say so once, instead of silently keeping the old extensions\nconst stopWatchingExtensions = watch(\n () => props.extensions,\n () => {\n console.warn(\n '[@dou-ui/editor] `extensions` changed after mount and is ignored: it is read once. Create the list once outside the template, or give the editor a new `key` to rebuild it.',\n )\n stopWatchingExtensions()\n },\n)\n\nconst ns = useNamespace('editor')\nconst config = useGlobalConfig()\nconst root = useTemplateRef<HTMLElement>('root')\nconst mount = useTemplateRef<HTMLElement>('mount')\nconst view = shallowRef<EditorView | null>(null)\nconst state = shallowRef<EditorState | null>(null)\nconst focused = shallowRef(false)\nconst dragging = shallowRef(false)\n/** Showing what changed since an older version: read-only, without comments. */\nconst comparing = computed(() => !!props.compare)\n/**\n * The older version as whole blocks, matched to the current ones by id. A\n * block saved without an id gets a new one, so it shows as removed.\n */\nconst compareBlocks = computed(() => {\n const blocks = props.compare?.blocks\n return Array.isArray(blocks) ? docToBlocks(blocksToDoc(kit.schema, blocks)) : null\n})\nconst editable = computed(() => !props.readonly && !comparing.value)\n\nconst {\n comments,\n plugin: commentPlugin,\n anchors,\n scrollToComment,\n} = useEditorComments({\n props,\n emit,\n view,\n provider: kit.comments,\n})\n\nconst context = { view, state, focused, dragging, editable, messages, root, kit, comments }\nprovide(editorKey, context)\n\n// block components render outside this component's tree: hand them the context\nconst appContext = getCurrentInstance()?.appContext ?? null\nconst mountComponent = componentMounter(appContext, [[editorKey, context]])\nconst componentViews = {\n ...Object.fromEntries(\n Object.entries(kit.schema.nodes)\n .filter(([, type]) => type.spec.component)\n .map(([name, type]) => [\n name,\n vueNodeView(type.spec.component as Component, appContext, [[editorKey, context]]),\n ]),\n ),\n ...Object.fromEntries(\n Object.entries(kit.componentViews).map(([name, create]) => [name, create(mountComponent)]),\n ),\n}\n\n// find and replace: the panel over the text, the matches marked in it\nconst searchOpen = ref(false)\nconst searchReplacing = ref(false)\nconst searchBar = useTemplateRef<InstanceType<typeof SearchBar>>('searchBar')\n/** Blocks that draw their own text, such as a code block in the code editor, are not searched. */\nconst searchSkip = (node: { type: { name: string } }) => node.type.name in kit.componentViews\n\n/** Opens the panel, with the replace box for `replace`. A selection on one line becomes the search. */\nfunction openSearch(replace = false, given?: Partial<EditorSearchQuery>) {\n const v = view.value\n if (!v || !props.searchable) return false\n const old = searchKey.getState(v.state)?.query ?? { search: '' }\n const query = { ...old, ...given }\n const { from, to, empty } = v.state.selection\n if (given?.search === undefined && !empty) {\n const text = v.state.doc.textBetween(from, to, '\\n')\n if (text && !text.includes('\\n')) query.search = text\n }\n if ((replace || given?.replace !== undefined) && editable.value) searchReplacing.value = true\n searchOpen.value = true\n v.dispatch(setSearch(v.state.tr, { query, active: true }))\n const preview = previewMatch(v.state)\n if (preview) v.dispatch(preview)\n void nextTick(() => searchBar.value?.focus(replace && editable.value ? 'replace' : 'find'))\n return true\n}\n\nfunction closeSearch() {\n const v = view.value\n if (!searchOpen.value || !v) return false\n searchOpen.value = false\n v.dispatch(setSearch(v.state.tr, { active: false }))\n v.focus()\n return true\n}\n\n/** Goes to the next (or previous) match; with the panel shut, opens it on the last search. */\nfunction findAgain(step: 1 | -1) {\n if (!searchOpen.value) {\n const v = view.value\n if (!v || !searchKey.getState(v.state)?.query.search || !openSearch()) return false\n }\n void nextTick(() => (step > 0 ? searchBar.value?.next() : searchBar.value?.previous()))\n return true\n}\n\nconst replaceKey = isApplePlatform() ? 'Mod-Alt-f' : 'Mod-h'\nconst searchKeys = keymap({\n 'Mod-f': () => openSearch(),\n [replaceKey]: () => openSearch(true),\n F3: () => findAgain(1),\n 'Mod-g': () => findAgain(1),\n 'Shift-F3': () => findAgain(-1),\n 'Mod-Shift-g': () => findAgain(-1),\n Escape: () => closeSearch(),\n})\n\nconst slash = shallowRef<SlashState | null>(null)\nconst slashMenu = useTemplateRef<InstanceType<typeof SlashMenu>>('slashMenu')\nconst bubble = useTemplateRef<InstanceType<typeof BubbleToolbar>>('bubble')\n\n// The document last sent through `v-model`: when the same object comes back,\n// it is not loaded again (that would move the cursor).\nlet emitted: EditorDocument | undefined\n\n// the result of the last change, for `transact` to hand back\nlet lastResult: EditorTransactionResult | null = null\n\nfunction onChange(current: EditorView, tr: Transaction, before: EditorState) {\n const blocks = getBlocks(current)\n const doc: EditorDocument = { version: 1, blocks }\n emitted = doc\n const history = tr.getMeta('history$') as { redo: boolean } | undefined\n const origin =\n (tr.getMeta(originKey) as EditorOrigin | undefined) ??\n (history ? (history.redo ? 'redo' : 'undo') : isRemote(tr) ? 'remote' : undefined)\n const meta: EditorTransactionResult['meta'] = {\n history:\n tr.getMeta('addToHistory') !== false &&\n origin !== 'remote' &&\n origin !== 'undo' &&\n origin !== 'redo',\n }\n if (origin !== undefined) meta.origin = origin\n lastResult = { blocks, changes: diffBlocks(before.doc, current.state.doc), meta }\n emit('transaction', lastResult)\n emit('update:modelValue', doc)\n emit('change', doc)\n}\n\nlet selection: EditorSelection = { block: null, blocks: [] }\n\nconst warn = (message: string) => {\n if (process.env.NODE_ENV !== 'production') console.warn(`[@dou-ui/editor] ${message}`)\n}\n\nconst lacksId = (blocks: PartialBlock[]): boolean =>\n blocks.some((block) => !block.id || lacksId(block.children ?? []))\n// until the editor is focused (or a block is, by the program) its selection is no cursor\nlet cursorKnown = false\n\nfunction onUpdate(current: EditorView) {\n state.value = current.state\n if (!cursorKnown) {\n if (!focused.value) return\n cursorKnown = true\n }\n const next = selectionOf(current.state)\n if (sameSelection(next, selection)) return\n selection = next\n emit('update:selection', next)\n}\n\n// a click on a link places the cursor; with Ctrl or ⌘ held, or while read-only, it opens the link\nconst openLinks = new Plugin({\n props: {\n handleDOMEvents: {\n click(clicked, event) {\n const link = (event.target as HTMLElement).closest<HTMLAnchorElement>('a.dou-editor__link')\n if (!link?.href || !(event.metaKey || event.ctrlKey || !clicked.editable)) return false\n event.preventDefault()\n const $pos = clicked.state.doc.resolve(clicked.posAtDOM(link, 0))\n let block = ''\n for (let depth = $pos.depth; depth > 0; depth--)\n if ($pos.node(depth).type.name === 'block') {\n block = $pos.node(depth).attrs.id as string\n break\n }\n const opening: EditorLinkOpenEvent = {\n link: link.getAttribute('href') ?? link.href,\n block,\n defaultPrevented: false,\n preventDefault() {\n this.defaultPrevented = true\n },\n }\n emit('linkOpen', opening)\n if (!opening.defaultPrevented) window.open(link.href, '_blank', 'noopener,noreferrer')\n return true\n },\n },\n },\n})\n\nonMounted(() => {\n const instance = createEditorView({\n element: mount.value!,\n kit,\n nodeViews: componentViews,\n // with collaboration the document comes from the shared document\n blocks: kit.externalDocument ? [] : readBlocks(props.modelValue),\n editable: editable.value,\n placeholder: {\n text: () => props.placeholder ?? messages.value.placeholder,\n heading: () => messages.value.headingPlaceholder,\n empty: () => props.placeholder ?? messages.value.emptyPlaceholder,\n },\n plugins: [\n ...(props.plugins ?? []),\n slashPlugin({\n onChange: (value) => (slash.value = value),\n onKey: (event) => slashMenu.value?.onKey(event) ?? false,\n }),\n keymap({\n 'Mod-k': () => bubble.value?.editLink() ?? false,\n 'Mod-Alt-m': () => comments.start(),\n // with the thread card open, Escape in the text closes it, and only that\n Escape: () => {\n if (!comments.pending.value && !comments.active.value) return false\n comments.close()\n return true\n },\n }),\n commentPlugin,\n comparePlugin({\n before: () => compareBlocks.value,\n label: () => messages.value.removedBlock,\n }),\n openLinks,\n searchPlugin({ skip: searchSkip }),\n ],\n keymaps: [searchKeys],\n history: props.history,\n undo: props.undo,\n redo: props.redo,\n attributes: () => {\n const attrs: Record<string, string> = {}\n if (props.ariaLabel) attrs['aria-label'] = props.ariaLabel\n if (!editable.value) attrs['aria-readonly'] = 'true'\n return attrs\n },\n onChange,\n onUpdate,\n })\n view.value = instance\n state.value = instance.state\n // code blocks without their own highlighter use the one DouCodeBlock uses\n watch(\n () =>\n (config.value.defaults as { DouCodeBlock?: { highlight?: CodeHighlighter } }).DouCodeBlock\n ?.highlight ?? null,\n (highlight) => setFallbackHighlighter(instance, highlight),\n { immediate: true },\n )\n instance.dom.addEventListener('focus', onFocus)\n instance.dom.addEventListener('blur', onBlur)\n if (props.autofocus) instance.focus()\n // blocks given without ids got them now: hand those back, so events' ids can be looked up\n const given = kit.externalDocument ? undefined : readBlocks(props.modelValue)\n if (given && lacksId(given)) {\n const doc: EditorDocument = { version: 1, blocks: getBlocks(instance) }\n emitted = doc\n emit('update:modelValue', doc)\n }\n})\n\nfunction onFocus(event: FocusEvent) {\n focused.value = true\n if (!cursorKnown && view.value) {\n cursorKnown = true\n const next = selectionOf(view.value.state)\n if (!sameSelection(next, selection)) {\n selection = next\n emit('update:selection', next)\n }\n }\n emit('focus', event)\n}\n\nfunction onBlur(event: FocusEvent) {\n focused.value = false\n emit('blur', event)\n}\n\nonBeforeUnmount(() => {\n view.value?.destroy()\n view.value = null\n})\n\nwatch(\n () => props.modelValue,\n (value) => {\n const current = view.value\n if (!current || value === undefined || kit.externalDocument || toRaw(value) === emitted) return\n replaceBlocks(current, readBlocks(value) ?? [])\n },\n)\n\nwatch(editable, (value) => view.value && setEditable(view.value, value))\nwatch(compareBlocks, () => view.value?.dispatch(view.value.state.tr.setMeta(compareKey, true)))\n\n/** The change last scrolled to, by its place among them. */\nlet changeIndex = -1\nwatch(\n () => props.compare,\n () => (changeIndex = -1),\n)\nfunction goToChange(step: 1 | -1) {\n const dom = view.value?.dom\n if (!dom || !props.compare) return false\n // a block's own mark, or the first piece of text changed in it\n const marks = [\n ...dom.querySelectorAll<HTMLElement>(\n '.dou-editor__diff-added, .dou-editor__diff-changed, .dou-editor__diff-removed-block, .dou-editor__diff-added-text, .dou-editor__diff-removed',\n ),\n ].filter((el, index, list) => {\n const block = el.closest('[data-block-id]')\n const previous = list[index - 1]\n return !previous || previous.closest('[data-block-id]') !== block || !block\n })\n const next = changeIndex + step\n const target = marks[next]\n if (!target) return false\n changeIndex = next\n target.scrollIntoView({ block: 'center' })\n const m = messages.value\n // a block added or removed, or one whose text or kind changed\n const kind = target.matches('.dou-editor__diff-added')\n ? m.changeAdded\n : target.matches('.dou-editor__diff-removed-block')\n ? m.changeRemoved\n : m.changeChanged\n announce(`${kind} ${changeText(target)}`)\n return true\n}\n\n/** The text of a change: what was removed, or its block as it is now. */\nfunction changeText(target: HTMLElement) {\n if (target.matches('.dou-editor__diff-removed-block')) return target.textContent ?? ''\n const block = (target.closest('[data-block-id]') ?? target).cloneNode(true) as HTMLElement\n for (const el of block.querySelectorAll('[data-diff=\"removed\"]')) el.remove()\n return block.textContent ?? ''\n}\n\n/** What the live region reads out: a version restored, the change gone to. */\nconst spoken = ref('')\nfunction announce(text: string) {\n // the same words twice still get read\n spoken.value = ''\n void nextTick(() => (spoken.value = text))\n}\n\nfunction restore(doc: EditorDocument<PartialBlock>) {\n // like the other methods it works while `readonly`, and it is the change comparing allows\n if (!view.value || !restoreBlocks(view.value, readBlocks(doc) ?? [])) return false\n announce(messages.value.restored)\n return true\n}\n\n// a selection from outside: the cursor goes to the block, or the blocks are selected\nwatch(\n () => props.selection,\n (value) => {\n const current = view.value\n if (!current || !value || sameSelection(value, selection)) return\n const known = cursorKnown\n cursorKnown = true\n let applied = false\n if (value.blocks.length > 1) {\n applied = selectBlocks(value.blocks[0]!, value.blocks.at(-1)!)(\n current.state,\n current.dispatch,\n )\n if (!applied) warn('`selection.blocks` must be sibling blocks that exist in the document')\n } else {\n const id = value.block ?? value.blocks[0]\n const transaction = new EditorTransaction(current.state)\n if (id && transaction.focusBlock(id)) {\n current.dispatch(transaction.tr)\n applied = true\n } else if (!id) warn('a selection without blocks cannot be set; the cursor stays where it is')\n }\n if (applied) return\n cursorKnown = known\n // hand back where the selection really is, so the binding doesn't keep a value that never applied\n emit('update:selection', { ...selection, blocks: [...selection.blocks] })\n },\n)\n\nfunction transact(\n fn: (tr: EditorTransaction) => void,\n meta?: EditorTransaction['meta'],\n): EditorTransactionResult | null {\n const current = view.value\n // comparing shows a version: nothing changes it but `restore`\n if (!current || props.compare) return null\n const transaction = new EditorTransaction(current.state, meta, cursorKnown)\n fn(transaction)\n lastResult = null\n // `focusBlock` places the cursor\n if (transaction.focused) cursorKnown = true\n applyEditorTransaction(current, transaction)\n if (transaction.focused) current.focus()\n const result = lastResult\n lastResult = null\n return result\n}\n\nconst history = (action: 'undo' | 'redo', dispatch: boolean) => {\n const current = view.value\n if (!current || props.compare) return false\n const command = historyCommands(current.state)[action]\n return dispatch ? runCommand(current, command) : command(current.state)\n}\n\ndefineExpose<EditorExpose>({\n get view() {\n return view.value\n },\n focus: () => view.value?.focus(),\n blur: () => (view.value?.dom as HTMLElement | undefined)?.blur(),\n getBlocks: () => (view.value ? getBlocks(view.value) : []),\n setBlocks: (blocks: PartialBlock[]) => view.value && replaceBlocks(view.value, blocks),\n getHTML: () => (view.value ? writeHTML(getBlocks(view.value), kit) : ''),\n setHTML: (html: string) => view.value && replaceBlocks(view.value, parseHTML(html, kit)),\n run: (command) => (view.value ? runCommand(view.value, command) : false),\n openSearch: (query) => openSearch(query?.replace !== undefined, query),\n closeSearch,\n transact,\n getBlock: (id) => (view.value ? new EditorTransaction(view.value.state).getBlock(id) : null),\n insertBlocks: (blocks, placement) => {\n let ids: string[] = []\n transact((tr) => (ids = tr.insertBlocks(blocks, placement)))\n return ids\n },\n updateBlock: (id, patch) => {\n let ok = false\n transact((tr) => (ok = tr.updateBlock(id, patch)))\n return ok\n },\n removeBlocks: (ids) => {\n let ok = false\n transact((tr) => (ok = tr.removeBlocks(ids)))\n return ok\n },\n moveBlocks: (ids, placement) => {\n let ok = false\n transact((tr) => (ok = tr.moveBlocks(ids, placement)))\n return ok\n },\n focusBlock: (id, edge) => {\n let ok = false\n transact((tr) => (ok = tr.focusBlock(id, edge)))\n return ok\n },\n getSelection: () => ({ ...selection, blocks: [...selection.blocks] }),\n undo: () => history('undo', true),\n redo: () => history('redo', true),\n get canUndo() {\n return !!state.value && history('undo', false)\n },\n get canRedo() {\n return !!state.value && history('redo', false)\n },\n comment: () => comments.start(),\n getCommentAnchors: anchors,\n scrollToComment,\n restore,\n nextChange: () => goToChange(1),\n previousChange: () => goToChange(-1),\n})\n\n/*\n * Highlights for the threads that are open: by thread id, in one rule,\n * so a thread resolved or opened restyles its text without redrawing it.\n */\nconst scope = useId()\n/** An id as a CSS identifier: no quotes or `<`, which server rendering would escape. */\nconst ident = (id: string) =>\n id.replace(/[^a-zA-Z0-9_]|^[\\d-]/gu, (char) => `\\\\${char.codePointAt(0)!.toString(16)} `)\nconst highlighted = (id: string) => `[data-dou-editor=${ident(scope)}] [data-comment=${ident(id)}]`\nconst highlightCSS = computed(() => {\n if (!comments.enabled.value) return ''\n const open = comments.threads.value.filter((thread) => !thread.resolved)\n if (!open.length) return ''\n let css = `${open.map((thread) => highlighted(thread.id)).join(',')}{background-color:var(--dou-editor-comment-bg);border-bottom-color:var(--dou-editor-comment-line);--dou-editor-code-py:0;--dou-editor-code-bg:var(--dou-editor-comment-code-bg);--dou-editor-code-border:var(--dou-editor-comment-code-border)}`\n const active = comments.active.value\n if (active && open.some((thread) => thread.id === active))\n css += `${highlighted(active)}{background-color:var(--dou-editor-comment-bg-active)}`\n return css\n})\nconst HighlightStyle = () => (highlightCSS.value ? h('style', highlightCSS.value) : null)\n</script>\n\n<template>\n <div\n ref=\"root\"\n :class=\"[\n ns.b(),\n {\n // comparing takes a narrow gutter for the bars beside changed blocks\n 'is-readonly': readonly,\n 'is-comparing': comparing,\n 'is-focused': focused,\n 'is-dragging': dragging,\n },\n ]\"\n :data-dou-editor=\"scope\"\n >\n <div v-if=\"searchOpen && view\" :class=\"ns.e('search')\">\n <SearchBar\n ref=\"searchBar\"\n v-model:replacing=\"searchReplacing\"\n :readonly=\"!editable\"\n :skip=\"searchSkip\"\n @close=\"closeSearch\"\n />\n </div>\n <HighlightStyle />\n <div ref=\"mount\" :class=\"ns.e('mount')\" />\n <template v-if=\"editable && view\">\n <BlockHandle />\n <SlashMenu ref=\"slashMenu\" :slash=\"slash\" />\n <BubbleToolbar ref=\"bubble\" />\n <component :is=\"overlay\" v-for=\"(overlay, index) in kit.overlays\" :key=\"index\" />\n </template>\n <div :class=\"ns.e('live')\" aria-live=\"polite\">{{ spoken }}</div>\n <template v-if=\"view && comments.enabled.value && !comparing\">\n <CommentButton v-if=\"readonly\" />\n <CommentCard />\n </template>\n </div>\n</template>\n"],"mappings":""}
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @layer dou.components{.dou-editor{--dou-editor-font-size:var(--dou-font-size-lg);--dou-editor-line-height:1.7;--dou-editor-gutter:0px;--dou-editor-indent:24px;--dou-editor-column-gap:48px;--dou-editor-block-gap:4px;--dou-editor-list-gap:4px;--dou-editor-reading-width:none;--dou-editor-selected:color-mix(in oklab,var(--dou-color-focus)calc(12% + 10%*var(--dou-scheme-dark)),transparent);--dou-editor-scroll-shadow:color-mix(in oklab,var(--dou-color-text)14%,transparent);--dou-editor-control-hover:color-mix(in oklab,var(--dou-color-text)6%,transparent);--dou-editor-match:color-mix(in oklab,var(--dou-color-warning)22%,transparent);--dou-editor-match-current:color-mix(in oklab,var(--dou-color-warning-text)80%,transparent);--dou-editor-comment-bg:color-mix(in oklab,var(--dou-color-warning)18%,transparent);--dou-editor-comment-bg-active:color-mix(in oklab,var(--dou-color-warning)36%,transparent);--dou-editor-comment-line:color-mix(in oklab,var(--dou-color-warning)72%,transparent);position:relative;box-sizing:border-box;color:var(--dou-color-text);font-family:var(--dou-font-family);font-size:max(var(--dou-font-size-input-min,0px),var(--dou-editor-font-size));line-height:var(--dou-editor-line-height);overflow-wrap:break-word;width:100%;min-width:0;padding-inline-start:var(--dou-editor-gutter)}.dou-editor.is-comparing{--dou-editor-gutter:16px}@media (pointer:coarse){.dou-editor{--dou-editor-column-gap:32px}}.dou-editor.is-dragging{cursor:grabbing}.dou-editor.is-dragging *{cursor:grabbing}.dou-editor__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}.dou-editor__mount>.dou-editor__surface,.dou-editor__search{padding-inline-start:max(0px,(100% - var(--dou-editor-reading-width) - var(--dou-editor-gutter))/2);padding-inline-end:max(0px,min(100% - var(--dou-editor-reading-width),(100% - var(--dou-editor-reading-width) + var(--dou-editor-gutter))/2))}.dou-editor__surface{min-height:calc(var(--dou-editor-line-height)*1em);outline:none;white-space:pre-wrap;word-wrap:break-word;font-variant-ligatures:none}.dou-editor__block{position:relative;border-radius:4px}.dou-editor__group{padding-inline-start:var(--dou-editor-indent)}.dou-editor__content{position:relative;padding-block:calc(var(--dou-editor-block-gap)/2);font-size:1em;font-weight:inherit;line-height:var(--dou-editor-line-height);margin:0}.dou-editor__block>.dou-editor__content.is-list{--dou-editor-list-top:calc(var(--dou-editor-list-gap)/2);padding-block:var(--dou-editor-list-top)calc(var(--dou-editor-list-gap)/2)}.dou-editor__block>.dou-editor__content.is-list-start{--dou-editor-list-top:calc(max(var(--dou-editor-block-gap),var(--dou-editor-list-gap))/2);margin-top:min(0px,(var(--dou-editor-block-gap) - var(--dou-editor-list-gap))/2)}.dou-editor__block>.dou-editor__content.is-list-start.is-list-after{margin-top:min(0px,var(--dou-editor-block-gap) - var(--dou-editor-list-gap))}.dou-editor__block>.dou-editor__content.is-list-end{padding-bottom:calc(max(var(--dou-editor-block-gap),var(--dou-editor-list-gap))/2);margin-bottom:min(0px,(var(--dou-editor-block-gap) - var(--dou-editor-list-gap))/2)}.dou-editor__group.is-list-end{padding-bottom:max(0px,(var(--dou-editor-block-gap) - var(--dou-editor-list-gap))/2);margin-bottom:min(0px,(var(--dou-editor-block-gap) - var(--dou-editor-list-gap))/2)}.dou-editor__surface>.dou-editor__block:first-child>.dou-editor__content.is-list-start{margin-top:0}.dou-editor__surface>.dou-editor__block:last-child>.is-list-end{margin-bottom:0}.dou-editor__content--heading{--dou-editor-line-height:1.4;font-weight:var(--dou-font-weight-bold);letter-spacing:-.01em;margin-top:.6em}.dou-editor__content--heading:-webkit-any(h1){margin-top:.8em;font-size:1.75em}.dou-editor__content--heading:-moz-any(h1){margin-top:.8em;font-size:1.75em}.dou-editor__content--heading:is(h1){margin-top:.8em;font-size:1.75em}.dou-editor__content--heading:-webkit-any(h2){font-size:1.375em}.dou-editor__content--heading:-moz-any(h2){font-size:1.375em}.dou-editor__content--heading:is(h2){font-size:1.375em}.dou-editor__content--heading:-webkit-any(h3){font-size:1.125em}.dou-editor__content--heading:-moz-any(h3){font-size:1.125em}.dou-editor__content--heading:is(h3){font-size:1.125em}.dou-editor__surface>.dou-editor__block:first-child>.dou-editor__content--heading{margin-top:0}.dou-editor__content--bulletItem,.dou-editor__content--numberedItem{padding-inline-start:var(--dou-editor-indent)}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):before{position:absolute;width:var(--dou-editor-indent)}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:0}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:0}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:0}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:0}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:0}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:0}.dou-editor__content--bulletItem:before{content:"";top:calc(var(--dou-editor-list-top) + var(--dou-editor-line-height)*.5em - 3px);box-sizing:border-box;color:var(--dou-color-text-secondary);background-color:currentColor;border-radius:50%;width:6px;height:6px}.dou-editor__content--bulletItem:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:7px}.dou-editor__content--bulletItem:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:7px}.dou-editor__content--bulletItem:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:7px}.dou-editor__content--bulletItem:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:7px}.dou-editor__content--bulletItem:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:7px}.dou-editor__content--bulletItem:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:7px}.dou-editor__group .dou-editor__content--bulletItem:before{background-color:#0000;border:1.5px solid}.dou-editor__content--numberedItem:before{content:attr(data-index)".";top:var(--dou-editor-list-top);box-sizing:border-box;color:var(--dou-color-text-secondary);font-variant-numeric:tabular-nums;text-align:end;padding-inline-end:6px}.dou-editor__content--checkItem{display:flex;gap:8px}.dou-editor__check{display:inline-flex;height:calc(var(--dou-editor-line-height)*1em);user-select:none;flex:none;align-items: center}.dou-editor__checkbox{display:inline-flex;box-sizing:border-box;border:1px solid var(--dou-color-border-strong);border-radius:calc(var(--dou-radius-control) - 2px);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-sm);color:var(--dou-color-neutral-on);cursor:pointer;transition-property:background-color,border-color,box-shadow;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing);justify-content:center;align-items: center;width:16px;height:16px;margin:0;padding:0}.dou-editor__checkbox>svg{opacity:0;transition-property:opacity,transform;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing);width:100%;height:100%;transform:scale(.6)}.dou-editor__checkbox:hover:not(:disabled){border-color:color-mix(in oklab,var(--dou-color-neutral)45%,var(--dou-color-border-strong))}.dou-editor__checkbox:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor__checkbox:disabled{cursor:default}.dou-editor__content--checkItem[data-checked=true] .dou-editor__checkbox{border-color:color-mix(in oklab,var(--dou-color-neutral)90%,var(--dou-color-edge));background-color:var(--dou-color-neutral);box-shadow:var(--dou-shadow-highlight),0 1px 2px color-mix(in oklab,var(--dou-color-neutral)24%,transparent)}.dou-editor__content--checkItem[data-checked=true] .dou-editor__checkbox>svg{opacity:1;transform:none}.dou-editor__content--checkItem[data-checked=true] .dou-editor__text{color:var(--dou-color-text-tertiary);text-decoration:line-through;text-decoration-color:color-mix(in oklab,currentColor 60%,transparent)}.dou-editor__text{flex:auto;min-width:0}.dou-editor__content--quote{box-shadow:inset 2px 0 0 var(--dou-color-border-strong);color:var(--dou-color-text-secondary);padding-inline-start:14px}.dou-editor__content--codeBlock{--dou-editor-line-height:1.7;margin-block:calc(var(--dou-editor-block-gap)/2 + 2px);overflow-x:auto;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-container);background-color:var(--dou-color-bg-muted);font-family:var(--dou-font-family-mono);font-size:var(--dou-font-size-sm);tab-size:2;white-space:pre-wrap;padding:12px 16px}.dou-editor__content--codeBlock>code{font:inherit}.dou-editor-toggle{display:flex;gap:4px}.dou-editor-toggle__control{display:inline-flex;height:calc(var(--dou-editor-line-height)*1em);user-select:none;flex:none;align-items: center;margin-inline-start:-2px}.dou-editor-toggle__button{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-color-text-tertiary);cursor:pointer;background:0 0;border:none;justify-content:center;align-items: center;width:22px;height:22px;padding:0}.dou-editor-toggle__button>svg{transition:rotate var(--dou-motion-duration-fast)var(--dou-motion-easing);width:16px;height:16px}.dou-editor-toggle__button.is-open>svg{rotate:90deg}.dou-editor-toggle__button:hover{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text)}.dou-editor-toggle__button:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:-2px}.dou-editor__block.is-collapsed>.dou-editor__group{display:none}.dou-editor-callout{--dou-editor-callout-tone:var(--dou-color-text-secondary);display:flex;border:1px solid color-mix(in oklab,var(--dou-editor-callout-tone)22%,var(--dou-color-border));border-radius:var(--dou-radius-container);background-color:color-mix(in oklab,var(--dou-editor-callout-tone)6%,var(--dou-color-bg-surface));gap:8px;margin-block-start:2px;margin-block-end:2px;padding:8px 12px}.dou-editor-callout.is-tip{--dou-editor-callout-tone:var(--dou-color-success)}.dou-editor-callout.is-warning{--dou-editor-callout-tone:var(--dou-color-warning)}.dou-editor-callout.is-danger{--dou-editor-callout-tone:var(--dou-color-danger)}.dou-editor-callout__control{display:inline-flex;height:calc(var(--dou-editor-line-height)*1em);user-select:none;flex:none;align-items: center}.dou-editor-callout__icon{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-editor-callout-tone);background:0 0;border:none;justify-content:center;align-items: center;width:24px;height:24px;padding:0}.dou-editor-callout__icon>svg{width:16px;height:16px}button.dou-editor-callout__icon{cursor:pointer}button.dou-editor-callout__icon:hover{background-color:color-mix(in oklab,var(--dou-editor-callout-tone)12%,transparent)}button.dou-editor-callout__icon[aria-expanded=true]{background-color:color-mix(in oklab,var(--dou-editor-callout-tone)12%,transparent)}button.dou-editor-callout__icon:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:-2px}.dou-editor__content--codeBlock.dou-editor__content--custom{position:relative}.dou-editor-code__pre{font:inherit;white-space:inherit;margin:0}.dou-editor-code__pre>code{display:block;font:inherit}.dou-editor-code__bar{position:absolute;display:flex;border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-muted);font-family:var(--dou-font-family);opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);align-items: center;gap:2px;top:6px;right:6px}.dou-editor__content--codeBlock:hover>.dou-editor-code__bar,.dou-editor-code__bar:focus-within{opacity:1}.dou-editor-code__bar:has([aria-expanded=true]){opacity:1}.dou-editor-code__language{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-color-text-secondary);font:inherit;font-size:var(--dou-font-size-sm);cursor:pointer;background:0 0;border:none;align-items: center;gap:2px;height:24px;padding:0 4px 0 8px}.dou-editor-code__language>svg{width:14px;height:14px}.dou-editor-code__language:hover{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text)}.dou-editor-code__language[aria-expanded=true]{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text)}.dou-editor-code__language:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:-2px}.dou-editor-code__language.is-static{cursor:default;padding-inline-start:8px;padding-inline-end:8px}.dou-editor-code-editor.dou-editor__content--codeBlock{overflow:visible;white-space:normal;transition:border-color var(--dou-motion-duration-fast)var(--dou-motion-easing);padding:0}.dou-editor-code-editor.dou-editor__content--codeBlock:has(>.dou-code-editor.is-focused){border-color:color-mix(in oklab,var(--dou-color-focus)70%,var(--dou-color-text))}.dou-editor-code-editor.dou-editor__content--codeBlock>.dou-editor-code__bar{position:relative;z-index:3;opacity:1;background:0 0;justify-content:flex-end;padding:4px 6px 0 8px;top:auto;right:auto}.dou-editor-code-editor.dou-editor__content--codeBlock>.dou-editor-code__bar>:not(:last-child){margin-inline-end:auto}@media (pointer:coarse){.dou-editor-code__language:not(.is-static){position:relative}.dou-editor-code__language:not(.is-static):after{position:absolute;content:"";inset:min(0px,50% - 20px) 0}}.dou-editor-code__editor.dou-code-editor:not(.is-bordered){--dou-code-editor-bg:transparent;--dou-code-editor-gutter-bg:var(--dou-color-bg-muted);--dou-code-editor-padding-x:16px;--dou-code-editor-padding-y:8px;border-radius:inherit}.dou-editor__token{color:color-mix(in oklab,var(--shiki-dark,currentColor)calc(100%*var(--dou-scheme-dark)),var(--shiki-light,currentColor));font-style:var(--shiki-light-font-style,inherit);font-weight:var(--shiki-light-font-weight,inherit)}.dou-editor__content--divider{cursor:default;padding-block-start:12px;padding-block-end:12px}.dou-editor__content--divider>hr{background-color:var(--dou-color-border);border:none;height:1px;margin:0}.dou-editor__content--divider.ProseMirror-selectednode>hr{background-color:var(--dou-color-focus)}.dou-editor__surface strong{font-weight:var(--dou-font-weight-bold)}.dou-editor__surface u{text-underline-offset:.2em}.dou-editor__surface s u{text-decoration:underline line-through}.dou-editor__surface u s{text-decoration:underline line-through}.dou-editor__surface :not(pre)>code{background-color:var(--dou-color-bg-muted);box-shadow:inset 0 0 0 1px var(--dou-color-border-subtle);font-family:var(--dou-font-family-mono);border-radius:4px;padding:.1em .3em;font-size:.875em}.dou-editor__link{color:inherit;text-decoration:underline;text-decoration-color:var(--dou-color-border-strong);text-decoration-thickness:1px;text-underline-offset:.2em;transition:text-decoration-color var(--dou-motion-duration-fast)var(--dou-motion-easing)}.dou-editor__link:hover{text-decoration-color:currentColor}.dou-editor.is-readonly .dou-editor__link,.dou-editor.is-comparing .dou-editor__link{cursor:pointer}.dou-editor__comment{transition:background-color var(--dou-motion-duration-fast)var(--dou-motion-easing);border-bottom:2px solid #0000}.dou-editor__comment-pending{background-color:color-mix(in oklab,var(--dou-color-focus)16%,transparent)}.dou-editor-comment{box-sizing:border-box;max-height:min(var(--dou-floating-available,100vh),480px,calc(100vh - 32px));overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-container);background-color:color-mix(in oklab,var(--dou-color-text)calc(4%*var(--dou-scheme-dark)),var(--dou-color-bg-surface));box-shadow:var(--dou-shadow-md);font-family:var(--dou-font-family);width:min(340px,100vw - 32px);padding:12px;line-height:normal}.dou-editor__content.is-empty:after{content:attr(data-placeholder);position:absolute;top:calc(var(--dou-editor-block-gap)/2);color:var(--dou-color-text-tertiary);pointer-events:none;user-select:none;white-space:nowrap}.dou-editor__content.is-empty:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:0}.dou-editor__content.is-empty:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:0}.dou-editor__content.is-empty:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:0}.dou-editor__content.is-empty:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:0}.dou-editor__content.is-empty:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:0}.dou-editor__content.is-empty:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:0}.dou-editor__content.is-list.is-empty:after{top:var(--dou-editor-list-top)}.dou-editor__content--bulletItem.is-empty:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--bulletItem.is-empty:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--bulletItem.is-empty:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--bulletItem.is-empty:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--bulletItem.is-empty:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--bulletItem.is-empty:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--checkItem.is-empty:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:24px}.dou-editor__content--checkItem.is-empty:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:24px}.dou-editor__content--checkItem.is-empty:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:24px}.dou-editor__content--checkItem.is-empty:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:24px}.dou-editor__content--checkItem.is-empty:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:24px}.dou-editor__content--checkItem.is-empty:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:24px}.dou-editor__content--quote.is-empty:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:14px}.dou-editor__content--quote.is-empty:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:14px}.dou-editor__content--quote.is-empty:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:14px}.dou-editor__content--quote.is-empty:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:14px}.dou-editor__content--quote.is-empty:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:14px}.dou-editor__content--quote.is-empty:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:14px}.dou-editor__diff-added:before,.dou-editor__diff-changed:before,.dou-editor__diff-removed-block:before{position:absolute;content:"";border-radius:2px;width:3px;top:2px;bottom:2px}.dou-editor__diff-added:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-added:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-added:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-changed:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-changed:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-changed:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-removed-block:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-removed-block:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-removed-block:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-added:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-added:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-added:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-changed:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-changed:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-changed:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-removed-block:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-removed-block:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-removed-block:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-added:before{background-color:var(--dou-color-success)}.dou-editor__diff-changed:before{background-color:var(--dou-color-warning)}.dou-editor__diff-added-text{background-color:color-mix(in oklab,var(--dou-color-success)14%,transparent);text-decoration:underline 1px var(--dou-color-success);text-underline-offset:3px}.dou-editor__diff-removed{background-color:color-mix(in oklab,var(--dou-color-danger)12%,transparent);color:var(--dou-color-danger-text);text-decoration:line-through 1px}.dou-editor__diff-removed-block{position:relative;color:var(--dou-color-danger-text);text-decoration:line-through 1px;white-space:pre-wrap;user-select:none;padding:3px 0}.dou-editor__diff-removed-block:before{background-color:var(--dou-color-danger)}.dou-editor__block.is-selected{background-color:var(--dou-editor-selected)}.dou-editor__block.is-selected+.dou-editor__block.is-selected:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected+.dou-editor__block.is-selected:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected+.dou-editor__block.is-selected:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected+.dou-editor__block.is-selected:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected+.dou-editor__block.is-selected:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected+.dou-editor__block.is-selected:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected .dou-editor__block.is-selected{background-color:#0000}.dou-editor__block.is-selected>.dou-editor__content--codeBlock{background-image:linear-gradient(var(--dou-editor-selected),var(--dou-editor-selected))}.dou-editor .is-block-selecting{caret-color:transparent}.dou-editor .is-block-selecting ::selection{background-color:#0000}.dou-editor.is-dragging .dou-editor__block.is-selected{opacity:.45}.dou-editor__handle{--dou-editor-handle-height:24px;--dou-editor-handle-offset:4px;position:absolute;z-index:1;box-sizing:border-box;display:flex;height:var(--dou-editor-handle-height);margin-top:calc((var(--dou-editor-line,24px) - var(--dou-editor-handle-height))/2);border:1px solid var(--dou-color-border);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-sm);transform:translateX(calc(-100% - var(--dou-editor-handle-offset) + var(--dou-editor-handle-shift,0px)));border-radius:6px;align-items: center;padding:1px}.dou-editor__handle.is-table{--dou-editor-handle-offset:10px}@media (hover:hover) and (pointer:fine){.dou-editor__handle:after{content:"";position:absolute;top:0;bottom:0;width:calc(var(--dou-editor-handle-offset) + 1px);left:100%}}.dou-editor__handle-button{display:inline-flex;color:var(--dou-color-text-tertiary);cursor:pointer;transition-property:background-color,color;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing);background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items: center;width:20px;height:100%;margin:0;padding:0}.dou-editor__handle-button>svg{width:14px;height:14px}.dou-editor__handle-button:hover{background-color:var(--dou-editor-control-hover);color:var(--dou-color-text-secondary)}.dou-editor__handle-button[aria-expanded=true]{background-color:var(--dou-editor-control-hover);color:var(--dou-color-text-secondary)}.dou-editor__add{display:none}@media (hover:hover) and (pointer:fine){.dou-editor__handle:not(.is-compact):hover .dou-editor__add{display:inline-flex}}.dou-editor__grip{position:relative;cursor:grab;touch-action:none;width:16px}@media (pointer:coarse){.dou-editor__handle{--dou-editor-handle-height:32px}.dou-editor__handle.is-table{--dou-editor-handle-offset:12px}.dou-editor__grip{-webkit-touch-callout:none;user-select:none;width:18px}.dou-editor__grip:before{content:"";position:absolute;inset:-8px -8px -8px -14px}}.dou-editor__ghost{position:fixed;z-index:2000;box-sizing:border-box;overflow:hidden;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);opacity:.88;pointer-events:none;max-height:160px;padding:6px 12px;top:0;left:0}.dou-editor__ghost>.dou-editor__block:first-child>.dou-editor__content{margin-top:0}.dou-editor__drop{position:absolute;background-color:var(--dou-color-focus);pointer-events:none;border-radius:1px;height:2px;margin-top:-1px}.dou-editor__drop.is-vertical{width:2px;height:auto;margin-top:0;margin-left:-1px}.dou-editor__mention{background-color:var(--dou-color-bg-muted);color:var(--dou-color-text);white-space:nowrap;border-radius:4px;padding:0 2px;font-weight:500}.dou-editor-mention{max-height:min(var(--dou-floating-available,100vh),288px);width:240px}.dou-editor-mention__item{gap:10px;height:auto;padding:6px 8px}.dou-editor-mention__item:focus{background-color:var(--dou-dropdown-item-active-bg)}.dou-editor-mention__item.is-active{background-color:var(--dou-dropdown-item-active-bg)}.dou-editor-mention__text{display:flex;flex-direction:column;flex:auto;gap:6px;min-width:0}.dou-editor-mention__label,.dou-editor-mention__description{overflow-x:clip;text-box:trim-both cap alphabetic;text-overflow:ellipsis;white-space:nowrap}.dou-editor-mention__description{color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm)}.dou-editor-slash{max-height:min(var(--dou-floating-available,100vh),336px);width:288px}.dou-editor-slash__item{gap:10px;height:auto;padding:6px 8px 6px 6px}.dou-editor-slash__item:focus{background-color:var(--dou-dropdown-item-active-bg)}.dou-editor-slash__item.is-active{background-color:var(--dou-dropdown-item-active-bg)}.dou-editor-slash__icon{display:inline-flex;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);color:var(--dou-color-text-secondary);flex:none;justify-content:center;align-items: center;width:32px;height:32px}.dou-editor-slash__icon>svg{width:18px;height:18px}.dou-editor-slash__text{display:flex;flex-direction:column;flex:auto;gap:6px;min-width:0}.dou-editor-slash__label,.dou-editor-slash__hint{overflow-x:clip;text-box:trim-both cap alphabetic;text-overflow:ellipsis}.dou-editor-slash__hint{color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm)}.dou-editor-slash__shortcut{color:var(--dou-color-text-tertiary);font-family:var(--dou-font-family-mono);font-size:var(--dou-font-size-sm);text-box:trim-both cap alphabetic;flex:none}.dou-editor-slash__empty{color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm);padding:8px}.dou-editor-slash__more{color:var(--dou-color-text-tertiary);flex:none;width:16px;height:16px}.dou-editor-slash__choices{max-height:none;padding:8px}.dou-editor-slash__choices-title{color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm);text-box:trim-both cap alphabetic;padding:4px 4px 10px}.dou-editor-slash__unfolded{padding:4px 8px 8px}.dou-editor-slash__unfolded .dou-editor-slash__choices-title{padding-inline-start:0;padding-inline-end:0}.dou-editor-slash__more{transition:rotate var(--dou-motion-duration-fast)var(--dou-motion-easing)}.dou-editor-slash__more.is-unfolded{rotate:90deg}.dou-editor-column-picker{display:flex;gap:6px;padding:2px 4px 4px}.dou-editor-column-picker__bar{background-color:var(--dou-color-bg-muted);cursor:pointer;transition:background-color var(--dou-motion-duration-fast)var(--dou-motion-easing);border-radius:4px;width:24px;height:72px}.dou-editor-column-picker__bar.is-lit{background-color:color-mix(in oklab,var(--dou-color-text)calc(22% + 8%*var(--dou-scheme-dark)),transparent)}@media (pointer:coarse){.dou-editor-column-picker__bar{width:32px}}.dou-editor__content--columns,.dou-editor__content--column{display:none}.dou-editor__content--columns+.dou-editor__group{container:dou-editor-columns/inline-size;display:flex;column-gap:var(--dou-editor-column-gap);flex-wrap:wrap;row-gap:12px;padding-inline-start:0}.dou-editor__content--columns+.dou-editor__group>.dou-editor__block{flex:var(--dou-editor-column-width,1)1 0;min-width:0}.dou-editor__content--column+.dou-editor__group{padding-inline-start:0}.dou-editor__content--column+.dou-editor__group .dou-editor__content--table{padding-inline-start:12px}@media (hover:hover){.dou-editor:not(.is-readonly) .dou-editor__content--columns+.dou-editor__group:hover>.dou-editor__block{outline:1px dashed var(--dou-color-border)}}@container dou-editor-columns (width<=480px){.dou-editor__content--columns+.dou-editor__group>.dou-editor__block{flex-basis:100%}}.dou-editor-columns__bar{position:absolute;z-index:2;outline:none;cursor:col-resize;touch-action:none;width:10px;margin-inline-start:-5px}@media (pointer:coarse){.dou-editor-columns__bar:before{content:"";position:absolute;top:0;bottom:0;left:-15px;right:-15px}}.dou-editor-columns__bar:after{content:"";position:absolute;background-color:var(--dou-color-focus);opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);border-radius:1px;width:2px;top:0;bottom:0}.dou-editor-columns__bar:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:4px}.dou-editor-columns__bar:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:4px}.dou-editor-columns__bar:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:4px}.dou-editor-columns__bar:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:4px}.dou-editor-columns__bar:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:4px}.dou-editor-columns__bar:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:4px}.dou-editor-columns__bar:hover:after{opacity:1}.dou-editor-columns__bar.is-shown:after{opacity:1}.dou-editor-columns__bar:focus-visible:after{opacity:1}.dou-editor-columns__bar.is-key:not(:-webkit-any(.is-shown,:focus)){pointer-events:none}.dou-editor-columns__bar.is-key:not(:-moz-any(.is-shown,:focus)){pointer-events:none}.dou-editor-columns__bar.is-key:not(:is(.is-shown,:focus)){pointer-events:none}.dou-editor:has(.dou-editor-columns__bar:-webkit-any(:hover,.is-shown)) .dou-editor__handle.is-compact{opacity:0;pointer-events:none}.dou-editor:has(.dou-editor-columns__bar:-moz-any(:hover,.is-shown)) .dou-editor__handle.is-compact{opacity:0;pointer-events:none}.dou-editor:has(.dou-editor-columns__bar:is(:hover,.is-shown)) .dou-editor__handle.is-compact{opacity:0;pointer-events:none}.dou-editor__content--table{display:flex;overflow-x:auto;overscroll-behavior-x:contain;margin-block-start:4px;margin-block-end:4px;padding-block-start:8px;padding-block-end:4px}.dou-editor__content--table>.dou-editor-table{flex:none}.dou-editor__content--table:before{content:"";position:sticky;z-index:1;opacity:0;pointer-events:none;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);flex:none;width:8px}.dou-editor__content--table:after{content:"";position:sticky;z-index:1;opacity:0;pointer-events:none;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);flex:none;width:8px}.dou-editor__content--table:before{background-image:linear-gradient(to right,var(--dou-editor-scroll-shadow),transparent);margin-inline-end:-8px}.dou-editor__content--table:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:after{background-image:linear-gradient(to left,var(--dou-editor-scroll-shadow),transparent);margin-inline-start:-8px}.dou-editor__content--table:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{right:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{right:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{right:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{left:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{left:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{left:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table.is-cut-start:before{opacity:1}.dou-editor__content--table.is-cut-end:after{opacity:1}.dou-editor__mount>.dou-editor__surface>.dou-editor__block>.dou-editor__content--table{--dou-editor-bleed-start:max(0px,var(--dou-editor-margin-start,0px) - 10px);--dou-editor-bleed-end:var(--dou-editor-margin-end,0px);--dou-editor-frame-start:var(--dou-editor-bleed-start);--dou-editor-frame-end:min(var(--dou-editor-bleed-end),28px);margin-inline:calc(-1*var(--dou-editor-bleed-start))calc(-1*var(--dou-editor-bleed-end));padding-inline:var(--dou-editor-frame-start)var(--dou-editor-frame-end)}.dou-editor__mount>.dou-editor__surface>.dou-editor__block.is-selected.has-table{background-color:#0000}.dou-editor__mount>.dou-editor__surface>.dou-editor__block.is-selected.has-table:before{content:"";position:absolute;top:0;bottom:0;inset-inline:calc(-1*var(--dou-editor-margin-start,0px))calc(-1*var(--dou-editor-margin-end,0px));border-radius:inherit;background-color:var(--dou-editor-selected);pointer-events:none}.dou-editor__mount>.dou-editor__surface>.dou-editor__block.is-selected.has-table>.dou-editor__content--table{position:relative;z-index:0}.dou-editor-table{border-collapse:collapse;table-layout:fixed;font-size:inherit;line-height:inherit}.dou-editor-table td{position:relative;box-sizing:border-box;border:1px solid var(--dou-color-border);text-align:start;vertical-align:top;white-space:pre-wrap;min-width:48px;padding:6px 10px}.dou-editor-table th{position:relative;box-sizing:border-box;border:1px solid var(--dou-color-border);text-align:start;vertical-align:top;white-space:pre-wrap;min-width:48px;padding:6px 10px}.dou-editor-table th{background-color:var(--dou-color-bg-muted);font-weight:600}.ProseMirror-hideselection .dou-editor-table *::selection{background:0 0}.ProseMirror-hideselection .dou-editor-table{caret-color:transparent}.dou-editor-table .selectedCell:after{content:"";position:absolute;background-color:var(--dou-editor-selected);pointer-events:none;inset:0}.dou-editor-table .column-resize-handle{position:absolute;z-index:1;background-color:var(--dou-color-focus);pointer-events:none;width:3px;top:-1px;bottom:-1px}.dou-editor-table .column-resize-handle:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:-2px}.dou-editor-table .column-resize-handle:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:-2px}.dou-editor-table .column-resize-handle:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:-2px}.dou-editor-table .column-resize-handle:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:-2px}.dou-editor-table .column-resize-handle:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:-2px}.dou-editor-table .column-resize-handle:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:-2px}.dou-editor__surface.resize-cursor{cursor:col-resize}.dou-editor-table__handle{position:absolute;z-index:2;display:inline-flex;border:1px solid var(--dou-color-border);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-sm);color:var(--dou-color-text-tertiary);cursor:pointer;transition-property:background-color,color;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing);touch-action:none;border-radius:4px;justify-content:center;align-items: center;margin:0;padding:0;transform:translate(-50%,-50%)}.dou-editor-table__handle.is-column{width:24px;height:14px}.dou-editor-table__handle.is-row{width:14px;height:24px}.dou-editor-table__handle:before{content:"";position:absolute;inset:-4px}@media (pointer:coarse){.dou-editor-table__handle.is-column{width:32px;height:18px}.dou-editor-table__handle.is-row{width:18px;height:32px}.dou-editor-table__handle:before{inset:-10px}}.dou-editor-table__handle svg{width:14px;height:14px}.dou-editor-table__handle:hover{background-color:color-mix(in oklab,var(--dou-color-text)calc(6% + 6%*var(--dou-scheme-dark)),var(--dou-color-bg-surface));color:var(--dou-color-text)}.dou-editor-table__handle.is-active{background-color:color-mix(in oklab,var(--dou-color-text)calc(6% + 6%*var(--dou-scheme-dark)),var(--dou-color-bg-surface));color:var(--dou-color-text)}.dou-editor-table__add{position:absolute;z-index:1;display:inline-flex;box-sizing:border-box;color:var(--dou-color-text-tertiary);cursor:pointer;opacity:.6;transition-property:background-color,color,opacity;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing);background-color:#0000;border:none;border-radius:4px;justify-content:center;align-items: center;margin:0;padding:0}.dou-editor-table__add.is-column{width:16px;margin-inline-start:4px}.dou-editor-table__add.is-row{height:16px;margin-block-start:4px}.dou-editor-table__add svg{width:14px;height:14px}.dou-editor-table__add:hover{background-color:var(--dou-editor-control-hover);color:var(--dou-color-text);opacity:1}@media (pointer:coarse){.dou-editor-table__add{opacity:1}.dou-editor-table__add.is-column{width:24px}.dou-editor-table__add.is-row{height:24px}.dou-editor-table .column-resize-handle{display:none}}.dou-editor-table__ghost{overflow:hidden;padding:0}.dou-editor-table__ghost .dou-editor-table{width:auto;margin:0}.dou-editor-table__cells{position:absolute;z-index:3;display:flex;border:1px solid var(--dou-color-border);border-radius:calc(var(--dou-radius-control) + 2px);background-color:color-mix(in oklab,var(--dou-color-text)calc(4%*var(--dou-scheme-dark)),var(--dou-color-bg-surface));box-shadow:var(--dou-shadow-md);font-size:var(--dou-font-size-sm);white-space:nowrap;gap:2px;padding:3px;line-height:normal;transform:translate(-50%,calc(-100% - 6px))}.dou-editor-table__cells.is-below{transform:translate(-50%,6px)}.dou-editor-table__cells-button{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-color-text);font:inherit;cursor:pointer;background:0 0;border:none;align-items: center;gap:4px;height:26px;margin:0;padding-inline-start:8px;padding-inline-end:8px}.dou-editor-table__cells-button svg{color:var(--dou-color-text-secondary);width:14px;height:14px}.dou-editor-table__cells-button:hover:not(:disabled){background-color:var(--dou-editor-control-hover)}.dou-editor-table__cells-button:disabled{color:var(--dou-color-text-tertiary);cursor:default}.dou-editor-bubble{border:1px solid var(--dou-color-border);border-radius:calc(var(--dou-radius-control) + 4px);background-color:color-mix(in oklab,var(--dou-color-text)calc(4%*var(--dou-scheme-dark)),var(--dou-color-bg-surface));box-shadow:var(--dou-shadow-md);color:var(--dou-color-text);font-family:var(--dou-font-family);font-size:var(--dou-font-size-md);padding:4px;line-height:normal}.dou-editor-bubble__type{gap:4px}.dou-editor-bubble__type svg{color:var(--dou-color-text-tertiary)}.dou-editor-bubble__link{display:flex;align-items: center;gap:4px}.dou-editor-bubble__link>.dou-input{width:240px}.dou-editor__content--image{padding-block-start:6px;padding-block-end:6px}.dou-editor-image__figure{width:-moz-fit-content;width:fit-content;min-width:min(100%,240px);max-width:100%;margin:0 auto}.dou-editor-image__frame{position:relative;border-radius:var(--dou-radius-control);width:-moz-fit-content;width:fit-content;max-width:100%;margin:0 auto;line-height:0}.dou-editor-image__img{display:block;border-radius:inherit;outline:1px solid color-mix(in oklab,var(--dou-color-text)8%,transparent);outline-offset:-1px;max-width:100%;height:auto}.dou-editor-image__figure.is-sized .dou-editor-image__frame,.dou-editor-image__figure.is-sized .dou-editor-image__img{width:100%}.dou-editor-image.is-selected .dou-editor-image__img{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor-image__status{position:absolute;display:flex;border-radius:inherit;background-color:color-mix(in oklab,var(--dou-color-bg-surface)72%,transparent);color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-md);justify-content:center;align-items: center;gap:8px;line-height:normal;inset:0}.dou-editor-image__status.is-failed{color:var(--dou-color-danger-text)}.dou-editor-image__handle{position:absolute;border:1px solid color-mix(in oklab,var(--dou-color-bg-surface)70%,transparent);border-radius:var(--dou-radius-full);background-color:color-mix(in oklab,var(--dou-color-text)55%,transparent);cursor:ew-resize;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);touch-action:none;width:6px;height:40px;max-height:50%;top:50%;transform:translateY(-50%)}.dou-editor-image__handle:before{position:absolute;content:"";inset:-4px -9px}.dou-editor-image__handle.is-left{left:8px}.dou-editor-image__handle.is-right{right:8px}.dou-editor-image__frame:hover .dou-editor-image__handle,.dou-editor-image.is-selected .dou-editor-image__handle{opacity:1}.dou-editor-image__caption{color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-md);text-align:center;margin-top:6px;line-height:1.5}.dou-editor-image__caption-input{color:inherit;font:inherit;font-size:max(var(--dou-font-size-input-min,0px),1em);text-align:inherit;outline:none;background:0 0;border:none;width:100%;padding:0}.dou-editor-image__caption-input::placeholder{color:var(--dou-color-text-tertiary)}.dou-editor-image__caption-input:placeholder-shown:not(:focus){opacity:0}.dou-editor-image:hover .dou-editor-image__caption-input,.dou-editor-image.is-selected .dou-editor-image__caption-input,.dou-editor-embed:hover .dou-editor-image__caption-input,.dou-editor-embed.is-selected .dou-editor-image__caption-input{opacity:1}.dou-editor-image__empty{display:flex;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:color-mix(in oklab,var(--dou-color-text)3%,var(--dou-color-bg-surface));color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-md);flex-wrap:wrap;align-items: center;gap:8px 12px;padding:12px 14px;line-height:normal}.dou-editor-image.is-selected .dou-editor-image__empty,.dou-editor-attachment.is-selected .dou-editor-image__empty,.dou-editor-embed.is-selected .dou-editor-image__empty{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor-image__empty-icon{color:var(--dou-color-text-tertiary);flex:none;width:18px;height:18px}.dou-editor-image__empty-text{flex:auto}.dou-editor-image__actions,.dou-editor-image__embed{display:flex;gap:8px}.dou-editor-image__embed{flex:240px}.dou-editor-image__embed>.dou-input{flex:auto}.dou-editor__content--attachment,.dou-editor__content--embed{padding-block-start:4px;padding-block-end:4px}.dou-editor-attachment__card{display:flex;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-sm);align-items: center;gap:12px;padding:10px 10px 10px 14px;line-height:normal}.dou-editor-attachment.is-selected .dou-editor-attachment__card{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor-attachment__icon{color:var(--dou-color-text-secondary);flex:none;width:20px;height:20px}.dou-editor-attachment__text{display:flex;flex-direction:column;flex:auto;gap:2px;min-width:0}.dou-editor-attachment__name{overflow-x:clip;color:var(--dou-color-text);font-size:var(--dou-font-size-md);text-overflow:ellipsis;white-space:nowrap;font-weight:500}.dou-editor-attachment__meta{display:flex;color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm);font-variant-numeric:tabular-nums;align-items: center;gap:6px}.dou-editor-attachment__download{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-color-text-secondary);transition:background-color var(--dou-motion-duration-fast)var(--dou-motion-easing);flex:none;justify-content:center;align-items: center;width:32px;height:32px}.dou-editor-attachment__download>svg{width:16px;height:16px}.dou-editor-attachment__download:hover{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text)}.dou-editor-attachment__download:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:1px}@media (pointer:coarse){.dou-editor-attachment__download{width:40px;height:40px}}.dou-editor-embed__figure{margin:0}.dou-editor-embed__frame{overflow:clip;border-radius:var(--dou-radius-control);background-color:color-mix(in oklab,var(--dou-color-text)4%,var(--dou-color-bg-surface));outline:1px solid color-mix(in oklab,var(--dou-color-text)8%,transparent);outline-offset:-1px;width:100%;line-height:0}.dou-editor-embed__frame>iframe{display:block;border:0;width:100%;height:100%}.dou-editor-embed__frame>video{display:block;border:0;width:100%;height:100%}.dou-editor-embed__frame.is-audio{overflow:visible;outline:none;background:0 0}.dou-editor-embed__frame.is-audio>audio{display:block;width:100%}.dou-editor-embed.is-selected .dou-editor-embed__frame{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor.is-dragging .dou-editor-embed__frame{pointer-events:none}.dou-editor-embed__caption{display:grid;grid-template-columns:var(--dou-control-height-sm)1fr var(--dou-control-height-sm);align-items: center;gap:4px}.dou-editor-embed__caption>.dou-editor-image__caption-input{grid-column:2}.dou-editor-embed__edit{grid-column:3;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing)}.dou-editor-embed:hover .dou-editor-embed__edit,.dou-editor-embed.is-selected .dou-editor-embed__edit{opacity:1}.dou-editor-embed__edit:focus-visible{opacity:1}@media (pointer:coarse){.dou-editor-embed__edit{opacity:1}}.dou-editor-board{position:relative;overflow:hidden;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);touch-action:pan-y}.dou-editor-board.is-selected{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor__block.is-selected>.dou-editor__content>.dou-editor-board:after{position:absolute;background-color:var(--dou-editor-selected);content:"";pointer-events:none;inset:0}.dou-editor-board__preview{position:absolute;pointer-events:none;inset:0}.dou-editor-board__preview .dou-flow-editor{background:0 0;width:100%;height:100%}.dou-editor-board__empty{display:flex;background-color:color-mix(in oklab,var(--dou-color-text)3%,var(--dou-color-bg-surface));color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-md);flex-direction:column;justify-content:center;align-items: center;gap:12px;height:100%}.dou-editor-board__actions{position:absolute;display:flex;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);gap:4px;top:8px;right:8px}.dou-editor-board:hover .dou-editor-board__actions,.dou-editor-board.is-selected .dou-editor-board__actions,.dou-editor-board__actions:focus-within{opacity:1}@media (pointer:coarse){.dou-editor-board__actions{opacity:1}}.dou-editor-board__resize{position:absolute;cursor:ns-resize;touch-action:none;height:10px;bottom:0;left:0;right:0}.dou-editor-board__resize:after{position:absolute;background-color:var(--dou-color-border-strong);content:"";opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);border-radius:2px;width:40px;height:4px;bottom:3px;left:50%;transform:translate(-50%)}.dou-editor-board__resize:focus-visible{outline:none}.dou-editor-board__resize:focus-visible:after{background-color:var(--dou-color-focus)}.dou-editor-board:hover .dou-editor-board__resize:after,.dou-editor-board.is-selected .dou-editor-board__resize:after{opacity:1}.dou-editor-board__resize:focus-visible:after{opacity:1}@media (pointer:coarse){.dou-editor-board__resize{width:80px;height:40px;left:50%;right:auto;transform:translate(-50%)}.dou-editor-board:not(.is-selected) .dou-editor-board__resize{pointer-events:none}.dou-editor-board.is-selected .dou-editor-board__resize:after{opacity:1}}.dou-editor-board__editor{height:100%}.dou-editor-board__editor>.dou-flow-editor{width:100%;height:100%}.dou-editor-board__add{position:absolute;border-radius:var(--dou-radius-control);box-shadow:var(--dou-shadow-sm);top:12px;left:12px}@media (pointer:coarse){.dou-editor-board__add .dou-button:after{position:absolute;content:"";inset:min(0px,50% - 20px) 0}}.dou-popover:has(>.dou-popover__content>.dou-editor-board__types){--dou-popover-padding:0}.dou-editor-board__types{width:260px;max-width:100%}.dou-editor-board__types .dou-command__search{height:40px;padding:0 12px}.dou-editor-board__type-icon{display:inline-flex;border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-muted);color:var(--dou-color-text-secondary);flex:none;justify-content:center;align-items: center;width:20px;height:20px}.dou-editor-board__type-icon svg{width:14px;height:14px}.dou-editor-board__type{display:flex;flex:1;align-self:stretch;align-items: center;gap:8px;min-width:0;margin:-6px -10px;padding:6px 10px}.dou-flow-editor__panels>.dou-editor-board__hint{position:absolute;color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm);text-align:center;pointer-events:none;width:max-content;max-width:calc(100% - 48px);margin:0;top:50%;left:50%;transform:translate(-50%,-50%)}.dou-editor-embed__link{overflow-x:clip;color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm);text-overflow:ellipsis;white-space:nowrap;max-width:100%}.dou-editor-embed__error{color:var(--dou-color-danger-text);font-size:var(--dou-font-size-sm);flex-basis:100%}.dou-editor__cursor{position:relative;border-inline-start:2px solid var(--dou-editor-cursor-color);pointer-events:none;word-break:normal;margin-inline-start:-1px;margin-inline-end:-1px}.dou-editor__cursor-label{position:absolute;background-color:var(--dou-editor-cursor-color);color:oklch(from var(--dou-editor-cursor-color)clamp(.2,(.66 - l)*100,.99)0 0);font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);white-space:nowrap;user-select:none;border-radius:4px 4px 4px 0;padding:0 6px;font-style:normal;font-weight:400;line-height:18px;bottom:100%;left:-2px}.dou-editor__remote-selection{background-color:color-mix(in oklab,var(--dou-editor-cursor-color)20%,transparent)}.dou-editor,.dou-editor-menu,.dou-editor-palette{--dou-editor-color-gray:color-mix(in srgb,#a3a7ad calc(100%*var(--dou-scheme-dark)),#6b6f76);--dou-editor-highlight-gray:color-mix(in srgb,#3a3b3d calc(100%*var(--dou-scheme-dark)),#ececeb);--dou-editor-color-red:color-mix(in srgb,#e58a84 calc(100%*var(--dou-scheme-dark)),#b4453f);--dou-editor-highlight-red:color-mix(in srgb,#4a2826 calc(100%*var(--dou-scheme-dark)),#f8e3e1);--dou-editor-color-orange:color-mix(in srgb,#e0975f calc(100%*var(--dou-scheme-dark)),#b0622a);--dou-editor-highlight-orange:color-mix(in srgb,#4a3222 calc(100%*var(--dou-scheme-dark)),#f9e7d8);--dou-editor-color-yellow:color-mix(in srgb,#d4b44f calc(100%*var(--dou-scheme-dark)),#94761b);--dou-editor-highlight-yellow:color-mix(in srgb,#4a4020 calc(100%*var(--dou-scheme-dark)),#f8efc8);--dou-editor-color-green:color-mix(in srgb,#7fbf8c calc(100%*var(--dou-scheme-dark)),#3f7f4f);--dou-editor-highlight-green:color-mix(in srgb,#253d2b calc(100%*var(--dou-scheme-dark)),#e1f0e2);--dou-editor-color-blue:color-mix(in srgb,#7fa7d9 calc(100%*var(--dou-scheme-dark)),#3b6ea8);--dou-editor-highlight-blue:color-mix(in srgb,#23334a calc(100%*var(--dou-scheme-dark)),#e1ebf7);--dou-editor-color-purple:color-mix(in srgb,#b69ad6 calc(100%*var(--dou-scheme-dark)),#7a52a3);--dou-editor-highlight-purple:color-mix(in srgb,#352a47 calc(100%*var(--dou-scheme-dark)),#ece4f5);--dou-editor-color-pink:color-mix(in srgb,#dd8ab4 calc(100%*var(--dou-scheme-dark)),#a8467a);--dou-editor-highlight-pink:color-mix(in srgb,#46283a calc(100%*var(--dou-scheme-dark)),#f6e2ec)}.dou-editor__color,.dou-editor-palette span[data-color]{color:var(--dou-editor-text-color,inherit)}.dou-editor__highlight,.dou-editor-palette mark[data-color]{background-color:var(--dou-editor-mark-color,var(--dou-editor-highlight-yellow));color:inherit;box-decoration-break:clone;border-radius:2px}.dou-editor__color[data-color=gray],.dou-editor-palette span[data-color=gray],.dou-editor-colors__swatch[data-color=gray]{--dou-editor-text-color:var(--dou-editor-color-gray)}.dou-editor__highlight[data-color=gray],.dou-editor-palette mark[data-color=gray],.dou-editor-colors__swatch[data-highlight=gray]{--dou-editor-mark-color:var(--dou-editor-highlight-gray)}.dou-editor__color[data-color=red],.dou-editor-palette span[data-color=red],.dou-editor-colors__swatch[data-color=red]{--dou-editor-text-color:var(--dou-editor-color-red)}.dou-editor__highlight[data-color=red],.dou-editor-palette mark[data-color=red],.dou-editor-colors__swatch[data-highlight=red]{--dou-editor-mark-color:var(--dou-editor-highlight-red)}.dou-editor__color[data-color=orange],.dou-editor-palette span[data-color=orange],.dou-editor-colors__swatch[data-color=orange]{--dou-editor-text-color:var(--dou-editor-color-orange)}.dou-editor__highlight[data-color=orange],.dou-editor-palette mark[data-color=orange],.dou-editor-colors__swatch[data-highlight=orange]{--dou-editor-mark-color:var(--dou-editor-highlight-orange)}.dou-editor__color[data-color=yellow],.dou-editor-palette span[data-color=yellow],.dou-editor-colors__swatch[data-color=yellow]{--dou-editor-text-color:var(--dou-editor-color-yellow)}.dou-editor__highlight[data-color=yellow],.dou-editor-palette mark[data-color=yellow],.dou-editor-colors__swatch[data-highlight=yellow]{--dou-editor-mark-color:var(--dou-editor-highlight-yellow)}.dou-editor__color[data-color=green],.dou-editor-palette span[data-color=green],.dou-editor-colors__swatch[data-color=green]{--dou-editor-text-color:var(--dou-editor-color-green)}.dou-editor__highlight[data-color=green],.dou-editor-palette mark[data-color=green],.dou-editor-colors__swatch[data-highlight=green]{--dou-editor-mark-color:var(--dou-editor-highlight-green)}.dou-editor__color[data-color=blue],.dou-editor-palette span[data-color=blue],.dou-editor-colors__swatch[data-color=blue]{--dou-editor-text-color:var(--dou-editor-color-blue)}.dou-editor__highlight[data-color=blue],.dou-editor-palette mark[data-color=blue],.dou-editor-colors__swatch[data-highlight=blue]{--dou-editor-mark-color:var(--dou-editor-highlight-blue)}.dou-editor__color[data-color=purple],.dou-editor-palette span[data-color=purple],.dou-editor-colors__swatch[data-color=purple]{--dou-editor-text-color:var(--dou-editor-color-purple)}.dou-editor__highlight[data-color=purple],.dou-editor-palette mark[data-color=purple],.dou-editor-colors__swatch[data-highlight=purple]{--dou-editor-mark-color:var(--dou-editor-highlight-purple)}.dou-editor__color[data-color=pink],.dou-editor-palette span[data-color=pink],.dou-editor-colors__swatch[data-color=pink]{--dou-editor-text-color:var(--dou-editor-color-pink)}.dou-editor__highlight[data-color=pink],.dou-editor-palette mark[data-color=pink],.dou-editor-colors__swatch[data-highlight=pink]{--dou-editor-mark-color:var(--dou-editor-highlight-pink)}.dou-editor-colors__swatch{display:inline-flex;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:calc(var(--dou-radius-control) - 2px);background-color:var(--dou-editor-mark-color,transparent);color:var(--dou-editor-text-color,var(--dou-color-text));font-size:var(--dou-font-size-sm);font-weight:var(--dou-font-weight-bold);justify-content:center;align-items: center;width:20px;height:20px;line-height:1}.dou-dropdown__item:focus .dou-editor-colors__swatch{border-color:var(--dou-color-border-strong)}.dou-editor-colors__button:-webkit-any(:hover,[aria-expanded=true]) .dou-editor-colors__swatch{border-color:var(--dou-color-border-strong)}.dou-editor-colors__button:-moz-any(:hover,[aria-expanded=true]) .dou-editor-colors__swatch{border-color:var(--dou-color-border-strong)}.dou-editor-colors__button:is(:hover,[aria-expanded=true]) .dou-editor-colors__swatch{border-color:var(--dou-color-border-strong)}.dou-editor-colors__letter{display:block;text-box:trim-both cap alphabetic}.dou-editor__search{position:sticky;z-index:5;display:flex;container-type:inline-size;pointer-events:none;justify-content:flex-end;align-items: flex-start;height:0;top:8px}.dou-editor__search>*{pointer-events:auto}.dou-editor__match{background-color:var(--dou-editor-match);border-radius:2px}.dou-editor__match.is-current{box-shadow:0 0 0 1px var(--dou-editor-match-current)}}
1
+ @layer dou.components{.dou-editor{--dou-editor-font-size:var(--dou-font-size-lg);--dou-editor-line-height:1.7;--dou-editor-gutter:0px;--dou-editor-indent:24px;--dou-editor-column-gap:48px;--dou-editor-block-gap:4px;--dou-editor-list-gap:4px;--dou-editor-reading-width:none;--dou-editor-selected:color-mix(in oklab,var(--dou-color-focus)calc(12% + 10%*var(--dou-scheme-dark)),transparent);--dou-editor-scroll-shadow:color-mix(in oklab,var(--dou-color-text)14%,transparent);--dou-editor-control-hover:color-mix(in oklab,var(--dou-color-text)6%,transparent);--dou-editor-match:color-mix(in oklab,var(--dou-color-warning)22%,transparent);--dou-editor-match-current:color-mix(in oklab,var(--dou-color-warning-text)80%,transparent);--dou-editor-comment-bg:color-mix(in oklab,var(--dou-color-warning)18%,transparent);--dou-editor-comment-bg-active:color-mix(in oklab,var(--dou-color-warning)36%,transparent);--dou-editor-comment-line:color-mix(in oklab,var(--dou-color-warning)72%,transparent);--dou-editor-comment-code-bg:color-mix(in oklab,var(--dou-color-text)calc(6% + 4%*var(--dou-scheme-dark)),transparent);--dou-editor-comment-code-border:color-mix(in oklab,var(--dou-color-text)calc(12% + 6%*var(--dou-scheme-dark)),transparent);--dou-editor-table-col-min-width:96px;--dou-editor-table-col-max-width:min(320px,70vw);position:relative;box-sizing:border-box;color:var(--dou-color-text);font-family:var(--dou-font-family);font-size:max(var(--dou-font-size-input-min,0px),var(--dou-editor-font-size));line-height:var(--dou-editor-line-height);overflow-wrap:break-word;width:100%;min-width:0;padding-inline-start:var(--dou-editor-gutter)}.dou-editor.is-comparing{--dou-editor-gutter:16px}@media (pointer:coarse){.dou-editor{--dou-editor-column-gap:32px}}.dou-editor.is-dragging{cursor:grabbing}.dou-editor.is-dragging *{cursor:grabbing}.dou-editor__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}.dou-editor__mount>.dou-editor__surface,.dou-editor__search{padding-inline-start:max(0px,(100% - var(--dou-editor-reading-width) - var(--dou-editor-gutter))/2);padding-inline-end:max(0px,min(100% - var(--dou-editor-reading-width),(100% - var(--dou-editor-reading-width) + var(--dou-editor-gutter))/2))}.dou-editor__surface{min-height:calc(var(--dou-editor-line-height)*1em);outline:none;white-space:pre-wrap;word-wrap:break-word;font-variant-ligatures:none}.dou-editor__block{position:relative;border-radius:4px}.dou-editor__group{padding-inline-start:var(--dou-editor-indent)}.dou-editor__content{position:relative;padding-block:calc(var(--dou-editor-block-gap)/2);font-size:1em;font-weight:inherit;line-height:var(--dou-editor-line-height);margin:0}.dou-editor__block>.dou-editor__content.is-list{--dou-editor-list-top:calc(var(--dou-editor-list-gap)/2);padding-block:var(--dou-editor-list-top)calc(var(--dou-editor-list-gap)/2)}.dou-editor__block>.dou-editor__content.is-list-start{--dou-editor-list-top:calc(max(var(--dou-editor-block-gap),var(--dou-editor-list-gap))/2);margin-top:min(0px,(var(--dou-editor-block-gap) - var(--dou-editor-list-gap))/2)}.dou-editor__block>.dou-editor__content.is-list-start.is-list-after{margin-top:min(0px,var(--dou-editor-block-gap) - var(--dou-editor-list-gap))}.dou-editor__block>.dou-editor__content.is-list-end{padding-bottom:calc(max(var(--dou-editor-block-gap),var(--dou-editor-list-gap))/2);margin-bottom:min(0px,(var(--dou-editor-block-gap) - var(--dou-editor-list-gap))/2)}.dou-editor__group.is-list-end{padding-bottom:max(0px,(var(--dou-editor-block-gap) - var(--dou-editor-list-gap))/2);margin-bottom:min(0px,(var(--dou-editor-block-gap) - var(--dou-editor-list-gap))/2)}.dou-editor__surface>.dou-editor__block:first-child>.dou-editor__content.is-list-start{margin-top:0}.dou-editor__surface>.dou-editor__block:last-child>.is-list-end{margin-bottom:0}.dou-editor__content--heading{--dou-editor-line-height:1.4;font-weight:var(--dou-font-weight-bold);letter-spacing:-.01em;margin-top:.6em}.dou-editor__content--heading:-webkit-any(h1){margin-top:.8em;font-size:1.75em}.dou-editor__content--heading:-moz-any(h1){margin-top:.8em;font-size:1.75em}.dou-editor__content--heading:is(h1){margin-top:.8em;font-size:1.75em}.dou-editor__content--heading:-webkit-any(h2){font-size:1.375em}.dou-editor__content--heading:-moz-any(h2){font-size:1.375em}.dou-editor__content--heading:is(h2){font-size:1.375em}.dou-editor__content--heading:-webkit-any(h3){font-size:1.125em}.dou-editor__content--heading:-moz-any(h3){font-size:1.125em}.dou-editor__content--heading:is(h3){font-size:1.125em}.dou-editor__surface>.dou-editor__block:first-child>.dou-editor__content--heading{margin-top:0}.dou-editor__content--bulletItem,.dou-editor__content--numberedItem{padding-inline-start:var(--dou-editor-indent)}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):before{position:absolute;width:var(--dou-editor-indent)}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:0}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:0}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:0}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:0}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:0}:is(.dou-editor__content--bulletItem,.dou-editor__content--numberedItem):is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:0}.dou-editor__content--bulletItem:before{content:"";top:calc(var(--dou-editor-list-top) + var(--dou-editor-line-height)*.5em - 3px);box-sizing:border-box;color:var(--dou-color-text-secondary);background-color:currentColor;border-radius:50%;width:6px;height:6px}.dou-editor__content--bulletItem:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:7px}.dou-editor__content--bulletItem:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:7px}.dou-editor__content--bulletItem:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:7px}.dou-editor__content--bulletItem:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:7px}.dou-editor__content--bulletItem:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:7px}.dou-editor__content--bulletItem:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:7px}.dou-editor__group .dou-editor__content--bulletItem:before{background-color:#0000;border:1.5px solid}.dou-editor__content--numberedItem:before{content:attr(data-index)".";top:var(--dou-editor-list-top);box-sizing:border-box;color:var(--dou-color-text-secondary);font-variant-numeric:tabular-nums;text-align:end;padding-inline-end:6px}.dou-editor__content--checkItem{display:flex;gap:8px}.dou-editor__check{display:inline-flex;height:calc(var(--dou-editor-line-height)*1em);user-select:none;flex:none;align-items: center}.dou-editor__checkbox{display:inline-flex;box-sizing:border-box;border:1px solid var(--dou-color-border-strong);border-radius:calc(var(--dou-radius-control) - 2px);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-sm);color:var(--dou-color-neutral-on);cursor:pointer;transition-property:background-color,border-color,box-shadow;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing);justify-content:center;align-items: center;width:16px;height:16px;margin:0;padding:0}.dou-editor__checkbox>svg{opacity:0;transition-property:opacity,transform;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing);width:100%;height:100%;transform:scale(.6)}.dou-editor__checkbox:hover:not(:disabled){border-color:color-mix(in oklab,var(--dou-color-neutral)45%,var(--dou-color-border-strong))}.dou-editor__checkbox:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor__checkbox:disabled{cursor:default}.dou-editor__content--checkItem[data-checked=true] .dou-editor__checkbox{border-color:color-mix(in oklab,var(--dou-color-neutral)90%,var(--dou-color-edge));background-color:var(--dou-color-neutral);box-shadow:var(--dou-shadow-highlight),0 1px 2px color-mix(in oklab,var(--dou-color-neutral)24%,transparent)}.dou-editor__content--checkItem[data-checked=true] .dou-editor__checkbox>svg{opacity:1;transform:none}.dou-editor__content--checkItem[data-checked=true] .dou-editor__text{color:var(--dou-color-text-tertiary);text-decoration:line-through;text-decoration-color:color-mix(in oklab,currentColor 60%,transparent)}.dou-editor__text{flex:auto;min-width:0}.dou-editor__content--quote{box-shadow:inset 2px 0 0 var(--dou-color-border-strong);color:var(--dou-color-text-secondary);padding-inline-start:14px}.dou-editor__content--codeBlock{--dou-editor-line-height:1.7;margin-block:calc(var(--dou-editor-block-gap)/2 + 2px);overflow-x:auto;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-container);background-color:var(--dou-color-bg-muted);font-family:var(--dou-font-family-mono);font-size:var(--dou-font-size-sm);tab-size:2;white-space:pre-wrap;padding:12px 16px}.dou-editor__content--codeBlock>code{font:inherit}.dou-editor-toggle{display:flex;gap:4px}.dou-editor-toggle__control{display:inline-flex;height:calc(var(--dou-editor-line-height)*1em);user-select:none;flex:none;align-items: center;margin-inline-start:-2px}.dou-editor-toggle__button{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-color-text-tertiary);cursor:pointer;background:0 0;border:none;justify-content:center;align-items: center;width:22px;height:22px;padding:0}.dou-editor-toggle__button>svg{transition:rotate var(--dou-motion-duration-fast)var(--dou-motion-easing);width:16px;height:16px}.dou-editor-toggle__button.is-open>svg{rotate:90deg}.dou-editor-toggle__button:hover{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text)}.dou-editor-toggle__button:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:-2px}.dou-editor__block.is-collapsed>.dou-editor__group{display:none}.dou-editor-callout{--dou-editor-callout-tone:var(--dou-color-text-secondary);display:flex;border:1px solid color-mix(in oklab,var(--dou-editor-callout-tone)22%,var(--dou-color-border));border-radius:var(--dou-radius-container);background-color:color-mix(in oklab,var(--dou-editor-callout-tone)6%,var(--dou-color-bg-surface));gap:8px;margin-block-start:2px;margin-block-end:2px;padding:8px 12px}.dou-editor-callout.is-tip{--dou-editor-callout-tone:var(--dou-color-success)}.dou-editor-callout.is-warning{--dou-editor-callout-tone:var(--dou-color-warning)}.dou-editor-callout.is-danger{--dou-editor-callout-tone:var(--dou-color-danger)}.dou-editor-callout__control{display:inline-flex;height:calc(var(--dou-editor-line-height)*1em);user-select:none;flex:none;align-items: center}.dou-editor-callout__icon{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-editor-callout-tone);background:0 0;border:none;justify-content:center;align-items: center;width:24px;height:24px;padding:0}.dou-editor-callout__icon>svg{width:16px;height:16px}button.dou-editor-callout__icon{cursor:pointer}button.dou-editor-callout__icon:hover{background-color:color-mix(in oklab,var(--dou-editor-callout-tone)12%,transparent)}button.dou-editor-callout__icon[aria-expanded=true]{background-color:color-mix(in oklab,var(--dou-editor-callout-tone)12%,transparent)}button.dou-editor-callout__icon:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:-2px}.dou-editor__content--codeBlock.dou-editor__content--custom{position:relative}.dou-editor-code__pre{font:inherit;white-space:inherit;margin:0}.dou-editor-code__pre>code{display:block;font:inherit}.dou-editor-code__bar{position:absolute;display:flex;border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-muted);font-family:var(--dou-font-family);opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);align-items: center;gap:2px;top:6px;right:6px}.dou-editor__content--codeBlock:hover>.dou-editor-code__bar,.dou-editor-code__bar:focus-within{opacity:1}.dou-editor-code__bar:has([aria-expanded=true]){opacity:1}.dou-editor-code__language{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-color-text-secondary);font:inherit;font-size:var(--dou-font-size-sm);cursor:pointer;background:0 0;border:none;align-items: center;gap:2px;height:24px;padding:0 4px 0 8px}.dou-editor-code__language>svg{width:14px;height:14px}.dou-editor-code__language:hover{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text)}.dou-editor-code__language[aria-expanded=true]{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text)}.dou-editor-code__language:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:-2px}.dou-editor-code__language.is-static{cursor:default;padding-inline-start:8px;padding-inline-end:8px}.dou-editor-code-editor.dou-editor__content--codeBlock{overflow:visible;white-space:normal;transition:border-color var(--dou-motion-duration-fast)var(--dou-motion-easing);padding:0}.dou-editor-code-editor.dou-editor__content--codeBlock:has(>.dou-code-editor.is-focused){border-color:color-mix(in oklab,var(--dou-color-focus)70%,var(--dou-color-text))}.dou-editor-code-editor.dou-editor__content--codeBlock>.dou-editor-code__bar{position:relative;z-index:3;opacity:1;background:0 0;justify-content:flex-end;padding:4px 6px 0 8px;top:auto;right:auto}.dou-editor-code-editor.dou-editor__content--codeBlock>.dou-editor-code__bar>:not(:last-child){margin-inline-end:auto}@media (pointer:coarse){.dou-editor-code__language:not(.is-static){position:relative}.dou-editor-code__language:not(.is-static):after{position:absolute;content:"";inset:min(0px,50% - 20px) 0}}.dou-editor-code__editor.dou-code-editor:not(.is-bordered){--dou-code-editor-bg:transparent;--dou-code-editor-gutter-bg:var(--dou-color-bg-muted);--dou-code-editor-padding-x:16px;--dou-code-editor-padding-y:8px;border-radius:inherit}.dou-editor__token{color:color-mix(in oklab,var(--shiki-dark,currentColor)calc(100%*var(--dou-scheme-dark)),var(--shiki-light,currentColor));font-style:var(--shiki-light-font-style,inherit);font-weight:var(--shiki-light-font-weight,inherit)}.dou-editor__content--divider{cursor:default;padding-block-start:12px;padding-block-end:12px}.dou-editor__content--divider>hr{background-color:var(--dou-color-border);border:none;height:1px;margin:0}.dou-editor__content--divider.ProseMirror-selectednode>hr{background-color:var(--dou-color-focus)}.dou-editor__surface strong{font-weight:var(--dou-font-weight-bold)}.dou-editor__surface u{text-underline-offset:.2em}.dou-editor__surface s u{text-decoration:underline line-through}.dou-editor__surface u s{text-decoration:underline line-through}.dou-editor__surface :not(pre)>code{padding:var(--dou-editor-code-py,.1em).3em;background-color:var(--dou-editor-code-bg,var(--dou-color-bg-muted));box-shadow:inset 0 0 0 1px var(--dou-editor-code-border,var(--dou-color-border-subtle));font-family:var(--dou-font-family-mono);border-radius:4px;font-size:.875em}.dou-editor__surface :not(pre)>code:has(.dou-editor__comment-pending){--dou-editor-code-py:0;--dou-editor-code-bg:var(--dou-editor-comment-code-bg);--dou-editor-code-border:var(--dou-editor-comment-code-border)}.dou-editor__link{color:inherit;text-decoration:underline;text-decoration-color:var(--dou-color-border-strong);text-decoration-thickness:1px;text-underline-offset:.2em;transition:text-decoration-color var(--dou-motion-duration-fast)var(--dou-motion-easing)}.dou-editor__link:hover{text-decoration-color:currentColor}.dou-editor.is-readonly .dou-editor__link,.dou-editor.is-comparing .dou-editor__link{cursor:pointer}.dou-editor__comment{transition:background-color var(--dou-motion-duration-fast)var(--dou-motion-easing);border-bottom:2px solid #0000}.dou-editor__comment-pending{--dou-editor-code-py:0;--dou-editor-code-bg:var(--dou-editor-comment-code-bg);--dou-editor-code-border:var(--dou-editor-comment-code-border);background-color:color-mix(in oklab,var(--dou-color-focus)16%,transparent)}.dou-editor-comment{box-sizing:border-box;max-height:min(var(--dou-floating-available,100vh),480px,calc(100vh - 32px));overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-container);background-color:color-mix(in oklab,var(--dou-color-text)calc(4%*var(--dou-scheme-dark)),var(--dou-color-bg-surface));box-shadow:var(--dou-shadow-md);font-family:var(--dou-font-family);width:min(340px,100vw - 32px);padding:12px;line-height:normal}.dou-editor__content.is-empty:after{content:attr(data-placeholder);position:absolute;top:calc(var(--dou-editor-block-gap)/2);color:var(--dou-color-text-tertiary);pointer-events:none;user-select:none;white-space:nowrap}.dou-editor__content.is-empty:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:0}.dou-editor__content.is-empty:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:0}.dou-editor__content.is-empty:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:0}.dou-editor__content.is-empty:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:0}.dou-editor__content.is-empty:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:0}.dou-editor__content.is-empty:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:0}.dou-editor__content.is-list.is-empty:after{top:var(--dou-editor-list-top)}.dou-editor__content--bulletItem.is-empty:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--bulletItem.is-empty:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--bulletItem.is-empty:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:var(--dou-editor-indent)}.dou-editor__content--bulletItem.is-empty:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--bulletItem.is-empty:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--bulletItem.is-empty:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--numberedItem.is-empty:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:var(--dou-editor-indent)}.dou-editor__content--checkItem.is-empty:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:24px}.dou-editor__content--checkItem.is-empty:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:24px}.dou-editor__content--checkItem.is-empty:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:24px}.dou-editor__content--checkItem.is-empty:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:24px}.dou-editor__content--checkItem.is-empty:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:24px}.dou-editor__content--checkItem.is-empty:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:24px}.dou-editor__content--quote.is-empty:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:14px}.dou-editor__content--quote.is-empty:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:14px}.dou-editor__content--quote.is-empty:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:14px}.dou-editor__content--quote.is-empty:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:14px}.dou-editor__content--quote.is-empty:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:14px}.dou-editor__content--quote.is-empty:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:14px}.dou-editor__diff-added:before,.dou-editor__diff-changed:before,.dou-editor__diff-removed-block:before{position:absolute;content:"";border-radius:2px;width:3px;top:2px;bottom:2px}.dou-editor__diff-added:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-added:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-added:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-changed:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-changed:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-changed:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-removed-block:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-removed-block:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-removed-block:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:-12px}.dou-editor__diff-added:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-added:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-added:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-changed:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-changed:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-changed:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-removed-block:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-removed-block:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-removed-block:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:-12px}.dou-editor__diff-added:before{background-color:var(--dou-color-success)}.dou-editor__diff-changed:before{background-color:var(--dou-color-warning)}.dou-editor__diff-added-text{background-color:color-mix(in oklab,var(--dou-color-success)14%,transparent);text-decoration:underline 1px var(--dou-color-success);text-underline-offset:3px}.dou-editor__diff-removed{background-color:color-mix(in oklab,var(--dou-color-danger)12%,transparent);color:var(--dou-color-danger-text);text-decoration:line-through 1px}.dou-editor__diff-removed-block{position:relative;color:var(--dou-color-danger-text);text-decoration:line-through 1px;white-space:pre-wrap;user-select:none;padding:3px 0}.dou-editor__diff-removed-block:before{background-color:var(--dou-color-danger)}.dou-editor__block.is-selected{background-color:var(--dou-editor-selected)}.dou-editor__block.is-selected+.dou-editor__block.is-selected:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected+.dou-editor__block.is-selected:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected+.dou-editor__block.is-selected:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected+.dou-editor__block.is-selected:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected+.dou-editor__block.is-selected:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected+.dou-editor__block.is-selected:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected:has(+.dou-editor__block.is-selected):is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}.dou-editor__block.is-selected .dou-editor__block.is-selected{background-color:#0000}.dou-editor__block.is-selected>.dou-editor__content--codeBlock{background-image:linear-gradient(var(--dou-editor-selected),var(--dou-editor-selected))}.dou-editor .is-block-selecting{caret-color:transparent}.dou-editor .is-block-selecting ::selection{background-color:#0000}.dou-editor.is-dragging .dou-editor__block.is-selected{opacity:.45}.dou-editor__handle{--dou-editor-handle-height:24px;--dou-editor-handle-offset:4px;position:absolute;z-index:1;box-sizing:border-box;display:flex;height:var(--dou-editor-handle-height);margin-top:calc((var(--dou-editor-line,24px) - var(--dou-editor-handle-height))/2);border:1px solid var(--dou-color-border);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-sm);transform:translateX(calc(-100% - var(--dou-editor-handle-offset) + var(--dou-editor-handle-shift,0px)));border-radius:6px;align-items: center;padding:1px}.dou-editor__handle.is-table{--dou-editor-handle-offset:10px}@media (hover:hover) and (pointer:fine){.dou-editor__handle:after{content:"";position:absolute;top:0;bottom:0;width:calc(var(--dou-editor-handle-offset) + 1px);left:100%}}.dou-editor__handle-button{display:inline-flex;color:var(--dou-color-text-tertiary);cursor:pointer;transition-property:background-color,color;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing);background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items: center;width:20px;height:100%;margin:0;padding:0}.dou-editor__handle-button>svg{width:14px;height:14px}.dou-editor__handle-button:hover{background-color:var(--dou-editor-control-hover);color:var(--dou-color-text-secondary)}.dou-editor__handle-button[aria-expanded=true]{background-color:var(--dou-editor-control-hover);color:var(--dou-color-text-secondary)}.dou-editor__add{display:none}@media (hover:hover) and (pointer:fine){.dou-editor__handle:not(.is-compact):hover .dou-editor__add{display:inline-flex}}.dou-editor__grip{position:relative;cursor:grab;touch-action:none;width:16px}@media (pointer:coarse){.dou-editor__handle{--dou-editor-handle-height:32px}.dou-editor__handle.is-table{--dou-editor-handle-offset:12px}.dou-editor__grip{-webkit-touch-callout:none;user-select:none;width:18px}.dou-editor__grip:before{content:"";position:absolute;inset:-8px -8px -8px -14px}}.dou-editor__ghost{position:fixed;z-index:2000;box-sizing:border-box;overflow:hidden;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);opacity:.88;pointer-events:none;max-height:160px;padding:6px 12px;top:0;left:0}.dou-editor__ghost>.dou-editor__block:first-child>.dou-editor__content{margin-top:0}.dou-editor__drop{position:absolute;background-color:var(--dou-color-focus);pointer-events:none;border-radius:1px;height:2px;margin-top:-1px}.dou-editor__drop.is-vertical{width:2px;height:auto;margin-top:0;margin-left:-1px}.dou-editor__mention{background-color:var(--dou-color-bg-muted);color:var(--dou-color-text);white-space:nowrap;border-radius:4px;padding:0 2px;font-weight:500}.dou-editor-mention{max-height:min(var(--dou-floating-available,100vh),288px);width:240px}.dou-editor-mention__item{gap:10px;height:auto;padding:6px 8px}.dou-editor-mention__item:focus{background-color:var(--dou-dropdown-item-active-bg)}.dou-editor-mention__item.is-active{background-color:var(--dou-dropdown-item-active-bg)}.dou-editor-mention__text{display:flex;flex-direction:column;flex:auto;gap:6px;min-width:0}.dou-editor-mention__label,.dou-editor-mention__description{overflow-x:clip;text-box:trim-both cap alphabetic;text-overflow:ellipsis;white-space:nowrap}.dou-editor-mention__description{color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm)}.dou-editor-slash{max-height:min(var(--dou-floating-available,100vh),336px);width:288px}.dou-editor-slash__item{gap:10px;height:auto;padding:6px 8px 6px 6px}.dou-editor-slash__item:focus{background-color:var(--dou-dropdown-item-active-bg)}.dou-editor-slash__item.is-active{background-color:var(--dou-dropdown-item-active-bg)}.dou-editor-slash__icon{display:inline-flex;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);color:var(--dou-color-text-secondary);flex:none;justify-content:center;align-items: center;width:32px;height:32px}.dou-editor-slash__icon>svg{width:18px;height:18px}.dou-editor-slash__text{display:flex;flex-direction:column;flex:auto;gap:6px;min-width:0}.dou-editor-slash__label,.dou-editor-slash__hint{overflow-x:clip;text-box:trim-both cap alphabetic;text-overflow:ellipsis}.dou-editor-slash__hint{color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm)}.dou-editor-slash__shortcut{color:var(--dou-color-text-tertiary);font-family:var(--dou-font-family-mono);font-size:var(--dou-font-size-sm);text-box:trim-both cap alphabetic;flex:none}.dou-editor-slash__empty{color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm);padding:8px}.dou-editor-slash__more{color:var(--dou-color-text-tertiary);flex:none;width:16px;height:16px}.dou-editor-slash__choices{max-height:none;padding:8px}.dou-editor-slash__choices-title{color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm);text-box:trim-both cap alphabetic;padding:4px 4px 10px}.dou-editor-slash__unfolded{padding:4px 8px 8px}.dou-editor-slash__unfolded .dou-editor-slash__choices-title{padding-inline-start:0;padding-inline-end:0}.dou-editor-slash__more{transition:rotate var(--dou-motion-duration-fast)var(--dou-motion-easing)}.dou-editor-slash__more.is-unfolded{rotate:90deg}.dou-editor-column-picker{display:flex;gap:6px;padding:2px 4px 4px}.dou-editor-column-picker__bar{background-color:var(--dou-color-bg-muted);cursor:pointer;transition:background-color var(--dou-motion-duration-fast)var(--dou-motion-easing);border-radius:4px;width:24px;height:72px}.dou-editor-column-picker__bar.is-lit{background-color:color-mix(in oklab,var(--dou-color-text)calc(22% + 8%*var(--dou-scheme-dark)),transparent)}@media (pointer:coarse){.dou-editor-column-picker__bar{width:32px}}.dou-editor__content--columns,.dou-editor__content--column{display:none}.dou-editor__content--columns+.dou-editor__group{container:dou-editor-columns/inline-size;display:flex;column-gap:var(--dou-editor-column-gap);flex-wrap:wrap;row-gap:12px;padding-inline-start:0}.dou-editor__content--columns+.dou-editor__group>.dou-editor__block{flex:var(--dou-editor-column-width,1)1 0;min-width:0}.dou-editor__content--column+.dou-editor__group{padding-inline-start:0}.dou-editor__content--column+.dou-editor__group .dou-editor__content--table{padding-inline-start:12px}@media (hover:hover){.dou-editor:not(.is-readonly) .dou-editor__content--columns+.dou-editor__group:hover>.dou-editor__block{outline:1px dashed var(--dou-color-border)}}@container dou-editor-columns (width<=480px){.dou-editor__content--columns+.dou-editor__group>.dou-editor__block{flex-basis:100%}}.dou-editor-columns__bar{position:absolute;z-index:2;outline:none;cursor:col-resize;touch-action:none;width:10px;margin-inline-start:-5px}@media (pointer:coarse){.dou-editor-columns__bar:before{content:"";position:absolute;top:0;bottom:0;left:-15px;right:-15px}}.dou-editor-columns__bar:after{content:"";position:absolute;background-color:var(--dou-color-focus);opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);border-radius:1px;width:2px;top:0;bottom:0}.dou-editor-columns__bar:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:4px}.dou-editor-columns__bar:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:4px}.dou-editor-columns__bar:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:4px}.dou-editor-columns__bar:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:4px}.dou-editor-columns__bar:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:4px}.dou-editor-columns__bar:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:4px}.dou-editor-columns__bar:hover:after{opacity:1}.dou-editor-columns__bar.is-shown:after{opacity:1}.dou-editor-columns__bar:focus-visible:after{opacity:1}.dou-editor-columns__bar.is-key:not(:-webkit-any(.is-shown,:focus)){pointer-events:none}.dou-editor-columns__bar.is-key:not(:-moz-any(.is-shown,:focus)){pointer-events:none}.dou-editor-columns__bar.is-key:not(:is(.is-shown,:focus)){pointer-events:none}.dou-editor:has(.dou-editor-columns__bar:-webkit-any(:hover,.is-shown)) .dou-editor__handle.is-compact{opacity:0;pointer-events:none}.dou-editor:has(.dou-editor-columns__bar:-moz-any(:hover,.is-shown)) .dou-editor__handle.is-compact{opacity:0;pointer-events:none}.dou-editor:has(.dou-editor-columns__bar:is(:hover,.is-shown)) .dou-editor__handle.is-compact{opacity:0;pointer-events:none}.dou-editor__content--table{display:flex;overflow-x:auto;overscroll-behavior-x:contain;margin-block-start:4px;margin-block-end:4px;padding-block-start:8px;padding-block-end:4px}.dou-editor__content--table>.dou-editor-table{flex:none}.dou-editor__content--table:before{content:"";position:sticky;z-index:1;opacity:0;pointer-events:none;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);flex:none;width:8px}.dou-editor__content--table:after{content:"";position:sticky;z-index:1;opacity:0;pointer-events:none;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);flex:none;width:8px}.dou-editor__content--table:before{background-image:linear-gradient(to right,var(--dou-editor-scroll-shadow),transparent);margin-inline-end:-8px}.dou-editor__content--table:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):before{left:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):before{right:calc(-1*var(--dou-editor-frame-start,0px))}.dou-editor__content--table:after{background-image:linear-gradient(to left,var(--dou-editor-scroll-shadow),transparent);margin-inline-start:-8px}.dou-editor__content--table:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{right:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{right:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{right:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{left:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{left:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{left:calc(-1*var(--dou-editor-frame-end,0px))}.dou-editor__content--table.is-cut-start:before{opacity:1}.dou-editor__content--table.is-cut-end:after{opacity:1}.dou-editor__mount>.dou-editor__surface>.dou-editor__block>.dou-editor__content--table{--dou-editor-bleed-start:max(0px,var(--dou-editor-margin-start,0px) - 10px);--dou-editor-bleed-end:var(--dou-editor-margin-end,0px);--dou-editor-frame-start:var(--dou-editor-bleed-start);--dou-editor-frame-end:min(var(--dou-editor-bleed-end),28px);margin-inline:calc(-1*var(--dou-editor-bleed-start))calc(-1*var(--dou-editor-bleed-end));padding-inline:var(--dou-editor-frame-start)var(--dou-editor-frame-end)}.dou-editor__mount>.dou-editor__surface>.dou-editor__block.is-selected.has-table{background-color:#0000}.dou-editor__mount>.dou-editor__surface>.dou-editor__block.is-selected.has-table:before{content:"";position:absolute;top:0;bottom:0;inset-inline:calc(-1*var(--dou-editor-margin-start,0px))calc(-1*var(--dou-editor-margin-end,0px));border-radius:inherit;background-color:var(--dou-editor-selected);pointer-events:none}.dou-editor__mount>.dou-editor__surface>.dou-editor__block.is-selected.has-table>.dou-editor__content--table{position:relative;z-index:0}.dou-editor-table{border-collapse:collapse;table-layout:fixed;font-size:inherit;line-height:inherit}.dou-editor-table col:not([style*=width\:]){min-inline-size:var(--dou-editor-table-col-min-width,96px)}.dou-editor-table td{position:relative;box-sizing:border-box;border:1px solid var(--dou-color-border);text-align:start;vertical-align:top;white-space:pre-wrap;overflow-wrap:anywhere;min-width:48px;padding:6px 10px}.dou-editor-table th{position:relative;box-sizing:border-box;border:1px solid var(--dou-color-border);text-align:start;vertical-align:top;white-space:pre-wrap;overflow-wrap:anywhere;min-width:48px;padding:6px 10px}.dou-editor-table :-webkit-any(td,th):not(:-webkit-any([data-colwidth],[colspan],.column-resize-dragging)){min-inline-size:var(--dou-editor-table-col-min-width,96px);max-inline-size:var(--dou-editor-table-col-max-width,min(320px,70vw))}.dou-editor-table :-moz-any(td,th):not(:-moz-any([data-colwidth],[colspan],.column-resize-dragging)){min-inline-size:var(--dou-editor-table-col-min-width,96px);max-inline-size:var(--dou-editor-table-col-max-width,min(320px,70vw))}.dou-editor-table :is(td,th):not(:is([data-colwidth],[colspan],.column-resize-dragging)){min-inline-size:var(--dou-editor-table-col-min-width,96px);max-inline-size:var(--dou-editor-table-col-max-width,min(320px,70vw))}.dou-editor-table th{background-color:var(--dou-color-bg-muted);font-weight:600}.ProseMirror-hideselection .dou-editor-table *::selection{background:0 0}.ProseMirror-hideselection .dou-editor-table{caret-color:transparent}.dou-editor-table .selectedCell:after{content:"";position:absolute;background-color:var(--dou-editor-selected);pointer-events:none;inset:0}.dou-editor-table .column-resize-handle{position:absolute;z-index:1;background-color:var(--dou-color-focus);pointer-events:none;width:3px;top:-1px;bottom:-1px}.dou-editor-table .column-resize-handle:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:-2px}.dou-editor-table .column-resize-handle:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:-2px}.dou-editor-table .column-resize-handle:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:-2px}.dou-editor-table .column-resize-handle:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:-2px}.dou-editor-table .column-resize-handle:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:-2px}.dou-editor-table .column-resize-handle:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:-2px}.dou-editor__surface.resize-cursor{cursor:col-resize}.dou-editor-table__handle{position:absolute;z-index:2;display:inline-flex;border:1px solid var(--dou-color-border);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-sm);color:var(--dou-color-text-tertiary);cursor:pointer;transition-property:background-color,color;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing);touch-action:none;border-radius:4px;justify-content:center;align-items: center;margin:0;padding:0;transform:translate(-50%,-50%)}.dou-editor-table__handle.is-column{width:24px;height:14px}.dou-editor-table__handle.is-row{width:14px;height:24px}.dou-editor-table__handle:before{content:"";position:absolute;inset:-4px}@media (pointer:coarse){.dou-editor-table__handle.is-column{width:32px;height:18px}.dou-editor-table__handle.is-row{width:18px;height:32px}.dou-editor-table__handle:before{inset:-10px}}.dou-editor-table__handle svg{width:14px;height:14px}.dou-editor-table__handle:hover{background-color:color-mix(in oklab,var(--dou-color-text)calc(6% + 6%*var(--dou-scheme-dark)),var(--dou-color-bg-surface));color:var(--dou-color-text)}.dou-editor-table__handle.is-active{background-color:color-mix(in oklab,var(--dou-color-text)calc(6% + 6%*var(--dou-scheme-dark)),var(--dou-color-bg-surface));color:var(--dou-color-text)}.dou-editor-table__add{position:absolute;z-index:1;display:inline-flex;box-sizing:border-box;color:var(--dou-color-text-tertiary);cursor:pointer;opacity:.6;transition-property:background-color,color,opacity;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing);background-color:#0000;border:none;border-radius:4px;justify-content:center;align-items: center;margin:0;padding:0}.dou-editor-table__add.is-column{width:16px;margin-inline-start:4px}.dou-editor-table__add.is-row{height:16px;margin-block-start:4px}.dou-editor-table__add svg{width:14px;height:14px}.dou-editor-table__add:hover{background-color:var(--dou-editor-control-hover);color:var(--dou-color-text);opacity:1}@media (pointer:coarse){.dou-editor-table__add{opacity:1}.dou-editor-table__add.is-column{width:24px}.dou-editor-table__add.is-row{height:24px}.dou-editor-table .column-resize-handle{display:none}}.dou-editor-table__ghost{overflow:hidden;padding:0}.dou-editor-table__ghost .dou-editor-table{width:auto;margin:0}.dou-editor-table__cells{position:absolute;z-index:3;display:flex;border:1px solid var(--dou-color-border);border-radius:calc(var(--dou-radius-control) + 2px);background-color:color-mix(in oklab,var(--dou-color-text)calc(4%*var(--dou-scheme-dark)),var(--dou-color-bg-surface));box-shadow:var(--dou-shadow-md);font-size:var(--dou-font-size-sm);white-space:nowrap;gap:2px;padding:3px;line-height:normal;transform:translate(-50%,calc(-100% - 6px))}.dou-editor-table__cells.is-below{transform:translate(-50%,6px)}.dou-editor-table__cells-button{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-color-text);font:inherit;cursor:pointer;background:0 0;border:none;align-items: center;gap:4px;height:26px;margin:0;padding-inline-start:8px;padding-inline-end:8px}.dou-editor-table__cells-button svg{color:var(--dou-color-text-secondary);width:14px;height:14px}.dou-editor-table__cells-button:hover:not(:disabled){background-color:var(--dou-editor-control-hover)}.dou-editor-table__cells-button:disabled{color:var(--dou-color-text-tertiary);cursor:default}.dou-editor-bubble{border:1px solid var(--dou-color-border);border-radius:calc(var(--dou-radius-control) + 4px);background-color:color-mix(in oklab,var(--dou-color-text)calc(4%*var(--dou-scheme-dark)),var(--dou-color-bg-surface));box-shadow:var(--dou-shadow-md);color:var(--dou-color-text);font-family:var(--dou-font-family);font-size:var(--dou-font-size-md);padding:4px;line-height:normal}.dou-editor-bubble__type{gap:4px}.dou-editor-bubble__type svg{color:var(--dou-color-text-tertiary)}.dou-editor-bubble__link{display:flex;align-items: center;gap:4px}.dou-editor-bubble__link>.dou-input{width:240px}.dou-editor__content--image{padding-block-start:6px;padding-block-end:6px}.dou-editor-image__figure{width:-moz-fit-content;width:fit-content;min-width:min(100%,240px);max-width:100%;margin:0 auto}.dou-editor-image__frame{position:relative;border-radius:var(--dou-radius-control);width:-moz-fit-content;width:fit-content;max-width:100%;margin:0 auto;line-height:0}.dou-editor-image__img{display:block;border-radius:inherit;outline:1px solid color-mix(in oklab,var(--dou-color-text)8%,transparent);outline-offset:-1px;max-width:100%;height:auto}.dou-editor-image__figure.is-sized .dou-editor-image__frame,.dou-editor-image__figure.is-sized .dou-editor-image__img{width:100%}.dou-editor-image.is-selected .dou-editor-image__img{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor-image__status{position:absolute;display:flex;border-radius:inherit;background-color:color-mix(in oklab,var(--dou-color-bg-surface)72%,transparent);color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-md);justify-content:center;align-items: center;gap:8px;line-height:normal;inset:0}.dou-editor-image__status.is-failed{color:var(--dou-color-danger-text)}.dou-editor-image__handle{position:absolute;border:1px solid color-mix(in oklab,var(--dou-color-bg-surface)70%,transparent);border-radius:var(--dou-radius-full);background-color:color-mix(in oklab,var(--dou-color-text)55%,transparent);cursor:ew-resize;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);touch-action:none;width:6px;height:40px;max-height:50%;top:50%;transform:translateY(-50%)}.dou-editor-image__handle:before{position:absolute;content:"";inset:-4px -9px}.dou-editor-image__handle.is-left{left:8px}.dou-editor-image__handle.is-right{right:8px}.dou-editor-image__frame:hover .dou-editor-image__handle,.dou-editor-image.is-selected .dou-editor-image__handle{opacity:1}.dou-editor-image__caption{color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-md);text-align:center;margin-top:6px;line-height:1.5}.dou-editor-image__caption-input{color:inherit;font:inherit;font-size:max(var(--dou-font-size-input-min,0px),1em);text-align:inherit;outline:none;background:0 0;border:none;width:100%;padding:0}.dou-editor-image__caption-input::placeholder{color:var(--dou-color-text-tertiary)}.dou-editor-image__caption-input:placeholder-shown:not(:focus){opacity:0}.dou-editor-image:hover .dou-editor-image__caption-input,.dou-editor-image.is-selected .dou-editor-image__caption-input,.dou-editor-embed:hover .dou-editor-image__caption-input,.dou-editor-embed.is-selected .dou-editor-image__caption-input{opacity:1}.dou-editor-image__empty{display:flex;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:color-mix(in oklab,var(--dou-color-text)3%,var(--dou-color-bg-surface));color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-md);flex-wrap:wrap;align-items: center;gap:8px 12px;padding:12px 14px;line-height:normal}.dou-editor-image.is-selected .dou-editor-image__empty,.dou-editor-attachment.is-selected .dou-editor-image__empty,.dou-editor-embed.is-selected .dou-editor-image__empty{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor-image__empty-icon{color:var(--dou-color-text-tertiary);flex:none;width:18px;height:18px}.dou-editor-image__empty-text{flex:auto}.dou-editor-image__actions,.dou-editor-image__embed{display:flex;gap:8px}.dou-editor-image__embed{flex:240px}.dou-editor-image__embed>.dou-input{flex:auto}.dou-editor__content--attachment,.dou-editor__content--embed{padding-block-start:4px;padding-block-end:4px}.dou-editor-attachment__card{display:flex;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-sm);align-items: center;gap:12px;padding:10px 10px 10px 14px;line-height:normal}.dou-editor-attachment.is-selected .dou-editor-attachment__card{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor-attachment__icon{color:var(--dou-color-text-secondary);flex:none;width:20px;height:20px}.dou-editor-attachment__text{display:flex;flex-direction:column;flex:auto;gap:2px;min-width:0}.dou-editor-attachment__name{overflow-x:clip;color:var(--dou-color-text);font-size:var(--dou-font-size-md);text-overflow:ellipsis;white-space:nowrap;font-weight:500}.dou-editor-attachment__meta{display:flex;color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm);font-variant-numeric:tabular-nums;align-items: center;gap:6px}.dou-editor-attachment__download{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-color-text-secondary);transition:background-color var(--dou-motion-duration-fast)var(--dou-motion-easing);flex:none;justify-content:center;align-items: center;width:32px;height:32px}.dou-editor-attachment__download>svg{width:16px;height:16px}.dou-editor-attachment__download:hover{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text)}.dou-editor-attachment__download:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:1px}@media (pointer:coarse){.dou-editor-attachment__download{width:40px;height:40px}}.dou-editor-embed__figure{margin:0}.dou-editor-embed__frame{overflow:clip;border-radius:var(--dou-radius-control);background-color:color-mix(in oklab,var(--dou-color-text)4%,var(--dou-color-bg-surface));outline:1px solid color-mix(in oklab,var(--dou-color-text)8%,transparent);outline-offset:-1px;width:100%;line-height:0}.dou-editor-embed__frame>iframe{display:block;border:0;width:100%;height:100%}.dou-editor-embed__frame>video{display:block;border:0;width:100%;height:100%}.dou-editor-embed__frame.is-audio{overflow:visible;outline:none;background:0 0}.dou-editor-embed__frame.is-audio>audio{display:block;width:100%}.dou-editor-embed.is-selected .dou-editor-embed__frame{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor.is-dragging .dou-editor-embed__frame{pointer-events:none}.dou-editor-embed__caption{display:grid;grid-template-columns:var(--dou-control-height-sm)1fr var(--dou-control-height-sm);align-items: center;gap:4px}.dou-editor-embed__caption>.dou-editor-image__caption-input{grid-column:2}.dou-editor-embed__edit{grid-column:3;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing)}.dou-editor-embed:hover .dou-editor-embed__edit,.dou-editor-embed.is-selected .dou-editor-embed__edit{opacity:1}.dou-editor-embed__edit:focus-visible{opacity:1}@media (pointer:coarse){.dou-editor-embed__edit{opacity:1}}.dou-editor-board{position:relative;overflow:hidden;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);touch-action:pan-y}.dou-editor-board.is-selected{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-editor__block.is-selected>.dou-editor__content>.dou-editor-board:after{position:absolute;background-color:var(--dou-editor-selected);content:"";pointer-events:none;inset:0}.dou-editor-board__preview{position:absolute;pointer-events:none;inset:0}.dou-editor-board__preview .dou-flow-editor{background:0 0;width:100%;height:100%}.dou-editor-board__empty{display:flex;background-color:color-mix(in oklab,var(--dou-color-text)3%,var(--dou-color-bg-surface));color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-md);flex-direction:column;justify-content:center;align-items: center;gap:12px;height:100%}.dou-editor-board__actions{position:absolute;display:flex;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);gap:4px;top:8px;right:8px}.dou-editor-board:hover .dou-editor-board__actions,.dou-editor-board.is-selected .dou-editor-board__actions,.dou-editor-board__actions:focus-within{opacity:1}@media (pointer:coarse){.dou-editor-board__actions{opacity:1}}.dou-editor-board__resize{position:absolute;cursor:ns-resize;touch-action:none;height:10px;bottom:0;left:0;right:0}.dou-editor-board__resize:after{position:absolute;background-color:var(--dou-color-border-strong);content:"";opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);border-radius:2px;width:40px;height:4px;bottom:3px;left:50%;transform:translate(-50%)}.dou-editor-board__resize:focus-visible{outline:none}.dou-editor-board__resize:focus-visible:after{background-color:var(--dou-color-focus)}.dou-editor-board:hover .dou-editor-board__resize:after,.dou-editor-board.is-selected .dou-editor-board__resize:after{opacity:1}.dou-editor-board__resize:focus-visible:after{opacity:1}@media (pointer:coarse){.dou-editor-board__resize{width:80px;height:40px;left:50%;right:auto;transform:translate(-50%)}.dou-editor-board:not(.is-selected) .dou-editor-board__resize{pointer-events:none}.dou-editor-board.is-selected .dou-editor-board__resize:after{opacity:1}}.dou-editor-board__editor{height:100%}.dou-editor-board__editor>.dou-flow-editor{width:100%;height:100%}.dou-editor-board__add{position:absolute;border-radius:var(--dou-radius-control);box-shadow:var(--dou-shadow-sm);top:12px;left:12px}@media (pointer:coarse){.dou-editor-board__add .dou-button:after{position:absolute;content:"";inset:min(0px,50% - 20px) 0}}.dou-popover:has(>.dou-popover__content>.dou-editor-board__types){--dou-popover-padding:0}.dou-editor-board__types{width:260px;max-width:100%}.dou-editor-board__types .dou-command__search{height:40px;padding:0 12px}.dou-editor-board__type-icon{display:inline-flex;border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-muted);color:var(--dou-color-text-secondary);flex:none;justify-content:center;align-items: center;width:20px;height:20px}.dou-editor-board__type-icon svg{width:14px;height:14px}.dou-editor-board__type{display:flex;flex:1;align-self:stretch;align-items: center;gap:8px;min-width:0;margin:-6px -10px;padding:6px 10px}.dou-flow-editor__panels>.dou-editor-board__hint{position:absolute;color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm);text-align:center;pointer-events:none;width:max-content;max-width:calc(100% - 48px);margin:0;top:50%;left:50%;transform:translate(-50%,-50%)}.dou-editor-embed__link{overflow-x:clip;color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm);text-overflow:ellipsis;white-space:nowrap;max-width:100%}.dou-editor-embed__error{color:var(--dou-color-danger-text);font-size:var(--dou-font-size-sm);flex-basis:100%}.dou-editor__cursor{position:relative;border-inline-start:2px solid var(--dou-editor-cursor-color);pointer-events:none;word-break:normal;margin-inline-start:-1px;margin-inline-end:-1px}.dou-editor__cursor-label{position:absolute;background-color:var(--dou-editor-cursor-color);color:oklch(from var(--dou-editor-cursor-color)clamp(.2,(.66 - l)*100,.99)0 0);font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);white-space:nowrap;user-select:none;border-radius:4px 4px 4px 0;padding:0 6px;font-style:normal;font-weight:400;line-height:18px;bottom:100%;left:-2px}.dou-editor__remote-selection{background-color:color-mix(in oklab,var(--dou-editor-cursor-color)20%,transparent)}.dou-editor,.dou-editor-menu,.dou-editor-palette{--dou-editor-color-gray:color-mix(in srgb,#a3a7ad calc(100%*var(--dou-scheme-dark)),#6b6f76);--dou-editor-highlight-gray:color-mix(in srgb,#3a3b3d calc(100%*var(--dou-scheme-dark)),#ececeb);--dou-editor-color-red:color-mix(in srgb,#e58a84 calc(100%*var(--dou-scheme-dark)),#b4453f);--dou-editor-highlight-red:color-mix(in srgb,#4a2826 calc(100%*var(--dou-scheme-dark)),#f8e3e1);--dou-editor-color-orange:color-mix(in srgb,#e0975f calc(100%*var(--dou-scheme-dark)),#b0622a);--dou-editor-highlight-orange:color-mix(in srgb,#4a3222 calc(100%*var(--dou-scheme-dark)),#f9e7d8);--dou-editor-color-yellow:color-mix(in srgb,#d4b44f calc(100%*var(--dou-scheme-dark)),#94761b);--dou-editor-highlight-yellow:color-mix(in srgb,#4a4020 calc(100%*var(--dou-scheme-dark)),#f8efc8);--dou-editor-color-green:color-mix(in srgb,#7fbf8c calc(100%*var(--dou-scheme-dark)),#3f7f4f);--dou-editor-highlight-green:color-mix(in srgb,#253d2b calc(100%*var(--dou-scheme-dark)),#e1f0e2);--dou-editor-color-blue:color-mix(in srgb,#7fa7d9 calc(100%*var(--dou-scheme-dark)),#3b6ea8);--dou-editor-highlight-blue:color-mix(in srgb,#23334a calc(100%*var(--dou-scheme-dark)),#e1ebf7);--dou-editor-color-purple:color-mix(in srgb,#b69ad6 calc(100%*var(--dou-scheme-dark)),#7a52a3);--dou-editor-highlight-purple:color-mix(in srgb,#352a47 calc(100%*var(--dou-scheme-dark)),#ece4f5);--dou-editor-color-pink:color-mix(in srgb,#dd8ab4 calc(100%*var(--dou-scheme-dark)),#a8467a);--dou-editor-highlight-pink:color-mix(in srgb,#46283a calc(100%*var(--dou-scheme-dark)),#f6e2ec)}.dou-editor__color,.dou-editor-palette span[data-color]{color:var(--dou-editor-text-color,inherit)}.dou-editor__highlight,.dou-editor-palette mark[data-color]{background-color:var(--dou-editor-mark-color,var(--dou-editor-highlight-yellow));color:inherit;box-decoration-break:clone;border-radius:2px}.dou-editor__color[data-color=gray],.dou-editor-palette span[data-color=gray],.dou-editor-colors__swatch[data-color=gray]{--dou-editor-text-color:var(--dou-editor-color-gray)}.dou-editor__highlight[data-color=gray],.dou-editor-palette mark[data-color=gray],.dou-editor-colors__swatch[data-highlight=gray]{--dou-editor-mark-color:var(--dou-editor-highlight-gray)}.dou-editor__color[data-color=red],.dou-editor-palette span[data-color=red],.dou-editor-colors__swatch[data-color=red]{--dou-editor-text-color:var(--dou-editor-color-red)}.dou-editor__highlight[data-color=red],.dou-editor-palette mark[data-color=red],.dou-editor-colors__swatch[data-highlight=red]{--dou-editor-mark-color:var(--dou-editor-highlight-red)}.dou-editor__color[data-color=orange],.dou-editor-palette span[data-color=orange],.dou-editor-colors__swatch[data-color=orange]{--dou-editor-text-color:var(--dou-editor-color-orange)}.dou-editor__highlight[data-color=orange],.dou-editor-palette mark[data-color=orange],.dou-editor-colors__swatch[data-highlight=orange]{--dou-editor-mark-color:var(--dou-editor-highlight-orange)}.dou-editor__color[data-color=yellow],.dou-editor-palette span[data-color=yellow],.dou-editor-colors__swatch[data-color=yellow]{--dou-editor-text-color:var(--dou-editor-color-yellow)}.dou-editor__highlight[data-color=yellow],.dou-editor-palette mark[data-color=yellow],.dou-editor-colors__swatch[data-highlight=yellow]{--dou-editor-mark-color:var(--dou-editor-highlight-yellow)}.dou-editor__color[data-color=green],.dou-editor-palette span[data-color=green],.dou-editor-colors__swatch[data-color=green]{--dou-editor-text-color:var(--dou-editor-color-green)}.dou-editor__highlight[data-color=green],.dou-editor-palette mark[data-color=green],.dou-editor-colors__swatch[data-highlight=green]{--dou-editor-mark-color:var(--dou-editor-highlight-green)}.dou-editor__color[data-color=blue],.dou-editor-palette span[data-color=blue],.dou-editor-colors__swatch[data-color=blue]{--dou-editor-text-color:var(--dou-editor-color-blue)}.dou-editor__highlight[data-color=blue],.dou-editor-palette mark[data-color=blue],.dou-editor-colors__swatch[data-highlight=blue]{--dou-editor-mark-color:var(--dou-editor-highlight-blue)}.dou-editor__color[data-color=purple],.dou-editor-palette span[data-color=purple],.dou-editor-colors__swatch[data-color=purple]{--dou-editor-text-color:var(--dou-editor-color-purple)}.dou-editor__highlight[data-color=purple],.dou-editor-palette mark[data-color=purple],.dou-editor-colors__swatch[data-highlight=purple]{--dou-editor-mark-color:var(--dou-editor-highlight-purple)}.dou-editor__color[data-color=pink],.dou-editor-palette span[data-color=pink],.dou-editor-colors__swatch[data-color=pink]{--dou-editor-text-color:var(--dou-editor-color-pink)}.dou-editor__highlight[data-color=pink],.dou-editor-palette mark[data-color=pink],.dou-editor-colors__swatch[data-highlight=pink]{--dou-editor-mark-color:var(--dou-editor-highlight-pink)}.dou-editor-colors__swatch{display:inline-flex;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:calc(var(--dou-radius-control) - 2px);background-color:var(--dou-editor-mark-color,transparent);color:var(--dou-editor-text-color,var(--dou-color-text));font-size:var(--dou-font-size-sm);font-weight:var(--dou-font-weight-bold);justify-content:center;align-items: center;width:20px;height:20px;line-height:1}.dou-dropdown__item:focus .dou-editor-colors__swatch{border-color:var(--dou-color-border-strong)}.dou-editor-colors__button:-webkit-any(:hover,[aria-expanded=true]) .dou-editor-colors__swatch{border-color:var(--dou-color-border-strong)}.dou-editor-colors__button:-moz-any(:hover,[aria-expanded=true]) .dou-editor-colors__swatch{border-color:var(--dou-color-border-strong)}.dou-editor-colors__button:is(:hover,[aria-expanded=true]) .dou-editor-colors__swatch{border-color:var(--dou-color-border-strong)}.dou-editor-colors__letter{display:block;text-box:trim-both cap alphabetic}.dou-editor__search{position:sticky;z-index:5;display:flex;container-type:inline-size;pointer-events:none;justify-content:flex-end;align-items: flex-start;height:0;top:8px}.dou-editor__search>*{pointer-events:auto}.dou-editor__match{background-color:var(--dou-editor-match);border-radius:2px}.dou-editor__match.is-current{box-shadow:0 0 0 1px var(--dou-editor-match-current)}}
@@ -186,6 +186,12 @@ export interface EditorExpose {
186
186
  comment: () => boolean;
187
187
  /** Where each thread is anchored; `null` for a thread whose text was deleted. */
188
188
  getCommentAnchors: () => Record<string, CommentAnchor | null>;
189
+ /**
190
+ * Scroll the anchor of comment thread `id` into view (opening any collapsed
191
+ * toggles around it). Returns `false` when comments are off or `id` has no
192
+ * anchor in the document.
193
+ */
194
+ scrollToComment: (id: string, options?: ScrollIntoViewOptions) => boolean;
189
195
  /**
190
196
  * Replace the document with `doc`, e.g. an older version, as one
191
197
  * change undo takes back. With collaboration only the blocks that differ
@@ -13,5 +13,6 @@ export declare function useEditorComments(options: {
13
13
  comments: EditorComments;
14
14
  plugin: import("prosemirror-state").Plugin<import("./core/comments").CommentPluginState>;
15
15
  anchors: () => Record<string, CommentAnchor | null>;
16
+ scrollToComment: (id: string, scrollOptions?: ScrollIntoViewOptions) => boolean;
16
17
  };
17
18
  export {};
@@ -1,6 +1,7 @@
1
1
  import { anchorComment, commentAnchors, commentPlugin, commentsAt, setPendingComment, unanchorComment } from "./core/comments.js";
2
- import { applyCommentAction } from "dou-ui";
3
- import { computed, shallowRef, watch } from "vue";
2
+ import { toggleKey } from "./extensions/toggle/state.js";
3
+ import { applyCommentAction, useReducedMotion } from "dou-ui";
4
+ import { computed, nextTick, shallowRef, watch } from "vue";
4
5
  import { TextSelection } from "prosemirror-state";
5
6
  // src/use-comments.ts
6
7
  /** The selected text in a read-only editor, which keeps no selection of its own. */
@@ -34,9 +35,19 @@ function hasText(state, range) {
34
35
  function useEditorComments(options) {
35
36
  const { props, emit, view, provider } = options;
36
37
  const threads = computed(() => provider?.threads.value ?? props.comments ?? []);
38
+ let latestThreads = null;
39
+ watch(() => props.comments, () => {
40
+ latestThreads = null;
41
+ }, { flush: "sync" });
42
+ const currentThreads = () => {
43
+ const value = threads.value;
44
+ return latestThreads ?? value;
45
+ };
37
46
  const enabled = computed(() => !!provider || props.comments !== void 0);
38
47
  const writable = computed(() => enabled.value && !!props.author && props.commentable !== false);
39
48
  const known = computed(() => new Set(threads.value.map((thread) => thread.id)));
49
+ const currentKnown = () => latestThreads ? new Set(latestThreads.map((thread) => thread.id)) : known.value;
50
+ const reducedMotion = useReducedMotion();
40
51
  if (provider) watch(provider.threads, (value) => emit("update:comments", [...value]), { immediate: true });
41
52
  const innerActive = shallowRef(null);
42
53
  const active = computed(() => props.activeComment === void 0 ? innerActive.value : props.activeComment);
@@ -91,7 +102,12 @@ function useEditorComments(options) {
91
102
  anchorComment(current, range, action.thread.id);
92
103
  } else if (current && action.type === "remove") unanchorComment(current, action.threadId);
93
104
  if (provider) provider.apply(action);
94
- else emit("update:comments", applyCommentAction(threads.value, action));
105
+ else {
106
+ const next = applyCommentAction(currentThreads(), action);
107
+ if (!latestThreads) nextTick(() => latestThreads = null);
108
+ latestThreads = next;
109
+ emit("update:comments", next);
110
+ }
95
111
  emit("commentAction", action);
96
112
  if (action.type === "create") {
97
113
  open(action.thread.id);
@@ -99,11 +115,11 @@ function useEditorComments(options) {
99
115
  } else if (action.type === "remove" || action.type === "resolve") open(null);
100
116
  }
101
117
  const isOpen = (id) => {
102
- const thread = threads.value.find((item) => item.id === id);
118
+ const thread = currentThreads().find((item) => item.id === id);
103
119
  return !!thread && !thread.resolved;
104
120
  };
105
121
  const plugin = commentPlugin({
106
- known: () => enabled.value ? known.value : null,
122
+ known: () => enabled.value ? currentKnown() : null,
107
123
  onClick: (ids) => {
108
124
  if (pending.value && view.value) setPendingComment(view.value, null);
109
125
  open(ids.find(isOpen) ?? null);
@@ -115,7 +131,44 @@ function useEditorComments(options) {
115
131
  });
116
132
  function anchors() {
117
133
  const found = view.value ? commentAnchors(view.value.state.doc) : /* @__PURE__ */ new Map();
118
- return Object.fromEntries(threads.value.map((thread) => [thread.id, found.get(thread.id) ?? null]));
134
+ return Object.fromEntries(currentThreads().map((thread) => [thread.id, found.get(thread.id) ?? null]));
135
+ }
136
+ function scrollToComment(id, scrollOptions) {
137
+ const current = view.value;
138
+ if (!current || !enabled.value) return false;
139
+ const anchor = anchors()[id];
140
+ if (!anchor) return false;
141
+ const toggleState = toggleKey.getState(current.state);
142
+ if (toggleState?.closed.size) {
143
+ const $pos = current.state.doc.resolve(anchor.from);
144
+ for (let depth = $pos.depth - 1; depth > 0; depth--) {
145
+ if ($pos.node(depth).type.name !== "blockGroup") continue;
146
+ const blockId = $pos.node(depth - 1).attrs.id;
147
+ if (blockId && toggleState.closed.has(blockId)) current.dispatch(current.state.tr.setMeta(toggleKey, blockId).setMeta("addToHistory", false));
148
+ }
149
+ }
150
+ let target = null;
151
+ if (!anchor.type) {
152
+ target = current.dom.querySelector(`[data-comment="${CSS.escape(id)}"]`);
153
+ if (!target) {
154
+ const at = current.domAtPos(anchor.from).node;
155
+ target = at instanceof HTMLElement ? at : at.parentElement;
156
+ }
157
+ }
158
+ if (!target && anchor.block) target = current.dom.querySelector(`[data-block-id="${CSS.escape(anchor.block)}"]`);
159
+ if (!target) {
160
+ const dom = current.nodeDOM(anchor.from);
161
+ if (dom instanceof HTMLElement) target = dom;
162
+ }
163
+ if (!target) return false;
164
+ const behavior = scrollOptions?.behavior === "smooth" && reducedMotion.value ? "auto" : scrollOptions?.behavior ?? (reducedMotion.value ? "auto" : "smooth");
165
+ target.scrollIntoView?.({
166
+ block: "center",
167
+ inline: "nearest",
168
+ ...scrollOptions,
169
+ behavior
170
+ });
171
+ return true;
119
172
  }
120
173
  return {
121
174
  comments: {
@@ -133,7 +186,8 @@ function useEditorComments(options) {
133
186
  close
134
187
  },
135
188
  plugin,
136
- anchors
189
+ anchors,
190
+ scrollToComment
137
191
  };
138
192
  }
139
193
  export { useEditorComments };
@@ -1 +1 @@
1
- {"version":3,"file":"use-comments.js","names":[],"sources":["../src/use-comments.ts"],"sourcesContent":["import { applyCommentAction, type CommentAction, type CommentThread } from 'dou-ui'\nimport { TextSelection, type EditorState } from 'prosemirror-state'\nimport type { EditorView } from 'prosemirror-view'\nimport { computed, shallowRef, watch, type ShallowRef } from 'vue'\nimport {\n anchorComment,\n commentAnchors,\n commentsAt,\n commentPlugin,\n setPendingComment,\n unanchorComment,\n type CommentAnchor,\n type CommentRange,\n} from './core/comments'\nimport type { CommentsProvider } from './core/extension'\nimport type { EditorComments, EditorEmits, EditorProps } from './editor'\n\ntype Emit = <K extends keyof EditorEmits>(event: K, ...args: EditorEmits[K]) => void\n\n/** The selected text in a read-only editor, which keeps no selection of its own. */\nfunction domSelection(view: EditorView): CommentRange | null {\n const selection = view.dom.ownerDocument.getSelection()\n if (!selection || selection.isCollapsed || !selection.rangeCount) return null\n const range = selection.getRangeAt(0)\n if (!view.dom.contains(range.startContainer) || !view.dom.contains(range.endContainer))\n return null\n try {\n const from = view.posAtDOM(range.startContainer, range.startOffset)\n const to = view.posAtDOM(range.endContainer, range.endOffset)\n return to > from ? { from, to } : null\n } catch {\n return null\n }\n}\n\n/** Whether a range holds text a thread can be about: not only a divider, not in code. */\nfunction hasText(state: EditorState, range: CommentRange) {\n let text = false\n state.doc.nodesBetween(range.from, range.to, (node) => {\n if (text) return false\n if (!node.isTextblock) return true\n text = !node.type.spec.code && node.content.size > 0\n return false\n })\n return text\n}\n\nexport function useEditorComments(options: {\n props: EditorProps\n emit: Emit\n view: ShallowRef<EditorView | null>\n provider: CommentsProvider | null\n}) {\n const { props, emit, view, provider } = options\n\n const threads = computed<readonly CommentThread[]>(\n () => provider?.threads.value ?? props.comments ?? [],\n )\n const enabled = computed(() => !!provider || props.comments !== undefined)\n const writable = computed(() => enabled.value && !!props.author && props.commentable !== false)\n const known = computed(() => new Set(threads.value.map((thread) => thread.id)))\n\n // the shared document's threads, mirrored to `v-model:comments`\n if (provider)\n watch(provider.threads, (value) => emit('update:comments', [...value]), { immediate: true })\n\n const innerActive = shallowRef<string | null>(null)\n const active = computed(() =>\n props.activeComment === undefined ? innerActive.value : props.activeComment,\n )\n function open(id: string | null) {\n if (id === active.value) return\n innerActive.value = id\n emit('update:activeComment', id)\n }\n\n const pending = shallowRef<CommentRange | null>(null)\n\n function selection(): CommentRange | null {\n const current = view.value\n if (!current) return null\n const range = current.editable\n ? current.state.selection instanceof TextSelection && !current.state.selection.empty\n ? { from: current.state.selection.from, to: current.state.selection.to }\n : null\n : domSelection(current)\n return range && hasText(current.state, range) ? range : null\n }\n\n const focusRequest = shallowRef(0)\n\n /** The open thread the cursor is in, innermost first. */\n function threadAtCursor(): string | null {\n const current = view.value\n if (!current) return null\n const ids = commentsAt(current.state, current.state.selection.from)\n return ids.find((id) => isOpen(id)) ?? null\n }\n\n function start(): boolean {\n const current = view.value\n if (!current || !enabled.value) return false\n const range = selection()\n if (!range) {\n // on commented text: open its thread, ready to reply\n const id = threadAtCursor()\n if (!id) return false\n open(id)\n focusRequest.value++\n return true\n }\n if (!writable.value) return false\n open(null)\n setPendingComment(current, range)\n return true\n }\n\n function close() {\n const current = view.value\n if (current && pending.value) setPendingComment(current, null)\n open(null)\n }\n\n function apply(action: CommentAction, how: { anchored?: boolean } = {}) {\n const current = view.value\n if (action.type === 'create' && !how.anchored) {\n const range = pending.value\n if (!current || !range) return\n anchorComment(current, range, action.thread.id)\n } else if (current && action.type === 'remove') unanchorComment(current, action.threadId)\n if (provider) provider.apply(action)\n else emit('update:comments', applyCommentAction(threads.value, action))\n emit('commentAction', action)\n if (action.type === 'create') {\n open(action.thread.id)\n focusRequest.value++\n } else if (action.type === 'remove' || action.type === 'resolve') open(null)\n }\n\n const isOpen = (id: string) => {\n const thread = threads.value.find((item) => item.id === id)\n return !!thread && !thread.resolved\n }\n\n const plugin = commentPlugin({\n known: () => (enabled.value ? known.value : null),\n onClick: (ids) => {\n if (pending.value && view.value) setPendingComment(view.value, null)\n open(ids.find(isOpen) ?? null)\n },\n // selecting other text (the formatting toolbar shows) closes an open thread\n onSelect: () => {\n if (!pending.value) open(null)\n },\n onPending: (range) => (pending.value = range),\n })\n\n function anchors(): Record<string, CommentAnchor | null> {\n const found = view.value ? commentAnchors(view.value.state.doc) : new Map()\n return Object.fromEntries(\n threads.value.map((thread) => [thread.id, found.get(thread.id) ?? null]),\n )\n }\n\n const comments: EditorComments = {\n enabled,\n writable,\n threads,\n author: computed(() => props.author),\n active,\n pending,\n focusRequest,\n selection,\n start,\n apply,\n open,\n close,\n }\n\n return { comments, plugin, anchors }\n}\n"],"mappings":";;;;;;AAoBA,SAAS,aAAa,MAAuC;CAC3D,MAAM,YAAY,KAAK,IAAI,cAAc,aAAa;CACtD,IAAI,CAAC,aAAa,UAAU,eAAe,CAAC,UAAU,YAAY,OAAO;CACzE,MAAM,QAAQ,UAAU,WAAW,CAAC;CACpC,IAAI,CAAC,KAAK,IAAI,SAAS,MAAM,cAAc,KAAK,CAAC,KAAK,IAAI,SAAS,MAAM,YAAY,GACnF,OAAO;CACT,IAAI;EACF,MAAM,OAAO,KAAK,SAAS,MAAM,gBAAgB,MAAM,WAAW;EAClE,MAAM,KAAK,KAAK,SAAS,MAAM,cAAc,MAAM,SAAS;EAC5D,OAAO,KAAK,OAAO;GAAE;G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AI,OAAO,SAAS,UAAU;GAC5B,KAAK,OAAO,OAAO,EAAE;GACrB,aAAa;EACf,OAAO,IAAI,OAAO,SAAS,YAAY,OAAO,SAAS,WAAW,KAAK,IAAI;CAC7E;CAEA,MAAM,UAAU,OAAe;EAC7B,MAAM,SAAS,QAAQ,MAAM,MAAM,SAAS,KAAK,OAAO,EAAE;EAC1D,OAAO,CAAC,CAAC,UAAU,CAAC,OAAO;CAC7B;CAEA,MAAM,SAAS,cAAc;EAC3B,aAAc,QAAQ,QAAQ,MAAM,QAAQ;EAC5C,UAAU,QAAQ;GAChB,IAAI,QAAQ,SAAS,KAAK,OAAO,kBAAkB,KAAK,OAAO,IAAI;GACnE,KAAK,IAAI,KAAK,MAAM,KAAK,IAAI;EAC/B;EAEA,gBAAgB;GACd,IAAI,CAAC,QAAQ,OAAO,KAAK,IAAI;EAC/B;EACA,YAAY,UAAW,QAAQ,QAAQ;CACzC,CAAC;CAED,SAAS,UAAgD;EACvD,MAAM,QAAQ,KAAK,QAAQ,eAAe,KAAK,MAAM,MAAM,GAAG,oBAAI,IAAI,IAAI;EAC1E,OAAO,OAAO,YACZ,QAAQ,MAAM,KAAK,WAAW,CAAC,OAAO,IAAI,MAAM,IAAI,OAAO,EAAE,KAAK,IAAI,CAAC,CACzE;CACF;CAiBA,OAAO;EAAE,UAAA;GAdP;GACA;GACA;GACA,QAAQ,eAAe,MAAM,MAAM;GACnC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EAGO;EAAU;EAAQ;CAAQ;AACrC"}
1
+ {"version":3,"file":"use-comments.js","names":[],"sources":["../src/use-comments.ts"],"sourcesContent":["import {\n applyCommentAction,\n useReducedMotion,\n type CommentAction,\n type CommentThread,\n} from 'dou-ui'\nimport { TextSelection, type EditorState } from 'prosemirror-state'\nimport type { EditorView } from 'prosemirror-view'\nimport { computed, nextTick, shallowRef, watch, type ShallowRef } from 'vue'\nimport {\n anchorComment,\n commentAnchors,\n commentsAt,\n commentPlugin,\n setPendingComment,\n unanchorComment,\n type CommentAnchor,\n type CommentRange,\n} from './core/comments'\nimport type { CommentsProvider } from './core/extension'\nimport type { EditorComments, EditorEmits, EditorProps } from './editor'\nimport { toggleKey } from './extensions/toggle/state'\n\ntype Emit = <K extends keyof EditorEmits>(event: K, ...args: EditorEmits[K]) => void\n\n/** The selected text in a read-only editor, which keeps no selection of its own. */\nfunction domSelection(view: EditorView): CommentRange | null {\n const selection = view.dom.ownerDocument.getSelection()\n if (!selection || selection.isCollapsed || !selection.rangeCount) return null\n const range = selection.getRangeAt(0)\n if (!view.dom.contains(range.startContainer) || !view.dom.contains(range.endContainer))\n return null\n try {\n const from = view.posAtDOM(range.startContainer, range.startOffset)\n const to = view.posAtDOM(range.endContainer, range.endOffset)\n return to > from ? { from, to } : null\n } catch {\n return null\n }\n}\n\n/** Whether a range holds text a thread can be about: not only a divider, not in code. */\nfunction hasText(state: EditorState, range: CommentRange) {\n let text = false\n state.doc.nodesBetween(range.from, range.to, (node) => {\n if (text) return false\n if (!node.isTextblock) return true\n text = !node.type.spec.code && node.content.size > 0\n return false\n })\n return text\n}\n\nexport function useEditorComments(options: {\n props: EditorProps\n emit: Emit\n view: ShallowRef<EditorView | null>\n provider: CommentsProvider | null\n}) {\n const { props, emit, view, provider } = options\n\n const threads = computed<readonly CommentThread[]>(\n () => provider?.threads.value ?? props.comments ?? [],\n )\n /*\n * `v-model:comments` catches up after the parent renders, so reads in the\n * same tick (such as `getCommentAnchors()` inside `@comment-action`) see\n * the latest applied list immediately.\n */\n let latestThreads: readonly CommentThread[] | null = null\n watch(\n () => props.comments,\n () => {\n latestThreads = null\n },\n { flush: 'sync' },\n )\n const currentThreads = (): readonly CommentThread[] => {\n const value = threads.value\n return latestThreads ?? value\n }\n const enabled = computed(() => !!provider || props.comments !== undefined)\n const writable = computed(() => enabled.value && !!props.author && props.commentable !== false)\n const known = computed(() => new Set(threads.value.map((thread) => thread.id)))\n const currentKnown = () =>\n latestThreads ? new Set(latestThreads.map((thread) => thread.id)) : known.value\n const reducedMotion = useReducedMotion()\n\n // the shared document's threads, mirrored to `v-model:comments`\n if (provider)\n watch(provider.threads, (value) => emit('update:comments', [...value]), { immediate: true })\n\n const innerActive = shallowRef<string | null>(null)\n const active = computed(() =>\n props.activeComment === undefined ? innerActive.value : props.activeComment,\n )\n function open(id: string | null) {\n if (id === active.value) return\n innerActive.value = id\n emit('update:activeComment', id)\n }\n\n const pending = shallowRef<CommentRange | null>(null)\n\n function selection(): CommentRange | null {\n const current = view.value\n if (!current) return null\n const range = current.editable\n ? current.state.selection instanceof TextSelection && !current.state.selection.empty\n ? { from: current.state.selection.from, to: current.state.selection.to }\n : null\n : domSelection(current)\n return range && hasText(current.state, range) ? range : null\n }\n\n const focusRequest = shallowRef(0)\n\n /** The open thread the cursor is in, innermost first. */\n function threadAtCursor(): string | null {\n const current = view.value\n if (!current) return null\n const ids = commentsAt(current.state, current.state.selection.from)\n return ids.find((id) => isOpen(id)) ?? null\n }\n\n function start(): boolean {\n const current = view.value\n if (!current || !enabled.value) return false\n const range = selection()\n if (!range) {\n // on commented text: open its thread, ready to reply\n const id = threadAtCursor()\n if (!id) return false\n open(id)\n focusRequest.value++\n return true\n }\n if (!writable.value) return false\n open(null)\n setPendingComment(current, range)\n return true\n }\n\n function close() {\n const current = view.value\n if (current && pending.value) setPendingComment(current, null)\n open(null)\n }\n\n function apply(action: CommentAction, how: { anchored?: boolean } = {}) {\n const current = view.value\n if (action.type === 'create' && !how.anchored) {\n const range = pending.value\n if (!current || !range) return\n anchorComment(current, range, action.thread.id)\n } else if (current && action.type === 'remove') unanchorComment(current, action.threadId)\n if (provider) provider.apply(action)\n else {\n const next = applyCommentAction(currentThreads(), action)\n if (!latestThreads) void nextTick(() => (latestThreads = null))\n latestThreads = next\n emit('update:comments', next)\n }\n emit('commentAction', action)\n if (action.type === 'create') {\n open(action.thread.id)\n focusRequest.value++\n } else if (action.type === 'remove' || action.type === 'resolve') open(null)\n }\n\n const isOpen = (id: string) => {\n const thread = currentThreads().find((item) => item.id === id)\n return !!thread && !thread.resolved\n }\n\n const plugin = commentPlugin({\n known: () => (enabled.value ? currentKnown() : null),\n onClick: (ids) => {\n if (pending.value && view.value) setPendingComment(view.value, null)\n open(ids.find(isOpen) ?? null)\n },\n // selecting other text (the formatting toolbar shows) closes an open thread\n onSelect: () => {\n if (!pending.value) open(null)\n },\n onPending: (range) => (pending.value = range),\n })\n\n function anchors(): Record<string, CommentAnchor | null> {\n const found = view.value ? commentAnchors(view.value.state.doc) : new Map()\n return Object.fromEntries(\n currentThreads().map((thread) => [thread.id, found.get(thread.id) ?? null]),\n )\n }\n\n function scrollToComment(id: string, scrollOptions?: ScrollIntoViewOptions): boolean {\n const current = view.value\n if (!current || !enabled.value) return false\n const anchor = anchors()[id]\n if (!anchor) return false\n // open any collapsed toggle around the anchor so the element is laid out before scrolling\n const toggleState = toggleKey.getState(current.state)\n if (toggleState?.closed.size) {\n const $pos = current.state.doc.resolve(anchor.from)\n for (let depth = $pos.depth - 1; depth > 0; depth--) {\n if ($pos.node(depth).type.name !== 'blockGroup') continue\n const blockId = $pos.node(depth - 1).attrs.id as string | undefined\n if (blockId && toggleState.closed.has(blockId))\n current.dispatch(\n current.state.tr.setMeta(toggleKey, blockId).setMeta('addToHistory', false),\n )\n }\n }\n let target: HTMLElement | null = null\n if (!anchor.type) {\n target = current.dom.querySelector<HTMLElement>(`[data-comment=\"${CSS.escape(id)}\"]`)\n if (!target) {\n const at = current.domAtPos(anchor.from).node\n target = at instanceof HTMLElement ? at : at.parentElement\n }\n }\n if (!target && anchor.block)\n target = current.dom.querySelector<HTMLElement>(\n `[data-block-id=\"${CSS.escape(anchor.block)}\"]`,\n )\n if (!target) {\n const dom = current.nodeDOM(anchor.from)\n if (dom instanceof HTMLElement) target = dom\n }\n if (!target) return false\n const behavior =\n scrollOptions?.behavior === 'smooth' && reducedMotion.value\n ? 'auto'\n : (scrollOptions?.behavior ?? (reducedMotion.value ? 'auto' : 'smooth'))\n target.scrollIntoView?.({\n block: 'center',\n inline: 'nearest',\n ...scrollOptions,\n behavior,\n })\n return true\n }\n\n const comments: EditorComments = {\n enabled,\n writable,\n threads,\n author: computed(() => props.author),\n active,\n pending,\n focusRequest,\n selection,\n start,\n apply,\n open,\n close,\n }\n\n return { comments, plugin, anchors, scrollToComment }\n}\n"],"mappings":";;;;;;;AA0BA,SAAS,aAAa,MAAuC;CAC3D,MAAM,YAAY,KAAK,IAAI,cAAc,aAAa;CACtD,IAAI,CAAC,aAAa,UAAU,eAAe,CAAC,UAAU,YAAY,OAAO;CACzE,MAAM,QAAQ,UAAU,WAAW,CAAC;CACpC,IAAI,CAAC,KAAK,IAAI,SAAS,MAAM,cAAc,KAAK,CAAC,KAAK,IAAI,SAAS,MAAM,YAAY,GACnF,OAAO;CACT,IAAI;EACF,MAAM,OAAO,KAAK,SAAS,MAAM,gBAAgB,MAAM,WAAW;EAClE,MAAM,KAAK,KAAK,SAAS,MAAM,cAAc,MAAM,SAAS;EAC5D,OAAO,KAAK,OAAO;GAAE;GAAM;EAAG,IAAI;CACpC,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,SAAS,QAAQ,OAAoB,OAAqB;CACxD,IAAI,OAAO;CACX,MAAM,IAAI,aAAa,MAAM,MAAM,MAAM,KAAK,SAAS;EACrD,IAAI,MAAM,OAAO;EACjB,IAAI,CAAC,KAAK,aAAa,OAAO;EAC9B,OAAO,CAAC,KAAK,KAAK,KAAK,QAAQ,KAAK,QAAQ,OAAO;EACnD,OAAO;CACT,CAAC;CACD,OAAO;AACT;AAEA,SAAgB,kBAAkB,SAK/B;CACD,MAAM,EAAE,OAAO,MAAM,MAAM,aAAa;CAExC,MAAM,UAAU,eACR,UAAU,QAAQ,SAAS,MAAM,YAAY,CAAC,CACtD;CAMA,IAAI,gBAAiD;CACrD,YACQ,MAAM,gBACN;EACJ,gBAAgB;CAClB,GACA,EAAE,OAAO,OAAO,CAClB;CACA,MAAM,uBAAiD;EACrD,MAAM,QAAQ,QAAQ;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;EACF;EACA,IAAI,SAA6B;EACjC,IAAI,CAAC,OAAO,MAAM;GAChB,SAAS,QAAQ,IAAI,cAA2B,kBAAkB,IAAI,OAAO,EAAE,EAAE,GAAG;GACpF,IAAI,CAAC,QAAQ;IACX,MAAM,KAAK,QAAQ,SAAS,OAAO,IAAI,CAAC,CAAC;IACzC,SAAS,cAAc,cAAc,KAAK,GAAG;GAC/C;EACF;EACA,IAAI,CAAC,UAAU,OAAO,OACpB,SAAS,QAAQ,IAAI,cACnB,mBAAmB,IAAI,OAAO,OAAO,KAAK,EAAE,GAC9C;EACF,IAAI,CAAC,QAAQ;GACX,MAAM,MAAM,QAAQ,QAAQ,OAAO,IAAI;GACvC,IAAI,eAAe,aAAa,SAAS;EAC3C;EACA,IAAI,CAAC,QAAQ,OAAO;EACpB,MAAM,WACJ,eAAe,aAAa,YAAY,cAAc,QAClD,SACC,eAAe,aAAa,cAAc,QAAQ,SAAS;EAClE,OAAO,iBAAiB;GACtB,OAAO;GACP,QAAQ;GACR,GAAG;GACH;EACF,CAAC;EACD,OAAO;CACT;CAiBA,OAAO;EAAE,UAAA;GAdP;GACA;GACA;GACA,QAAQ,eAAe,MAAM,MAAM;GACnC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EAGO;EAAU;EAAQ;EAAS;CAAgB;AACtD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dou-ui/editor",
3
- "version": "0.1.0-alpha.21",
3
+ "version": "0.1.0-alpha.23",
4
4
  "description": "DouUI 的块编辑器:基于 ProseMirror,文档由可拖动、可转换的块组成",
5
5
  "keywords": [
6
6
  "vue",
@@ -62,9 +62,9 @@
62
62
  "build": "vite build && vue-tsc -p tsconfig.build.json && bun scripts/build-style.ts"
63
63
  },
64
64
  "peerDependencies": {
65
- "@dou-ui/code": "0.1.0-alpha.21",
66
- "@dou-ui/flow": "0.1.0-alpha.21",
67
- "dou-ui": "0.1.0-alpha.21",
65
+ "@dou-ui/code": "0.1.0-alpha.23",
66
+ "@dou-ui/flow": "0.1.0-alpha.23",
67
+ "dou-ui": "0.1.0-alpha.23",
68
68
  "vue": "^3.5.0",
69
69
  "yjs": "^13.6.0",
70
70
  "markdown-it": "^14.0.0"
@@ -84,7 +84,7 @@
84
84
  }
85
85
  },
86
86
  "dependencies": {
87
- "@dou-ui/icons": "0.1.0-alpha.21",
87
+ "@dou-ui/icons": "0.1.0-alpha.23",
88
88
  "prosemirror-commands": "^1.7.2",
89
89
  "prosemirror-history": "^1.5.1",
90
90
  "prosemirror-inputrules": "^1.5.1",
@@ -99,8 +99,8 @@
99
99
  "access": "public"
100
100
  },
101
101
  "devDependencies": {
102
- "@dou-ui/code": "0.1.0-alpha.21",
103
- "@dou-ui/flow": "0.1.0-alpha.21",
102
+ "@dou-ui/code": "0.1.0-alpha.23",
103
+ "@dou-ui/flow": "0.1.0-alpha.23",
104
104
  "@types/markdown-it": "^14.1.2",
105
105
  "markdown-it": "^14.1.0",
106
106
  "y-protocols": "^1.0.7",