@prosekit/extensions 0.13.0 → 0.14.1
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-DJq8pF92.js} +11 -10
- package/dist/drop-indicator-DJq8pF92.js.map +1 -0
- package/dist/{file-DrfcSid-.js → file-upload-I9m1EJAM.js} +3 -3
- package/dist/file-upload-I9m1EJAM.js.map +1 -0
- package/dist/{index-oIc1a2f2.d.ts → file-upload-dr3IXUty.d.ts} +1 -1
- package/dist/file-upload-dr3IXUty.d.ts.map +1 -0
- package/dist/{paste-rule-pVb4sqvJ.js → mark-paste-rule-n_2Ehmb5.js} +7 -7
- package/dist/mark-paste-rule-n_2Ehmb5.js.map +1 -0
- package/dist/{mark-rule-BcLB4Uv2.js → mark-rule-CUnXwBuy.js} +6 -6
- package/dist/mark-rule-CUnXwBuy.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 +6 -79
- package/dist/prosekit-extensions-enter-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-enter-rule.js +37 -2
- package/dist/prosekit-extensions-enter-rule.js.map +1 -0
- package/dist/prosekit-extensions-file.d.ts +2 -2
- 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 +10 -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 +89 -2
- package/dist/prosekit-extensions-input-rule.js.map +1 -0
- 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-math.d.ts +154 -0
- package/dist/prosekit-extensions-math.d.ts.map +1 -0
- package/dist/prosekit-extensions-math.js +104 -0
- package/dist/prosekit-extensions-math.js.map +1 -0
- 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.d.ts +19 -2
- package/dist/shiki-highlighter-chunk.d.ts.map +1 -0
- package/dist/shiki-highlighter-chunk.js.map +1 -1
- package/dist/{table-BRDh_9mG.js → table-UJVYsrB7.js} +2 -2
- package/dist/table-UJVYsrB7.js.map +1 -0
- package/package.json +42 -17
- 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 +18 -200
- 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/math/index.ts +22 -0
- package/src/math/math-block.ts +89 -0
- package/src/math/math-inline.ts +89 -0
- package/src/math/math-plugin.ts +8 -0
- package/src/math/math.ts +39 -0
- 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 +10 -12
- package/src/testing/katex.ts +9 -0
- 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 +8 -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 +0 -96
- 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 +0 -90
- 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 +0 -19
- 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
package/src/list/list-keymap.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type PlainExtension,
|
|
4
|
-
} from '@prosekit/core'
|
|
5
|
-
import {
|
|
6
|
-
chainCommands,
|
|
7
|
-
deleteSelection,
|
|
8
|
-
} from '@prosekit/pm/commands'
|
|
1
|
+
import { defineKeymap, type PlainExtension } from '@prosekit/core'
|
|
2
|
+
import { chainCommands, deleteSelection } from '@prosekit/pm/commands'
|
|
9
3
|
import {
|
|
10
4
|
createDedentListCommand,
|
|
11
5
|
createIndentListCommand,
|
package/src/list/list-plugins.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { isElementLike } from '@ocavue/utils'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type PlainExtension,
|
|
5
|
-
} from '@prosekit/core'
|
|
6
|
-
import {
|
|
7
|
-
findCheckboxInListItem,
|
|
8
|
-
joinListElements,
|
|
9
|
-
listToDOM,
|
|
10
|
-
} from 'prosemirror-flat-list'
|
|
2
|
+
import { defineClipboardSerializer, type PlainExtension } from '@prosekit/core'
|
|
3
|
+
import { findCheckboxInListItem, joinListElements, listToDOM } from 'prosemirror-flat-list'
|
|
11
4
|
|
|
12
5
|
/**
|
|
13
6
|
* @internal
|
package/src/list/list-spec.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from '@prosekit/core'
|
|
5
|
-
import type {
|
|
6
|
-
DOMOutputSpec,
|
|
7
|
-
ProseMirrorNode,
|
|
8
|
-
} from '@prosekit/pm/model'
|
|
9
|
-
import {
|
|
10
|
-
createListSpec,
|
|
11
|
-
listToDOM,
|
|
12
|
-
type ListAttributes,
|
|
13
|
-
} from 'prosemirror-flat-list'
|
|
1
|
+
import { defineNodeSpec, type Extension } from '@prosekit/core'
|
|
2
|
+
import type { DOMOutputSpec, ProseMirrorNode } from '@prosekit/pm/model'
|
|
3
|
+
import { createListSpec, listToDOM, type ListAttributes } from 'prosemirror-flat-list'
|
|
14
4
|
|
|
15
5
|
import type { ListAttrs } from './list-types'
|
|
16
6
|
|
package/src/list/list.spec.ts
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createEditor,
|
|
3
|
-
nodeFromHTML,
|
|
4
|
-
union,
|
|
5
|
-
} from '@prosekit/core'
|
|
1
|
+
import { createEditor, nodeFromHTML, union } from '@prosekit/core'
|
|
6
2
|
import type { ProseMirrorNode } from '@prosekit/pm/model'
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
expect,
|
|
10
|
-
it,
|
|
11
|
-
} from 'vitest'
|
|
3
|
+
import { formatHTML } from 'diffable-html-snapshot'
|
|
4
|
+
import { describe, expect, it } from 'vitest'
|
|
12
5
|
|
|
13
6
|
import { defineDoc } from '../doc'
|
|
14
7
|
import { defineParagraph } from '../paragraph'
|
|
15
8
|
import { setupTest } from '../testing'
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
htmlFromMarkdown,
|
|
19
|
-
markdownFromHTML,
|
|
20
|
-
} from '../testing/markdown'
|
|
9
|
+
import { htmlFromMarkdown, markdownFromHTML } from '../testing/markdown'
|
|
21
10
|
import { defineText } from '../text'
|
|
22
11
|
|
|
23
12
|
import { defineList } from './index'
|
|
@@ -118,13 +107,13 @@ describe('defineList', () => {
|
|
|
118
107
|
<ul data-pm-slice="0 0 []">
|
|
119
108
|
<li
|
|
120
109
|
class="prosemirror-flat-list"
|
|
121
|
-
data-list-kind="task"
|
|
122
110
|
data-list-checked
|
|
111
|
+
data-list-kind="task"
|
|
123
112
|
>
|
|
124
113
|
<p>
|
|
125
114
|
<input
|
|
126
|
-
type="checkbox"
|
|
127
115
|
checked
|
|
116
|
+
type="checkbox"
|
|
128
117
|
>
|
|
129
118
|
Checked 1
|
|
130
119
|
</p>
|
|
@@ -182,13 +171,13 @@ describe('defineList', () => {
|
|
|
182
171
|
<ul>
|
|
183
172
|
<li
|
|
184
173
|
class="prosemirror-flat-list"
|
|
185
|
-
data-list-kind="task"
|
|
186
174
|
data-list-checked
|
|
175
|
+
data-list-kind="task"
|
|
187
176
|
>
|
|
188
177
|
<p>
|
|
189
178
|
<input
|
|
190
|
-
type="checkbox"
|
|
191
179
|
checked
|
|
180
|
+
type="checkbox"
|
|
192
181
|
>
|
|
193
182
|
Checked
|
|
194
183
|
</p>
|
|
@@ -237,9 +226,9 @@ describe('defineList', () => {
|
|
|
237
226
|
<li class="task-list-item">
|
|
238
227
|
<p>
|
|
239
228
|
<input
|
|
240
|
-
type="checkbox"
|
|
241
229
|
checked
|
|
242
230
|
disabled
|
|
231
|
+
type="checkbox"
|
|
243
232
|
>
|
|
244
233
|
Checked
|
|
245
234
|
</p>
|
|
@@ -247,8 +236,8 @@ describe('defineList', () => {
|
|
|
247
236
|
<li class="task-list-item">
|
|
248
237
|
<p>
|
|
249
238
|
<input
|
|
250
|
-
type="checkbox"
|
|
251
239
|
disabled
|
|
240
|
+
type="checkbox"
|
|
252
241
|
>
|
|
253
242
|
Unchecked
|
|
254
243
|
</p>
|
package/src/list/list.ts
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
union,
|
|
3
|
-
type Union,
|
|
4
|
-
} from '@prosekit/core'
|
|
1
|
+
import { union, type Union } from '@prosekit/core'
|
|
5
2
|
|
|
6
|
-
import {
|
|
7
|
-
defineListCommands,
|
|
8
|
-
type ListCommandsExtension,
|
|
9
|
-
} from './list-commands'
|
|
3
|
+
import { defineListCommands, type ListCommandsExtension } from './list-commands'
|
|
10
4
|
import { defineListDropIndicator } from './list-drop-indicator'
|
|
11
5
|
import { defineListInputRules } from './list-input-rules'
|
|
12
6
|
import { defineListKeymap } from './list-keymap'
|
|
13
7
|
import { defineListPlugins } from './list-plugins'
|
|
14
8
|
import { defineListSerializer } from './list-serializer'
|
|
15
|
-
import {
|
|
16
|
-
defineListSpec,
|
|
17
|
-
type ListSpecExtension,
|
|
18
|
-
} from './list-spec'
|
|
9
|
+
import { defineListSpec, type ListSpecExtension } from './list-spec'
|
|
19
10
|
|
|
20
11
|
/**
|
|
21
12
|
* @internal
|
package/src/loro/index.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
|
|
3
|
-
LoroUndoPluginProps,
|
|
4
|
-
} from 'loro-prosemirror'
|
|
5
|
-
export {
|
|
6
|
-
defineLoro,
|
|
7
|
-
type LoroExtension,
|
|
8
|
-
type LoroOptions,
|
|
9
|
-
} from './loro'
|
|
1
|
+
export type { LoroSyncPluginProps, LoroUndoPluginProps } from 'loro-prosemirror'
|
|
2
|
+
export { defineLoro, type LoroExtension, type LoroOptions } from './loro'
|
|
10
3
|
export { defineLoroCommands } from './loro-commands'
|
|
11
|
-
export {
|
|
12
|
-
defineLoroCursorPlugin,
|
|
13
|
-
type LoroCursorOptions,
|
|
14
|
-
} from './loro-cursor-plugin'
|
|
4
|
+
export { defineLoroCursorPlugin, type LoroCursorOptions } from './loro-cursor-plugin'
|
|
15
5
|
export { defineLoroKeymap } from './loro-keymap'
|
|
16
6
|
export { defineLoroSyncPlugin } from './loro-sync-plugin'
|
|
17
7
|
export { defineLoroUndoPlugin } from './loro-undo-plugin'
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type Extension,
|
|
4
|
-
} from '@prosekit/core'
|
|
5
|
-
import {
|
|
6
|
-
redo,
|
|
7
|
-
undo,
|
|
8
|
-
} from 'loro-prosemirror'
|
|
1
|
+
import { defineCommands, type Extension } from '@prosekit/core'
|
|
2
|
+
import { redo, undo } from 'loro-prosemirror'
|
|
9
3
|
|
|
10
4
|
const commands = {
|
|
11
5
|
undo: () => undo,
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
definePlugin,
|
|
3
|
-
type PlainExtension,
|
|
4
|
-
} from '@prosekit/core'
|
|
1
|
+
import { definePlugin, type PlainExtension } from '@prosekit/core'
|
|
5
2
|
import type { Plugin } from '@prosekit/pm/state'
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
CursorEphemeralStore,
|
|
9
|
-
CursorPluginOptions,
|
|
10
|
-
} from 'loro-prosemirror'
|
|
11
|
-
import {
|
|
12
|
-
LoroCursorPlugin,
|
|
13
|
-
LoroEphemeralCursorPlugin,
|
|
14
|
-
} from 'loro-prosemirror'
|
|
3
|
+
import type { CursorAwareness, CursorEphemeralStore, CursorPluginOptions } from 'loro-prosemirror'
|
|
4
|
+
import { LoroCursorPlugin, LoroEphemeralCursorPlugin } from 'loro-prosemirror'
|
|
15
5
|
|
|
16
6
|
export interface LoroCursorOptions extends CursorPluginOptions {
|
|
17
7
|
awareness?: CursorAwareness
|
package/src/loro/loro-keymap.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
isApple,
|
|
4
|
-
type Keymap,
|
|
5
|
-
type PlainExtension,
|
|
6
|
-
} from '@prosekit/core'
|
|
7
|
-
import {
|
|
8
|
-
redo,
|
|
9
|
-
undo,
|
|
10
|
-
} from 'loro-prosemirror'
|
|
1
|
+
import { defineKeymap, isApple, type Keymap, type PlainExtension } from '@prosekit/core'
|
|
2
|
+
import { redo, undo } from 'loro-prosemirror'
|
|
11
3
|
|
|
12
4
|
const keymap: Keymap = {
|
|
13
5
|
'Mod-z': undo,
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type PlainExtension,
|
|
4
|
-
} from '@prosekit/core'
|
|
5
|
-
import {
|
|
6
|
-
LoroSyncPlugin,
|
|
7
|
-
type LoroSyncPluginProps,
|
|
8
|
-
} from 'loro-prosemirror'
|
|
1
|
+
import { definePlugin, type PlainExtension } from '@prosekit/core'
|
|
2
|
+
import { LoroSyncPlugin, type LoroSyncPluginProps } from 'loro-prosemirror'
|
|
9
3
|
|
|
10
4
|
export function defineLoroSyncPlugin(
|
|
11
5
|
options: LoroSyncPluginProps,
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type PlainExtension,
|
|
4
|
-
} from '@prosekit/core'
|
|
5
|
-
import {
|
|
6
|
-
LoroUndoPlugin,
|
|
7
|
-
type LoroUndoPluginProps,
|
|
8
|
-
} from 'loro-prosemirror'
|
|
1
|
+
import { definePlugin, type PlainExtension } from '@prosekit/core'
|
|
2
|
+
import { LoroUndoPlugin, type LoroUndoPluginProps } from 'loro-prosemirror'
|
|
9
3
|
|
|
10
4
|
export function defineLoroUndoPlugin(options: LoroUndoPluginProps): PlainExtension {
|
|
11
5
|
return definePlugin(LoroUndoPlugin(options))
|
package/src/loro/loro.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Priority,
|
|
3
|
-
union,
|
|
4
|
-
withPriority,
|
|
5
|
-
type PlainExtension,
|
|
6
|
-
type Union,
|
|
7
|
-
} from '@prosekit/core'
|
|
1
|
+
import { Priority, union, withPriority, type PlainExtension, type Union } from '@prosekit/core'
|
|
8
2
|
import type {
|
|
9
3
|
CursorAwareness,
|
|
10
4
|
CursorEphemeralStore,
|
|
@@ -14,10 +8,7 @@ import type {
|
|
|
14
8
|
LoroUndoPluginProps,
|
|
15
9
|
} from 'loro-prosemirror'
|
|
16
10
|
|
|
17
|
-
import {
|
|
18
|
-
defineLoroCommands,
|
|
19
|
-
type LoroCommandsExtension,
|
|
20
|
-
} from './loro-commands'
|
|
11
|
+
import { defineLoroCommands, type LoroCommandsExtension } from './loro-commands'
|
|
21
12
|
import { defineLoroCursorPlugin } from './loro-cursor-plugin'
|
|
22
13
|
import { defineLoroKeymap } from './loro-keymap'
|
|
23
14
|
import { defineLoroSyncPlugin } from './loro-sync-plugin'
|
package/src/mark-rule/apply.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
OBJECT_REPLACEMENT_CHARACTER,
|
|
5
|
-
} from '@prosekit/core'
|
|
6
|
-
import type {
|
|
7
|
-
Mark,
|
|
8
|
-
ProseMirrorNode,
|
|
9
|
-
} from '@prosekit/pm/model'
|
|
10
|
-
import type {
|
|
11
|
-
EditorState,
|
|
12
|
-
Transaction,
|
|
13
|
-
} from '@prosekit/pm/state'
|
|
1
|
+
import { getMarkType, maybeRun, OBJECT_REPLACEMENT_CHARACTER } from '@prosekit/core'
|
|
2
|
+
import type { Mark, ProseMirrorNode } from '@prosekit/pm/model'
|
|
3
|
+
import type { EditorState, Transaction } from '@prosekit/pm/state'
|
|
14
4
|
|
|
15
5
|
import { getCheckRanges } from './range'
|
|
16
6
|
import type { MarkRuleOptions } from './types'
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createEditor,
|
|
3
|
-
defineBaseCommands,
|
|
4
|
-
defineMarkSpec,
|
|
5
|
-
elementFromNode,
|
|
6
|
-
union,
|
|
7
|
-
type Editor,
|
|
8
|
-
} from '@prosekit/core'
|
|
1
|
+
import { createEditor, defineBaseCommands, defineMarkSpec, elementFromNode, union, type Editor } from '@prosekit/core'
|
|
9
2
|
import type { ProseMirrorNode } from '@prosekit/pm/model'
|
|
10
|
-
import {
|
|
11
|
-
describe,
|
|
12
|
-
expect,
|
|
13
|
-
it,
|
|
14
|
-
} from 'vitest'
|
|
3
|
+
import { describe, expect, it } from 'vitest'
|
|
15
4
|
|
|
16
5
|
import { defineDoc } from '../doc'
|
|
17
6
|
import { defineParagraph } from '../paragraph'
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
defineFacetPayload,
|
|
4
|
-
pluginFacet,
|
|
5
|
-
type PlainExtension,
|
|
6
|
-
type PluginPayload,
|
|
7
|
-
} from '@prosekit/core'
|
|
8
|
-
import {
|
|
9
|
-
PluginKey,
|
|
10
|
-
ProseMirrorPlugin,
|
|
11
|
-
type EditorState,
|
|
12
|
-
type Transaction,
|
|
13
|
-
} from '@prosekit/pm/state'
|
|
1
|
+
import { defineFacet, defineFacetPayload, pluginFacet, type PlainExtension, type PluginPayload } from '@prosekit/core'
|
|
2
|
+
import { PluginKey, ProseMirrorPlugin, type EditorState, type Transaction } from '@prosekit/pm/state'
|
|
14
3
|
|
|
15
4
|
import { applyMarkRules } from './apply'
|
|
16
5
|
import type { MarkRuleOptions } from './types'
|
package/src/mark-rule/range.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
ResolvedPos,
|
|
4
|
-
} from '@prosekit/pm/model'
|
|
5
|
-
import type {
|
|
6
|
-
EditorState,
|
|
7
|
-
Transaction,
|
|
8
|
-
} from '@prosekit/pm/state'
|
|
1
|
+
import type { ProseMirrorNode, ResolvedPos } from '@prosekit/pm/model'
|
|
2
|
+
import type { EditorState, Transaction } from '@prosekit/pm/state'
|
|
9
3
|
import type { ProsemirrorNode } from 'prosemirror-flat-list'
|
|
10
4
|
|
|
11
5
|
function getSpanTextRanges($from: ResolvedPos, $to: ResolvedPos) {
|
package/src/mark-rule/types.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { defineMath, type MathExtension, type MathOptions } from './math'
|
|
2
|
+
export {
|
|
3
|
+
defineMathBlock,
|
|
4
|
+
defineMathBlockEnterRule,
|
|
5
|
+
defineMathBlockSpec,
|
|
6
|
+
defineMathBlockView,
|
|
7
|
+
type MathBlockExtension,
|
|
8
|
+
type MathBlockOptions,
|
|
9
|
+
type MathBlockSpecExtension,
|
|
10
|
+
type MathBlockViewOptions,
|
|
11
|
+
} from './math-block'
|
|
12
|
+
export {
|
|
13
|
+
defineMathInline,
|
|
14
|
+
defineMathInlineInputRule,
|
|
15
|
+
defineMathInlineSpec,
|
|
16
|
+
defineMathInlineView,
|
|
17
|
+
type MathInlineExtension,
|
|
18
|
+
type MathInlineOptions,
|
|
19
|
+
type MathInlineSpecExtension,
|
|
20
|
+
type MathInlineViewOptions,
|
|
21
|
+
} from './math-inline'
|
|
22
|
+
export { defineMathPlugin } from './math-plugin'
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { defineNodeSpec, defineNodeView, union, type Extension, type PlainExtension, type Union } from '@prosekit/core'
|
|
2
|
+
import type { Attrs } from '@prosekit/pm/model'
|
|
3
|
+
import { createMathBlockView, mathBlockEnterRule, mathBlockSpec, type RenderMathBlock } from 'prosemirror-math'
|
|
4
|
+
|
|
5
|
+
import { defineEnterRule } from '../enter-rule'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export type MathBlockSpecExtension = Extension<{
|
|
11
|
+
Nodes: {
|
|
12
|
+
mathBlock: Attrs
|
|
13
|
+
}
|
|
14
|
+
}>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export function defineMathBlockSpec(): MathBlockSpecExtension {
|
|
20
|
+
return defineNodeSpec<'mathBlock', Attrs>({
|
|
21
|
+
...mathBlockSpec,
|
|
22
|
+
name: 'mathBlock',
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Options for {@link defineMathBlockView}.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export interface MathBlockViewOptions {
|
|
32
|
+
/**
|
|
33
|
+
* The function to render the math block.
|
|
34
|
+
*/
|
|
35
|
+
render: RenderMathBlock
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Defines an extension that renders a math block using a custom node view.
|
|
40
|
+
*
|
|
41
|
+
* @param options
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export function defineMathBlockView({ render }: MathBlockViewOptions): Extension {
|
|
45
|
+
return defineNodeView({
|
|
46
|
+
name: 'mathBlock',
|
|
47
|
+
constructor: (node, view, getPos, decorations) => {
|
|
48
|
+
return createMathBlockView(render, node, decorations)
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export function defineMathBlockEnterRule(): PlainExtension {
|
|
57
|
+
return defineEnterRule(mathBlockEnterRule)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Options for {@link defineMathBlock}.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export interface MathBlockOptions {
|
|
66
|
+
/**
|
|
67
|
+
* The function to render the math block.
|
|
68
|
+
*/
|
|
69
|
+
render: RenderMathBlock
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export type MathBlockExtension = Union<[MathBlockSpecExtension]>
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Defines node `mathBlock` and related functionalities.
|
|
79
|
+
*
|
|
80
|
+
* @param options
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
export function defineMathBlock(options: MathBlockOptions): MathBlockExtension {
|
|
84
|
+
return union(
|
|
85
|
+
defineMathBlockSpec(),
|
|
86
|
+
defineMathBlockView(options),
|
|
87
|
+
defineMathBlockEnterRule(),
|
|
88
|
+
)
|
|
89
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { defineNodeSpec, defineNodeView, union, type Extension, type PlainExtension, type Union } from '@prosekit/core'
|
|
2
|
+
import type { Attrs } from '@prosekit/pm/model'
|
|
3
|
+
import { createMathInlineInputRule, createMathInlineView, mathInlineSpec, type RenderMathInline } from 'prosemirror-math'
|
|
4
|
+
|
|
5
|
+
import { defineInputRule } from '../input-rule'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export type MathInlineSpecExtension = Extension<{
|
|
11
|
+
Nodes: {
|
|
12
|
+
mathInline: Attrs
|
|
13
|
+
}
|
|
14
|
+
}>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export function defineMathInlineSpec(): MathInlineSpecExtension {
|
|
20
|
+
return defineNodeSpec<'mathInline', Attrs>({
|
|
21
|
+
...mathInlineSpec,
|
|
22
|
+
name: 'mathInline',
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Options for {@link defineMathInlineView}.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export interface MathInlineViewOptions {
|
|
32
|
+
/**
|
|
33
|
+
* The function to render the math inline.
|
|
34
|
+
*/
|
|
35
|
+
render: RenderMathInline
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Defines an extension that renders a math inline using a custom node view.
|
|
40
|
+
*
|
|
41
|
+
* @param options
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export function defineMathInlineView({ render }: MathInlineViewOptions): Extension {
|
|
45
|
+
return defineNodeView({
|
|
46
|
+
name: 'mathInline',
|
|
47
|
+
constructor: (node, view, getPos, decorations) => {
|
|
48
|
+
return createMathInlineView(render, node, decorations)
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export function defineMathInlineInputRule(): PlainExtension {
|
|
57
|
+
return defineInputRule(createMathInlineInputRule('mathInline'))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Options for {@link defineMathInline}.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export interface MathInlineOptions {
|
|
66
|
+
/**
|
|
67
|
+
* The function to render the math inline.
|
|
68
|
+
*/
|
|
69
|
+
render: RenderMathInline
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export type MathInlineExtension = Union<[MathInlineSpecExtension]>
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Defines node `mathInline` and related functionalities.
|
|
79
|
+
*
|
|
80
|
+
* @param options
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
export function defineMathInline(options: MathInlineOptions): MathInlineExtension {
|
|
84
|
+
return union(
|
|
85
|
+
defineMathInlineSpec(),
|
|
86
|
+
defineMathInlineView(options),
|
|
87
|
+
defineMathInlineInputRule(),
|
|
88
|
+
)
|
|
89
|
+
}
|
package/src/math/math.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { union, type Union } from '@prosekit/core'
|
|
2
|
+
import type { RenderMathBlock, RenderMathInline } from 'prosemirror-math'
|
|
3
|
+
|
|
4
|
+
import { defineMathBlock, type MathBlockExtension } from './math-block'
|
|
5
|
+
import { defineMathInline, type MathInlineExtension } from './math-inline'
|
|
6
|
+
import { defineMathPlugin } from './math-plugin'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export type MathExtension = Union<[MathInlineExtension, MathBlockExtension]>
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Options for {@link defineMath}.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export interface MathOptions {
|
|
19
|
+
/**
|
|
20
|
+
* The function to render the math block.
|
|
21
|
+
*/
|
|
22
|
+
renderMathBlock: RenderMathBlock
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The function to render the math inline.
|
|
26
|
+
*/
|
|
27
|
+
renderMathInline: RenderMathInline
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export function defineMath(options: MathOptions): MathExtension {
|
|
34
|
+
return union(
|
|
35
|
+
defineMathBlock({ render: options.renderMathBlock }),
|
|
36
|
+
defineMathInline({ render: options.renderMathInline }),
|
|
37
|
+
defineMathPlugin(),
|
|
38
|
+
)
|
|
39
|
+
}
|
package/src/mention/index.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineCommands,
|
|
3
|
-
defineNodeSpec,
|
|
4
|
-
insertNode,
|
|
5
|
-
union,
|
|
6
|
-
type Extension,
|
|
7
|
-
type Union,
|
|
8
|
-
} from '@prosekit/core'
|
|
1
|
+
import { defineCommands, defineNodeSpec, insertNode, union, type Extension, type Union } from '@prosekit/core'
|
|
9
2
|
|
|
10
3
|
export interface MentionAttrs {
|
|
11
4
|
id: string
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
isApple,
|
|
4
|
-
type PlainExtension,
|
|
5
|
-
} from '@prosekit/core'
|
|
6
|
-
import {
|
|
7
|
-
Plugin,
|
|
8
|
-
PluginKey,
|
|
9
|
-
} from '@prosekit/pm/state'
|
|
1
|
+
import { definePlugin, isApple, type PlainExtension } from '@prosekit/core'
|
|
2
|
+
import { Plugin, PluginKey } from '@prosekit/pm/state'
|
|
10
3
|
import type { EditorView } from '@prosekit/pm/view'
|
|
11
4
|
|
|
12
5
|
/**
|