@prosekit/extensions 0.13.0 → 0.14.0
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.
- package/dist/{drop-indicator-B1QHFb5m.js → drop-indicator-B_oMfeVP.js} +11 -10
- package/dist/drop-indicator-B_oMfeVP.js.map +1 -0
- package/dist/{enter-rule-CzWOZF_Z.js → enter-rule-D-p4ykfv.js} +1 -1
- package/dist/enter-rule-D-p4ykfv.js.map +1 -0
- package/dist/{file-DrfcSid-.js → file-iLVR0eM0.js} +3 -3
- package/dist/file-iLVR0eM0.js.map +1 -0
- package/dist/{index-oIc1a2f2.d.ts → index-cp1u4e0e.d.ts} +1 -1
- package/dist/index-cp1u4e0e.d.ts.map +1 -0
- package/dist/{input-rule-dmsb3j6w.js → input-rule-COGr_GBb.js} +1 -1
- package/dist/input-rule-COGr_GBb.js.map +1 -0
- package/dist/{mark-rule-BcLB4Uv2.js → mark-rule-CYe8zk4q.js} +6 -6
- package/dist/mark-rule-CYe8zk4q.js.map +1 -0
- package/dist/{paste-rule-pVb4sqvJ.js → paste-rule-BaDghcaU.js} +7 -7
- package/dist/paste-rule-BaDghcaU.js.map +1 -0
- package/dist/prosekit-extensions-autocomplete.d.ts.map +1 -1
- package/dist/prosekit-extensions-autocomplete.js.map +1 -1
- package/dist/prosekit-extensions-background-color.d.ts +62 -0
- package/dist/prosekit-extensions-background-color.d.ts.map +1 -0
- package/dist/prosekit-extensions-background-color.js +76 -0
- package/dist/prosekit-extensions-background-color.js.map +1 -0
- package/dist/prosekit-extensions-blockquote.d.ts.map +1 -1
- package/dist/prosekit-extensions-blockquote.js +1 -1
- package/dist/prosekit-extensions-blockquote.js.map +1 -1
- package/dist/prosekit-extensions-bold.d.ts.map +1 -1
- package/dist/prosekit-extensions-bold.js +1 -1
- package/dist/prosekit-extensions-bold.js.map +1 -1
- package/dist/prosekit-extensions-code-block.d.ts +1 -1
- package/dist/prosekit-extensions-code-block.d.ts.map +1 -1
- package/dist/prosekit-extensions-code-block.js +4 -4
- package/dist/prosekit-extensions-code-block.js.map +1 -1
- package/dist/prosekit-extensions-code.d.ts.map +1 -1
- package/dist/prosekit-extensions-code.js +1 -1
- package/dist/prosekit-extensions-code.js.map +1 -1
- package/dist/prosekit-extensions-commit.d.ts +0 -1
- package/dist/prosekit-extensions-commit.d.ts.map +1 -1
- package/dist/prosekit-extensions-commit.js.map +1 -1
- package/dist/prosekit-extensions-doc.d.ts +0 -1
- package/dist/prosekit-extensions-doc.d.ts.map +1 -1
- package/dist/prosekit-extensions-doc.js.map +1 -1
- package/dist/prosekit-extensions-drop-cursor.d.ts.map +1 -1
- package/dist/prosekit-extensions-drop-cursor.js.map +1 -1
- package/dist/prosekit-extensions-drop-indicator.d.ts +0 -1
- package/dist/prosekit-extensions-drop-indicator.d.ts.map +1 -1
- package/dist/prosekit-extensions-drop-indicator.js +1 -1
- package/dist/prosekit-extensions-enter-rule.d.ts +0 -1
- package/dist/prosekit-extensions-enter-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-enter-rule.js +1 -1
- package/dist/prosekit-extensions-file.d.ts +1 -1
- package/dist/prosekit-extensions-file.js +1 -1
- package/dist/prosekit-extensions-gap-cursor.d.ts +0 -1
- package/dist/prosekit-extensions-gap-cursor.d.ts.map +1 -1
- package/dist/prosekit-extensions-gap-cursor.js.map +1 -1
- package/dist/prosekit-extensions-hard-break.d.ts.map +1 -1
- package/dist/prosekit-extensions-hard-break.js.map +1 -1
- package/dist/prosekit-extensions-heading.d.ts.map +1 -1
- package/dist/prosekit-extensions-heading.js +1 -1
- package/dist/prosekit-extensions-heading.js.map +1 -1
- package/dist/prosekit-extensions-horizontal-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-horizontal-rule.js +1 -1
- package/dist/prosekit-extensions-horizontal-rule.js.map +1 -1
- package/dist/prosekit-extensions-image.d.ts +9 -2
- package/dist/prosekit-extensions-image.d.ts.map +1 -1
- package/dist/prosekit-extensions-image.js +17 -4
- package/dist/prosekit-extensions-image.js.map +1 -1
- package/dist/prosekit-extensions-input-rule.d.ts +0 -1
- package/dist/prosekit-extensions-input-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-input-rule.js +1 -1
- package/dist/prosekit-extensions-italic.d.ts.map +1 -1
- package/dist/prosekit-extensions-italic.js +1 -1
- package/dist/prosekit-extensions-italic.js.map +1 -1
- package/dist/prosekit-extensions-link.d.ts +0 -1
- package/dist/prosekit-extensions-link.d.ts.map +1 -1
- package/dist/prosekit-extensions-link.js +4 -4
- package/dist/prosekit-extensions-link.js.map +1 -1
- package/dist/prosekit-extensions-list.d.ts +0 -1
- package/dist/prosekit-extensions-list.d.ts.map +1 -1
- package/dist/prosekit-extensions-list.js +3 -3
- package/dist/prosekit-extensions-list.js.map +1 -1
- package/dist/prosekit-extensions-loro.d.ts.map +1 -1
- package/dist/prosekit-extensions-loro.js +2 -2
- package/dist/prosekit-extensions-loro.js.map +1 -1
- package/dist/prosekit-extensions-mark-rule.d.ts +0 -1
- package/dist/prosekit-extensions-mark-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-mark-rule.js +1 -1
- package/dist/prosekit-extensions-mention.d.ts.map +1 -1
- package/dist/prosekit-extensions-mention.js.map +1 -1
- package/dist/prosekit-extensions-mod-click-prevention.d.ts +0 -1
- package/dist/prosekit-extensions-mod-click-prevention.d.ts.map +1 -1
- package/dist/prosekit-extensions-mod-click-prevention.js.map +1 -1
- package/dist/prosekit-extensions-paragraph.d.ts.map +1 -1
- package/dist/prosekit-extensions-paragraph.js.map +1 -1
- package/dist/prosekit-extensions-paste-rule.d.ts +0 -1
- package/dist/prosekit-extensions-paste-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-paste-rule.js +1 -1
- package/dist/prosekit-extensions-placeholder.d.ts.map +1 -1
- package/dist/prosekit-extensions-placeholder.js +1 -1
- package/dist/prosekit-extensions-placeholder.js.map +1 -1
- package/dist/prosekit-extensions-readonly.d.ts +0 -1
- package/dist/prosekit-extensions-readonly.d.ts.map +1 -1
- package/dist/prosekit-extensions-readonly.js.map +1 -1
- package/dist/prosekit-extensions-search.d.ts +0 -1
- package/dist/prosekit-extensions-search.d.ts.map +1 -1
- package/dist/prosekit-extensions-search.js.map +1 -1
- package/dist/prosekit-extensions-strike.d.ts +0 -1
- package/dist/prosekit-extensions-strike.d.ts.map +1 -1
- package/dist/prosekit-extensions-strike.js +1 -1
- package/dist/prosekit-extensions-table.d.ts.map +1 -1
- package/dist/prosekit-extensions-table.js +1 -1
- package/dist/prosekit-extensions-text-align.d.ts +0 -1
- package/dist/prosekit-extensions-text-align.d.ts.map +1 -1
- package/dist/prosekit-extensions-text-align.js +2 -2
- package/dist/prosekit-extensions-text-align.js.map +1 -1
- package/dist/prosekit-extensions-text-color.d.ts +62 -0
- package/dist/prosekit-extensions-text-color.d.ts.map +1 -0
- package/dist/prosekit-extensions-text-color.js +76 -0
- package/dist/prosekit-extensions-text-color.js.map +1 -0
- package/dist/prosekit-extensions-text.d.ts +0 -1
- package/dist/prosekit-extensions-text.d.ts.map +1 -1
- package/dist/prosekit-extensions-text.js.map +1 -1
- package/dist/prosekit-extensions-underline.d.ts +0 -1
- package/dist/prosekit-extensions-underline.d.ts.map +1 -1
- package/dist/prosekit-extensions-virtual-selection.d.ts +0 -1
- package/dist/prosekit-extensions-virtual-selection.d.ts.map +1 -1
- package/dist/prosekit-extensions-virtual-selection.js.map +1 -1
- package/dist/prosekit-extensions-yjs.d.ts +9 -2
- package/dist/prosekit-extensions-yjs.d.ts.map +1 -1
- package/dist/prosekit-extensions-yjs.js.map +1 -1
- package/dist/{shiki-highlighter-chunk-rkzofy4z.d.ts → shiki-highlighter-chunk-DNNm2Vow.d.ts} +1 -1
- package/dist/shiki-highlighter-chunk-DNNm2Vow.d.ts.map +1 -0
- package/dist/shiki-highlighter-chunk.d.ts +1 -1
- package/dist/shiki-highlighter-chunk.js.map +1 -1
- package/dist/{table-BRDh_9mG.js → table-4oHfV-Ql.js} +2 -2
- package/dist/table-4oHfV-Ql.js.map +1 -0
- package/package.json +28 -14
- package/src/autocomplete/autocomplete-helpers.ts +1 -5
- package/src/autocomplete/autocomplete-plugin.ts +3 -13
- package/src/autocomplete/autocomplete.spec.ts +4 -19
- package/src/autocomplete/autocomplete.ts +1 -7
- package/src/background-color/background-color-commands.spec.ts +71 -0
- package/src/background-color/background-color-commands.ts +35 -0
- package/src/background-color/background-color-spec.spec.ts +286 -0
- package/src/background-color/background-color-spec.ts +58 -0
- package/src/background-color/background-color.ts +21 -0
- package/src/background-color/index.ts +8 -0
- package/src/blockquote/blockquote-commands.ts +1 -7
- package/src/blockquote/blockquote-keymap.spec.ts +1 -5
- package/src/blockquote/blockquote-keymap.ts +1 -6
- package/src/blockquote/blockquote-spec.ts +1 -4
- package/src/blockquote/blockquote.ts +3 -12
- package/src/blockquote/index.ts +3 -12
- package/src/bold/bold-commands.ts +1 -5
- package/src/bold/bold-input-rule.spec.ts +1 -5
- package/src/bold/bold-input-rule.ts +1 -4
- package/src/bold/bold-keymap.ts +1 -5
- package/src/bold/bold-spec.ts +1 -4
- package/src/bold/bold.ts +3 -12
- package/src/bold/index.ts +3 -12
- package/src/code/code-commands.ts +1 -5
- package/src/code/code-input-rule.ts +1 -4
- package/src/code/code-keymap.ts +1 -5
- package/src/code/code-spec.ts +1 -4
- package/src/code/code.ts +3 -12
- package/src/code/index.ts +3 -12
- package/src/code-block/code-block-commands.ts +1 -8
- package/src/code-block/code-block-highlight.ts +2 -8
- package/src/code-block/code-block-keymap.ts +2 -9
- package/src/code-block/code-block-shiki.ts +1 -4
- package/src/code-block/code-block-spec.spec.ts +4 -11
- package/src/code-block/code-block-spec.ts +1 -4
- package/src/code-block/code-block.ts +4 -16
- package/src/code-block/index.ts +5 -21
- package/src/code-block/shiki-highlighter-chunk.ts +1 -7
- package/src/code-block/shiki-highlighter.ts +1 -4
- package/src/code-block/shiki-parser.ts +1 -4
- package/src/commit/index.ts +6 -35
- package/src/doc/index.ts +1 -4
- package/src/drop-cursor/drop-cursor.ts +1 -4
- package/src/drop-cursor/index.ts +1 -5
- package/src/drop-indicator/drop-indicator-facet.ts +12 -21
- package/src/drop-indicator/index.ts +1 -5
- package/src/enter-rule/index.ts +2 -11
- package/src/file/file-paste-handler.spec.ts +3 -16
- package/src/file/index.ts +3 -16
- package/src/gap-cursor/gap-cursor.ts +1 -4
- package/src/gap-cursor/index.ts +1 -4
- package/src/hard-break/hard-break-commands.ts +1 -5
- package/src/hard-break/hard-break-keymap.spec.ts +1 -5
- package/src/hard-break/hard-break-keymap.ts +1 -4
- package/src/hard-break/hard-break-spec.ts +1 -4
- package/src/hard-break/hard-break.ts +3 -12
- package/src/hard-break/index.ts +3 -12
- package/src/heading/heading-commands.ts +1 -7
- package/src/heading/heading-keymap.spec.ts +1 -5
- package/src/heading/heading-keymap.ts +1 -8
- package/src/heading/heading-spec.ts +1 -4
- package/src/heading/heading.ts +3 -12
- package/src/heading/index.ts +3 -12
- package/src/horizontal-rule/horizontal-rule-commands.spec.ts +1 -5
- package/src/horizontal-rule/horizontal-rule-commands.ts +2 -9
- package/src/horizontal-rule/horizontal-rule-input-rule.spec.ts +5 -9
- package/src/horizontal-rule/horizontal-rule-input-rule.ts +1 -5
- package/src/horizontal-rule/horizontal-rule-spec.ts +1 -4
- package/src/horizontal-rule/horizontal-rule.ts +3 -12
- package/src/horizontal-rule/index.ts +3 -13
- package/src/image/image-commands/upload-image.spec.ts +245 -0
- package/src/image/image-commands/upload-image.ts +46 -11
- package/src/image/image-commands.ts +2 -8
- package/src/image/image-spec.ts +1 -4
- package/src/image/image-upload-handler.ts +2 -8
- package/src/image/image.ts +3 -12
- package/src/image/index.ts +3 -13
- package/src/input-rule/index.ts +2 -13
- package/src/italic/index.ts +3 -12
- package/src/italic/italic-commands.spec.ts +2 -10
- package/src/italic/italic-commands.ts +1 -5
- package/src/italic/italic-input-rule.spec.ts +1 -5
- package/src/italic/italic-input-rule.ts +1 -4
- package/src/italic/italic-keymap.ts +1 -5
- package/src/italic/italic-spec.ts +1 -4
- package/src/italic/italic.ts +3 -12
- package/src/link/index.spec.ts +1 -5
- package/src/link/index.ts +1 -5
- package/src/link/link-paste-rule.spec.ts +2 -9
- package/src/link/link-regex.spec.ts +1 -5
- package/src/list/index.ts +3 -12
- package/src/list/list-commands.ts +1 -5
- package/src/list/list-input-rules.ts +1 -4
- package/src/list/list-keymap.spec.ts +1 -5
- package/src/list/list-keymap.ts +2 -8
- package/src/list/list-plugins.ts +1 -4
- package/src/list/list-serializer.ts +2 -9
- package/src/list/list-spec.ts +3 -13
- package/src/list/list.spec.ts +10 -21
- package/src/list/list.ts +3 -12
- package/src/loro/index.ts +3 -13
- package/src/loro/loro-commands.ts +2 -8
- package/src/loro/loro-cursor-plugin.ts +3 -13
- package/src/loro/loro-keymap.ts +2 -10
- package/src/loro/loro-sync-plugin.ts +2 -8
- package/src/loro/loro-undo-plugin.ts +2 -8
- package/src/loro/loro.ts +2 -11
- package/src/mark-rule/apply.ts +3 -13
- package/src/mark-rule/mark-rule.spec.ts +2 -13
- package/src/mark-rule/mark-rule.ts +2 -13
- package/src/mark-rule/range.ts +2 -8
- package/src/mark-rule/types.ts +1 -4
- package/src/mention/index.ts +1 -8
- package/src/mod-click-prevention/index.ts +2 -9
- package/src/paragraph/paragraph-commands.ts +1 -5
- package/src/paragraph/paragraph-keymap.ts +1 -4
- package/src/paragraph/paragraph-spec.ts +1 -4
- package/src/paragraph/paragraph.ts +3 -14
- package/src/paste-rule/index.ts +2 -10
- package/src/paste-rule/mark-paste-rule.spec.ts +3 -13
- package/src/paste-rule/mark-paste-rule.ts +4 -14
- package/src/paste-rule/paste-rule-plugin.ts +2 -11
- package/src/paste-rule/paste-rule.spec.ts +4 -19
- package/src/paste-rule/split-text-by-regex.spec.ts +1 -5
- package/src/placeholder/index.ts +3 -16
- package/src/readonly/index.ts +2 -8
- package/src/search/index.ts +1 -6
- package/src/table/index.ts +10 -40
- package/src/table/table-commands/delete-cell-selection.spec.ts +1 -5
- package/src/table/table-commands/exit-table.spec.ts +1 -5
- package/src/table/table-commands/insert-table.spec.ts +1 -5
- package/src/table/table-commands/insert-table.ts +1 -4
- package/src/table/table-commands/move-table-column.spec.ts +1 -5
- package/src/table/table-commands/move-table-column.ts +1 -4
- package/src/table/table-commands/move-table-row.spec.ts +1 -5
- package/src/table/table-commands/move-table-row.ts +1 -4
- package/src/table/table-commands/select-table-cell.spec.ts +1 -5
- package/src/table/table-commands/select-table-column.spec.ts +1 -5
- package/src/table/table-commands/select-table-row.spec.ts +1 -5
- package/src/table/table-commands/select-table.spec.ts +1 -5
- package/src/table/table-commands/select-table.ts +1 -4
- package/src/table/table-commands.ts +8 -32
- package/src/table/table-plugins.ts +2 -8
- package/src/table/table-spec.spec.ts +2 -11
- package/src/table/table-spec.ts +2 -8
- package/src/table/table-utils.ts +2 -6
- package/src/table/table.ts +2 -8
- package/src/table/test-utils.ts +1 -4
- package/src/testing/clipboard.ts +1 -2
- package/src/testing/index.ts +7 -12
- package/src/text/index.ts +1 -4
- package/src/text-align/index.ts +2 -2
- package/src/text-color/index.ts +3 -0
- package/src/text-color/text-color-commands.spec.ts +71 -0
- package/src/text-color/text-color-commands.ts +35 -0
- package/src/text-color/text-color-spec.spec.ts +297 -0
- package/src/text-color/text-color-spec.ts +58 -0
- package/src/text-color/text-color.ts +21 -0
- package/src/virtual-selection/index.ts +3 -14
- package/src/yjs/index.ts +5 -20
- package/src/yjs/yjs-commands.ts +2 -8
- package/src/yjs/yjs-cursor-plugin.ts +3 -5
- package/src/yjs/yjs-keymap.ts +2 -10
- package/src/yjs/yjs-sync-plugin.ts +1 -4
- package/src/yjs/yjs-types.ts +10 -0
- package/src/yjs/yjs-undo-plugin.ts +2 -8
- package/src/yjs/yjs.ts +6 -24
- package/dist/drop-indicator-B1QHFb5m.js.map +0 -1
- package/dist/enter-rule-CzWOZF_Z.js.map +0 -1
- package/dist/file-DrfcSid-.js.map +0 -1
- package/dist/index-oIc1a2f2.d.ts.map +0 -1
- package/dist/input-rule-dmsb3j6w.js.map +0 -1
- package/dist/mark-rule-BcLB4Uv2.js.map +0 -1
- package/dist/paste-rule-pVb4sqvJ.js.map +0 -1
- package/dist/shiki-highlighter-chunk-rkzofy4z.d.ts.map +0 -1
- package/dist/table-BRDh_9mG.js.map +0 -1
- package/src/testing/format-html.ts +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-placeholder.d.ts","names":[],"sources":["../src/placeholder/index.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-placeholder.d.ts","names":[],"sources":["../src/placeholder/index.ts"],"mappings":";;;;UAOiB,kBAAA;;AAAjB;;;EAKE,WAAA,aAAwB,KAAA,EAAO,WAAA;EAA/B;;;;;;;;AAuBF;;;;;;EAPE,QAAA,uBAA+B,KAAA,EAAO,WAAA;AAAA;;;;;iBAOxB,iBAAA,CAAkB,OAAA,EAAS,kBAAA,GAAqB,cAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as findTable } from "./table-
|
|
1
|
+
import { p as findTable } from "./table-4oHfV-Ql.js";
|
|
2
2
|
import { definePlugin, isInCodeBlock, isTextSelection, maybeRun } from "@prosekit/core";
|
|
3
3
|
import { Plugin, PluginKey } from "@prosekit/pm/state";
|
|
4
4
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-placeholder.js","names":[],"sources":["../src/placeholder/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-placeholder.js","names":[],"sources":["../src/placeholder/index.ts"],"sourcesContent":["import { definePlugin, isInCodeBlock, isTextSelection, maybeRun, type PlainExtension } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport { Plugin, PluginKey, type EditorState } from '@prosekit/pm/state'\nimport { Decoration, DecorationSet } from '@prosekit/pm/view'\n\nimport { findTable } from '../table'\n\nexport interface PlaceholderOptions {\n /**\n * The placeholder to use. It can be a static string or a function that\n * receives the current editor state and returns a string.\n */\n placeholder: string | ((state: EditorState) => string)\n\n /**\n * By default, the placeholder text will be shown whenever the current text\n * cursor is in an empty text node and it's not inside a code block or a\n * table node.\n *\n * If you only want to show the placeholder when the whole doc is empty, you\n * can set this option to 'doc'.\n *\n * You can also pass a function that receives the current editor state and\n * returns a boolean value to determine whether the placeholder should be\n * shown.\n *\n * @default 'block'\n */\n strategy?: 'doc' | 'block' | ((state: EditorState) => boolean)\n}\n\n/**\n * Add a placeholder text to the editor when the current block or document is\n * empty.\n */\nexport function definePlaceholder(options: PlaceholderOptions): PlainExtension {\n return definePlugin(createPlaceholderPlugin(options))\n}\n\nfunction createPlaceholderPlugin({\n placeholder,\n strategy = 'block',\n}: PlaceholderOptions): Plugin {\n return new Plugin({\n key: new PluginKey('prosekit-placeholder'),\n props: {\n decorations: (state) => {\n const strategyFn = typeof strategy === 'function'\n ? strategy\n : strategy === 'doc'\n ? docStrategy\n : defaultStrategy\n\n if (!strategyFn(state)) {\n return null\n }\n\n const placeholderText: string = maybeRun(placeholder, state)\n const deco = createPlaceholderDecoration(state, placeholderText)\n if (!deco) {\n return null\n }\n\n return DecorationSet.create(state.doc, [deco])\n },\n },\n })\n}\n\nfunction defaultStrategy(state: EditorState): boolean {\n return !isInCodeBlock(state.selection) && !findTable(state.selection.$from)\n}\n\nfunction docStrategy(state: EditorState): boolean {\n return isDocEmpty(state.doc) && defaultStrategy(state)\n}\n\nfunction isDocEmpty(doc: ProseMirrorNode) {\n return doc.childCount <= 1 && !doc.firstChild?.content.size\n}\n\nfunction createPlaceholderDecoration(\n state: EditorState,\n placeholderText: string,\n): Decoration | null {\n if (!placeholderText) return null\n\n const { selection } = state\n if (!selection.empty || !isTextSelection(selection)) return null\n\n const $pos = selection.$anchor\n const node = $pos.parent\n if (node.content.size > 0) return null\n\n const before = $pos.before()\n\n return Decoration.node(before, before + node.nodeSize, {\n 'class': 'prosekit-placeholder',\n 'data-placeholder': placeholderText,\n })\n}\n"],"mappings":";;;;;;;;;;AAmCA,SAAgB,kBAAkB,SAA6C;AAC7E,QAAO,aAAa,wBAAwB,QAAQ,CAAC;;AAGvD,SAAS,wBAAwB,EAC/B,aACA,WAAW,WACkB;AAC7B,QAAO,IAAI,OAAO;EAChB,KAAK,IAAI,UAAU,uBAAuB;EAC1C,OAAO,EACL,cAAc,UAAU;AAOtB,OAAI,EANe,OAAO,aAAa,aACnC,WACA,aAAa,QACb,cACA,iBAEY,MAAM,CACpB,QAAO;GAIT,MAAM,OAAO,4BAA4B,OADT,SAAS,aAAa,MAAM,CACI;AAChE,OAAI,CAAC,KACH,QAAO;AAGT,UAAO,cAAc,OAAO,MAAM,KAAK,CAAC,KAAK,CAAC;KAEjD;EACF,CAAC;;AAGJ,SAAS,gBAAgB,OAA6B;AACpD,QAAO,CAAC,cAAc,MAAM,UAAU,IAAI,CAAC,UAAU,MAAM,UAAU,MAAM;;AAG7E,SAAS,YAAY,OAA6B;AAChD,QAAO,WAAW,MAAM,IAAI,IAAI,gBAAgB,MAAM;;AAGxD,SAAS,WAAW,KAAsB;AACxC,QAAO,IAAI,cAAc,KAAK,CAAC,IAAI,YAAY,QAAQ;;AAGzD,SAAS,4BACP,OACA,iBACmB;AACnB,KAAI,CAAC,gBAAiB,QAAO;CAE7B,MAAM,EAAE,cAAc;AACtB,KAAI,CAAC,UAAU,SAAS,CAAC,gBAAgB,UAAU,CAAE,QAAO;CAE5D,MAAM,OAAO,UAAU;CACvB,MAAM,OAAO,KAAK;AAClB,KAAI,KAAK,QAAQ,OAAO,EAAG,QAAO;CAElC,MAAM,SAAS,KAAK,QAAQ;AAE5B,QAAO,WAAW,KAAK,QAAQ,SAAS,KAAK,UAAU;EACrD,SAAS;EACT,oBAAoB;EACrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-readonly.d.ts","names":[],"sources":["../src/readonly/index.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-readonly.d.ts","names":[],"sources":["../src/readonly/index.ts"],"mappings":";;;;;AAMA;iBAAgB,cAAA,CAAA,GAAkB,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-readonly.js","names":[],"sources":["../src/readonly/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-readonly.js","names":[],"sources":["../src/readonly/index.ts"],"sourcesContent":["import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport { PluginKey, ProseMirrorPlugin } from '@prosekit/pm/state'\n\n/**\n * Make the editor read-only.\n */\nexport function defineReadonly(): PlainExtension {\n return definePlugin(plugin)\n}\n\nconst plugin = new ProseMirrorPlugin({\n key: new PluginKey('prosekey-readonly'),\n props: {\n editable: () => false,\n },\n})\n"],"mappings":";;;;;;;AAMA,SAAgB,iBAAiC;AAC/C,QAAO,aAAa,OAAO;;AAG7B,MAAM,SAAS,IAAI,kBAAkB;CACnC,KAAK,IAAI,UAAU,oBAAoB;CACvC,OAAO,EACL,gBAAgB,OACjB;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-search.d.ts","names":[],"sources":["../src/search/index.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-search.d.ts","names":[],"sources":["../src/search/index.ts"],"mappings":";;;;;AAqBA;;;UAAiB,kBAAA;EAIf;;;EAAA,MAAA;EA4BA;;;EAvBA,OAAA;EAsCc;;;;;EA/Bd,aAAA;EA+B8D;;;AAqChE;;;;EA3DE,OAAA;EA4DA;;;;;EArDA,MAAA;EA2DE;;;;;EApDF,SAAA;AAAA;;;;;;iBAQc,iBAAA,CAAkB,OAAA,EAAS,kBAAA,GAAqB,cAAA;;;;KAqCpD,uBAAA,GAA0B,SAAA;EACpC,QAAA;IACE,QAAA;IACA,QAAA;IACA,cAAA;IACA,cAAA;IACA,WAAA;IACA,iBAAA;IACA,cAAA;IACA,UAAA;EAAA;AAAA;;;;;;iBASY,oBAAA,CAAA,GAAwB,uBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-search.js","names":[],"sources":["../src/search/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-search.js","names":[],"sources":["../src/search/index.ts"],"sourcesContent":["import { defineCommands, definePlugin, type Extension, type PlainExtension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport {\n findNext,\n findNextNoWrap,\n findPrev,\n findPrevNoWrap,\n replaceAll,\n replaceCurrent,\n replaceNext,\n replaceNextNoWrap,\n search,\n SearchQuery,\n} from 'prosemirror-search'\n\n/**\n * Options for {@link defineSearchQuery}\n *\n * @public\n */\nexport interface SearchQueryOptions {\n /**\n * The search string (or regular expression).\n */\n search: string\n\n /**\n * The replace text.\n */\n replace?: string\n\n /**\n * Indicates whether the search is case-sensitive\n *\n * @default false\n */\n caseSensitive?: boolean\n\n /**\n * By default, string search will replace `\\n`, `\\r`, and `\\t` in the query\n * with newline, return, and tab characters. When this is set to true, that\n * behavior is disabled.\n *\n * @default false\n */\n literal?: boolean\n\n /**\n * When true, the search string is interpreted as a regular expression.\n *\n * @default false\n */\n regexp?: boolean\n\n /**\n * Enable whole-word matching.\n *\n * @default false\n */\n wholeWord?: boolean\n}\n\n/**\n * Defines an extension that stores a current search query and replace string.\n *\n * @public\n */\nexport function defineSearchQuery(options: SearchQueryOptions): PlainExtension {\n const query = new SearchQuery(options)\n return definePlugin(search({ initialQuery: query }))\n}\n\n/**\n * Scrolls the active search match into view.\n */\nfunction scrollActiveIntoView(view: EditorView) {\n if (view.isDestroyed) return\n const active = view.dom.querySelector('.ProseMirror-active-search-match')\n active?.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n behavior: 'smooth',\n })\n}\n\n/**\n * Wraps a command and scrolls the active search match into view when the command\n * is applied.\n */\nfunction withScrollActiveIntoView(command: Command): Command {\n return (state, dispatch, view) => {\n const result = command(state, dispatch, view)\n if (result && dispatch && view) {\n // Add a small delay because the command itself will handle scrolling if\n // the view is focused.\n setTimeout(() => scrollActiveIntoView(view), 50)\n }\n return result\n }\n}\n\n/**\n * @internal\n */\nexport type SearchCommandsExtension = Extension<{\n Commands: {\n findNext: []\n findPrev: []\n findNextNoWrap: []\n findPrevNoWrap: []\n replaceNext: []\n replaceNextNoWrap: []\n replaceCurrent: []\n replaceAll: []\n }\n}>\n\n/**\n * Defines commands for search and replace.\n *\n * @public\n */\nexport function defineSearchCommands(): SearchCommandsExtension {\n return defineCommands({\n findNext: () => withScrollActiveIntoView(findNext),\n findPrev: () => withScrollActiveIntoView(findPrev),\n findNextNoWrap: () => withScrollActiveIntoView(findNextNoWrap),\n findPrevNoWrap: () => withScrollActiveIntoView(findPrevNoWrap),\n replaceNext: () => withScrollActiveIntoView(replaceNext),\n replaceNextNoWrap: () => withScrollActiveIntoView(replaceNextNoWrap),\n replaceCurrent: () => withScrollActiveIntoView(replaceCurrent),\n replaceAll: () => withScrollActiveIntoView(replaceAll),\n })\n}\n"],"mappings":";;;;;;;;;AAoEA,SAAgB,kBAAkB,SAA6C;AAE7E,QAAO,aAAa,OAAO,EAAE,cADf,IAAI,YAAY,QAAQ,EACY,CAAC,CAAC;;;;;AAMtD,SAAS,qBAAqB,MAAkB;AAC9C,KAAI,KAAK,YAAa;AAEtB,CADe,KAAK,IAAI,cAAc,mCAAmC,EACjE,eAAe;EACrB,OAAO;EACP,QAAQ;EACR,UAAU;EACX,CAAC;;;;;;AAOJ,SAAS,yBAAyB,SAA2B;AAC3D,SAAQ,OAAO,UAAU,SAAS;EAChC,MAAM,SAAS,QAAQ,OAAO,UAAU,KAAK;AAC7C,MAAI,UAAU,YAAY,KAGxB,kBAAiB,qBAAqB,KAAK,EAAE,GAAG;AAElD,SAAO;;;;;;;;AAyBX,SAAgB,uBAAgD;AAC9D,QAAO,eAAe;EACpB,gBAAgB,yBAAyB,SAAS;EAClD,gBAAgB,yBAAyB,SAAS;EAClD,sBAAsB,yBAAyB,eAAe;EAC9D,sBAAsB,yBAAyB,eAAe;EAC9D,mBAAmB,yBAAyB,YAAY;EACxD,yBAAyB,yBAAyB,kBAAkB;EACpE,sBAAsB,yBAAyB,eAAe;EAC9D,kBAAkB,yBAAyB,WAAW;EACvD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-strike.d.ts","names":[],"sources":["../src/strike/index.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-strike.d.ts","names":[],"sources":["../src/strike/index.ts"],"mappings":";;;;;;AAkBA;KAAY,mBAAA,GAAsB,SAAA;EAChC,KAAA;IACE,MAAA,EAAQ,KAAA;EAAA;AAAA;;;;iBAOI,gBAAA,CAAA,GAAoB,mBAAA;AAApC;;;AAAA,KAmBY,uBAAA,GAA0B,SAAA;EACpC,QAAA;IACE,YAAA;EAAA;AAAA;;;;iBAOY,oBAAA,CAAA,GAAwB,uBAAA;;;AAAxC;iBASgB,kBAAA,CAAA,GAAsB,cAAA;;;;iBAUtB,qBAAA,CAAA,GAAyB,cAAA;;;;KAY7B,eAAA,GAAkB,KAAA,EAC3B,mBAAA,EAAqB,uBAAA;;;AADxB;iBAOgB,YAAA,CAAA,GAAgB,eAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as defineMarkInputRule } from "./input-rule-
|
|
1
|
+
import { r as defineMarkInputRule } from "./input-rule-COGr_GBb.js";
|
|
2
2
|
import { canUseRegexLookbehind, defineCommands, defineKeymap, defineMarkSpec, toggleMark, union } from "@prosekit/core";
|
|
3
3
|
|
|
4
4
|
//#region src/strike/index.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-table.d.ts","names":[],"sources":["../src/table/table-commands/insert-table.ts","../src/table/table-commands/select-table.ts","../src/table/table-commands/select-table-cell.ts","../src/table/table-commands/select-table-column.ts","../src/table/table-commands/select-table-row.ts","../src/table/table-commands.ts","../src/table/table-spec.ts","../src/table/table.ts","../src/table/table-commands/exit-table.ts","../src/table/table-drop-indicator.ts","../src/table/table-plugins.ts","../src/table/table-utils.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-table.d.ts","names":[],"sources":["../src/table/table-commands/insert-table.ts","../src/table/table-commands/select-table.ts","../src/table/table-commands/select-table-cell.ts","../src/table/table-commands/select-table-column.ts","../src/table/table-commands/select-table-row.ts","../src/table/table-commands.ts","../src/table/table-spec.ts","../src/table/table.ts","../src/table/table-commands/exit-table.ts","../src/table/table-drop-indicator.ts","../src/table/table-plugins.ts","../src/table/table-utils.ts"],"mappings":";;;;;;;;;UA2CiB,kBAAA;;AAAjB;;EAIE,GAAA;EAJiC;;;EASjC,GAAA;EAOM;;AAWR;;;EAXE,MAAA;AAAA;;;;;;;;ACnDF;iBD8DgB,WAAA,CAAY,OAAA,EAAS,kBAAA,GAAqB,OAAA;;;;;;UC9DzC,kBAAA;;ADmCjB;;;EC9BE,GAAA;AAAA;;;;iBAMc,WAAA,CAAY,OAAA,GAAU,kBAAA,GAAqB,OAAA;;;;;;UCX1C,sBAAA;;AFmCjB;;;EE9BE,GAAA;AAAA;;;;iBAMc,eAAA,CAAgB,OAAA,GAAU,sBAAA,GAAyB,OAAA;;;;;;UCXlD,wBAAA;;AHmCjB;;;EG9BE,MAAA;EHkCA;;;;EG5BA,IAAA;AAAA;;;;iBAMc,iBAAA,CAAkB,OAAA,GAAU,wBAAA,GAA2B,OAAA;;;;;;UCjBtD,qBAAA;;AJmCjB;;;EI9BE,MAAA;EJkCA;;;;EI5BA,IAAA;AAAA;;;;iBAMc,cAAA,CAAe,OAAA,GAAU,qBAAA,GAAwB,OAAA;;;;;;KCCrD,sBAAA,GAAyB,SAAA;EACnC,QAAA;IACE,WAAA,GAAc,OAAA,EAAS,kBAAA;IACvB,SAAA;IAEA,WAAA,GAAc,OAAA,GAAU,kBAAA;IACxB,eAAA,GAAkB,OAAA,GAAU,sBAAA;IAC5B,iBAAA,GAAoB,OAAA,GAAU,wBAAA;IAC9B,cAAA,GAAiB,OAAA,GAAU,qBAAA;IAE3B,oBAAA;IACA,mBAAA;IACA,gBAAA;IACA,gBAAA;IAEA,WAAA;IACA,iBAAA;IACA,cAAA;IACA,mBAAA;IAEA,eAAA;IACA,cAAA;IAEA,YAAA,GAAe,OAAA,EAAS,mBAAA;IACxB,eAAA,GAAkB,OAAA,EAAS,sBAAA;EAAA;AAAA;;;;;;iBASf,mBAAA,CAAA,GAAuB,sBAAA;;;;;;UClDtB,SAAA;EACf,OAAA;EACA,OAAA;EACA,QAAA;AAAA;;;;KAYU,kBAAA,GAAqB,SAAA;EAC/B,KAAA;IACE,KAAA,EAAO,KAAA;EAAA;AAAA;;;;iBAaK,eAAA,CAAA,GAAmB,kBAAA;;;;KAWvB,qBAAA,GAAwB,SAAA;EAClC,KAAA;IACE,QAAA,EAAU,KAAA;EAAA;AAAA;;;ALjCd;iBKwCgB,kBAAA,CAAA,GAAsB,qBAAA;;;;KAW1B,sBAAA,GAAyB,SAAA;EACnC,KAAA;IACE,SAAA,EAAW,SAAA;EAAA;AAAA;;;AJhEf;iBIuEgB,mBAAA,CAAA,GAAuB,sBAAA;;;;KAW3B,4BAAA,GAA+B,SAAA;EACzC,KAAA;IACE,eAAA,EAAiB,SAAA;EAAA;AAAA;AAAA,iBAIL,yBAAA,CAAA,GAA6B,4BAAA;;;;;;KC7EjC,cAAA,GAAiB,KAAA,EAEzB,kBAAA,EACA,qBAAA,EACA,sBAAA,EACA,4BAAA,EACA,sBAAA;;;AP6CJ;iBOtCgB,WAAA,CAAA,GAAe,cAAA;;;;;;;;APW/B;cQhCa,SAAA,EAAW,OAAA;;;;;;;;ARgCxB;iBShCgB,wBAAA,CAAA,GAA4B,cAAA;;;;;;iBCL5B,kBAAA,CAAA,GAAsB,cAAA;;;;;;;AVqCtC;iBWlCgB,eAAA,CAAgB,KAAA,YAAiB,KAAA,IAAS,aAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as insertTable, a as defineTableSpec, c as defineTableCommands, d as selectTableCell, f as selectTable, g as moveTableColumn, h as moveTableRow, i as defineTableRowSpec, l as selectTableRow, m as isCellSelection, n as defineTableCellSpec, o as defineTablePlugins, p as findTable, r as defineTableHeaderCellSpec, s as defineTableDropIndicator, t as defineTable, u as selectTableColumn, v as exitTable } from "./table-
|
|
1
|
+
import { _ as insertTable, a as defineTableSpec, c as defineTableCommands, d as selectTableCell, f as selectTable, g as moveTableColumn, h as moveTableRow, i as defineTableRowSpec, l as selectTableRow, m as isCellSelection, n as defineTableCellSpec, o as defineTablePlugins, p as findTable, r as defineTableHeaderCellSpec, s as defineTableDropIndicator, t as defineTable, u as selectTableColumn, v as exitTable } from "./table-4oHfV-Ql.js";
|
|
2
2
|
|
|
3
3
|
export { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-text-align.d.ts","names":[],"sources":["../src/text-align/index.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-text-align.d.ts","names":[],"sources":["../src/text-align/index.ts"],"mappings":";;;;;;AAeA;UAAiB,gBAAA;EAAgB;;;;;;;EAQ/B,KAAA,EAAO,QAAA;EA6BG;;;;;EAtBV,OAAA;AAAA;;;;KAsBU,uBAAA,4BAAmD,SAAA;EAC7D,KAAA,UAAe,QAAA;IAAa,SAAA;EAAA;AAAA;;;;iBAgBd,YAAA,CAAA;EACd,KAAA;EACA;AAAA;EAEA,KAAA;EACA,KAAA;AAAA,IACE,OAAA;;;;KAOQ,0BAAA,GAA6B,SAAA;EACvC,QAAA;IACE,YAAA,GAAe,KAAA;EAAA;AAAA;;;;iBAOH,uBAAA,CACd,KAAA,aACC,0BAAA;;;;iBASa,qBAAA,CAAsB,KAAA,aAAkB,cAAA;;;;KAY5C,kBAAA,4BAA8C,KAAA,EACvD,uBAAA,CAAwB,QAAA,GAAW,0BAAA;;;AADtC;;;;iBAUgB,eAAA,kCAAA,CACd,OAAA,EAAS,gBAAA,CAAiB,QAAA,IACzB,kBAAA,CAAmB,QAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineCommands, defineKeymap, defineNodeAttr,
|
|
1
|
+
import { defineCommands, defineKeymap, defineNodeAttr, setNodeAttrsBetween, union } from "@prosekit/core";
|
|
2
2
|
|
|
3
3
|
//#region src/text-align/index.ts
|
|
4
4
|
function defineTextAlignAttr(type, defaultValue) {
|
|
@@ -23,7 +23,7 @@ function defineTextAlignAttrs(types, defaultValue) {
|
|
|
23
23
|
* @internal
|
|
24
24
|
*/
|
|
25
25
|
function setTextAlign({ types, value }) {
|
|
26
|
-
return
|
|
26
|
+
return setNodeAttrsBetween({
|
|
27
27
|
type: types,
|
|
28
28
|
attrs: { textAlign: value }
|
|
29
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-text-align.js","names":[],"sources":["../src/text-align/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineNodeAttr,\n
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-text-align.js","names":[],"sources":["../src/text-align/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineNodeAttr,\n setNodeAttrsBetween,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\n/**\n * @public\n */\nexport interface TextAlignOptions<NodeName extends string = string> {\n /**\n * The names of node to add the attribute to.\n *\n * @example\n *\n * [\"paragraph\", \"heading\"]\n */\n types: NodeName[]\n\n /**\n * The default value for the attribute.\n *\n * @default \"left\"\n */\n default?: string\n}\n\nfunction defineTextAlignAttr<NodeName extends string>(\n type: NodeName,\n defaultValue: string | null,\n) {\n return defineNodeAttr<NodeName, 'textAlign', string | null>({\n type,\n attr: 'textAlign',\n default: defaultValue,\n splittable: true,\n toDOM: (value: any) => (value ? ['style', `text-align:${value};`] : null),\n parseDOM: (node: HTMLElement) => {\n return node.style.getPropertyValue('text-align') || null\n },\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignAttrsExtension<NodeName extends string> = Extension<{\n Nodes: { [K in NodeName]: { textAlign: string | null } }\n}>\n\n/**\n * @internal\n */\nfunction defineTextAlignAttrs<NodeName extends string>(\n types: NodeName[],\n defaultValue: string | null,\n): TextAlignAttrsExtension<NodeName> {\n return union(types.map((type) => defineTextAlignAttr(type, defaultValue)))\n}\n\n/**\n * @internal\n */\nexport function setTextAlign({\n types,\n value,\n}: {\n types: string[]\n value: string | null\n}): Command {\n return setNodeAttrsBetween({ type: types, attrs: { textAlign: value } })\n}\n\n/**\n * @internal\n */\nexport type TextAlignCommandsExtension = Extension<{\n Commands: {\n setTextAlign: [value: string | null]\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextAlignCommands(\n types: string[],\n): TextAlignCommandsExtension {\n return defineCommands({\n setTextAlign: (value: string | null) => setTextAlign({ types, value }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineTextAlignKeymap(types: string[]): PlainExtension {\n return defineKeymap({\n 'Mod-L': setTextAlign({ types, value: 'left' }),\n 'Mod-E': setTextAlign({ types, value: 'center' }),\n 'Mod-R': setTextAlign({ types, value: 'right' }),\n 'Mod-J': setTextAlign({ types, value: 'justify' }),\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignExtension<NodeName extends string> = Union<\n [TextAlignAttrsExtension<NodeName>, TextAlignCommandsExtension]\n>\n\n/**\n * Adds a `textAlign` attribute to the specified nodes. This will be rendered as\n * a CSS `text-align` style.\n *\n * @public\n */\nexport function defineTextAlign<NodeName extends string = string>(\n options: TextAlignOptions<NodeName>,\n): TextAlignExtension<NodeName> {\n return union(\n defineTextAlignAttrs<NodeName>(options.types, options.default || 'left'),\n defineTextAlignKeymap(options.types),\n defineTextAlignCommands(options.types),\n )\n}\n"],"mappings":";;;AAiCA,SAAS,oBACP,MACA,cACA;AACA,QAAO,eAAqD;EAC1D;EACA,MAAM;EACN,SAAS;EACT,YAAY;EACZ,QAAQ,UAAgB,QAAQ,CAAC,SAAS,cAAc,MAAM,GAAG,GAAG;EACpE,WAAW,SAAsB;AAC/B,UAAO,KAAK,MAAM,iBAAiB,aAAa,IAAI;;EAEvD,CAAC;;;;;AAaJ,SAAS,qBACP,OACA,cACmC;AACnC,QAAO,MAAM,MAAM,KAAK,SAAS,oBAAoB,MAAM,aAAa,CAAC,CAAC;;;;;AAM5E,SAAgB,aAAa,EAC3B,OACA,SAIU;AACV,QAAO,oBAAoB;EAAE,MAAM;EAAO,OAAO,EAAE,WAAW,OAAO;EAAE,CAAC;;;;;AAe1E,SAAgB,wBACd,OAC4B;AAC5B,QAAO,eAAe,EACpB,eAAe,UAAyB,aAAa;EAAE;EAAO;EAAO,CAAC,EACvE,CAAC;;;;;AAMJ,SAAgB,sBAAsB,OAAiC;AACrE,QAAO,aAAa;EAClB,SAAS,aAAa;GAAE;GAAO,OAAO;GAAQ,CAAC;EAC/C,SAAS,aAAa;GAAE;GAAO,OAAO;GAAU,CAAC;EACjD,SAAS,aAAa;GAAE;GAAO,OAAO;GAAS,CAAC;EAChD,SAAS,aAAa;GAAE;GAAO,OAAO;GAAW,CAAC;EACnD,CAAC;;;;;;;;AAgBJ,SAAgB,gBACd,SAC8B;AAC9B,QAAO,MACL,qBAA+B,QAAQ,OAAO,QAAQ,WAAW,OAAO,EACxE,sBAAsB,QAAQ,MAAM,EACpC,wBAAwB,QAAQ,MAAM,CACvC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Extension, Union } from "@prosekit/core";
|
|
2
|
+
import { Command } from "@prosekit/pm/state";
|
|
3
|
+
|
|
4
|
+
//#region src/text-color/text-color-spec.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Attributes for the `textColor` mark.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
interface TextColorAttrs {
|
|
11
|
+
color: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
type TextColorSpecExtension = Extension<{
|
|
17
|
+
Marks: {
|
|
18
|
+
textColor: TextColorAttrs;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
declare function defineTextColorSpec(): TextColorSpecExtension;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/text-color/text-color-commands.d.ts
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
declare function addTextColor(attrs: TextColorAttrs): Command;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
declare function removeTextColor(): Command;
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
type TextColorCommandsExtension = Extension<{
|
|
39
|
+
Commands: {
|
|
40
|
+
addTextColor: [attrs: TextColorAttrs];
|
|
41
|
+
removeTextColor: [];
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
declare function defineTextColorCommands(): TextColorCommandsExtension;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/text-color/text-color.d.ts
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
type TextColorExtension = Union<[TextColorSpecExtension, TextColorCommandsExtension]>;
|
|
54
|
+
/**
|
|
55
|
+
* Defines the `textColor` mark and some commands for it.
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
declare function defineTextColor(): TextColorExtension;
|
|
60
|
+
//#endregion
|
|
61
|
+
export { type TextColorAttrs, type TextColorCommandsExtension, type TextColorExtension, type TextColorSpecExtension, addTextColor, defineTextColor, defineTextColorCommands, defineTextColorSpec, removeTextColor };
|
|
62
|
+
//# sourceMappingURL=prosekit-extensions-text-color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-text-color.d.ts","names":[],"sources":["../src/text-color/text-color-spec.ts","../src/text-color/text-color-commands.ts","../src/text-color/text-color.ts"],"mappings":";;;;;;;AAOA;;UAAiB,cAAA;EACf,KAAA;AAAA;AAMF;;;AAAA,KAAY,sBAAA,GAAyB,SAAA;EACnC,KAAA;IACE,SAAA,EAAW,cAAA;EAAA;AAAA;;;AAOf;iBAAgB,mBAAA,CAAA,GAAuB,sBAAA;;;;AAhBvC;;iBCCgB,YAAA,CAAa,KAAA,EAAO,cAAA,GAAiB,OAAA;;;ADMrD;iBCCgB,eAAA,CAAA,GAAmB,OAAA;;;;KAOvB,0BAAA,GAA6B,SAAA;EACvC,QAAA;IACE,YAAA,GAAe,KAAA,EAAO,cAAA;IACtB,eAAA;EAAA;AAAA;;;;iBAOY,uBAAA,CAAA,GAA2B,0BAAA;;;;ADzB3C;;KECY,kBAAA,GAAqB,KAAA,EAAO,sBAAA,EAAwB,0BAAA;;;AFMhE;;;iBECgB,eAAA,CAAA,GAAmB,kBAAA"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { addMark, defineCommands, defineMarkSpec, removeMark, union } from "@prosekit/core";
|
|
2
|
+
|
|
3
|
+
//#region src/text-color/text-color-commands.ts
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
function addTextColor(attrs) {
|
|
8
|
+
return addMark({
|
|
9
|
+
type: "textColor",
|
|
10
|
+
attrs
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
function removeTextColor() {
|
|
17
|
+
return removeMark({ type: "textColor" });
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
function defineTextColorCommands() {
|
|
23
|
+
return defineCommands({
|
|
24
|
+
addTextColor,
|
|
25
|
+
removeTextColor
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/text-color/text-color-spec.ts
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
function defineTextColorSpec() {
|
|
35
|
+
return defineMarkSpec({
|
|
36
|
+
name: "textColor",
|
|
37
|
+
attrs: { color: { validate: "string" } },
|
|
38
|
+
parseDOM: [{
|
|
39
|
+
tag: ":where([style*=\"color:\"], [data-text-color])",
|
|
40
|
+
getAttrs: (node) => {
|
|
41
|
+
const value = node.getAttribute("data-text-color");
|
|
42
|
+
if (value && value !== "inherit") return { color: value };
|
|
43
|
+
const color = node.style.color;
|
|
44
|
+
if (color && color !== "inherit") return { color };
|
|
45
|
+
return false;
|
|
46
|
+
},
|
|
47
|
+
consuming: false
|
|
48
|
+
}],
|
|
49
|
+
toDOM(mark) {
|
|
50
|
+
const color = mark.attrs.color;
|
|
51
|
+
return [
|
|
52
|
+
"span",
|
|
53
|
+
{
|
|
54
|
+
"style": `color: ${color};`,
|
|
55
|
+
"data-text-color": color
|
|
56
|
+
},
|
|
57
|
+
0
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/text-color/text-color.ts
|
|
65
|
+
/**
|
|
66
|
+
* Defines the `textColor` mark and some commands for it.
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
function defineTextColor() {
|
|
71
|
+
return union(defineTextColorSpec(), defineTextColorCommands());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { addTextColor, defineTextColor, defineTextColorCommands, defineTextColorSpec, removeTextColor };
|
|
76
|
+
//# sourceMappingURL=prosekit-extensions-text-color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-text-color.js","names":[],"sources":["../src/text-color/text-color-commands.ts","../src/text-color/text-color-spec.ts","../src/text-color/text-color.ts"],"sourcesContent":["import { addMark, defineCommands, removeMark, type Extension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\nimport type { TextColorAttrs } from './text-color-spec'\n\n/**\n * @internal\n */\nexport function addTextColor(attrs: TextColorAttrs): Command {\n return addMark({ type: 'textColor', attrs })\n}\n\n/**\n * @internal\n */\nexport function removeTextColor(): Command {\n return removeMark({ type: 'textColor' })\n}\n\n/**\n * @internal\n */\nexport type TextColorCommandsExtension = Extension<{\n Commands: {\n addTextColor: [attrs: TextColorAttrs]\n removeTextColor: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextColorCommands(): TextColorCommandsExtension {\n return defineCommands({ addTextColor, removeTextColor })\n}\n","import { defineMarkSpec, type Extension } from '@prosekit/core'\n\n/**\n * Attributes for the `textColor` mark.\n *\n * @public\n */\nexport interface TextColorAttrs {\n color: string\n}\n\n/**\n * @internal\n */\nexport type TextColorSpecExtension = Extension<{\n Marks: {\n textColor: TextColorAttrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextColorSpec(): TextColorSpecExtension {\n return defineMarkSpec<'textColor', TextColorAttrs>({\n name: 'textColor',\n attrs: {\n color: {\n validate: 'string',\n },\n },\n parseDOM: [\n {\n tag: ':where([style*=\"color:\"], [data-text-color])',\n getAttrs: (node): TextColorAttrs | false => {\n // When both `data-text-color` and `style=\"color\"` are present, we\n // prioritize the `data-text-color` attribute. This avoids the\n // browser's default behavior of changing hex colors to rgba in style\n // attribute.\n const value = node.getAttribute('data-text-color')\n if (value && value !== 'inherit') {\n return { color: value }\n }\n const color = node.style.color\n if (color && color !== 'inherit') {\n return { color }\n }\n return false\n },\n consuming: false,\n },\n ],\n toDOM(mark) {\n const color = (mark.attrs as TextColorAttrs).color\n return ['span', { 'style': `color: ${color};`, 'data-text-color': color }, 0]\n },\n })\n}\n","import { union, type Union } from '@prosekit/core'\n\nimport { defineTextColorCommands, type TextColorCommandsExtension } from './text-color-commands'\nimport { defineTextColorSpec, type TextColorSpecExtension } from './text-color-spec'\n\n/**\n * @internal\n */\nexport type TextColorExtension = Union<[TextColorSpecExtension, TextColorCommandsExtension]>\n\n/**\n * Defines the `textColor` mark and some commands for it.\n *\n * @public\n */\nexport function defineTextColor(): TextColorExtension {\n return union(\n defineTextColorSpec(),\n defineTextColorCommands(),\n )\n}\n"],"mappings":";;;;;;AAQA,SAAgB,aAAa,OAAgC;AAC3D,QAAO,QAAQ;EAAE,MAAM;EAAa;EAAO,CAAC;;;;;AAM9C,SAAgB,kBAA2B;AACzC,QAAO,WAAW,EAAE,MAAM,aAAa,CAAC;;;;;AAgB1C,SAAgB,0BAAsD;AACpE,QAAO,eAAe;EAAE;EAAc;EAAiB,CAAC;;;;;;;;ACV1D,SAAgB,sBAA8C;AAC5D,QAAO,eAA4C;EACjD,MAAM;EACN,OAAO,EACL,OAAO,EACL,UAAU,UACX,EACF;EACD,UAAU,CACR;GACE,KAAK;GACL,WAAW,SAAiC;IAK1C,MAAM,QAAQ,KAAK,aAAa,kBAAkB;AAClD,QAAI,SAAS,UAAU,UACrB,QAAO,EAAE,OAAO,OAAO;IAEzB,MAAM,QAAQ,KAAK,MAAM;AACzB,QAAI,SAAS,UAAU,UACrB,QAAO,EAAE,OAAO;AAElB,WAAO;;GAET,WAAW;GACZ,CACF;EACD,MAAM,MAAM;GACV,MAAM,QAAS,KAAK,MAAyB;AAC7C,UAAO;IAAC;IAAQ;KAAE,SAAS,UAAU,MAAM;KAAI,mBAAmB;KAAO;IAAE;IAAE;;EAEhF,CAAC;;;;;;;;;;ACzCJ,SAAgB,kBAAsC;AACpD,QAAO,MACL,qBAAqB,EACrB,yBAAyB,CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-text.d.ts","names":[],"sources":["../src/text/index.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-text.d.ts","names":[],"sources":["../src/text/index.ts"],"mappings":";;;;;;AAMA;KAAY,aAAA,GAAgB,SAAA;EAC1B,KAAA;IACE,IAAA,EAAM,KAAA;EAAA;AAAA;;;;iBAOM,UAAA,CAAA,GAAc,aAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-text.js","names":[],"sources":["../src/text/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-text.js","names":[],"sources":["../src/text/index.ts"],"sourcesContent":["import { defineNodeSpec, type Extension } from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type TextExtension = Extension<{\n Nodes: {\n text: Attrs\n }\n}>\n\n/**\n * @public\n */\nexport function defineText(): TextExtension {\n return defineNodeSpec({\n name: 'text',\n group: 'inline',\n })\n}\n"],"mappings":";;;;;;AAeA,SAAgB,aAA4B;AAC1C,QAAO,eAAe;EACpB,MAAM;EACN,OAAO;EACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-underline.d.ts","names":[],"sources":["../src/underline/index.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-underline.d.ts","names":[],"sources":["../src/underline/index.ts"],"mappings":";;;;;;AAeA;KAAY,sBAAA,GAAyB,SAAA;EACnC,KAAA;IACE,SAAA,EAAW,KAAA;EAAA;AAAA;;;;iBAOC,mBAAA,CAAA,GAAuB,sBAAA;AAAvC;;;AAAA,KAkBY,0BAAA,GAA6B,SAAA;EACvC,QAAA;IACE,eAAA;EAAA;AAAA;;;;iBAOY,uBAAA,CAAA,GAA2B,0BAAA;;;AAA3C;iBASgB,qBAAA,CAAA,GAAyB,cAAA;;;;KAS7B,kBAAA,GAAqB,KAAA,EAC9B,sBAAA,EAAwB,0BAAA;;AAD3B;;iBAOgB,eAAA,CAAA,GAAmB,kBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-virtual-selection.d.ts","names":[],"sources":["../src/virtual-selection/index.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-virtual-selection.d.ts","names":[],"sources":["../src/virtual-selection/index.ts"],"mappings":";;;;;AAOA;KAAY,yBAAA,GAA4B,cAAA;;;;AAYxC;;;;;;;iBAAgB,sBAAA,CAAA,GAA0B,yBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-virtual-selection.js","names":[],"sources":["../src/virtual-selection/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-virtual-selection.js","names":[],"sources":["../src/virtual-selection/index.ts"],"sourcesContent":["import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport { PluginKey, ProseMirrorPlugin, type EditorState, type Transaction } from '@prosekit/pm/state'\nimport { Decoration, DecorationSet } from '@prosekit/pm/view'\n\n/**\n * @internal\n */\nexport type VirtualSelectionExtension = PlainExtension\n\n/**\n * Shows a virtual selection when the editor is not focused. When the editor is\n * not focused, the selected inline content will be wrapped in a `<span>`\n * element with the class `prosekit-virtual-selection`.\n *\n * This is useful when you want to move the focus to an element outside the\n * editor, but still want to show the selection.\n *\n * @public\n */\nexport function defineVirtualSelection(): VirtualSelectionExtension {\n return definePlugin(virtualSelectionPlugin)\n}\n\n// Show the decoration when this is true.\ntype PluginState = boolean\n\nconst key = new PluginKey<PluginState>('prosekit-virtual-selection')\n\nfunction getFocusMeta(tr: Transaction): PluginState | undefined {\n return tr.getMeta(key) as PluginState | undefined\n}\n\nfunction setFocusMeta(tr: Transaction, value: PluginState) {\n return tr.setMeta(key, value)\n}\n\nfunction getFocusState(state: EditorState): PluginState | undefined {\n return key.getState(state)\n}\n\nconst virtualSelectionPlugin = new ProseMirrorPlugin<PluginState>({\n key,\n state: {\n init: () => false,\n apply: (tr, value) => {\n return getFocusMeta(tr) ?? value\n },\n },\n props: {\n handleDOMEvents: {\n focus: (view) => {\n view.dispatch(setFocusMeta(view.state.tr, false))\n },\n\n blur: (view) => {\n const { dom, root } = view\n const activeElement = root.activeElement\n\n // Don't show the decoration if the dom is blurred because the focus\n // moved outside the browser window.\n if (activeElement === dom) return\n\n view.dispatch(setFocusMeta(view.state.tr, true))\n },\n },\n decorations: (state) => {\n const { selection, doc } = state\n\n if (\n selection.empty\n || !getFocusState(state)\n // When `selection.visible` is false, it indicates that the selection is\n // rendered by the editor and it's not a native browser selection. An\n // example of this is `NodeSelection`. In this situation, since the\n // editor already shows the selection, we don't need to display a\n // virtual selection.\n || !selection.visible\n ) {\n return null\n }\n\n return DecorationSet.create(doc, [\n Decoration.inline(selection.from, selection.to, {\n class: 'prosekit-virtual-selection',\n }),\n ])\n },\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,SAAgB,yBAAoD;AAClE,QAAO,aAAa,uBAAuB;;AAM7C,MAAM,MAAM,IAAI,UAAuB,6BAA6B;AAEpE,SAAS,aAAa,IAA0C;AAC9D,QAAO,GAAG,QAAQ,IAAI;;AAGxB,SAAS,aAAa,IAAiB,OAAoB;AACzD,QAAO,GAAG,QAAQ,KAAK,MAAM;;AAG/B,SAAS,cAAc,OAA6C;AAClE,QAAO,IAAI,SAAS,MAAM;;AAG5B,MAAM,yBAAyB,IAAI,kBAA+B;CAChE;CACA,OAAO;EACL,YAAY;EACZ,QAAQ,IAAI,UAAU;AACpB,UAAO,aAAa,GAAG,IAAI;;EAE9B;CACD,OAAO;EACL,iBAAiB;GACf,QAAQ,SAAS;AACf,SAAK,SAAS,aAAa,KAAK,MAAM,IAAI,MAAM,CAAC;;GAGnD,OAAO,SAAS;IACd,MAAM,EAAE,KAAK,SAAS;AAKtB,QAJsB,KAAK,kBAIL,IAAK;AAE3B,SAAK,SAAS,aAAa,KAAK,MAAM,IAAI,KAAK,CAAC;;GAEnD;EACD,cAAc,UAAU;GACtB,MAAM,EAAE,WAAW,QAAQ;AAE3B,OACE,UAAU,SACP,CAAC,cAAc,MAAM,IAMrB,CAAC,UAAU,QAEd,QAAO;AAGT,UAAO,cAAc,OAAO,KAAK,CAC/B,WAAW,OAAO,UAAU,MAAM,UAAU,IAAI,EAC9C,OAAO,8BACR,CAAC,CACH,CAAC;;EAEL;CACF,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Extension, PlainExtension, Union } from "@prosekit/core";
|
|
2
2
|
import { yCursorPlugin, ySyncPlugin, yUndoPlugin } from "y-prosemirror";
|
|
3
|
-
import { Awareness } from "y-protocols/awareness";
|
|
4
3
|
import * as Y from "yjs";
|
|
5
4
|
|
|
6
5
|
//#region src/yjs/yjs-commands.d.ts
|
|
@@ -15,6 +14,14 @@ type YjsCommandsExtension = Extension<{
|
|
|
15
14
|
}>;
|
|
16
15
|
declare function defineYjsCommands(): YjsCommandsExtension;
|
|
17
16
|
//#endregion
|
|
17
|
+
//#region src/yjs/yjs-types.d.ts
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*
|
|
21
|
+
* The type `Awareness` is not exported by `y-prosemirror` so we need to define it like this.
|
|
22
|
+
*/
|
|
23
|
+
type Awareness = Parameters<typeof yCursorPlugin>[0];
|
|
24
|
+
//#endregion
|
|
18
25
|
//#region src/yjs/yjs-cursor-plugin.d.ts
|
|
19
26
|
/**
|
|
20
27
|
* Options for `y-prosemirror`'s `yCursorPlugin`.
|
|
@@ -86,5 +93,5 @@ declare function defineYjs(options: YjsOptions): YjsExtension;
|
|
|
86
93
|
//#region src/yjs/yjs-keymap.d.ts
|
|
87
94
|
declare function defineYjsKeymap(): PlainExtension;
|
|
88
95
|
//#endregion
|
|
89
|
-
export { type YjsCursorOptions, type YjsCursorPluginOptions, type YjsExtension, type YjsOptions, type YjsSyncOptions, type YjsSyncPluginOptions, type YjsUndoOptions, type YjsUndoPluginOptions, defineYjs, defineYjsCommands, defineYjsCursorPlugin, defineYjsKeymap, defineYjsSyncPlugin, defineYjsUndoPlugin };
|
|
96
|
+
export { type Awareness, type YjsCursorOptions, type YjsCursorPluginOptions, type YjsExtension, type YjsOptions, type YjsSyncOptions, type YjsSyncPluginOptions, type YjsUndoOptions, type YjsUndoPluginOptions, defineYjs, defineYjsCommands, defineYjsCursorPlugin, defineYjsKeymap, defineYjsSyncPlugin, defineYjsUndoPlugin };
|
|
90
97
|
//# sourceMappingURL=prosekit-extensions-yjs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-yjs.d.ts","names":[],"sources":["../src/yjs/yjs-commands.ts","../src/yjs/yjs-cursor-plugin.ts","../src/yjs/yjs-sync-plugin.ts","../src/yjs/yjs-undo-plugin.ts","../src/yjs/yjs.ts","../src/yjs/yjs-keymap.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-yjs.d.ts","names":[],"sources":["../src/yjs/yjs-commands.ts","../src/yjs/yjs-types.ts","../src/yjs/yjs-cursor-plugin.ts","../src/yjs/yjs-sync-plugin.ts","../src/yjs/yjs-undo-plugin.ts","../src/yjs/yjs.ts","../src/yjs/yjs-keymap.ts"],"mappings":";;;;;;;;KAWY,oBAAA,GAAuB,SAAA;EACjC,QAAA;IACE,IAAA;IACA,IAAA;EAAA;AAAA;AAAA,iBAIY,iBAAA,CAAA,GAAqB,oBAAA;;;;;;;AAPrC;KCFY,SAAA,GAAY,UAAA,QAAkB,aAAA;;;;;ADE1C;KEFY,sBAAA,GAAyB,WAAA,CACnC,UAAA,QAAkB,aAAA;AAAA,UAGH,gBAAA,SAAyB,sBAAA;EACxC,SAAA,EAAW,SAAA;AAAA;AAAA,iBAGG,qBAAA,CACd,OAAA,EAAS,gBAAA,GACR,cAAA;;;;;AFRH;KGHY,oBAAA,GAAuB,WAAA,CACjC,UAAA,QAAkB,WAAA;AAAA,UAGH,cAAA,SAAuB,oBAAA;EACtC,QAAA,EAAU,CAAA,CAAE,WAAA;AAAA;AAAA,iBAGE,mBAAA,CAAoB,OAAA,EAAS,cAAA,GAAiB,cAAA;;;;;;KC4ClD,oBAAA,GAAuB,WAAA,CACjC,UAAA,QAAkB,WAAA;AAAA,UAGH,cAAA,SAAuB,oBAAA;;;;iBAcxB,mBAAA,CAAoB,OAAA,EAAS,cAAA,GAAiB,cAAA;;;UCpE7C,UAAA;ELC2B;;;EKG1C,GAAA,EAAK,CAAA,CAAE,GAAA;ELAL;;;EKKF,SAAA,EAAW,SAAA;ELDoB;;;;EKO/B,QAAA,GAAW,CAAA,CAAE,WAAA;;;AJhBf;EIqBE,IAAA,GAAO,oBAAA;;;;EAKP,IAAA,GAAO,oBAAA;;;AH1BT;EG+BE,MAAA,GAAS,sBAAA;AAAA;;;;KAMC,YAAA,GAAe,KAAA,EAAO,oBAAA,EAAsB,cAAA;;;;iBAKxC,SAAA,CAAU,OAAA,EAAS,UAAA,GAAa,YAAA;;;iBCvChC,eAAA,CAAA,GAAmB,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-yjs.js","names":["
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-yjs.js","names":["yUndoPlugin","originalYUndoPlugin"],"sources":["../src/yjs/yjs-commands.ts","../src/yjs/yjs-cursor-plugin.ts","../src/yjs/yjs-keymap.ts","../src/yjs/yjs-sync-plugin.ts","../src/yjs/yjs-undo-plugin.ts","../src/yjs/yjs.ts"],"sourcesContent":["import { defineCommands, type Extension } from '@prosekit/core'\nimport { redoCommand, undoCommand } from 'y-prosemirror'\n\nconst commands = {\n undo: () => undoCommand,\n redo: () => redoCommand,\n} as const\n\n/**\n * @internal\n */\nexport type YjsCommandsExtension = Extension<{\n Commands: {\n undo: []\n redo: []\n }\n}>\n\nexport function defineYjsCommands(): YjsCommandsExtension {\n return defineCommands(commands)\n}\n","import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport type { Plugin } from '@prosekit/pm/state'\nimport { yCursorPlugin } from 'y-prosemirror'\n\nimport type { Awareness } from './yjs-types'\n\n/**\n * Options for `y-prosemirror`'s `yCursorPlugin`.\n */\nexport type YjsCursorPluginOptions = NonNullable<\n Parameters<typeof yCursorPlugin>[1]\n>\n\nexport interface YjsCursorOptions extends YjsCursorPluginOptions {\n awareness: Awareness\n}\n\nexport function defineYjsCursorPlugin(\n options: YjsCursorOptions,\n): PlainExtension {\n const { awareness, ...rest } = options\n return definePlugin(yCursorPlugin(awareness, rest) as Plugin)\n}\n","import { defineKeymap, isApple, type Keymap, type PlainExtension } from '@prosekit/core'\nimport { redoCommand, undoCommand } from 'y-prosemirror'\n\nconst keymap: Keymap = {\n 'Mod-z': undoCommand,\n 'Mod-Z': redoCommand,\n}\n\nif (!isApple) {\n keymap['Mod-y'] = redoCommand\n}\n\nexport function defineYjsKeymap(): PlainExtension {\n return defineKeymap(keymap)\n}\n","import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport type { Plugin } from '@prosekit/pm/state'\nimport { ySyncPlugin } from 'y-prosemirror'\nimport type * as Y from 'yjs'\n\n/**\n * Options for `y-prosemirror`'s `ySyncPlugin`.\n */\nexport type YjsSyncPluginOptions = NonNullable<\n Parameters<typeof ySyncPlugin>[1]\n>\n\nexport interface YjsSyncOptions extends YjsSyncPluginOptions {\n fragment: Y.XmlFragment\n}\n\nexport function defineYjsSyncPlugin(options: YjsSyncOptions): PlainExtension {\n const { fragment, ...rest } = options\n return definePlugin(ySyncPlugin(fragment, rest) as Plugin)\n}\n","import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport type { ProseMirrorPlugin } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport { yUndoPlugin as originalYUndoPlugin, yUndoPluginKey } from 'y-prosemirror'\nimport type { UndoManager as YjsUndoManager } from 'yjs'\n\ntype UndoManager = YjsUndoManager & { restore: () => void }\n\n/**\n * @see https://github.com/yjs/y-prosemirror/issues/114 and https://github.com/yjs/y-prosemirror/issues/102\n */\nfunction fixYUndoPlugin(yUndoPluginInstance: ProseMirrorPlugin) {\n const originalUndoPluginView = yUndoPluginInstance.spec.view\n yUndoPluginInstance.spec.view = (view: EditorView) => {\n const pluginState = yUndoPluginKey.getState(view.state)\n if (!pluginState) {\n return {}\n }\n\n const undoManager = pluginState.undoManager as UndoManager\n\n if (undoManager.restore) {\n undoManager.restore()\n undoManager.restore = () => {}\n }\n\n const viewRet = originalUndoPluginView\n ? originalUndoPluginView(view)\n : undefined\n\n return {\n destroy: () => {\n const hasUndoManSelf = undoManager.trackedOrigins.has(undoManager)\n\n const observers = undoManager._observers\n\n undoManager.restore = () => {\n if (hasUndoManSelf) {\n undoManager.trackedOrigins.add(undoManager)\n }\n\n undoManager.doc.on(\n 'afterTransaction',\n undoManager.afterTransactionHandler,\n )\n\n undoManager._observers = observers\n }\n\n if (viewRet?.destroy) {\n viewRet.destroy()\n }\n },\n }\n }\n}\n\n/**\n * Options for the `y-prosemirror`'s `yUndoPlugin`.\n */\nexport type YjsUndoPluginOptions = NonNullable<\n Parameters<typeof originalYUndoPlugin>[0]\n>\n\nexport interface YjsUndoOptions extends YjsUndoPluginOptions {}\n\n/**\n * @internal\n */\nfunction yUndoPlugin(options?: YjsUndoOptions) {\n const yUndoPluginInstance = originalYUndoPlugin(options)\n fixYUndoPlugin(yUndoPluginInstance)\n return yUndoPluginInstance\n}\n\n/**\n * @internal\n */\nexport function defineYjsUndoPlugin(options: YjsUndoOptions): PlainExtension {\n return definePlugin(yUndoPlugin(options))\n}\n","import { Priority, union, withPriority, type PlainExtension, type Union } from '@prosekit/core'\nimport type * as Y from 'yjs'\n\nimport { defineYjsCommands, type YjsCommandsExtension } from './yjs-commands'\nimport { defineYjsCursorPlugin, type YjsCursorPluginOptions } from './yjs-cursor-plugin'\nimport { defineYjsKeymap } from './yjs-keymap'\nimport { defineYjsSyncPlugin, type YjsSyncPluginOptions } from './yjs-sync-plugin'\nimport type { Awareness } from './yjs-types'\nimport { defineYjsUndoPlugin, type YjsUndoPluginOptions } from './yjs-undo-plugin'\n\nexport interface YjsOptions {\n /**\n * The Yjs instance handles the state of shared data.\n */\n doc: Y.Doc\n\n /**\n * The Awareness instance.\n */\n awareness: Awareness\n\n /**\n * The Yjs XmlFragment to use. If not provided,\n * `doc.getXmlFragment('prosemirror')` will be used.\n */\n fragment?: Y.XmlFragment\n\n /**\n * Options for `y-prosemirror`'s `ySyncPlugin`.\n */\n sync?: YjsSyncPluginOptions\n\n /**\n * Options for the `y-prosemirror`'s `yUndoPlugin`.\n */\n undo?: YjsUndoPluginOptions\n\n /**\n * Options for `y-prosemirror`'s `yCursorPlugin`.\n */\n cursor?: YjsCursorPluginOptions\n}\n\n/**\n * @internal\n */\nexport type YjsExtension = Union<[YjsCommandsExtension, PlainExtension]>\n\n/**\n * @public\n */\nexport function defineYjs(options: YjsOptions): YjsExtension {\n const { doc, awareness, sync, undo, cursor } = options\n const fragment = options.fragment ?? doc.getXmlFragment('prosemirror')\n\n return withPriority(\n union([\n defineYjsKeymap(),\n defineYjsCommands(),\n defineYjsCursorPlugin({ ...cursor, awareness }),\n defineYjsUndoPlugin({ ...undo }),\n defineYjsSyncPlugin({ ...sync, fragment }),\n ]),\n Priority.high,\n )\n}\n"],"mappings":";;;;AAGA,MAAM,WAAW;CACf,YAAY;CACZ,YAAY;CACb;AAYD,SAAgB,oBAA0C;AACxD,QAAO,eAAe,SAAS;;;;;ACFjC,SAAgB,sBACd,SACgB;CAChB,MAAM,EAAE,WAAW,GAAG,SAAS;AAC/B,QAAO,aAAa,cAAc,WAAW,KAAK,CAAW;;;;;AClB/D,MAAM,SAAiB;CACrB,SAAS;CACT,SAAS;CACV;AAED,IAAI,CAAC,QACH,QAAO,WAAW;AAGpB,SAAgB,kBAAkC;AAChD,QAAO,aAAa,OAAO;;;;;ACG7B,SAAgB,oBAAoB,SAAyC;CAC3E,MAAM,EAAE,UAAU,GAAG,SAAS;AAC9B,QAAO,aAAa,YAAY,UAAU,KAAK,CAAW;;;;;;;;ACP5D,SAAS,eAAe,qBAAwC;CAC9D,MAAM,yBAAyB,oBAAoB,KAAK;AACxD,qBAAoB,KAAK,QAAQ,SAAqB;EACpD,MAAM,cAAc,eAAe,SAAS,KAAK,MAAM;AACvD,MAAI,CAAC,YACH,QAAO,EAAE;EAGX,MAAM,cAAc,YAAY;AAEhC,MAAI,YAAY,SAAS;AACvB,eAAY,SAAS;AACrB,eAAY,gBAAgB;;EAG9B,MAAM,UAAU,yBACZ,uBAAuB,KAAK,GAC5B;AAEJ,SAAO,EACL,eAAe;GACb,MAAM,iBAAiB,YAAY,eAAe,IAAI,YAAY;GAElE,MAAM,YAAY,YAAY;AAE9B,eAAY,gBAAgB;AAC1B,QAAI,eACF,aAAY,eAAe,IAAI,YAAY;AAG7C,gBAAY,IAAI,GACd,oBACA,YAAY,wBACb;AAED,gBAAY,aAAa;;AAG3B,OAAI,SAAS,QACX,SAAQ,SAAS;KAGtB;;;;;;AAgBL,SAASA,cAAY,SAA0B;CAC7C,MAAM,sBAAsBC,YAAoB,QAAQ;AACxD,gBAAe,oBAAoB;AACnC,QAAO;;;;;AAMT,SAAgB,oBAAoB,SAAyC;AAC3E,QAAO,aAAaD,cAAY,QAAQ,CAAC;;;;;;;;AC5B3C,SAAgB,UAAU,SAAmC;CAC3D,MAAM,EAAE,KAAK,WAAW,MAAM,MAAM,WAAW;CAC/C,MAAM,WAAW,QAAQ,YAAY,IAAI,eAAe,cAAc;AAEtE,QAAO,aACL,MAAM;EACJ,iBAAiB;EACjB,mBAAmB;EACnB,sBAAsB;GAAE,GAAG;GAAQ;GAAW,CAAC;EAC/C,oBAAoB,EAAE,GAAG,MAAM,CAAC;EAChC,oBAAoB;GAAE,GAAG;GAAM;GAAU,CAAC;EAC3C,CAAC,EACF,SAAS,KACV"}
|
package/dist/{shiki-highlighter-chunk-rkzofy4z.d.ts → shiki-highlighter-chunk-DNNm2Vow.d.ts}
RENAMED
|
@@ -16,4 +16,4 @@ type HighlighterResult = {
|
|
|
16
16
|
declare function createOrGetHighlighter(options: HighlighterOptions): HighlighterResult;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { createOrGetHighlighter as i, HighlighterResult as n, ShikiHighlighterOptions as r, HighlighterOptions as t };
|
|
19
|
-
//# sourceMappingURL=shiki-highlighter-chunk-
|
|
19
|
+
//# sourceMappingURL=shiki-highlighter-chunk-DNNm2Vow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shiki-highlighter-chunk-DNNm2Vow.d.ts","names":[],"sources":["../src/code-block/shiki-highlighter-chunk.ts"],"mappings":";;;UASiB,uBAAA,SAAgC,yBAAA,CAA0B,eAAA,EAAiB,YAAA;AAAA,UAE3E,kBAAA,SAA2B,IAAA,CAAK,uBAAA;EAC/C,MAAA,EAAQ,YAAA;EACR,KAAA,GAAQ,eAAA,GAAkB,eAAA;AAAA;AAAA,KAoChB,iBAAA;EAER,WAAA,EAAa,WAAA;EACb,OAAA;AAAA;EAGA,WAAA;EACA,OAAA,EAAS,OAAA;AAAA;AAAA,iBAGG,sBAAA,CACd,OAAA,EAAS,kBAAA,GACR,iBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as createOrGetHighlighter, n as HighlighterResult, r as ShikiHighlighterOptions, t as HighlighterOptions } from "./shiki-highlighter-chunk-
|
|
1
|
+
import { i as createOrGetHighlighter, n as HighlighterResult, r as ShikiHighlighterOptions, t as HighlighterOptions } from "./shiki-highlighter-chunk-DNNm2Vow.js";
|
|
2
2
|
export { HighlighterOptions, HighlighterResult, ShikiHighlighterOptions, createOrGetHighlighter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shiki-highlighter-chunk.js","names":[
|
|
1
|
+
{"version":3,"file":"shiki-highlighter-chunk.js","names":[],"sources":["../src/code-block/shiki-highlighter-chunk.ts"],"sourcesContent":["import type { BundledHighlighterOptions, BundledLanguage, BundledTheme, Highlighter, SpecialLanguage } from 'shiki'\nimport { createHighlighter } from 'shiki/bundle/full'\nimport { createJavaScriptRegexEngine } from 'shiki/engine/javascript'\n\nlet highlighterPromise: Promise<void> | undefined\nlet highlighter: Highlighter | undefined\nconst loadedLangs = new Set<BundledLanguage | SpecialLanguage>()\nconst loadedThemes = new Set<BundledTheme>()\n\nexport interface ShikiHighlighterOptions extends BundledHighlighterOptions<BundledLanguage, BundledTheme> {}\n\nexport interface HighlighterOptions extends Omit<ShikiHighlighterOptions, 'langs' | 'themes'> {\n themes: BundledTheme[]\n langs: (BundledLanguage | SpecialLanguage)[]\n}\n\nfunction ensureHighlighter({\n ...options\n}: HighlighterOptions): Promise<void> {\n if (!highlighterPromise) {\n // If no engine is provided, use the JavaScript engine, which is\n // smaller than the WASM engine.\n if (!options.engine) {\n const engine = createJavaScriptRegexEngine({ forgiving: true })\n options.engine = engine\n }\n highlighterPromise = createHighlighter(options).then((createdHighlighter) => {\n highlighter = createdHighlighter\n })\n }\n return highlighterPromise\n}\n\nasync function loadLanguages(langs: (BundledLanguage | SpecialLanguage)[]) {\n for (const lang of langs) {\n if (!highlighter) break\n await highlighter.loadLanguage(lang)\n loadedLangs.add(lang)\n }\n}\n\nasync function loadThemes(themes: BundledTheme[]) {\n for (const theme of themes) {\n if (!highlighter) break\n await highlighter.loadTheme(theme)\n loadedThemes.add(theme)\n }\n}\n\nexport type HighlighterResult =\n | {\n highlighter: Highlighter\n promise?: undefined\n }\n | {\n highlighter?: undefined\n promise: Promise<void>\n }\n\nexport function createOrGetHighlighter(\n options: HighlighterOptions,\n): HighlighterResult {\n if (!highlighter) {\n return { promise: ensureHighlighter(options) }\n }\n\n const langs = options.langs.filter((lang) => !loadedLangs.has(lang))\n if (langs.length > 0) {\n return { promise: loadLanguages(langs) }\n }\n\n const themes = options.themes.filter((theme) => !loadedThemes.has(theme))\n if (themes.length > 0) {\n return { promise: loadThemes(themes) }\n }\n\n return { highlighter }\n}\n"],"mappings":";;;;AAIA,IAAI;AACJ,IAAI;AACJ,MAAM,8BAAc,IAAI,KAAwC;AAChE,MAAM,+BAAe,IAAI,KAAmB;AAS5C,SAAS,kBAAkB,EACzB,GAAG,WACiC;AACpC,KAAI,CAAC,oBAAoB;AAGvB,MAAI,CAAC,QAAQ,OAEX,SAAQ,SADO,4BAA4B,EAAE,WAAW,MAAM,CAAC;AAGjE,uBAAqB,kBAAkB,QAAQ,CAAC,MAAM,uBAAuB;AAC3E,iBAAc;IACd;;AAEJ,QAAO;;AAGT,eAAe,cAAc,OAA8C;AACzE,MAAK,MAAM,QAAQ,OAAO;AACxB,MAAI,CAAC,YAAa;AAClB,QAAM,YAAY,aAAa,KAAK;AACpC,cAAY,IAAI,KAAK;;;AAIzB,eAAe,WAAW,QAAwB;AAChD,MAAK,MAAM,SAAS,QAAQ;AAC1B,MAAI,CAAC,YAAa;AAClB,QAAM,YAAY,UAAU,MAAM;AAClC,eAAa,IAAI,MAAM;;;AAc3B,SAAgB,uBACd,SACmB;AACnB,KAAI,CAAC,YACH,QAAO,EAAE,SAAS,kBAAkB,QAAQ,EAAE;CAGhD,MAAM,QAAQ,QAAQ,MAAM,QAAQ,SAAS,CAAC,YAAY,IAAI,KAAK,CAAC;AACpE,KAAI,MAAM,SAAS,EACjB,QAAO,EAAE,SAAS,cAAc,MAAM,EAAE;CAG1C,MAAM,SAAS,QAAQ,OAAO,QAAQ,UAAU,CAAC,aAAa,IAAI,MAAM,CAAC;AACzE,KAAI,OAAO,SAAS,EAClB,QAAO,EAAE,SAAS,WAAW,OAAO,EAAE;AAGxC,QAAO,EAAE,aAAa"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as defineDropIndicator } from "./drop-indicator-
|
|
1
|
+
import { t as defineDropIndicator } from "./drop-indicator-B_oMfeVP.js";
|
|
2
2
|
import { defaultBlockAt, defineCommands, defineNodeSpec, definePlugin, getNodeType, insertNode, union } from "@prosekit/core";
|
|
3
3
|
import { TextSelection } from "@prosekit/pm/state";
|
|
4
4
|
import { CellSelection, TableMap, addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, columnResizing, deleteCellSelection, deleteColumn, deleteRow, deleteTable, findCellPos, findCellRange, findTable, mergeCells, moveTableColumn, moveTableRow, splitCell, tableEditing, tableNodes } from "prosemirror-tables";
|
|
@@ -285,4 +285,4 @@ function defineTable() {
|
|
|
285
285
|
|
|
286
286
|
//#endregion
|
|
287
287
|
export { insertTable as _, defineTableSpec as a, defineTableCommands as c, selectTableCell as d, selectTable as f, moveTableColumn as g, moveTableRow as h, defineTableRowSpec as i, selectTableRow as l, isCellSelection as m, defineTableCellSpec as n, defineTablePlugins as o, findTable as p, defineTableHeaderCellSpec as r, defineTableDropIndicator as s, defineTable as t, selectTableColumn as u, exitTable as v };
|
|
288
|
-
//# sourceMappingURL=table-
|
|
288
|
+
//# sourceMappingURL=table-4oHfV-Ql.js.map
|