@prosekit/extensions 0.12.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{drop-indicator-B1QHFb5m.js → drop-indicator-B_oMfeVP.js} +11 -10
- package/dist/drop-indicator-B_oMfeVP.js.map +1 -0
- package/dist/{enter-rule-CzWOZF_Z.js → enter-rule-D-p4ykfv.js} +1 -1
- package/dist/enter-rule-D-p4ykfv.js.map +1 -0
- package/dist/{file-DrfcSid-.js → file-iLVR0eM0.js} +3 -3
- package/dist/file-iLVR0eM0.js.map +1 -0
- package/dist/{index-oIc1a2f2.d.ts → index-cp1u4e0e.d.ts} +1 -1
- package/dist/index-cp1u4e0e.d.ts.map +1 -0
- package/dist/{input-rule-dmsb3j6w.js → input-rule-COGr_GBb.js} +1 -1
- package/dist/input-rule-COGr_GBb.js.map +1 -0
- package/dist/list/style.css +5 -5
- package/dist/list/style.css.map +1 -1
- package/dist/{mark-rule-BcLB4Uv2.js → mark-rule-CYe8zk4q.js} +6 -6
- package/dist/mark-rule-CYe8zk4q.js.map +1 -0
- package/dist/{paste-rule-pVb4sqvJ.js → paste-rule-BaDghcaU.js} +7 -7
- package/dist/paste-rule-BaDghcaU.js.map +1 -0
- package/dist/prosekit-extensions-autocomplete.d.ts +11 -3
- package/dist/prosekit-extensions-autocomplete.d.ts.map +1 -1
- package/dist/prosekit-extensions-autocomplete.js +171 -60
- 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 +2 -2
- 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 +1 -1
- package/dist/prosekit-extensions-commit.js.map +1 -1
- package/dist/prosekit-extensions-doc.d.ts +0 -1
- package/dist/prosekit-extensions-doc.d.ts.map +1 -1
- package/dist/prosekit-extensions-doc.js.map +1 -1
- package/dist/prosekit-extensions-drop-cursor.d.ts.map +1 -1
- package/dist/prosekit-extensions-drop-cursor.js.map +1 -1
- package/dist/prosekit-extensions-drop-indicator.d.ts +0 -1
- package/dist/prosekit-extensions-drop-indicator.d.ts.map +1 -1
- package/dist/prosekit-extensions-drop-indicator.js +1 -1
- package/dist/prosekit-extensions-enter-rule.d.ts +0 -1
- package/dist/prosekit-extensions-enter-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-enter-rule.js +1 -1
- package/dist/prosekit-extensions-file.d.ts +1 -1
- package/dist/prosekit-extensions-file.js +1 -1
- package/dist/prosekit-extensions-gap-cursor.d.ts +0 -1
- package/dist/prosekit-extensions-gap-cursor.d.ts.map +1 -1
- package/dist/prosekit-extensions-gap-cursor.js.map +1 -1
- package/dist/prosekit-extensions-hard-break.d.ts.map +1 -1
- package/dist/prosekit-extensions-hard-break.js.map +1 -1
- package/dist/prosekit-extensions-heading.d.ts.map +1 -1
- package/dist/prosekit-extensions-heading.js +7 -7
- package/dist/prosekit-extensions-heading.js.map +1 -1
- package/dist/prosekit-extensions-horizontal-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-horizontal-rule.js +1 -1
- package/dist/prosekit-extensions-horizontal-rule.js.map +1 -1
- package/dist/prosekit-extensions-image.d.ts +9 -2
- package/dist/prosekit-extensions-image.d.ts.map +1 -1
- package/dist/prosekit-extensions-image.js +17 -4
- package/dist/prosekit-extensions-image.js.map +1 -1
- package/dist/prosekit-extensions-input-rule.d.ts +0 -1
- package/dist/prosekit-extensions-input-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-input-rule.js +1 -1
- package/dist/prosekit-extensions-italic.d.ts.map +1 -1
- package/dist/prosekit-extensions-italic.js +1 -1
- package/dist/prosekit-extensions-italic.js.map +1 -1
- package/dist/prosekit-extensions-link.d.ts +0 -1
- package/dist/prosekit-extensions-link.d.ts.map +1 -1
- package/dist/prosekit-extensions-link.js +4 -4
- package/dist/prosekit-extensions-link.js.map +1 -1
- package/dist/prosekit-extensions-list.d.ts +0 -1
- package/dist/prosekit-extensions-list.d.ts.map +1 -1
- package/dist/prosekit-extensions-list.js +3 -3
- package/dist/prosekit-extensions-list.js.map +1 -1
- package/dist/prosekit-extensions-loro.d.ts +16 -17
- package/dist/prosekit-extensions-loro.d.ts.map +1 -1
- package/dist/prosekit-extensions-loro.js +14 -7
- package/dist/prosekit-extensions-loro.js.map +1 -1
- package/dist/prosekit-extensions-mark-rule.d.ts +0 -1
- package/dist/prosekit-extensions-mark-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-mark-rule.js +1 -1
- package/dist/prosekit-extensions-mention.d.ts.map +1 -1
- package/dist/prosekit-extensions-mention.js.map +1 -1
- package/dist/prosekit-extensions-mod-click-prevention.d.ts +0 -1
- package/dist/prosekit-extensions-mod-click-prevention.d.ts.map +1 -1
- package/dist/prosekit-extensions-mod-click-prevention.js.map +1 -1
- package/dist/prosekit-extensions-paragraph.d.ts.map +1 -1
- package/dist/prosekit-extensions-paragraph.js +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 +3 -4
- 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 +3 -3
- package/dist/prosekit-extensions-strike.js.map +1 -1
- package/dist/prosekit-extensions-table.d.ts.map +1 -1
- package/dist/prosekit-extensions-table.js +1 -2
- 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 +6 -6
- 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 +1 -1
- package/dist/prosekit-extensions-yjs.js.map +1 -1
- package/dist/{shiki-highlighter-chunk-rkzofy4z.d.ts → shiki-highlighter-chunk-DNNm2Vow.d.ts} +1 -1
- package/dist/shiki-highlighter-chunk-DNNm2Vow.d.ts.map +1 -0
- package/dist/shiki-highlighter-chunk.d.ts +1 -1
- package/dist/shiki-highlighter-chunk.js.map +1 -1
- package/dist/{table-BRDh_9mG.js → table-4oHfV-Ql.js} +2 -2
- package/dist/table-4oHfV-Ql.js.map +1 -0
- package/package.json +33 -18
- package/src/autocomplete/autocomplete-helpers.ts +19 -14
- package/src/autocomplete/autocomplete-plugin.ts +260 -126
- package/src/autocomplete/autocomplete-rule.ts +3 -3
- package/src/autocomplete/autocomplete.spec.ts +244 -40
- package/src/autocomplete/autocomplete.ts +9 -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 +5 -9
- package/src/blockquote/blockquote-keymap.ts +2 -7
- 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 +7 -36
- package/src/doc/index.ts +1 -4
- package/src/drop-cursor/drop-cursor.ts +1 -4
- package/src/drop-cursor/index.ts +1 -5
- package/src/drop-indicator/drop-indicator-facet.ts +12 -21
- package/src/drop-indicator/index.ts +1 -5
- package/src/enter-rule/index.ts +2 -11
- package/src/file/file-paste-handler.spec.ts +3 -16
- package/src/file/index.ts +3 -16
- package/src/gap-cursor/gap-cursor.ts +1 -4
- package/src/gap-cursor/index.ts +1 -4
- package/src/hard-break/hard-break-commands.ts +1 -5
- package/src/hard-break/hard-break-keymap.spec.ts +6 -12
- 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 +8 -12
- package/src/heading/heading-keymap.ts +7 -14
- 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 +10 -13
- 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 +6 -10
- 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/list/style.css +5 -5
- package/src/loro/index.ts +3 -13
- package/src/loro/loro-commands.ts +2 -8
- package/src/loro/loro-cursor-plugin.ts +21 -21
- package/src/loro/loro-keymap.ts +3 -11
- package/src/loro/loro-sync-plugin.ts +2 -8
- package/src/loro/loro-undo-plugin.ts +2 -8
- package/src/loro/loro.ts +16 -21
- package/src/mark-rule/apply.ts +3 -13
- package/src/mark-rule/mark-rule.spec.ts +2 -13
- package/src/mark-rule/mark-rule.ts +2 -13
- package/src/mark-rule/range.ts +2 -8
- package/src/mark-rule/types.ts +1 -4
- package/src/mention/index.ts +1 -8
- package/src/mod-click-prevention/index.ts +2 -9
- package/src/paragraph/paragraph-commands.ts +1 -5
- package/src/paragraph/paragraph-keymap.ts +2 -5
- 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 +4 -16
- package/src/readonly/index.ts +2 -8
- package/src/search/index.ts +1 -6
- package/src/strike/index.ts +2 -2
- 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 +9 -14
- package/src/testing/keyboard.ts +0 -30
- package/src/text/index.ts +1 -4
- package/src/text-align/index.ts +6 -6
- 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 +3 -11
- package/src/yjs/yjs-sync-plugin.ts +1 -4
- package/src/yjs/yjs-types.ts +10 -0
- package/src/yjs/yjs-undo-plugin.ts +2 -8
- package/src/yjs/yjs.ts +6 -24
- package/dist/drop-indicator-B1QHFb5m.js.map +0 -1
- package/dist/enter-rule-CzWOZF_Z.js.map +0 -1
- package/dist/file-DrfcSid-.js.map +0 -1
- package/dist/index-oIc1a2f2.d.ts.map +0 -1
- package/dist/input-rule-dmsb3j6w.js.map +0 -1
- package/dist/mark-rule-BcLB4Uv2.js.map +0 -1
- package/dist/paste-rule-pVb4sqvJ.js.map +0 -1
- package/dist/shiki-highlighter-chunk-rkzofy4z.d.ts.map +0 -1
- package/dist/table-BRDh_9mG.js.map +0 -1
- package/src/testing/format-html.ts +0 -5
package/src/italic/italic.ts
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
union,
|
|
3
|
-
type Union,
|
|
4
|
-
} from '@prosekit/core'
|
|
1
|
+
import { union, type Union } from '@prosekit/core'
|
|
5
2
|
|
|
6
|
-
import {
|
|
7
|
-
defineItalicCommands,
|
|
8
|
-
type ItalicCommandsExtension,
|
|
9
|
-
} from './italic-commands'
|
|
3
|
+
import { defineItalicCommands, type ItalicCommandsExtension } from './italic-commands'
|
|
10
4
|
import { defineItalicInputRule } from './italic-input-rule'
|
|
11
5
|
import { defineItalicKeymap } from './italic-keymap'
|
|
12
|
-
import {
|
|
13
|
-
defineItalicSpec,
|
|
14
|
-
type ItalicSpecExtension,
|
|
15
|
-
} from './italic-spec'
|
|
6
|
+
import { defineItalicSpec, type ItalicSpecExtension } from './italic-spec'
|
|
16
7
|
|
|
17
8
|
/**
|
|
18
9
|
* @internal
|
package/src/link/index.spec.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from 'vitest'
|
|
6
|
-
import { userEvent } from 'vitest/browser'
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { keyboard } from 'vitest-browser-commands/playwright'
|
|
7
3
|
|
|
8
4
|
import { setupTest } from '../testing'
|
|
5
|
+
import { inputText } from '../testing/keyboard'
|
|
9
6
|
|
|
10
7
|
describe('defineLinkCommands', () => {
|
|
11
8
|
const { editor, n, m } = setupTest()
|
|
@@ -46,11 +43,11 @@ describe('defineLinkCommands', () => {
|
|
|
46
43
|
describe('defineLinkInputRule', () => {
|
|
47
44
|
it('should insert a link after pressing Space', async () => {
|
|
48
45
|
const { editor } = setupTest()
|
|
49
|
-
await
|
|
46
|
+
await inputText('https://example.com')
|
|
50
47
|
expect(editor.view.state.doc.toString()).toMatchInlineSnapshot(
|
|
51
48
|
`"doc(paragraph("https://example.com"))"`,
|
|
52
49
|
)
|
|
53
|
-
await
|
|
50
|
+
await inputText(' ')
|
|
54
51
|
expect(editor.view.state.doc.toString()).toMatchInlineSnapshot(
|
|
55
52
|
`"doc(paragraph(link("https://example.com"), " "))"`,
|
|
56
53
|
)
|
|
@@ -58,15 +55,15 @@ describe('defineLinkInputRule', () => {
|
|
|
58
55
|
|
|
59
56
|
it('should handle a link before a period', async () => {
|
|
60
57
|
const { editor } = setupTest()
|
|
61
|
-
await
|
|
58
|
+
await inputText('https://example.com')
|
|
62
59
|
expect(editor.view.state.doc.toString()).toMatchInlineSnapshot(
|
|
63
60
|
`"doc(paragraph("https://example.com"))"`,
|
|
64
61
|
)
|
|
65
|
-
await
|
|
62
|
+
await inputText('.')
|
|
66
63
|
expect(editor.view.state.doc.toString()).toMatchInlineSnapshot(
|
|
67
64
|
`"doc(paragraph("https://example.com."))"`,
|
|
68
65
|
)
|
|
69
|
-
await
|
|
66
|
+
await inputText(' ')
|
|
70
67
|
expect(editor.view.state.doc.toString()).toMatchInlineSnapshot(
|
|
71
68
|
`"doc(paragraph(link("https://example.com"), ". "))"`,
|
|
72
69
|
)
|
|
@@ -76,11 +73,11 @@ describe('defineLinkInputRule', () => {
|
|
|
76
73
|
describe('defineLinkEnterRule', () => {
|
|
77
74
|
it('should insert a link after pressing Enter', async () => {
|
|
78
75
|
const { editor } = setupTest()
|
|
79
|
-
await
|
|
76
|
+
await inputText('https://example.com')
|
|
80
77
|
expect(editor.view.state.doc.toString()).toMatchInlineSnapshot(
|
|
81
78
|
`"doc(paragraph("https://example.com"))"`,
|
|
82
79
|
)
|
|
83
|
-
await
|
|
80
|
+
await keyboard.press('Enter')
|
|
84
81
|
expect(editor.view.state.doc.toString()).toMatchInlineSnapshot(
|
|
85
82
|
`"doc(paragraph(link("https://example.com")), paragraph)"`,
|
|
86
83
|
)
|
package/src/link/index.ts
CHANGED
|
@@ -17,11 +17,7 @@ import { defineInputRule } from '../input-rule'
|
|
|
17
17
|
import { defineMarkRule } from '../mark-rule'
|
|
18
18
|
|
|
19
19
|
import { defineLinkPasteRule } from './link-paste-rule'
|
|
20
|
-
import {
|
|
21
|
-
LINK_ENTER_RE,
|
|
22
|
-
LINK_INPUT_RE,
|
|
23
|
-
LINK_MARK_RE,
|
|
24
|
-
} from './link-regex'
|
|
20
|
+
import { LINK_ENTER_RE, LINK_INPUT_RE, LINK_MARK_RE } from './link-regex'
|
|
25
21
|
import type { LinkAttrs } from './link-types'
|
|
26
22
|
|
|
27
23
|
export { defineLinkPasteRule }
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from 'vitest'
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
6
2
|
|
|
7
3
|
import { setupTest } from '../testing'
|
|
8
|
-
import {
|
|
9
|
-
pasteHTML,
|
|
10
|
-
pasteText,
|
|
11
|
-
} from '../testing/clipboard'
|
|
4
|
+
import { pasteHTML, pasteText } from '../testing/clipboard'
|
|
12
5
|
|
|
13
6
|
describe('defineLinkPasteRule', () => {
|
|
14
7
|
const { editor, n, m } = setupTest()
|
package/src/list/index.ts
CHANGED
|
@@ -6,20 +6,11 @@ export type {
|
|
|
6
6
|
UnwrapListOptions,
|
|
7
7
|
WrapInListGetAttrs,
|
|
8
8
|
} from 'prosemirror-flat-list'
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
type ListExtension,
|
|
12
|
-
} from './list'
|
|
13
|
-
export {
|
|
14
|
-
defineListCommands,
|
|
15
|
-
type ListCommandsExtension,
|
|
16
|
-
} from './list-commands'
|
|
9
|
+
export { defineList, type ListExtension } from './list'
|
|
10
|
+
export { defineListCommands, type ListCommandsExtension } from './list-commands'
|
|
17
11
|
export { defineListInputRules } from './list-input-rules'
|
|
18
12
|
export { defineListKeymap } from './list-keymap'
|
|
19
13
|
export { defineListPlugins } from './list-plugins'
|
|
20
14
|
export { defineListSerializer } from './list-serializer'
|
|
21
|
-
export {
|
|
22
|
-
defineListSpec,
|
|
23
|
-
type ListSpecExtension,
|
|
24
|
-
} from './list-spec'
|
|
15
|
+
export { defineListSpec, type ListSpecExtension } from './list-spec'
|
|
25
16
|
export type { ListAttrs } from './list-types'
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineCommands,
|
|
3
|
-
insertNode,
|
|
4
|
-
type Extension,
|
|
5
|
-
} from '@prosekit/core'
|
|
1
|
+
import { defineCommands, insertNode, type Extension } from '@prosekit/core'
|
|
6
2
|
import type { Command } from '@prosekit/pm/state'
|
|
7
3
|
import {
|
|
8
4
|
createDedentListCommand as dedentList,
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from 'vitest'
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { keyboard } from 'vitest-browser-commands/playwright'
|
|
6
3
|
|
|
7
4
|
import { setupTest } from '../testing'
|
|
8
|
-
import { pressKey } from '../testing/keyboard'
|
|
9
5
|
|
|
10
6
|
describe('keymap', () => {
|
|
11
7
|
const { editor, n } = setupTest()
|
|
@@ -26,14 +22,14 @@ describe('keymap', () => {
|
|
|
26
22
|
)
|
|
27
23
|
editor.set(doc1)
|
|
28
24
|
|
|
29
|
-
await
|
|
25
|
+
await keyboard.press('ControlOrMeta+]')
|
|
30
26
|
expect(editor.state.doc.toJSON()).toEqual(doc2.toJSON())
|
|
31
|
-
await
|
|
27
|
+
await keyboard.press('ControlOrMeta+[')
|
|
32
28
|
expect(editor.state.doc.toJSON()).toEqual(doc1.toJSON())
|
|
33
29
|
|
|
34
|
-
await
|
|
30
|
+
await keyboard.press('Tab')
|
|
35
31
|
expect(editor.state.doc.toJSON()).toEqual(doc2.toJSON())
|
|
36
|
-
await
|
|
32
|
+
await keyboard.press('Shift+Tab')
|
|
37
33
|
expect(editor.state.doc.toJSON()).toEqual(doc1.toJSON())
|
|
38
34
|
})
|
|
39
35
|
})
|
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/list/style.css
CHANGED
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
|
|
15
15
|
& > .list-marker {
|
|
16
16
|
position: absolute;
|
|
17
|
-
left: 0;
|
|
18
17
|
width: 1.5em;
|
|
19
18
|
width: 1lh;
|
|
20
19
|
height: 1.5em;
|
|
21
20
|
height: 1lh;
|
|
21
|
+
inset-inline-start: 0;
|
|
22
22
|
text-align: center;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
& > .list-content {
|
|
26
|
-
margin-
|
|
27
|
-
margin-
|
|
26
|
+
margin-inline-start: 1.5em;
|
|
27
|
+
margin-inline-start: 1lh;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
&[data-list-kind="bullet"] > .list-marker,
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
|
|
65
65
|
&::before {
|
|
66
66
|
position: absolute;
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
inset-inline-end: calc(100% - 1.5em);
|
|
68
|
+
inset-inline-end: calc(100% - 1lh);
|
|
69
69
|
content: counter(prosemirror-flat-list-counter, decimal) ". ";
|
|
70
70
|
font-variant-numeric: tabular-nums;
|
|
71
71
|
}
|
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,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from '
|
|
5
|
-
import type {
|
|
6
|
-
EditorState,
|
|
7
|
-
Selection,
|
|
8
|
-
} from '@prosekit/pm/state'
|
|
9
|
-
import type { DecorationAttrs } from '@prosekit/pm/view'
|
|
10
|
-
import type { PeerID } from 'loro-crdt'
|
|
11
|
-
import {
|
|
12
|
-
LoroCursorPlugin,
|
|
13
|
-
type CursorAwareness,
|
|
14
|
-
} from 'loro-prosemirror'
|
|
1
|
+
import { definePlugin, type PlainExtension } from '@prosekit/core'
|
|
2
|
+
import type { Plugin } from '@prosekit/pm/state'
|
|
3
|
+
import type { CursorAwareness, CursorEphemeralStore, CursorPluginOptions } from 'loro-prosemirror'
|
|
4
|
+
import { LoroCursorPlugin, LoroEphemeralCursorPlugin } from 'loro-prosemirror'
|
|
15
5
|
|
|
16
|
-
export interface LoroCursorOptions {
|
|
17
|
-
awareness
|
|
18
|
-
|
|
19
|
-
createCursor?: (user: PeerID) => Element
|
|
20
|
-
createSelection?: (user: PeerID) => DecorationAttrs
|
|
6
|
+
export interface LoroCursorOptions extends CursorPluginOptions {
|
|
7
|
+
awareness?: CursorAwareness
|
|
8
|
+
presence?: CursorEphemeralStore
|
|
21
9
|
}
|
|
22
10
|
|
|
23
11
|
export function defineLoroCursorPlugin(
|
|
24
12
|
options: LoroCursorOptions,
|
|
25
13
|
): PlainExtension {
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
return definePlugin(createLoroCursorPlugin(options))
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function createLoroCursorPlugin(options: LoroCursorOptions): Plugin {
|
|
18
|
+
const { awareness, presence, ...rest } = options
|
|
19
|
+
if (awareness && presence) {
|
|
20
|
+
throw new Error('Only one of awareness and presence can be provided')
|
|
21
|
+
} else if (awareness) {
|
|
22
|
+
return LoroCursorPlugin(awareness, rest)
|
|
23
|
+
} else if (presence) {
|
|
24
|
+
return LoroEphemeralCursorPlugin(presence, rest)
|
|
25
|
+
} else {
|
|
26
|
+
throw new Error('Either awareness or presence must be provided')
|
|
27
|
+
}
|
|
28
28
|
}
|
package/src/loro/loro-keymap.ts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
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,
|
|
14
|
-
'
|
|
6
|
+
'Mod-Z': redo,
|
|
15
7
|
}
|
|
16
8
|
|
|
17
9
|
if (!isApple) {
|
|
@@ -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,25 +1,15 @@
|
|
|
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,
|
|
4
|
+
CursorEphemeralStore,
|
|
5
|
+
CursorPluginOptions,
|
|
10
6
|
LoroDocType,
|
|
11
7
|
LoroSyncPluginProps,
|
|
12
8
|
LoroUndoPluginProps,
|
|
13
9
|
} from 'loro-prosemirror'
|
|
14
10
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
type LoroCommandsExtension,
|
|
18
|
-
} from './loro-commands'
|
|
19
|
-
import {
|
|
20
|
-
defineLoroCursorPlugin,
|
|
21
|
-
type LoroCursorOptions,
|
|
22
|
-
} from './loro-cursor-plugin'
|
|
11
|
+
import { defineLoroCommands, type LoroCommandsExtension } from './loro-commands'
|
|
12
|
+
import { defineLoroCursorPlugin } from './loro-cursor-plugin'
|
|
23
13
|
import { defineLoroKeymap } from './loro-keymap'
|
|
24
14
|
import { defineLoroSyncPlugin } from './loro-sync-plugin'
|
|
25
15
|
import { defineLoroUndoPlugin } from './loro-undo-plugin'
|
|
@@ -31,9 +21,14 @@ export interface LoroOptions {
|
|
|
31
21
|
doc: LoroDocType
|
|
32
22
|
|
|
33
23
|
/**
|
|
34
|
-
* The Awareness instance.
|
|
24
|
+
* The (legacy) Awareness instance. One of `awareness` or `presence` must be provided.
|
|
35
25
|
*/
|
|
36
|
-
awareness
|
|
26
|
+
awareness?: CursorAwareness
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The CursorEphemeralStore instance. One of `awareness` or `presence` must be provided.
|
|
30
|
+
*/
|
|
31
|
+
presence?: CursorEphemeralStore
|
|
37
32
|
|
|
38
33
|
/**
|
|
39
34
|
* Extra options for `LoroSyncPlugin`.
|
|
@@ -46,9 +41,9 @@ export interface LoroOptions {
|
|
|
46
41
|
undo?: Omit<LoroUndoPluginProps, 'doc'>
|
|
47
42
|
|
|
48
43
|
/**
|
|
49
|
-
* Extra options for `LoroCursorPlugin`.
|
|
44
|
+
* Extra options for `LoroCursorPlugin` or `LoroEphemeralCursorPlugin`.
|
|
50
45
|
*/
|
|
51
|
-
cursor?:
|
|
46
|
+
cursor?: CursorPluginOptions
|
|
52
47
|
}
|
|
53
48
|
|
|
54
49
|
/**
|
|
@@ -60,13 +55,13 @@ export type LoroExtension = Union<[LoroCommandsExtension, PlainExtension]>
|
|
|
60
55
|
* @public
|
|
61
56
|
*/
|
|
62
57
|
export function defineLoro(options: LoroOptions): LoroExtension {
|
|
63
|
-
const { doc, awareness, sync, undo, cursor } = options
|
|
58
|
+
const { doc, awareness, presence, sync, undo, cursor } = options
|
|
64
59
|
|
|
65
60
|
return withPriority(
|
|
66
61
|
union([
|
|
67
62
|
defineLoroKeymap(),
|
|
68
63
|
defineLoroCommands(),
|
|
69
|
-
defineLoroCursorPlugin({ ...cursor, awareness }),
|
|
64
|
+
defineLoroCursorPlugin({ ...cursor, awareness, presence }),
|
|
70
65
|
defineLoroUndoPlugin({ ...undo, doc }),
|
|
71
66
|
defineLoroSyncPlugin({ ...sync, doc }),
|
|
72
67
|
]),
|