@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
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Priority,
|
|
3
|
-
union,
|
|
4
|
-
withPriority,
|
|
5
|
-
type Union,
|
|
6
|
-
} from '@prosekit/core'
|
|
1
|
+
import { Priority, union, withPriority, type Union } from '@prosekit/core'
|
|
7
2
|
|
|
8
|
-
import {
|
|
9
|
-
defineParagraphCommands,
|
|
10
|
-
type ParagraphCommandsExtension,
|
|
11
|
-
} from './paragraph-commands'
|
|
3
|
+
import { defineParagraphCommands, type ParagraphCommandsExtension } from './paragraph-commands'
|
|
12
4
|
import { defineParagraphKeymap } from './paragraph-keymap'
|
|
13
|
-
import {
|
|
14
|
-
defineParagraphSpec,
|
|
15
|
-
type ParagraphSpecExtension,
|
|
16
|
-
} from './paragraph-spec'
|
|
5
|
+
import { defineParagraphSpec, type ParagraphSpecExtension } from './paragraph-spec'
|
|
17
6
|
|
|
18
7
|
/**
|
|
19
8
|
* @internal
|
package/src/paste-rule/index.ts
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
type MarkPasteRuleOptions,
|
|
4
|
-
} from './mark-paste-rule'
|
|
5
|
-
export {
|
|
6
|
-
definePasteRule,
|
|
7
|
-
type PasteRuleHandler,
|
|
8
|
-
type PasteRuleHandlerOptions,
|
|
9
|
-
type PasteRuleOptions,
|
|
10
|
-
} from './paste-rule'
|
|
1
|
+
export { defineMarkPasteRule, type MarkPasteRuleOptions } from './mark-paste-rule'
|
|
2
|
+
export { definePasteRule, type PasteRuleHandler, type PasteRuleHandlerOptions, type PasteRuleOptions } from './paste-rule'
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
union,
|
|
4
|
-
} from '@prosekit/core'
|
|
5
|
-
import {
|
|
6
|
-
describe,
|
|
7
|
-
expect,
|
|
8
|
-
it,
|
|
9
|
-
} from 'vitest'
|
|
1
|
+
import { defineMarkSpec, union } from '@prosekit/core'
|
|
2
|
+
import { describe, expect, it } from 'vitest'
|
|
10
3
|
|
|
11
4
|
import { defineBold } from '../bold'
|
|
12
5
|
import { defineDoc } from '../doc'
|
|
13
6
|
import { defineParagraph } from '../paragraph'
|
|
14
7
|
import { setupTestFromExtension } from '../testing'
|
|
15
|
-
import {
|
|
16
|
-
pasteHTML,
|
|
17
|
-
pasteText,
|
|
18
|
-
} from '../testing/clipboard'
|
|
8
|
+
import { pasteHTML, pasteText } from '../testing/clipboard'
|
|
19
9
|
import { defineText } from '../text'
|
|
20
10
|
|
|
21
11
|
import type { MarkPasteRuleOptions } from './mark-paste-rule'
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from '@prosekit/core'
|
|
5
|
-
import type {
|
|
6
|
-
Attrs,
|
|
7
|
-
MarkType,
|
|
8
|
-
ProseMirrorNode,
|
|
9
|
-
} from '@prosekit/pm/model'
|
|
10
|
-
import {
|
|
11
|
-
Fragment,
|
|
12
|
-
Slice,
|
|
13
|
-
} from '@prosekit/pm/model'
|
|
1
|
+
import { getMarkType, type PlainExtension } from '@prosekit/core'
|
|
2
|
+
import type { Attrs, MarkType, ProseMirrorNode } from '@prosekit/pm/model'
|
|
3
|
+
import { Fragment, Slice } from '@prosekit/pm/model'
|
|
14
4
|
|
|
15
5
|
import { definePasteRule } from './paste-rule'
|
|
16
6
|
import { splitTextByRegex } from './split-text-by-regex'
|
|
@@ -88,7 +78,7 @@ function replaceMarkInSlice(options: MarkPasteRuleHandlerOptions, slice: Slice):
|
|
|
88
78
|
|
|
89
79
|
function replaceMarkInFragment(options: MarkPasteRuleHandlerOptions, fragment: Fragment): Fragment | undefined {
|
|
90
80
|
let changed = false
|
|
91
|
-
|
|
81
|
+
const children: ProseMirrorNode[] = []
|
|
92
82
|
|
|
93
83
|
for (const child of fragment.content) {
|
|
94
84
|
const newChild = replaceMarkInNode(options, child)
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineFacet,
|
|
3
|
-
defineFacetPayload,
|
|
4
|
-
pluginFacet,
|
|
5
|
-
type PlainExtension,
|
|
6
|
-
type PluginPayload,
|
|
7
|
-
} from '@prosekit/core'
|
|
1
|
+
import { defineFacet, defineFacetPayload, pluginFacet, type PlainExtension, type PluginPayload } from '@prosekit/core'
|
|
8
2
|
import type { Slice } from '@prosekit/pm/model'
|
|
9
|
-
import {
|
|
10
|
-
PluginKey,
|
|
11
|
-
ProseMirrorPlugin,
|
|
12
|
-
} from '@prosekit/pm/state'
|
|
3
|
+
import { PluginKey, ProseMirrorPlugin } from '@prosekit/pm/state'
|
|
13
4
|
import type { EditorView } from '@prosekit/pm/view'
|
|
14
5
|
|
|
15
6
|
type PasteRulePayload = (options: { slice: Slice; view: EditorView; plain: boolean }) => Slice
|
|
@@ -1,24 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Priority,
|
|
3
|
-
union,
|
|
4
|
-
withPriority,
|
|
5
|
-
type PlainExtension,
|
|
6
|
-
} from '@prosekit/core'
|
|
1
|
+
import { Priority, union, withPriority, type PlainExtension } from '@prosekit/core'
|
|
7
2
|
import type { ProseMirrorNode } from '@prosekit/pm/model'
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
Slice,
|
|
11
|
-
} from '@prosekit/pm/model'
|
|
12
|
-
import {
|
|
13
|
-
describe,
|
|
14
|
-
expect,
|
|
15
|
-
it,
|
|
16
|
-
} from 'vitest'
|
|
3
|
+
import { Fragment, Slice } from '@prosekit/pm/model'
|
|
4
|
+
import { describe, expect, it } from 'vitest'
|
|
17
5
|
|
|
18
|
-
import {
|
|
19
|
-
defineTestExtension,
|
|
20
|
-
setupTestFromExtension,
|
|
21
|
-
} from '../testing'
|
|
6
|
+
import { defineTestExtension, setupTestFromExtension } from '../testing'
|
|
22
7
|
|
|
23
8
|
import { definePasteRule } from './paste-rule'
|
|
24
9
|
|
package/src/placeholder/index.ts
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
definePlugin,
|
|
3
|
-
isInCodeBlock,
|
|
4
|
-
isTextSelection,
|
|
5
|
-
maybeRun,
|
|
6
|
-
type PlainExtension,
|
|
7
|
-
} from '@prosekit/core'
|
|
1
|
+
import { definePlugin, isInCodeBlock, isTextSelection, maybeRun, type PlainExtension } from '@prosekit/core'
|
|
8
2
|
import type { ProseMirrorNode } from '@prosekit/pm/model'
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
PluginKey,
|
|
12
|
-
type EditorState,
|
|
13
|
-
} from '@prosekit/pm/state'
|
|
14
|
-
import {
|
|
15
|
-
Decoration,
|
|
16
|
-
DecorationSet,
|
|
17
|
-
} from '@prosekit/pm/view'
|
|
3
|
+
import { Plugin, PluginKey, type EditorState } from '@prosekit/pm/state'
|
|
4
|
+
import { Decoration, DecorationSet } from '@prosekit/pm/view'
|
|
18
5
|
|
|
19
6
|
import { findTable } from '../table'
|
|
20
7
|
|
package/src/readonly/index.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type PlainExtension,
|
|
4
|
-
} from '@prosekit/core'
|
|
5
|
-
import {
|
|
6
|
-
PluginKey,
|
|
7
|
-
ProseMirrorPlugin,
|
|
8
|
-
} from '@prosekit/pm/state'
|
|
1
|
+
import { definePlugin, type PlainExtension } from '@prosekit/core'
|
|
2
|
+
import { PluginKey, ProseMirrorPlugin } from '@prosekit/pm/state'
|
|
9
3
|
|
|
10
4
|
/**
|
|
11
5
|
* Make the editor read-only.
|
package/src/search/index.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineCommands,
|
|
3
|
-
definePlugin,
|
|
4
|
-
type Extension,
|
|
5
|
-
type PlainExtension,
|
|
6
|
-
} from '@prosekit/core'
|
|
1
|
+
import { defineCommands, definePlugin, type Extension, type PlainExtension } from '@prosekit/core'
|
|
7
2
|
import type { Command } from '@prosekit/pm/state'
|
|
8
3
|
import type { EditorView } from '@prosekit/pm/view'
|
|
9
4
|
import {
|
package/src/table/index.ts
CHANGED
|
@@ -1,40 +1,13 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
type TableExtension,
|
|
4
|
-
} from './table'
|
|
5
|
-
export {
|
|
6
|
-
defineTableCommands,
|
|
7
|
-
type TableCommandsExtension,
|
|
8
|
-
} from './table-commands'
|
|
1
|
+
export { defineTable, type TableExtension } from './table'
|
|
2
|
+
export { defineTableCommands, type TableCommandsExtension } from './table-commands'
|
|
9
3
|
export { exitTable } from './table-commands/exit-table'
|
|
10
|
-
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from './table-commands/
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from './table-commands/move-table-column'
|
|
18
|
-
export {
|
|
19
|
-
moveTableRow,
|
|
20
|
-
type MoveTableRowOptions,
|
|
21
|
-
} from './table-commands/move-table-row'
|
|
22
|
-
export {
|
|
23
|
-
selectTable,
|
|
24
|
-
type SelectTableOptions,
|
|
25
|
-
} from './table-commands/select-table'
|
|
26
|
-
export {
|
|
27
|
-
selectTableCell,
|
|
28
|
-
type SelectTableCellOptions,
|
|
29
|
-
} from './table-commands/select-table-cell'
|
|
30
|
-
export {
|
|
31
|
-
selectTableColumn,
|
|
32
|
-
type SelectTableColumnOptions,
|
|
33
|
-
} from './table-commands/select-table-column'
|
|
34
|
-
export {
|
|
35
|
-
selectTableRow,
|
|
36
|
-
type SelectTableRowOptions,
|
|
37
|
-
} from './table-commands/select-table-row'
|
|
4
|
+
export { insertTable, type InsertTableOptions } from './table-commands/insert-table'
|
|
5
|
+
export { moveTableColumn, type MoveTableColumnOptions } from './table-commands/move-table-column'
|
|
6
|
+
export { moveTableRow, type MoveTableRowOptions } from './table-commands/move-table-row'
|
|
7
|
+
export { selectTable, type SelectTableOptions } from './table-commands/select-table'
|
|
8
|
+
export { selectTableCell, type SelectTableCellOptions } from './table-commands/select-table-cell'
|
|
9
|
+
export { selectTableColumn, type SelectTableColumnOptions } from './table-commands/select-table-column'
|
|
10
|
+
export { selectTableRow, type SelectTableRowOptions } from './table-commands/select-table-row'
|
|
38
11
|
export { defineTableDropIndicator } from './table-drop-indicator'
|
|
39
12
|
export { defineTablePlugins } from './table-plugins'
|
|
40
13
|
export {
|
|
@@ -47,7 +20,4 @@ export {
|
|
|
47
20
|
type TableRowSpecExtension,
|
|
48
21
|
type TableSpecExtension,
|
|
49
22
|
} from './table-spec'
|
|
50
|
-
export {
|
|
51
|
-
findTable,
|
|
52
|
-
isCellSelection,
|
|
53
|
-
} from './table-utils'
|
|
23
|
+
export { findTable, isCellSelection } from './table-utils'
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineCommands,
|
|
3
|
-
type Extension,
|
|
4
|
-
} from '@prosekit/core'
|
|
1
|
+
import { defineCommands, type Extension } from '@prosekit/core'
|
|
5
2
|
import {
|
|
6
3
|
addColumnAfter,
|
|
7
4
|
addColumnBefore,
|
|
@@ -16,34 +13,13 @@ import {
|
|
|
16
13
|
|
|
17
14
|
import { deleteCellSelection } from './table-commands/delete-cell-selection'
|
|
18
15
|
import { exitTable } from './table-commands/exit-table'
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from './table-commands/
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} from './table-commands/move-table-column'
|
|
27
|
-
import {
|
|
28
|
-
moveTableRow,
|
|
29
|
-
type MoveTableRowOptions,
|
|
30
|
-
} from './table-commands/move-table-row'
|
|
31
|
-
import {
|
|
32
|
-
selectTable,
|
|
33
|
-
type SelectTableOptions,
|
|
34
|
-
} from './table-commands/select-table'
|
|
35
|
-
import {
|
|
36
|
-
selectTableCell,
|
|
37
|
-
type SelectTableCellOptions,
|
|
38
|
-
} from './table-commands/select-table-cell'
|
|
39
|
-
import {
|
|
40
|
-
selectTableColumn,
|
|
41
|
-
type SelectTableColumnOptions,
|
|
42
|
-
} from './table-commands/select-table-column'
|
|
43
|
-
import {
|
|
44
|
-
selectTableRow,
|
|
45
|
-
type SelectTableRowOptions,
|
|
46
|
-
} from './table-commands/select-table-row'
|
|
16
|
+
import { insertTable, type InsertTableOptions } from './table-commands/insert-table'
|
|
17
|
+
import { moveTableColumn, type MoveTableColumnOptions } from './table-commands/move-table-column'
|
|
18
|
+
import { moveTableRow, type MoveTableRowOptions } from './table-commands/move-table-row'
|
|
19
|
+
import { selectTable, type SelectTableOptions } from './table-commands/select-table'
|
|
20
|
+
import { selectTableCell, type SelectTableCellOptions } from './table-commands/select-table-cell'
|
|
21
|
+
import { selectTableColumn, type SelectTableColumnOptions } from './table-commands/select-table-column'
|
|
22
|
+
import { selectTableRow, type SelectTableRowOptions } from './table-commands/select-table-row'
|
|
47
23
|
|
|
48
24
|
/**
|
|
49
25
|
* @internal
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type PlainExtension,
|
|
4
|
-
} from '@prosekit/core'
|
|
5
|
-
import {
|
|
6
|
-
columnResizing,
|
|
7
|
-
tableEditing,
|
|
8
|
-
} from 'prosemirror-tables'
|
|
1
|
+
import { definePlugin, type PlainExtension } from '@prosekit/core'
|
|
2
|
+
import { columnResizing, tableEditing } from 'prosemirror-tables'
|
|
9
3
|
|
|
10
4
|
/**
|
|
11
5
|
* @public
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import { union } from '@prosekit/core'
|
|
2
2
|
import pick from 'just-pick'
|
|
3
|
-
import {
|
|
4
|
-
describe,
|
|
5
|
-
expect,
|
|
6
|
-
it,
|
|
7
|
-
} from 'vitest'
|
|
3
|
+
import { describe, expect, it } from 'vitest'
|
|
8
4
|
|
|
9
5
|
import { defineDoc } from '../doc'
|
|
10
6
|
import { defineParagraph } from '../paragraph'
|
|
11
7
|
import { defineText } from '../text'
|
|
12
8
|
|
|
13
|
-
import {
|
|
14
|
-
defineTableCellSpec,
|
|
15
|
-
defineTableHeaderCellSpec,
|
|
16
|
-
defineTableRowSpec,
|
|
17
|
-
defineTableSpec,
|
|
18
|
-
} from './table-spec'
|
|
9
|
+
import { defineTableCellSpec, defineTableHeaderCellSpec, defineTableRowSpec, defineTableSpec } from './table-spec'
|
|
19
10
|
|
|
20
11
|
describe('table spec', () => {
|
|
21
12
|
it('should be defined', () => {
|
package/src/table/table-spec.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type Extension,
|
|
4
|
-
} from '@prosekit/core'
|
|
5
|
-
import type {
|
|
6
|
-
AttributeSpec,
|
|
7
|
-
Attrs,
|
|
8
|
-
} from '@prosekit/pm/model'
|
|
1
|
+
import { defineNodeSpec, type Extension } from '@prosekit/core'
|
|
2
|
+
import type { AttributeSpec, Attrs } from '@prosekit/pm/model'
|
|
9
3
|
import { tableNodes } from 'prosemirror-tables'
|
|
10
4
|
|
|
11
5
|
const cellContent = 'block+'
|
package/src/table/table-utils.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { CellSelection } from 'prosemirror-tables'
|
|
1
|
+
import { CellSelection, findCellPos, findCellRange, findTable } from 'prosemirror-tables'
|
|
2
2
|
|
|
3
|
-
export {
|
|
4
|
-
findCellPos,
|
|
5
|
-
findCellRange,
|
|
6
|
-
findTable,
|
|
7
|
-
} from 'prosemirror-tables'
|
|
3
|
+
export { findCellPos, findCellRange, findTable }
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
6
|
* Checks if the given object is a `CellSelection` instance.
|
package/src/table/table.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
union,
|
|
3
|
-
type Union,
|
|
4
|
-
} from '@prosekit/core'
|
|
1
|
+
import { union, type Union } from '@prosekit/core'
|
|
5
2
|
|
|
6
|
-
import {
|
|
7
|
-
defineTableCommands,
|
|
8
|
-
type TableCommandsExtension,
|
|
9
|
-
} from './table-commands'
|
|
3
|
+
import { defineTableCommands, type TableCommandsExtension } from './table-commands'
|
|
10
4
|
import { defineTableDropIndicator } from './table-drop-indicator'
|
|
11
5
|
import { defineTablePlugins } from './table-plugins'
|
|
12
6
|
import {
|
package/src/table/test-utils.ts
CHANGED
package/src/testing/clipboard.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { EditorView } from '@prosekit/pm/view'
|
|
2
|
-
|
|
3
|
-
import { formatHTML } from './format-html'
|
|
2
|
+
import { formatHTML } from 'diffable-html-snapshot'
|
|
4
3
|
|
|
5
4
|
async function readBlobFromClipboard(mimeType: string): Promise<Blob | undefined> {
|
|
6
5
|
const clipboardItems = await navigator.clipboard.read()
|
package/src/testing/index.ts
CHANGED
|
@@ -10,12 +10,10 @@ import {
|
|
|
10
10
|
type ExtractNodeActions,
|
|
11
11
|
type NodeChild,
|
|
12
12
|
} from '@prosekit/core'
|
|
13
|
-
import {
|
|
14
|
-
createTestEditor,
|
|
15
|
-
type TestEditor,
|
|
16
|
-
} from '@prosekit/core/test'
|
|
13
|
+
import { createTestEditor, type TestEditor } from '@prosekit/core/test'
|
|
17
14
|
import { keyboard } from 'vitest-browser-commands/playwright'
|
|
18
15
|
|
|
16
|
+
import { defineBackgroundColor } from '../background-color'
|
|
19
17
|
import { defineBlockquote } from '../blockquote'
|
|
20
18
|
import { defineBold } from '../bold'
|
|
21
19
|
import { defineCode } from '../code'
|
|
@@ -27,21 +25,18 @@ import { defineHorizontalRule } from '../horizontal-rule'
|
|
|
27
25
|
import { defineImage } from '../image'
|
|
28
26
|
import { defineItalic } from '../italic'
|
|
29
27
|
import { defineLink } from '../link'
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
type ListAttrs,
|
|
33
|
-
} from '../list'
|
|
28
|
+
import { defineList, type ListAttrs } from '../list'
|
|
29
|
+
import { defineMath } from '../math'
|
|
34
30
|
import { defineParagraph } from '../paragraph'
|
|
35
31
|
import { defineStrike } from '../strike'
|
|
36
32
|
import { defineTable } from '../table'
|
|
37
33
|
import type { CellAttrs } from '../table/table-spec'
|
|
38
34
|
import { defineText } from '../text'
|
|
35
|
+
import { defineTextColor } from '../text-color'
|
|
39
36
|
import { defineUnderline } from '../underline'
|
|
40
37
|
|
|
41
|
-
import {
|
|
42
|
-
|
|
43
|
-
readPlainTextFromClipboard,
|
|
44
|
-
} from './clipboard'
|
|
38
|
+
import { readHtmlTextFromClipboard, readPlainTextFromClipboard } from './clipboard'
|
|
39
|
+
import { renderMathBlock, renderMathInline } from './katex'
|
|
45
40
|
|
|
46
41
|
/**
|
|
47
42
|
* @internal
|
|
@@ -61,6 +56,8 @@ export function defineTestExtension() {
|
|
|
61
56
|
defineUnderline(),
|
|
62
57
|
defineStrike(),
|
|
63
58
|
defineCode(),
|
|
59
|
+
defineTextColor(),
|
|
60
|
+
defineBackgroundColor(),
|
|
64
61
|
defineLink(),
|
|
65
62
|
defineImage(),
|
|
66
63
|
defineParagraph(),
|
|
@@ -68,6 +65,7 @@ export function defineTestExtension() {
|
|
|
68
65
|
defineHorizontalRule(),
|
|
69
66
|
defineHardBreak(),
|
|
70
67
|
defineCodeBlock(),
|
|
68
|
+
defineMath({ renderMathBlock, renderMathInline }),
|
|
71
69
|
)
|
|
72
70
|
}
|
|
73
71
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { render } from 'katex'
|
|
2
|
+
|
|
3
|
+
export function renderMathBlock(text: string, element: HTMLElement) {
|
|
4
|
+
render(text, element, { displayMode: true, throwOnError: false, output: 'mathml' })
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function renderMathInline(text: string, element: HTMLElement) {
|
|
8
|
+
render(text, element, { displayMode: false, throwOnError: false, output: 'mathml' })
|
|
9
|
+
}
|