@prosekit/extensions 0.14.1 → 0.15.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/commit/style.css +1 -3
- package/dist/{drop-indicator-DJq8pF92.js → drop-indicator.js} +2 -4
- package/dist/drop-indicator.js.map +1 -0
- package/dist/{file-upload-I9m1EJAM.js → file.js} +2 -6
- package/dist/file.js.map +1 -0
- package/dist/gap-cursor/style.css +5 -8
- package/dist/{file-upload-dr3IXUty.d.ts → index.d.ts} +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/list/style.css +79 -110
- package/dist/loro/style.css +18 -21
- package/dist/{mark-rule-CUnXwBuy.js → mark-rule.js} +3 -6
- package/dist/mark-rule.js.map +1 -0
- package/dist/page/style.css +43 -0
- package/dist/{mark-paste-rule-n_2Ehmb5.js → paste-rule.js} +3 -7
- package/dist/paste-rule.js.map +1 -0
- package/dist/placeholder/style.css +4 -7
- package/dist/prosekit-extensions-autocomplete.d.ts +1 -1
- package/dist/prosekit-extensions-autocomplete.js +17 -21
- package/dist/prosekit-extensions-autocomplete.js.map +1 -1
- package/dist/prosekit-extensions-background-color.d.ts +1 -1
- package/dist/prosekit-extensions-background-color.js +1 -4
- package/dist/prosekit-extensions-background-color.js.map +1 -1
- package/dist/prosekit-extensions-blockquote.d.ts +13 -13
- package/dist/prosekit-extensions-blockquote.d.ts.map +1 -1
- package/dist/prosekit-extensions-blockquote.js +6 -10
- package/dist/prosekit-extensions-blockquote.js.map +1 -1
- package/dist/prosekit-extensions-bold.d.ts +12 -12
- package/dist/prosekit-extensions-bold.d.ts.map +1 -1
- package/dist/prosekit-extensions-bold.js +1 -6
- package/dist/prosekit-extensions-bold.js.map +1 -1
- package/dist/prosekit-extensions-code-block.d.ts +56 -37
- package/dist/prosekit-extensions-code-block.d.ts.map +1 -1
- package/dist/prosekit-extensions-code-block.js +73 -76
- package/dist/prosekit-extensions-code-block.js.map +1 -1
- package/dist/prosekit-extensions-code.d.ts +12 -12
- package/dist/prosekit-extensions-code.d.ts.map +1 -1
- package/dist/prosekit-extensions-code.js +1 -6
- package/dist/prosekit-extensions-code.js.map +1 -1
- package/dist/prosekit-extensions-commit.d.ts +1 -1
- package/dist/prosekit-extensions-commit.js +2 -3
- package/dist/prosekit-extensions-commit.js.map +1 -1
- package/dist/prosekit-extensions-doc.js +1 -2
- package/dist/prosekit-extensions-doc.js.map +1 -1
- package/dist/prosekit-extensions-drop-cursor.js +1 -2
- package/dist/prosekit-extensions-drop-cursor.js.map +1 -1
- package/dist/prosekit-extensions-drop-indicator.js +2 -3
- package/dist/prosekit-extensions-enter-rule.d.ts +2 -2
- package/dist/prosekit-extensions-enter-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-enter-rule.js +1 -2
- package/dist/prosekit-extensions-enter-rule.js.map +1 -1
- package/dist/prosekit-extensions-file.d.ts +2 -2
- package/dist/prosekit-extensions-file.js +2 -3
- package/dist/prosekit-extensions-gap-cursor.js +1 -2
- package/dist/prosekit-extensions-gap-cursor.js.map +1 -1
- package/dist/prosekit-extensions-hard-break.d.ts +7 -7
- package/dist/prosekit-extensions-hard-break.d.ts.map +1 -1
- package/dist/prosekit-extensions-hard-break.js +1 -5
- package/dist/prosekit-extensions-hard-break.js.map +1 -1
- package/dist/prosekit-extensions-heading.d.ts +15 -15
- package/dist/prosekit-extensions-heading.d.ts.map +1 -1
- package/dist/prosekit-extensions-heading.js +1 -6
- package/dist/prosekit-extensions-heading.js.map +1 -1
- package/dist/prosekit-extensions-horizontal-rule.d.ts +7 -7
- package/dist/prosekit-extensions-horizontal-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-horizontal-rule.js +12 -14
- package/dist/prosekit-extensions-horizontal-rule.js.map +1 -1
- package/dist/prosekit-extensions-image.d.ts +12 -13
- package/dist/prosekit-extensions-image.d.ts.map +1 -1
- package/dist/prosekit-extensions-image.js +10 -16
- package/dist/prosekit-extensions-image.js.map +1 -1
- package/dist/prosekit-extensions-input-rule.js +1 -2
- package/dist/prosekit-extensions-input-rule.js.map +1 -1
- package/dist/prosekit-extensions-italic.d.ts +12 -12
- package/dist/prosekit-extensions-italic.d.ts.map +1 -1
- package/dist/prosekit-extensions-italic.js +1 -6
- package/dist/prosekit-extensions-italic.js.map +1 -1
- package/dist/prosekit-extensions-link.js +3 -6
- package/dist/prosekit-extensions-link.js.map +1 -1
- package/dist/prosekit-extensions-list.d.ts +26 -26
- package/dist/prosekit-extensions-list.d.ts.map +1 -1
- package/dist/prosekit-extensions-list.js +26 -34
- package/dist/prosekit-extensions-list.js.map +1 -1
- package/dist/prosekit-extensions-loro.d.ts +16 -16
- package/dist/prosekit-extensions-loro.d.ts.map +1 -1
- package/dist/prosekit-extensions-loro.js +3 -9
- package/dist/prosekit-extensions-loro.js.map +1 -1
- package/dist/prosekit-extensions-mark-rule.js +2 -3
- package/dist/prosekit-extensions-math.d.ts +3 -3
- package/dist/prosekit-extensions-math.d.ts.map +1 -1
- package/dist/prosekit-extensions-math.js +5 -5
- package/dist/prosekit-extensions-math.js.map +1 -1
- package/dist/prosekit-extensions-mention.js +1 -2
- package/dist/prosekit-extensions-mention.js.map +1 -1
- package/dist/prosekit-extensions-mod-click-prevention.js +2 -3
- package/dist/prosekit-extensions-mod-click-prevention.js.map +1 -1
- package/dist/prosekit-extensions-page.d.ts +114 -0
- package/dist/prosekit-extensions-page.d.ts.map +1 -0
- package/dist/prosekit-extensions-page.js +324 -0
- package/dist/prosekit-extensions-page.js.map +1 -0
- package/dist/prosekit-extensions-paragraph.d.ts +7 -7
- package/dist/prosekit-extensions-paragraph.d.ts.map +1 -1
- package/dist/prosekit-extensions-paragraph.js +3 -7
- package/dist/prosekit-extensions-paragraph.js.map +1 -1
- package/dist/prosekit-extensions-paste-rule.js +2 -3
- package/dist/prosekit-extensions-placeholder.d.ts +1 -1
- package/dist/prosekit-extensions-placeholder.js +3 -4
- package/dist/prosekit-extensions-placeholder.js.map +1 -1
- package/dist/prosekit-extensions-readonly.js +2 -3
- package/dist/prosekit-extensions-readonly.js.map +1 -1
- package/dist/prosekit-extensions-search.js +1 -2
- package/dist/prosekit-extensions-search.js.map +1 -1
- package/dist/prosekit-extensions-strike.js +1 -2
- package/dist/prosekit-extensions-strike.js.map +1 -1
- package/dist/prosekit-extensions-table.d.ts +47 -47
- package/dist/prosekit-extensions-table.d.ts.map +1 -1
- package/dist/prosekit-extensions-table.js +2 -3
- package/dist/prosekit-extensions-text-align.d.ts +1 -1
- package/dist/prosekit-extensions-text-align.js +1 -2
- package/dist/prosekit-extensions-text-align.js.map +1 -1
- package/dist/prosekit-extensions-text-color.d.ts +1 -1
- package/dist/prosekit-extensions-text-color.js +1 -4
- package/dist/prosekit-extensions-text-color.js.map +1 -1
- package/dist/prosekit-extensions-text.js +1 -2
- package/dist/prosekit-extensions-text.js.map +1 -1
- package/dist/prosekit-extensions-underline.js +1 -2
- package/dist/prosekit-extensions-underline.js.map +1 -1
- package/dist/prosekit-extensions-virtual-selection.js +2 -3
- package/dist/prosekit-extensions-virtual-selection.js.map +1 -1
- package/dist/prosekit-extensions-yjs.d.ts +3 -3
- package/dist/prosekit-extensions-yjs.d.ts.map +1 -1
- package/dist/prosekit-extensions-yjs.js +3 -9
- package/dist/prosekit-extensions-yjs.js.map +1 -1
- package/dist/prosekit-extensions.js +1 -1
- package/dist/search/style.css +4 -8
- package/dist/shiki-highlighter-chunk.js +1 -2
- package/dist/shiki-highlighter-chunk.js.map +1 -1
- package/dist/table/style.css +16 -16
- package/dist/{table-UJVYsrB7.js → table.js} +29 -41
- package/dist/table.js.map +1 -0
- package/dist/virtual-selection/style.css +1 -4
- package/dist/yjs/style.css +14 -20
- package/package.json +30 -16
- package/src/autocomplete/autocomplete-helpers.ts +1 -1
- package/src/autocomplete/autocomplete-plugin.ts +2 -2
- package/src/autocomplete/autocomplete-rule.ts +1 -1
- package/src/autocomplete/autocomplete.spec.ts +4 -4
- package/src/autocomplete/autocomplete.ts +2 -2
- package/src/autocomplete/index.ts +2 -2
- package/src/background-color/background-color-commands.spec.ts +1 -1
- package/src/background-color/background-color-commands.ts +1 -1
- package/src/background-color/background-color-spec.spec.ts +1 -1
- package/src/background-color/background-color.ts +2 -2
- package/src/background-color/index.ts +3 -3
- package/src/blockquote/blockquote-input-rule.ts +1 -1
- package/src/blockquote/blockquote-keymap.spec.ts +1 -1
- package/src/blockquote/blockquote-keymap.ts +9 -7
- package/src/blockquote/blockquote.ts +4 -4
- package/src/blockquote/index.ts +5 -5
- package/src/bold/bold-input-rule.spec.ts +2 -2
- package/src/bold/bold-input-rule.ts +1 -1
- package/src/bold/bold.ts +4 -4
- package/src/bold/index.ts +5 -5
- package/src/code/code-input-rule.ts +1 -1
- package/src/code/code.ts +4 -4
- package/src/code/index.ts +5 -5
- package/src/code-block/code-block-commands.ts +1 -1
- package/src/code-block/code-block-highlight.ts +11 -1
- package/src/code-block/code-block-input-rule.ts +3 -3
- package/src/code-block/code-block-shiki.ts +13 -5
- package/src/code-block/code-block-spec.spec.ts +2 -2
- package/src/code-block/code-block-spec.ts +1 -1
- package/src/code-block/code-block.ts +4 -4
- package/src/code-block/index.ts +9 -9
- package/src/code-block/shiki-highlighter.ts +2 -2
- package/src/code-block/shiki-parser.ts +2 -2
- package/src/drop-cursor/index.ts +1 -1
- package/src/drop-indicator/drop-indicator.ts +1 -1
- package/src/drop-indicator/index.ts +1 -1
- package/src/enter-rule/index.ts +3 -3
- package/src/file/file-drop-handler.ts +1 -1
- package/src/file/file-paste-handler.spec.ts +3 -3
- package/src/file/file-paste-handler.ts +1 -1
- package/src/file/index.ts +3 -3
- package/src/gap-cursor/index.ts +1 -1
- package/src/hard-break/hard-break-keymap.spec.ts +2 -2
- package/src/hard-break/hard-break-keymap.ts +1 -1
- package/src/hard-break/hard-break.ts +3 -3
- package/src/hard-break/index.ts +4 -4
- package/src/heading/heading-commands.ts +1 -1
- package/src/heading/heading-input-rule.ts +2 -2
- package/src/heading/heading-keymap.spec.ts +1 -1
- package/src/heading/heading-spec.ts +1 -1
- package/src/heading/heading.ts +4 -4
- package/src/heading/index.ts +6 -6
- package/src/horizontal-rule/horizontal-rule-commands.spec.ts +1 -1
- package/src/horizontal-rule/horizontal-rule-commands.ts +14 -11
- package/src/horizontal-rule/horizontal-rule-input-rule.spec.ts +2 -2
- package/src/horizontal-rule/horizontal-rule-input-rule.ts +1 -1
- package/src/horizontal-rule/horizontal-rule.ts +3 -3
- package/src/horizontal-rule/index.ts +4 -4
- package/src/image/image-commands/insert-image.ts +1 -1
- package/src/image/image-commands/upload-image.spec.ts +4 -4
- package/src/image/image-commands/upload-image.ts +2 -2
- package/src/image/image-commands.ts +3 -3
- package/src/image/image-upload-handler.ts +2 -2
- package/src/image/image.ts +2 -2
- package/src/image/index.ts +6 -6
- package/src/italic/index.ts +5 -5
- package/src/italic/italic-commands.spec.ts +4 -4
- package/src/italic/italic-input-rule.spec.ts +2 -2
- package/src/italic/italic-input-rule.ts +1 -1
- package/src/italic/italic.ts +4 -4
- package/src/link/index.spec.ts +2 -2
- package/src/link/index.ts +6 -6
- package/src/link/link-paste-rule.spec.ts +2 -2
- package/src/link/link-paste-rule.ts +3 -3
- package/src/link/link-regex.spec.ts +1 -1
- package/src/list/index.ts +8 -8
- package/src/list/list-drop-indicator.ts +2 -2
- package/src/list/list-input-rules.ts +1 -1
- package/src/list/list-keymap.spec.ts +1 -1
- package/src/list/list-spec.ts +1 -1
- package/src/list/list-types.spec.ts +2 -2
- package/src/list/list.spec.ts +6 -6
- package/src/list/list.ts +7 -7
- package/src/loro/index.ts +6 -6
- package/src/loro/loro.ts +8 -7
- package/src/mark-rule/apply.ts +2 -2
- package/src/mark-rule/index.ts +2 -2
- package/src/mark-rule/mark-rule.spec.ts +4 -4
- package/src/mark-rule/mark-rule.ts +2 -2
- package/src/math/index.ts +4 -4
- package/src/math/math-block.ts +8 -1
- package/src/math/math-inline.ts +1 -1
- package/src/math/math.ts +3 -3
- package/src/page/index.ts +5 -0
- package/src/page/page-break-commands.spec.ts +61 -0
- package/src/page/page-break-commands.ts +41 -0
- package/src/page/page-break-keymap.ts +17 -0
- package/src/page/page-break-spec.ts +33 -0
- package/src/page/page-break.ts +23 -0
- package/src/page/page-element.ts +246 -0
- package/src/page/page-rendering.ts +164 -0
- package/src/page/style.css +43 -0
- package/src/paragraph/index.ts +7 -7
- package/src/paragraph/paragraph-keymap.ts +1 -1
- package/src/paragraph/paragraph.ts +6 -5
- package/src/paste-rule/index.ts +2 -2
- package/src/paste-rule/mark-paste-rule.spec.ts +8 -8
- package/src/paste-rule/mark-paste-rule.ts +2 -2
- package/src/paste-rule/paste-rule.spec.ts +2 -2
- package/src/paste-rule/paste-rule.ts +1 -1
- package/src/paste-rule/split-text-by-regex.spec.ts +1 -1
- package/src/placeholder/index.ts +1 -1
- package/src/strike/index.ts +1 -1
- package/src/table/index.ts +14 -14
- package/src/table/table-commands/delete-cell-selection.spec.ts +3 -3
- package/src/table/table-commands/exit-table.spec.ts +2 -2
- package/src/table/table-commands/insert-table.spec.ts +1 -1
- package/src/table/table-commands/move-table-column.spec.ts +2 -2
- package/src/table/table-commands/move-table-row.spec.ts +2 -2
- package/src/table/table-commands/select-table-cell.spec.ts +3 -3
- package/src/table/table-commands/select-table-cell.ts +1 -1
- package/src/table/table-commands/select-table-column.spec.ts +2 -2
- package/src/table/table-commands/select-table-column.ts +1 -1
- package/src/table/table-commands/select-table-row.spec.ts +2 -2
- package/src/table/table-commands/select-table-row.ts +1 -1
- package/src/table/table-commands/select-table.spec.ts +2 -2
- package/src/table/table-commands/select-table.ts +1 -1
- package/src/table/table-commands.ts +9 -9
- package/src/table/table-drop-indicator.ts +2 -2
- package/src/table/table-spec.spec.ts +4 -4
- package/src/table/table.ts +4 -4
- package/src/table/test-utils.ts +1 -1
- package/src/testing/index.ts +24 -24
- package/src/text-color/index.ts +3 -3
- package/src/text-color/text-color-commands.spec.ts +1 -1
- package/src/text-color/text-color-commands.ts +1 -1
- package/src/text-color/text-color-spec.spec.ts +1 -1
- package/src/text-color/text-color.ts +2 -2
- package/src/yjs/index.ts +7 -7
- package/src/yjs/yjs-cursor-plugin.ts +1 -1
- package/src/yjs/yjs-undo-plugin.ts +3 -2
- package/src/yjs/yjs.ts +9 -8
- package/dist/commit/style.css.map +0 -1
- package/dist/commit/style.js +0 -1
- package/dist/drop-indicator-DJq8pF92.js.map +0 -1
- package/dist/file-upload-I9m1EJAM.js.map +0 -1
- package/dist/file-upload-dr3IXUty.d.ts.map +0 -1
- package/dist/gap-cursor/style.css.map +0 -1
- package/dist/gap-cursor/style.js +0 -1
- package/dist/list/style.css.map +0 -1
- package/dist/list/style.js +0 -1
- package/dist/loro/style.css.map +0 -1
- package/dist/loro/style.js +0 -1
- package/dist/mark-paste-rule-n_2Ehmb5.js.map +0 -1
- package/dist/mark-rule-CUnXwBuy.js.map +0 -1
- package/dist/placeholder/style.css.map +0 -1
- package/dist/placeholder/style.js +0 -1
- package/dist/search/style.css.map +0 -1
- package/dist/search/style.js +0 -1
- package/dist/shiki-highlighter-chunk.d.ts +0 -19
- package/dist/shiki-highlighter-chunk.d.ts.map +0 -1
- package/dist/table/style.css.map +0 -1
- package/dist/table/style.js +0 -1
- package/dist/table-UJVYsrB7.js.map +0 -1
- package/dist/virtual-selection/style.css.map +0 -1
- package/dist/virtual-selection/style.js +0 -1
- package/dist/yjs/style.css.map +0 -1
- package/dist/yjs/style.js +0 -1
package/src/heading/heading.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { union, type Union } from '@prosekit/core'
|
|
2
2
|
|
|
3
|
-
import { defineHeadingCommands, type HeadingCommandsExtension } from './heading-commands'
|
|
4
|
-
import { defineHeadingInputRule } from './heading-input-rule'
|
|
5
|
-
import { defineHeadingKeymap } from './heading-keymap'
|
|
6
|
-
import { defineHeadingSpec, type HeadingSpecExtension } from './heading-spec'
|
|
3
|
+
import { defineHeadingCommands, type HeadingCommandsExtension } from './heading-commands.ts'
|
|
4
|
+
import { defineHeadingInputRule } from './heading-input-rule.ts'
|
|
5
|
+
import { defineHeadingKeymap } from './heading-keymap.ts'
|
|
6
|
+
import { defineHeadingSpec, type HeadingSpecExtension } from './heading-spec.ts'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
package/src/heading/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export type
|
|
1
|
+
export { defineHeadingCommands, type HeadingCommandsExtension } from './heading-commands.ts'
|
|
2
|
+
export { defineHeadingInputRule } from './heading-input-rule.ts'
|
|
3
|
+
export { defineHeadingKeymap } from './heading-keymap.ts'
|
|
4
|
+
export { defineHeadingSpec, type HeadingSpecExtension } from './heading-spec.ts'
|
|
5
|
+
export type { HeadingAttrs } from './heading-types.ts'
|
|
6
|
+
export { defineHeading, type HeadingExtension } from './heading.ts'
|
|
@@ -8,21 +8,24 @@ export type HorizontalRuleCommandsExtension = Extension<{
|
|
|
8
8
|
}
|
|
9
9
|
}>
|
|
10
10
|
|
|
11
|
+
const insertHorizontalRuleCommand: Command = (state, dispatch): boolean => {
|
|
12
|
+
if (!dispatch) return true
|
|
13
|
+
|
|
14
|
+
const { schema, tr } = state
|
|
15
|
+
const type = getNodeType(schema, 'horizontalRule')
|
|
16
|
+
const node = type.createChecked()
|
|
17
|
+
const pos = tr.selection.anchor
|
|
18
|
+
const slice = new Slice(Fragment.from(node), 0, 0)
|
|
19
|
+
tr.replaceRange(pos, pos, slice).scrollIntoView()
|
|
20
|
+
dispatch(tr)
|
|
21
|
+
return true
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
/**
|
|
12
25
|
* Returns a command that inserts a horizontal rule at the current selection.
|
|
13
26
|
*/
|
|
14
27
|
export function insertHorizontalRule(): Command {
|
|
15
|
-
return
|
|
16
|
-
if (!dispatch) return true
|
|
17
|
-
|
|
18
|
-
const { schema, tr } = state
|
|
19
|
-
const type = getNodeType(schema, 'horizontalRule')
|
|
20
|
-
const node = type.createChecked()
|
|
21
|
-
const pos = tr.selection.anchor
|
|
22
|
-
tr.replaceRange(pos, pos, new Slice(Fragment.from(node), 0, 0))
|
|
23
|
-
dispatch(tr)
|
|
24
|
-
return true
|
|
25
|
-
}
|
|
28
|
+
return insertHorizontalRuleCommand
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
export function defineHorizontalRuleCommands(): HorizontalRuleCommandsExtension {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
|
|
3
|
-
import { setupTest } from '../testing'
|
|
4
|
-
import { inputText } from '../testing/keyboard'
|
|
3
|
+
import { setupTest } from '../testing/index.ts'
|
|
4
|
+
import { inputText } from '../testing/keyboard.ts'
|
|
5
5
|
|
|
6
6
|
describe('defineHorizontalRuleInputRule', () => {
|
|
7
7
|
const { editor, n } = setupTest()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { union, type Union } from '@prosekit/core'
|
|
2
2
|
|
|
3
|
-
import { defineHorizontalRuleCommands, type HorizontalRuleCommandsExtension } from './horizontal-rule-commands'
|
|
4
|
-
import { defineHorizontalRuleInputRule } from './horizontal-rule-input-rule'
|
|
5
|
-
import { defineHorizontalRuleSpec, type HorizontalRuleSpecExtension } from './horizontal-rule-spec'
|
|
3
|
+
import { defineHorizontalRuleCommands, type HorizontalRuleCommandsExtension } from './horizontal-rule-commands.ts'
|
|
4
|
+
import { defineHorizontalRuleInputRule } from './horizontal-rule-input-rule.ts'
|
|
5
|
+
import { defineHorizontalRuleSpec, type HorizontalRuleSpecExtension } from './horizontal-rule-spec.ts'
|
|
6
6
|
|
|
7
7
|
export type HorizontalRuleExtension = Union<
|
|
8
8
|
[HorizontalRuleSpecExtension, HorizontalRuleCommandsExtension]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export { defineHorizontalRuleCommands, insertHorizontalRule, type HorizontalRuleCommandsExtension } from './horizontal-rule-commands.ts'
|
|
2
|
+
export { defineHorizontalRuleInputRule } from './horizontal-rule-input-rule.ts'
|
|
3
|
+
export { defineHorizontalRuleSpec, type HorizontalRuleSpecExtension } from './horizontal-rule-spec.ts'
|
|
4
|
+
export { defineHorizontalRule, type HorizontalRuleExtension } from './horizontal-rule.ts'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { insertNode } from '@prosekit/core'
|
|
2
2
|
import type { Command } from '@prosekit/pm/state'
|
|
3
3
|
|
|
4
|
-
import type { ImageAttrs } from '../image-spec'
|
|
4
|
+
import type { ImageAttrs } from '../image-spec.ts'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns a command that inserts an image node with the given attributes at the
|
|
@@ -3,11 +3,11 @@ import { findNode, findNodes } from '@prosekit/core'
|
|
|
3
3
|
import type { ProseMirrorNode } from '@prosekit/pm/model'
|
|
4
4
|
import { describe, expect, it, vi } from 'vitest'
|
|
5
5
|
|
|
6
|
-
import type { Uploader } from '../../file'
|
|
7
|
-
import { setupTest } from '../../testing'
|
|
8
|
-
import type { ImageAttrs } from '../image-spec'
|
|
6
|
+
import type { Uploader } from '../../file/index.ts'
|
|
7
|
+
import { setupTest } from '../../testing/index.ts'
|
|
8
|
+
import type { ImageAttrs } from '../image-spec.ts'
|
|
9
9
|
|
|
10
|
-
import { replaceImageURL, uploadImage, type ImageUploadErrorHandler } from './upload-image'
|
|
10
|
+
import { replaceImageURL, uploadImage, type ImageUploadErrorHandler } from './upload-image.ts'
|
|
11
11
|
|
|
12
12
|
describe('uploadImage', () => {
|
|
13
13
|
it('should insert image at current selection by default', async () => {
|
|
@@ -2,8 +2,8 @@ import { insertNode, ProseKitError } from '@prosekit/core'
|
|
|
2
2
|
import type { Command, EditorState, Transaction } from '@prosekit/pm/state'
|
|
3
3
|
import type { EditorView } from '@prosekit/pm/view'
|
|
4
4
|
|
|
5
|
-
import { UploadTask, type Uploader } from '../../file'
|
|
6
|
-
import type { ImageAttrs } from '../image-spec'
|
|
5
|
+
import { UploadTask, type Uploader } from '../../file/index.ts'
|
|
6
|
+
import type { ImageAttrs } from '../image-spec.ts'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Options for {@link uploadImage}.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineCommands, type Extension } from '@prosekit/core'
|
|
2
2
|
|
|
3
|
-
import { insertImage } from './image-commands/insert-image'
|
|
4
|
-
import { uploadImage, type UploadImageOptions } from './image-commands/upload-image'
|
|
5
|
-
import type { ImageAttrs } from './image-spec'
|
|
3
|
+
import { insertImage } from './image-commands/insert-image.ts'
|
|
4
|
+
import { uploadImage, type UploadImageOptions } from './image-commands/upload-image.ts'
|
|
5
|
+
import type { ImageAttrs } from './image-spec.ts'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
type FilePasteHandler,
|
|
9
9
|
type FilePasteHandlerOptions,
|
|
10
10
|
type Uploader,
|
|
11
|
-
} from '../file'
|
|
11
|
+
} from '../file/index.ts'
|
|
12
12
|
|
|
13
|
-
import { uploadImage, type ImageUploadErrorHandler } from './image-commands/upload-image'
|
|
13
|
+
import { uploadImage, type ImageUploadErrorHandler } from './image-commands/upload-image.ts'
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* A predicate to determine if the pasted file should be uploaded and inserted as an image.
|
package/src/image/image.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { union, type Union } from '@prosekit/core'
|
|
2
2
|
|
|
3
|
-
import { defineImageCommands, type ImageCommandsExtension } from './image-commands'
|
|
4
|
-
import { defineImageSpec, type ImageSpecExtension } from './image-spec'
|
|
3
|
+
import { defineImageCommands, type ImageCommandsExtension } from './image-commands.ts'
|
|
4
|
+
import { defineImageSpec, type ImageSpecExtension } from './image-spec.ts'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
package/src/image/index.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { insertImage } from './image-commands/insert-image'
|
|
1
|
+
export { defineImageCommands, type ImageCommandsExtension } from './image-commands.ts'
|
|
2
|
+
export { insertImage } from './image-commands/insert-image.ts'
|
|
4
3
|
export {
|
|
5
4
|
replaceImageURL,
|
|
6
5
|
uploadImage,
|
|
7
6
|
type ImageUploadErrorHandler,
|
|
8
7
|
type ImageUploadErrorHandlerOptions,
|
|
9
8
|
type UploadImageOptions,
|
|
10
|
-
} from './image-commands/upload-image'
|
|
11
|
-
export { defineImageSpec, type ImageAttrs, type ImageSpecExtension } from './image-spec'
|
|
9
|
+
} from './image-commands/upload-image.ts'
|
|
10
|
+
export { defineImageSpec, type ImageAttrs, type ImageSpecExtension } from './image-spec.ts'
|
|
12
11
|
export {
|
|
13
12
|
defineImageUploadHandler,
|
|
14
13
|
type ImageCanDropPredicate,
|
|
15
14
|
type ImageCanPastePredicate,
|
|
16
15
|
type ImageUploadHandlerOptions,
|
|
17
|
-
} from './image-upload-handler'
|
|
16
|
+
} from './image-upload-handler.ts'
|
|
17
|
+
export { defineImage, type ImageExtension } from './image.ts'
|
package/src/italic/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
export { defineItalicCommands, type ItalicCommandsExtension } from './italic-commands.ts'
|
|
2
|
+
export { defineItalicInputRule } from './italic-input-rule.ts'
|
|
3
|
+
export { defineItalicKeymap } from './italic-keymap.ts'
|
|
4
|
+
export { defineItalicSpec, type ItalicSpecExtension } from './italic-spec.ts'
|
|
5
|
+
export { defineItalic, type ItalicExtension } from './italic.ts'
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createEditor, defineBaseCommands, union } from '@prosekit/core'
|
|
2
2
|
import { describe, expect, it } from 'vitest'
|
|
3
3
|
|
|
4
|
-
import { defineDoc } from '../doc'
|
|
5
|
-
import { defineParagraph } from '../paragraph'
|
|
6
|
-
import { defineText } from '../text'
|
|
4
|
+
import { defineDoc } from '../doc/index.ts'
|
|
5
|
+
import { defineParagraph } from '../paragraph/index.ts'
|
|
6
|
+
import { defineText } from '../text/index.ts'
|
|
7
7
|
|
|
8
|
-
import { defineItalic } from './index'
|
|
8
|
+
import { defineItalic } from './index.ts'
|
|
9
9
|
|
|
10
10
|
describe('command', () => {
|
|
11
11
|
const extension = union(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
|
|
3
|
-
import { setupTest } from '../testing'
|
|
4
|
-
import { inputText } from '../testing/keyboard'
|
|
3
|
+
import { setupTest } from '../testing/index.ts'
|
|
4
|
+
import { inputText } from '../testing/keyboard.ts'
|
|
5
5
|
|
|
6
6
|
describe('defineItalicInputRule', () => {
|
|
7
7
|
const { editor, n, m } = setupTest()
|
package/src/italic/italic.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { union, type Union } from '@prosekit/core'
|
|
2
2
|
|
|
3
|
-
import { defineItalicCommands, type ItalicCommandsExtension } from './italic-commands'
|
|
4
|
-
import { defineItalicInputRule } from './italic-input-rule'
|
|
5
|
-
import { defineItalicKeymap } from './italic-keymap'
|
|
6
|
-
import { defineItalicSpec, type ItalicSpecExtension } from './italic-spec'
|
|
3
|
+
import { defineItalicCommands, type ItalicCommandsExtension } from './italic-commands.ts'
|
|
4
|
+
import { defineItalicInputRule } from './italic-input-rule.ts'
|
|
5
|
+
import { defineItalicKeymap } from './italic-keymap.ts'
|
|
6
|
+
import { defineItalicSpec, type ItalicSpecExtension } from './italic-spec.ts'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
package/src/link/index.spec.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
import { keyboard } from 'vitest-browser-commands/playwright'
|
|
3
3
|
|
|
4
|
-
import { setupTest } from '../testing'
|
|
5
|
-
import { inputText } from '../testing/keyboard'
|
|
4
|
+
import { setupTest } from '../testing/index.ts'
|
|
5
|
+
import { inputText } from '../testing/keyboard.ts'
|
|
6
6
|
|
|
7
7
|
describe('defineLinkCommands', () => {
|
|
8
8
|
const { editor, n, m } = setupTest()
|
package/src/link/index.ts
CHANGED
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
} from '@prosekit/core'
|
|
13
13
|
import { InputRule } from '@prosekit/pm/inputrules'
|
|
14
14
|
|
|
15
|
-
import { defineEnterRule } from '../enter-rule'
|
|
16
|
-
import { defineInputRule } from '../input-rule'
|
|
17
|
-
import { defineMarkRule } from '../mark-rule'
|
|
15
|
+
import { defineEnterRule } from '../enter-rule/index.ts'
|
|
16
|
+
import { defineInputRule } from '../input-rule/index.ts'
|
|
17
|
+
import { defineMarkRule } from '../mark-rule/index.ts'
|
|
18
18
|
|
|
19
|
-
import { defineLinkPasteRule } from './link-paste-rule'
|
|
20
|
-
import { LINK_ENTER_RE, LINK_INPUT_RE, LINK_MARK_RE } from './link-regex'
|
|
21
|
-
import type { LinkAttrs } from './link-types'
|
|
19
|
+
import { defineLinkPasteRule } from './link-paste-rule.ts'
|
|
20
|
+
import { LINK_ENTER_RE, LINK_INPUT_RE, LINK_MARK_RE } from './link-regex.ts'
|
|
21
|
+
import type { LinkAttrs } from './link-types.ts'
|
|
22
22
|
|
|
23
23
|
export { defineLinkPasteRule }
|
|
24
24
|
export type { LinkAttrs }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { pasteHTML, pasteText } from '../testing/clipboard.ts'
|
|
4
|
+
import { setupTest } from '../testing/index.ts'
|
|
5
5
|
|
|
6
6
|
describe('defineLinkPasteRule', () => {
|
|
7
7
|
const { editor, n, m } = setupTest()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { PlainExtension } from '@prosekit/core'
|
|
2
2
|
|
|
3
|
-
import { defineMarkPasteRule } from '../paste-rule'
|
|
3
|
+
import { defineMarkPasteRule } from '../paste-rule/index.ts'
|
|
4
4
|
|
|
5
|
-
import { LINK_MARK_RE } from './link-regex'
|
|
6
|
-
import type { LinkAttrs } from './link-types'
|
|
5
|
+
import { LINK_MARK_RE } from './link-regex.ts'
|
|
6
|
+
import type { LinkAttrs } from './link-types.ts'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
package/src/list/index.ts
CHANGED
|
@@ -6,11 +6,11 @@ export type {
|
|
|
6
6
|
UnwrapListOptions,
|
|
7
7
|
WrapInListGetAttrs,
|
|
8
8
|
} from 'prosemirror-flat-list'
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export type
|
|
9
|
+
export { defineListCommands, type ListCommandsExtension } from './list-commands.ts'
|
|
10
|
+
export { defineListInputRules } from './list-input-rules.ts'
|
|
11
|
+
export { defineListKeymap } from './list-keymap.ts'
|
|
12
|
+
export { defineListPlugins } from './list-plugins.ts'
|
|
13
|
+
export { defineListSerializer } from './list-serializer.ts'
|
|
14
|
+
export { defineListSpec, type ListSpecExtension } from './list-spec.ts'
|
|
15
|
+
export type { ListAttrs } from './list-types.ts'
|
|
16
|
+
export { defineList, type ListExtension } from './list.ts'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlainExtension } from '@prosekit/core'
|
|
2
2
|
|
|
3
|
-
import type { DragEventHandler } from '../drop-indicator'
|
|
4
|
-
import { defineDropIndicator } from '../drop-indicator'
|
|
3
|
+
import type { DragEventHandler } from '../drop-indicator/index.ts'
|
|
4
|
+
import { defineDropIndicator } from '../drop-indicator/index.ts'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Configures drop indicator to avoid unexpected drop point.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
import { keyboard } from 'vitest-browser-commands/playwright'
|
|
3
3
|
|
|
4
|
-
import { setupTest } from '../testing'
|
|
4
|
+
import { setupTest } from '../testing/index.ts'
|
|
5
5
|
|
|
6
6
|
describe('keymap', () => {
|
|
7
7
|
const { editor, n } = setupTest()
|
package/src/list/list-spec.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { defineNodeSpec, type Extension } from '@prosekit/core'
|
|
|
2
2
|
import type { DOMOutputSpec, ProseMirrorNode } from '@prosekit/pm/model'
|
|
3
3
|
import { createListSpec, listToDOM, type ListAttributes } from 'prosemirror-flat-list'
|
|
4
4
|
|
|
5
|
-
import type { ListAttrs } from './list-types'
|
|
5
|
+
import type { ListAttrs } from './list-types.ts'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ListAttributes } from 'prosemirror-flat-list'
|
|
2
2
|
import { test } from 'vitest'
|
|
3
3
|
|
|
4
|
-
import { assertTypeEqual } from '../types/assert-type-equal'
|
|
4
|
+
import { assertTypeEqual } from '../types/assert-type-equal.ts'
|
|
5
5
|
|
|
6
|
-
import type { ListAttrs } from './list-types'
|
|
6
|
+
import type { ListAttrs } from './list-types.ts'
|
|
7
7
|
|
|
8
8
|
test('ListAttrs', () => {
|
|
9
9
|
assertTypeEqual<keyof ListAttrs, keyof ListAttributes>(true)
|
package/src/list/list.spec.ts
CHANGED
|
@@ -3,13 +3,13 @@ import type { ProseMirrorNode } from '@prosekit/pm/model'
|
|
|
3
3
|
import { formatHTML } from 'diffable-html-snapshot'
|
|
4
4
|
import { describe, expect, it } from 'vitest'
|
|
5
5
|
|
|
6
|
-
import { defineDoc } from '../doc'
|
|
7
|
-
import { defineParagraph } from '../paragraph'
|
|
8
|
-
import { setupTest } from '../testing'
|
|
9
|
-
import { htmlFromMarkdown, markdownFromHTML } from '../testing/markdown'
|
|
10
|
-
import { defineText } from '../text'
|
|
6
|
+
import { defineDoc } from '../doc/index.ts'
|
|
7
|
+
import { defineParagraph } from '../paragraph/index.ts'
|
|
8
|
+
import { setupTest } from '../testing/index.ts'
|
|
9
|
+
import { htmlFromMarkdown, markdownFromHTML } from '../testing/markdown.ts'
|
|
10
|
+
import { defineText } from '../text/index.ts'
|
|
11
11
|
|
|
12
|
-
import { defineList } from './index'
|
|
12
|
+
import { defineList } from './index.ts'
|
|
13
13
|
|
|
14
14
|
describe('defineList', () => {
|
|
15
15
|
it('can add list node', () => {
|
package/src/list/list.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { union, type Union } from '@prosekit/core'
|
|
2
2
|
|
|
3
|
-
import { defineListCommands, type ListCommandsExtension } from './list-commands'
|
|
4
|
-
import { defineListDropIndicator } from './list-drop-indicator'
|
|
5
|
-
import { defineListInputRules } from './list-input-rules'
|
|
6
|
-
import { defineListKeymap } from './list-keymap'
|
|
7
|
-
import { defineListPlugins } from './list-plugins'
|
|
8
|
-
import { defineListSerializer } from './list-serializer'
|
|
9
|
-
import { defineListSpec, type ListSpecExtension } from './list-spec'
|
|
3
|
+
import { defineListCommands, type ListCommandsExtension } from './list-commands.ts'
|
|
4
|
+
import { defineListDropIndicator } from './list-drop-indicator.ts'
|
|
5
|
+
import { defineListInputRules } from './list-input-rules.ts'
|
|
6
|
+
import { defineListKeymap } from './list-keymap.ts'
|
|
7
|
+
import { defineListPlugins } from './list-plugins.ts'
|
|
8
|
+
import { defineListSerializer } from './list-serializer.ts'
|
|
9
|
+
import { defineListSpec, type ListSpecExtension } from './list-spec.ts'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @internal
|
package/src/loro/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { LoroSyncPluginProps, LoroUndoPluginProps } from 'loro-prosemirror'
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
2
|
+
export { defineLoroCommands } from './loro-commands.ts'
|
|
3
|
+
export { defineLoroCursorPlugin, type LoroCursorOptions } from './loro-cursor-plugin.ts'
|
|
4
|
+
export { defineLoroKeymap } from './loro-keymap.ts'
|
|
5
|
+
export { defineLoroSyncPlugin } from './loro-sync-plugin.ts'
|
|
6
|
+
export { defineLoroUndoPlugin } from './loro-undo-plugin.ts'
|
|
7
|
+
export { defineLoro, type LoroExtension, type LoroOptions } from './loro.ts'
|
package/src/loro/loro.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Priority
|
|
1
|
+
import type { Priority } from '@prosekit/core'
|
|
2
|
+
import { union, withPriority, type PlainExtension, type Union } from '@prosekit/core'
|
|
2
3
|
import type {
|
|
3
4
|
CursorAwareness,
|
|
4
5
|
CursorEphemeralStore,
|
|
@@ -8,11 +9,11 @@ import type {
|
|
|
8
9
|
LoroUndoPluginProps,
|
|
9
10
|
} from 'loro-prosemirror'
|
|
10
11
|
|
|
11
|
-
import { defineLoroCommands, type LoroCommandsExtension } from './loro-commands'
|
|
12
|
-
import { defineLoroCursorPlugin } from './loro-cursor-plugin'
|
|
13
|
-
import { defineLoroKeymap } from './loro-keymap'
|
|
14
|
-
import { defineLoroSyncPlugin } from './loro-sync-plugin'
|
|
15
|
-
import { defineLoroUndoPlugin } from './loro-undo-plugin'
|
|
12
|
+
import { defineLoroCommands, type LoroCommandsExtension } from './loro-commands.ts'
|
|
13
|
+
import { defineLoroCursorPlugin } from './loro-cursor-plugin.ts'
|
|
14
|
+
import { defineLoroKeymap } from './loro-keymap.ts'
|
|
15
|
+
import { defineLoroSyncPlugin } from './loro-sync-plugin.ts'
|
|
16
|
+
import { defineLoroUndoPlugin } from './loro-undo-plugin.ts'
|
|
16
17
|
|
|
17
18
|
export interface LoroOptions {
|
|
18
19
|
/**
|
|
@@ -65,6 +66,6 @@ export function defineLoro(options: LoroOptions): LoroExtension {
|
|
|
65
66
|
defineLoroUndoPlugin({ ...undo, doc }),
|
|
66
67
|
defineLoroSyncPlugin({ ...sync, doc }),
|
|
67
68
|
]),
|
|
68
|
-
Priority.high,
|
|
69
|
+
3 satisfies typeof Priority.high,
|
|
69
70
|
)
|
|
70
71
|
}
|
package/src/mark-rule/apply.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { getMarkType, maybeRun, OBJECT_REPLACEMENT_CHARACTER } from '@prosekit/c
|
|
|
2
2
|
import type { Mark, ProseMirrorNode } from '@prosekit/pm/model'
|
|
3
3
|
import type { EditorState, Transaction } from '@prosekit/pm/state'
|
|
4
4
|
|
|
5
|
-
import { getCheckRanges } from './range'
|
|
6
|
-
import type { MarkRuleOptions } from './types'
|
|
5
|
+
import { getCheckRanges } from './range.ts'
|
|
6
|
+
import type { MarkRuleOptions } from './types.ts'
|
|
7
7
|
|
|
8
8
|
type MarkRange = [from: number, to: number, mark: Mark]
|
|
9
9
|
|
package/src/mark-rule/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { defineMarkRule } from './mark-rule'
|
|
2
|
-
export type { MarkRuleOptions } from './types'
|
|
1
|
+
export { defineMarkRule } from './mark-rule.ts'
|
|
2
|
+
export type { MarkRuleOptions } from './types.ts'
|
|
@@ -2,11 +2,11 @@ import { createEditor, defineBaseCommands, defineMarkSpec, elementFromNode, unio
|
|
|
2
2
|
import type { ProseMirrorNode } from '@prosekit/pm/model'
|
|
3
3
|
import { describe, expect, it } from 'vitest'
|
|
4
4
|
|
|
5
|
-
import { defineDoc } from '../doc'
|
|
6
|
-
import { defineParagraph } from '../paragraph'
|
|
7
|
-
import { defineText } from '../text'
|
|
5
|
+
import { defineDoc } from '../doc/index.ts'
|
|
6
|
+
import { defineParagraph } from '../paragraph/index.ts'
|
|
7
|
+
import { defineText } from '../text/index.ts'
|
|
8
8
|
|
|
9
|
-
import { defineMarkRule } from './index'
|
|
9
|
+
import { defineMarkRule } from './index.ts'
|
|
10
10
|
|
|
11
11
|
describe('defineMarkRule', () => {
|
|
12
12
|
const editor = createEditor({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineFacet, defineFacetPayload, pluginFacet, type PlainExtension, type PluginPayload } from '@prosekit/core'
|
|
2
2
|
import { PluginKey, ProseMirrorPlugin, type EditorState, type Transaction } from '@prosekit/pm/state'
|
|
3
3
|
|
|
4
|
-
import { applyMarkRules } from './apply'
|
|
5
|
-
import type { MarkRuleOptions } from './types'
|
|
4
|
+
import { applyMarkRules } from './apply.ts'
|
|
5
|
+
import type { MarkRuleOptions } from './types.ts'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A mark rule is something that can automatically apply marks to text if it
|
package/src/math/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { defineMath, type MathExtension, type MathOptions } from './math'
|
|
2
1
|
export {
|
|
3
2
|
defineMathBlock,
|
|
4
3
|
defineMathBlockEnterRule,
|
|
@@ -8,7 +7,7 @@ export {
|
|
|
8
7
|
type MathBlockOptions,
|
|
9
8
|
type MathBlockSpecExtension,
|
|
10
9
|
type MathBlockViewOptions,
|
|
11
|
-
} from './math-block'
|
|
10
|
+
} from './math-block.ts'
|
|
12
11
|
export {
|
|
13
12
|
defineMathInline,
|
|
14
13
|
defineMathInlineInputRule,
|
|
@@ -18,5 +17,6 @@ export {
|
|
|
18
17
|
type MathInlineOptions,
|
|
19
18
|
type MathInlineSpecExtension,
|
|
20
19
|
type MathInlineViewOptions,
|
|
21
|
-
} from './math-inline'
|
|
22
|
-
export { defineMathPlugin } from './math-plugin'
|
|
20
|
+
} from './math-inline.ts'
|
|
21
|
+
export { defineMathPlugin } from './math-plugin.ts'
|
|
22
|
+
export { defineMath, type MathExtension, type MathOptions } from './math.ts'
|
package/src/math/math-block.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { defineNodeSpec, defineNodeView, union, type Extension, type PlainExtens
|
|
|
2
2
|
import type { Attrs } from '@prosekit/pm/model'
|
|
3
3
|
import { createMathBlockView, mathBlockEnterRule, mathBlockSpec, type RenderMathBlock } from 'prosemirror-math'
|
|
4
4
|
|
|
5
|
-
import { defineEnterRule } from '../enter-rule'
|
|
5
|
+
import { defineEnterRule } from '../enter-rule/index.ts'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
@@ -19,6 +19,13 @@ export type MathBlockSpecExtension = Extension<{
|
|
|
19
19
|
export function defineMathBlockSpec(): MathBlockSpecExtension {
|
|
20
20
|
return defineNodeSpec<'mathBlock', Attrs>({
|
|
21
21
|
...mathBlockSpec,
|
|
22
|
+
attrs: {
|
|
23
|
+
// The language in the `mathBlock` node, useful for syntax highlighting.
|
|
24
|
+
// This library doesn't focus on using the TeX language in a `mathBlock` node,
|
|
25
|
+
// but this is the most common language used for math blocks in rich text
|
|
26
|
+
// editors, so 'tex' is set as the default value.
|
|
27
|
+
language: { default: 'tex', validate: 'string' },
|
|
28
|
+
},
|
|
22
29
|
name: 'mathBlock',
|
|
23
30
|
})
|
|
24
31
|
}
|
package/src/math/math-inline.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { defineNodeSpec, defineNodeView, union, type Extension, type PlainExtens
|
|
|
2
2
|
import type { Attrs } from '@prosekit/pm/model'
|
|
3
3
|
import { createMathInlineInputRule, createMathInlineView, mathInlineSpec, type RenderMathInline } from 'prosemirror-math'
|
|
4
4
|
|
|
5
|
-
import { defineInputRule } from '../input-rule'
|
|
5
|
+
import { defineInputRule } from '../input-rule/index.ts'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|