@kerebron/extension-codemirror 0.4.4 → 0.4.6
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/esm/{extension-codemirror/src/ExtensionCodeMirror.d.ts → ExtensionCodeMirror.d.ts} +1 -2
- package/esm/ExtensionCodeMirror.d.ts.map +1 -0
- package/esm/{extension-codemirror/src/ExtensionCodeMirror.js → ExtensionCodeMirror.js} +2 -3
- package/esm/{extension-codemirror/src/NodeCodeMirror.d.ts → NodeCodeMirror.d.ts} +3 -3
- package/esm/NodeCodeMirror.d.ts.map +1 -0
- package/esm/{extension-codemirror/src/NodeCodeMirror.js → NodeCodeMirror.js} +2 -2
- package/esm/{extension-codemirror/src/codeMirrorBlockNodeView.d.ts → codeMirrorBlockNodeView.d.ts} +1 -1
- package/esm/codeMirrorBlockNodeView.d.ts.map +1 -0
- package/esm/defaults.d.ts.map +1 -0
- package/esm/languageLoaders.d.ts.map +1 -0
- package/esm/languages.d.ts.map +1 -0
- package/esm/{extension-codemirror/src/lsp → lsp}/LSPExtension.d.ts +2 -2
- package/esm/lsp/LSPExtension.d.ts.map +1 -0
- package/esm/lsp/completion.d.ts.map +1 -0
- package/esm/lsp/hover.d.ts.map +1 -0
- package/esm/lsp/index.d.ts.map +1 -0
- package/esm/{extension-codemirror/src/lsp → lsp}/plugin.d.ts +3 -3
- package/esm/lsp/plugin.d.ts.map +1 -0
- package/esm/{extension-codemirror/src/lsp → lsp}/plugin.js +2 -2
- package/esm/lsp/pos.d.ts.map +1 -0
- package/esm/lsp/text.d.ts.map +1 -0
- package/esm/lsp/theme.d.ts.map +1 -0
- package/esm/remote-selections.d.ts.map +1 -0
- package/esm/{extension-codemirror/src/remote-sync.d.ts → remote-sync.d.ts} +1 -1
- package/esm/remote-sync.d.ts.map +1 -0
- package/esm/{extension-codemirror/src/types.d.ts → types.d.ts} +1 -1
- package/esm/types.d.ts.map +1 -0
- package/esm/{extension-codemirror/src/utils.d.ts → utils.d.ts} +1 -1
- package/esm/utils.d.ts.map +1 -0
- package/package.json +30 -6
- package/esm/_dnt.polyfills.d.ts +0 -101
- package/esm/_dnt.polyfills.d.ts.map +0 -1
- package/esm/_dnt.polyfills.js +0 -127
- package/esm/_dnt.shims.d.ts +0 -2
- package/esm/_dnt.shims.d.ts.map +0 -1
- package/esm/_dnt.shims.js +0 -57
- package/esm/editor/src/CoreEditor.d.ts +0 -40
- package/esm/editor/src/CoreEditor.d.ts.map +0 -1
- package/esm/editor/src/CoreEditor.js +0 -252
- package/esm/editor/src/DummyEditorView.d.ts +0 -60
- package/esm/editor/src/DummyEditorView.d.ts.map +0 -1
- package/esm/editor/src/DummyEditorView.js +0 -277
- package/esm/editor/src/Extension.d.ts +0 -31
- package/esm/editor/src/Extension.d.ts.map +0 -1
- package/esm/editor/src/Extension.js +0 -53
- package/esm/editor/src/ExtensionManager.d.ts +0 -32
- package/esm/editor/src/ExtensionManager.d.ts.map +0 -1
- package/esm/editor/src/ExtensionManager.js +0 -260
- package/esm/editor/src/Mark.d.ts +0 -23
- package/esm/editor/src/Mark.d.ts.map +0 -1
- package/esm/editor/src/Mark.js +0 -51
- package/esm/editor/src/Node.d.ts +0 -32
- package/esm/editor/src/Node.d.ts.map +0 -1
- package/esm/editor/src/Node.js +0 -60
- package/esm/editor/src/commands/CommandManager.d.ts +0 -23
- package/esm/editor/src/commands/CommandManager.d.ts.map +0 -1
- package/esm/editor/src/commands/CommandManager.js +0 -118
- package/esm/editor/src/commands/baseCommandFactories.d.ts +0 -3
- package/esm/editor/src/commands/baseCommandFactories.d.ts.map +0 -1
- package/esm/editor/src/commands/baseCommandFactories.js +0 -836
- package/esm/editor/src/commands/createChainableState.d.ts +0 -3
- package/esm/editor/src/commands/createChainableState.d.ts.map +0 -1
- package/esm/editor/src/commands/createChainableState.js +0 -29
- package/esm/editor/src/commands/keyCommandFactories.d.ts +0 -3
- package/esm/editor/src/commands/keyCommandFactories.d.ts.map +0 -1
- package/esm/editor/src/commands/keyCommandFactories.js +0 -10
- package/esm/editor/src/commands/mod.d.ts +0 -7
- package/esm/editor/src/commands/mod.d.ts.map +0 -1
- package/esm/editor/src/commands/mod.js +0 -76
- package/esm/editor/src/commands/replaceCommandFactories.d.ts +0 -3
- package/esm/editor/src/commands/replaceCommandFactories.d.ts.map +0 -1
- package/esm/editor/src/commands/replaceCommandFactories.js +0 -94
- package/esm/editor/src/commands/types.d.ts +0 -18
- package/esm/editor/src/commands/types.d.ts.map +0 -1
- package/esm/editor/src/mod.d.ts +0 -9
- package/esm/editor/src/mod.d.ts.map +0 -1
- package/esm/editor/src/mod.js +0 -8
- package/esm/editor/src/nodeToTreeString.d.ts +0 -10
- package/esm/editor/src/nodeToTreeString.d.ts.map +0 -1
- package/esm/editor/src/nodeToTreeString.js +0 -74
- package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts +0 -6
- package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts.map +0 -1
- package/esm/editor/src/plugins/TrackSelecionPlugin.js +0 -24
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts +0 -23
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts.map +0 -1
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.js +0 -163
- package/esm/editor/src/plugins/input-rules/mod.d.ts +0 -3
- package/esm/editor/src/plugins/input-rules/mod.d.ts.map +0 -1
- package/esm/editor/src/plugins/input-rules/mod.js +0 -2
- package/esm/editor/src/plugins/input-rules/rulebuilders.d.ts +0 -5
- package/esm/editor/src/plugins/input-rules/rulebuilders.d.ts.map +0 -1
- package/esm/editor/src/plugins/input-rules/rulebuilders.js +0 -50
- package/esm/editor/src/plugins/keymap/keymap.d.ts +0 -11
- package/esm/editor/src/plugins/keymap/keymap.d.ts.map +0 -1
- package/esm/editor/src/plugins/keymap/keymap.js +0 -125
- package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts +0 -4
- package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts.map +0 -1
- package/esm/editor/src/plugins/keymap/w3c-keyname.js +0 -124
- package/esm/editor/src/types.d.ts +0 -52
- package/esm/editor/src/types.d.ts.map +0 -1
- package/esm/editor/src/types.js +0 -1
- package/esm/editor/src/ui.d.ts +0 -15
- package/esm/editor/src/ui.d.ts.map +0 -1
- package/esm/editor/src/ui.js +0 -16
- package/esm/editor/src/utilities/SmartOutput.d.ts +0 -41
- package/esm/editor/src/utilities/SmartOutput.d.ts.map +0 -1
- package/esm/editor/src/utilities/SmartOutput.js +0 -228
- package/esm/editor/src/utilities/createNodeFromContent.d.ts +0 -9
- package/esm/editor/src/utilities/createNodeFromContent.d.ts.map +0 -1
- package/esm/editor/src/utilities/createNodeFromContent.js +0 -32
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts +0 -9
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts.map +0 -1
- package/esm/editor/src/utilities/getHtmlAttributes.js +0 -47
- package/esm/editor/src/utilities/getShadowRoot.d.ts +0 -2
- package/esm/editor/src/utilities/getShadowRoot.d.ts.map +0 -1
- package/esm/editor/src/utilities/getShadowRoot.js +0 -16
- package/esm/editor/src/utilities/mod.d.ts +0 -6
- package/esm/editor/src/utilities/mod.d.ts.map +0 -1
- package/esm/editor/src/utilities/mod.js +0 -5
- package/esm/editor/src/utilities/toRawTextResult.d.ts +0 -3
- package/esm/editor/src/utilities/toRawTextResult.d.ts.map +0 -1
- package/esm/editor/src/utilities/toRawTextResult.js +0 -21
- package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts +0 -8
- package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/AutocompletePlugin.js +0 -232
- package/esm/extension-autocomplete/src/DefaultRenderer.d.ts +0 -17
- package/esm/extension-autocomplete/src/DefaultRenderer.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/DefaultRenderer.js +0 -137
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts +0 -26
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.js +0 -30
- package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts +0 -11
- package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/createDefaultMatcher.js +0 -58
- package/esm/extension-autocomplete/src/createRegexMatcher.d.ts +0 -4
- package/esm/extension-autocomplete/src/createRegexMatcher.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/createRegexMatcher.js +0 -50
- package/esm/extension-autocomplete/src/mod.d.ts +0 -3
- package/esm/extension-autocomplete/src/mod.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/mod.js +0 -2
- package/esm/extension-autocomplete/src/types.d.ts +0 -60
- package/esm/extension-autocomplete/src/types.d.ts.map +0 -1
- package/esm/extension-autocomplete/src/types.js +0 -1
- package/esm/extension-basic-editor/src/ExtensionHtml.d.ts +0 -15
- package/esm/extension-basic-editor/src/ExtensionHtml.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/ExtensionHtml.js +0 -108
- package/esm/extension-basic-editor/src/NodeCodeBlock.d.ts +0 -9
- package/esm/extension-basic-editor/src/NodeCodeBlock.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/NodeCodeBlock.js +0 -58
- package/esm/extension-basic-editor/src/remote-selection/ExtensionRemoteSelection.d.ts +0 -24
- package/esm/extension-basic-editor/src/remote-selection/ExtensionRemoteSelection.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/remote-selection/ExtensionRemoteSelection.js +0 -35
- package/esm/extension-basic-editor/src/remote-selection/remoteSelectionPlugin.d.ts +0 -25
- package/esm/extension-basic-editor/src/remote-selection/remoteSelectionPlugin.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/remote-selection/remoteSelectionPlugin.js +0 -96
- package/esm/extension-codemirror/src/ExtensionCodeMirror.d.ts.map +0 -1
- package/esm/extension-codemirror/src/NodeCodeMirror.d.ts.map +0 -1
- package/esm/extension-codemirror/src/codeMirrorBlockNodeView.d.ts.map +0 -1
- package/esm/extension-codemirror/src/defaults.d.ts.map +0 -1
- package/esm/extension-codemirror/src/languageLoaders.d.ts.map +0 -1
- package/esm/extension-codemirror/src/languages.d.ts.map +0 -1
- package/esm/extension-codemirror/src/lsp/LSPExtension.d.ts.map +0 -1
- package/esm/extension-codemirror/src/lsp/completion.d.ts.map +0 -1
- package/esm/extension-codemirror/src/lsp/hover.d.ts.map +0 -1
- package/esm/extension-codemirror/src/lsp/index.d.ts.map +0 -1
- package/esm/extension-codemirror/src/lsp/plugin.d.ts.map +0 -1
- package/esm/extension-codemirror/src/lsp/pos.d.ts.map +0 -1
- package/esm/extension-codemirror/src/lsp/text.d.ts.map +0 -1
- package/esm/extension-codemirror/src/lsp/theme.d.ts.map +0 -1
- package/esm/extension-codemirror/src/remote-selections.d.ts.map +0 -1
- package/esm/extension-codemirror/src/remote-sync.d.ts.map +0 -1
- package/esm/extension-codemirror/src/types.d.ts.map +0 -1
- package/esm/extension-codemirror/src/types.js +0 -1
- package/esm/extension-codemirror/src/utils.d.ts.map +0 -1
- package/esm/extension-lsp/src/DiagnosticPlugin.d.ts +0 -32
- package/esm/extension-lsp/src/DiagnosticPlugin.d.ts.map +0 -1
- package/esm/extension-lsp/src/DiagnosticPlugin.js +0 -131
- package/esm/extension-lsp/src/ExtensionLsp.d.ts +0 -25
- package/esm/extension-lsp/src/ExtensionLsp.d.ts.map +0 -1
- package/esm/extension-lsp/src/ExtensionLsp.js +0 -126
- package/esm/extension-lsp/src/LSPClient.d.ts +0 -56
- package/esm/extension-lsp/src/LSPClient.d.ts.map +0 -1
- package/esm/extension-lsp/src/LSPClient.js +0 -449
- package/esm/extension-lsp/src/computeIncrementalChanges.d.ts +0 -8
- package/esm/extension-lsp/src/computeIncrementalChanges.d.ts.map +0 -1
- package/esm/extension-lsp/src/computeIncrementalChanges.js +0 -82
- package/esm/extension-lsp/src/createLspAutocomplete.d.ts +0 -23
- package/esm/extension-lsp/src/createLspAutocomplete.d.ts.map +0 -1
- package/esm/extension-lsp/src/createLspAutocomplete.js +0 -68
- package/esm/extension-lsp/src/mod.d.ts +0 -4
- package/esm/extension-lsp/src/mod.d.ts.map +0 -1
- package/esm/extension-lsp/src/mod.js +0 -3
- package/esm/extension-lsp/src/workspace.d.ts +0 -62
- package/esm/extension-lsp/src/workspace.d.ts.map +0 -1
- package/esm/extension-lsp/src/workspace.js +0 -168
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts +0 -36
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts.map +0 -1
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.js +0 -240
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts +0 -26
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts.map +0 -1
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.js +0 -115
- package/esm/extension-markdown/src/ExtensionMarkdown.d.ts +0 -22
- package/esm/extension-markdown/src/ExtensionMarkdown.d.ts.map +0 -1
- package/esm/extension-markdown/src/ExtensionMarkdown.js +0 -48
- package/esm/extension-markdown/src/MarkdownParser.d.ts +0 -61
- package/esm/extension-markdown/src/MarkdownParser.d.ts.map +0 -1
- package/esm/extension-markdown/src/MarkdownParser.js +0 -249
- package/esm/extension-markdown/src/MarkdownSerializer.d.ts +0 -42
- package/esm/extension-markdown/src/MarkdownSerializer.d.ts.map +0 -1
- package/esm/extension-markdown/src/MarkdownSerializer.js +0 -325
- package/esm/extension-markdown/src/PositionMapper.d.ts +0 -15
- package/esm/extension-markdown/src/PositionMapper.d.ts.map +0 -1
- package/esm/extension-markdown/src/PositionMapper.js +0 -100
- package/esm/extension-markdown/src/TokenSource.d.ts +0 -11
- package/esm/extension-markdown/src/TokenSource.d.ts.map +0 -1
- package/esm/extension-markdown/src/TokenSource.js +0 -39
- package/esm/extension-markdown/src/mdToPmConverter.d.ts +0 -5
- package/esm/extension-markdown/src/mdToPmConverter.d.ts.map +0 -1
- package/esm/extension-markdown/src/mdToPmConverter.js +0 -111
- package/esm/extension-markdown/src/pmToMdConverter.d.ts +0 -16
- package/esm/extension-markdown/src/pmToMdConverter.d.ts.map +0 -1
- package/esm/extension-markdown/src/pmToMdConverter.js +0 -433
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts +0 -4
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts.map +0 -1
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.js +0 -151
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts +0 -3
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts.map +0 -1
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.js +0 -34
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts +0 -6
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts.map +0 -1
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.js +0 -380
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts +0 -3
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts.map +0 -1
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.js +0 -323
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts +0 -9
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts.map +0 -1
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.js +0 -308
- package/esm/extension-markdown/src/treeSitterTokenizer.d.ts +0 -5
- package/esm/extension-markdown/src/treeSitterTokenizer.d.ts.map +0 -1
- package/esm/extension-markdown/src/treeSitterTokenizer.js +0 -769
- package/esm/extension-markdown/src/types.d.ts +0 -28
- package/esm/extension-markdown/src/types.d.ts.map +0 -1
- package/esm/extension-markdown/src/types.js +0 -131
- package/esm/extension-markdown/src/utils.d.ts +0 -8
- package/esm/extension-markdown/src/utils.d.ts.map +0 -1
- package/esm/extension-markdown/src/utils.js +0 -86
- package/esm/tree-sitter-shim/src/main.d.ts +0 -15
- package/esm/tree-sitter-shim/src/main.d.ts.map +0 -1
- package/esm/tree-sitter-shim/src/main.js +0 -25
- package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts +0 -6
- package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts.map +0 -1
- package/esm/tree-sitter-shim/src/tree_sitter/node.js +0 -1
- package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts +0 -7
- package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts.map +0 -1
- package/esm/tree-sitter-shim/src/tree_sitter/parser.js +0 -5
- package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts +0 -6
- package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts.map +0 -1
- package/esm/tree-sitter-shim/src/tree_sitter/tree.js +0 -1
- package/esm/wasm/src/mod.d.ts +0 -12
- package/esm/wasm/src/mod.d.ts.map +0 -1
- package/esm/wasm/src/mod.js +0 -48
- package/esm/wasm/wasm.d.ts +0 -138
- package/esm/wasm/wasm.d.ts.map +0 -1
- package/esm/wasm/wasm.js +0 -120
- /package/esm/{extension-codemirror/src/codeMirrorBlockNodeView.js → codeMirrorBlockNodeView.js} +0 -0
- /package/esm/{extension-codemirror/src/defaults.d.ts → defaults.d.ts} +0 -0
- /package/esm/{extension-codemirror/src/defaults.js → defaults.js} +0 -0
- /package/esm/{extension-codemirror/src/languageLoaders.d.ts → languageLoaders.d.ts} +0 -0
- /package/esm/{extension-codemirror/src/languageLoaders.js → languageLoaders.js} +0 -0
- /package/esm/{extension-codemirror/src/languages.d.ts → languages.d.ts} +0 -0
- /package/esm/{extension-codemirror/src/languages.js → languages.js} +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/LSPExtension.js +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/completion.d.ts +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/completion.js +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/hover.d.ts +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/hover.js +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/index.d.ts +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/index.js +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/pos.d.ts +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/pos.js +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/text.d.ts +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/text.js +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/theme.d.ts +0 -0
- /package/esm/{extension-codemirror/src/lsp → lsp}/theme.js +0 -0
- /package/esm/{extension-codemirror/src/remote-selections.d.ts → remote-selections.d.ts} +0 -0
- /package/esm/{extension-codemirror/src/remote-selections.js → remote-selections.js} +0 -0
- /package/esm/{extension-codemirror/src/remote-sync.js → remote-sync.js} +0 -0
- /package/esm/{editor/src/commands/types.js → types.js} +0 -0
- /package/esm/{extension-codemirror/src/utils.js → utils.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createChainableState.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/commands/createChainableState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE7D,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,WAAW,GACjB,WAAW,CA8Bb"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export function createChainableState(transaction, state) {
|
|
2
|
-
let { selection } = transaction;
|
|
3
|
-
let { doc } = transaction;
|
|
4
|
-
let { storedMarks } = transaction;
|
|
5
|
-
return {
|
|
6
|
-
...state,
|
|
7
|
-
apply: state.apply.bind(state),
|
|
8
|
-
applyTransaction: state.applyTransaction.bind(state),
|
|
9
|
-
plugins: state.plugins,
|
|
10
|
-
schema: state.schema,
|
|
11
|
-
reconfigure: state.reconfigure.bind(state),
|
|
12
|
-
toJSON: state.toJSON.bind(state),
|
|
13
|
-
get storedMarks() {
|
|
14
|
-
return storedMarks;
|
|
15
|
-
},
|
|
16
|
-
get selection() {
|
|
17
|
-
return selection;
|
|
18
|
-
},
|
|
19
|
-
get doc() {
|
|
20
|
-
return doc;
|
|
21
|
-
},
|
|
22
|
-
get tr() {
|
|
23
|
-
selection = transaction.selection;
|
|
24
|
-
doc = transaction.doc;
|
|
25
|
-
storedMarks = transaction.storedMarks;
|
|
26
|
-
return transaction;
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyCommandFactories.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/commands/keyCommandFactories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAgB,MAAM,UAAU,CAAC;AAoBxD,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAI9D,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { firstCommand } from './mod.js';
|
|
2
|
-
import { baseCommandFactories } from './baseCommandFactories.js';
|
|
3
|
-
const backspace = firstCommand(baseCommandFactories.deleteSelection(), baseCommandFactories.joinBackward(), baseCommandFactories.selectNodeBackward());
|
|
4
|
-
const del = firstCommand(baseCommandFactories.deleteSelection(), baseCommandFactories.joinForward(), baseCommandFactories.selectNodeForward());
|
|
5
|
-
const enter = firstCommand(baseCommandFactories.newlineInCode(), baseCommandFactories.createParagraphNear(), baseCommandFactories.liftEmptyBlock(), baseCommandFactories.splitBlock());
|
|
6
|
-
export const keyCommandFactories = {
|
|
7
|
-
backspace: () => backspace,
|
|
8
|
-
del: () => del,
|
|
9
|
-
enter: () => enter,
|
|
10
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Node } from 'prosemirror-model';
|
|
2
|
-
import type { Command } from './types.js';
|
|
3
|
-
export * from './types.js';
|
|
4
|
-
export declare function firstCommand(...commands: readonly Command[]): Command;
|
|
5
|
-
export declare function alternativeCommands(...commands: readonly Command[]): Command;
|
|
6
|
-
export declare function autoJoin(command: Command, isJoinable: ((before: Node, after: Node) => boolean) | readonly string[]): Command;
|
|
7
|
-
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/commands/mod.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,cAAc,YAAY,CAAC;AAI3B,wBAAgB,YAAY,CAAC,GAAG,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,CAUrE;AAED,wBAAgB,mBAAmB,CAAC,GAAG,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,CAO5E;AAyDD,wBAAgB,QAAQ,CACtB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,OAAO,CAAC,GAAG,SAAS,MAAM,EAAE,GACvE,OAAO,CAMT"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { canJoin } from 'prosemirror-transform';
|
|
2
|
-
export * from './types.js';
|
|
3
|
-
/// Combine a number of command functions into a single function (which
|
|
4
|
-
/// calls them one by one until one returns true).
|
|
5
|
-
export function firstCommand(...commands) {
|
|
6
|
-
return function (state, dispatch, view) {
|
|
7
|
-
for (let i = 0; i < commands.length; i++) {
|
|
8
|
-
if (commands[i](state, dispatch, view)) {
|
|
9
|
-
console.debug('firstCommand: ', commands[i]);
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return false;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export function alternativeCommands(...commands) {
|
|
17
|
-
return function (state, dispatch, view) {
|
|
18
|
-
for (let i = 0; i < commands.length; i++) {
|
|
19
|
-
if (commands[i](state, dispatch, view))
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function wrapDispatchForJoin(dispatch, isJoinable) {
|
|
26
|
-
return (tr) => {
|
|
27
|
-
if (!tr.isGeneric)
|
|
28
|
-
return dispatch(tr);
|
|
29
|
-
let ranges = [];
|
|
30
|
-
for (let i = 0; i < tr.mapping.maps.length; i++) {
|
|
31
|
-
let map = tr.mapping.maps[i];
|
|
32
|
-
for (let j = 0; j < ranges.length; j++) {
|
|
33
|
-
ranges[j] = map.map(ranges[j]);
|
|
34
|
-
}
|
|
35
|
-
map.forEach((_s, _e, from, to) => ranges.push(from, to));
|
|
36
|
-
}
|
|
37
|
-
// Figure out which joinable points exist inside those ranges,
|
|
38
|
-
// by checking all node boundaries in their parent nodes.
|
|
39
|
-
let joinable = [];
|
|
40
|
-
for (let i = 0; i < ranges.length; i += 2) {
|
|
41
|
-
let from = ranges[i], to = ranges[i + 1];
|
|
42
|
-
let $from = tr.doc.resolve(from), depth = $from.sharedDepth(to), parent = $from.node(depth);
|
|
43
|
-
for (let index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {
|
|
44
|
-
let after = parent.maybeChild(index);
|
|
45
|
-
if (!after)
|
|
46
|
-
break;
|
|
47
|
-
if (index && joinable.indexOf(pos) == -1) {
|
|
48
|
-
let before = parent.child(index - 1);
|
|
49
|
-
if (before.type == after.type && isJoinable(before, after)) {
|
|
50
|
-
joinable.push(pos);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
pos += after.nodeSize;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// Join the joinable points
|
|
57
|
-
joinable.sort((a, b) => a - b);
|
|
58
|
-
for (let i = joinable.length - 1; i >= 0; i--) {
|
|
59
|
-
if (canJoin(tr.doc, joinable[i]))
|
|
60
|
-
tr.join(joinable[i]);
|
|
61
|
-
}
|
|
62
|
-
dispatch(tr);
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
/// Wrap a command so that, when it produces a transform that causes
|
|
66
|
-
/// two joinable nodes to end up next to each other, those are joined.
|
|
67
|
-
/// Nodes are considered joinable when they are of the same type and
|
|
68
|
-
/// when the `isJoinable` predicate returns true for them or, if an
|
|
69
|
-
/// array of strings was passed, if their node type name is in that
|
|
70
|
-
/// array.
|
|
71
|
-
export function autoJoin(command, isJoinable) {
|
|
72
|
-
let canJoin = Array.isArray(isJoinable)
|
|
73
|
-
? (node) => isJoinable.indexOf(node.type.name) > -1
|
|
74
|
-
: isJoinable;
|
|
75
|
-
return (state, dispatch, view) => command(state, dispatch && wrapDispatchForJoin(dispatch, canJoin), view);
|
|
76
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replaceCommandFactories.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/commands/replaceCommandFactories.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,UAAU,CAAC;AAwHxD,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAMlE,CAAC"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { Fragment, Slice } from 'prosemirror-model';
|
|
2
|
-
const replaceRangeText = (range, text) => {
|
|
3
|
-
return (state, dispatch) => {
|
|
4
|
-
const tr = state.tr;
|
|
5
|
-
const from = tr.mapping.map(range.from);
|
|
6
|
-
const to = tr.mapping.map(range.to);
|
|
7
|
-
const frag = Fragment.from(state.schema.text(text));
|
|
8
|
-
const insert = new Slice(frag, 0, 0);
|
|
9
|
-
tr.replace(from, to, insert);
|
|
10
|
-
if (dispatch) {
|
|
11
|
-
dispatch(tr);
|
|
12
|
-
}
|
|
13
|
-
return true;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
const replaceRangeSlice = (range, insert) => {
|
|
17
|
-
return (state, dispatch) => {
|
|
18
|
-
const tr = state.tr;
|
|
19
|
-
const from = tr.mapping.map(range.from);
|
|
20
|
-
const to = tr.mapping.map(range.to);
|
|
21
|
-
tr.replace(from, to, insert);
|
|
22
|
-
if (dispatch) {
|
|
23
|
-
dispatch(tr);
|
|
24
|
-
}
|
|
25
|
-
return true;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
function getTopMostBlockStartForOffset(state, offset) {
|
|
29
|
-
const { doc } = state;
|
|
30
|
-
const $pos = doc.resolve(offset);
|
|
31
|
-
const blockPos = $pos.before($pos.depth);
|
|
32
|
-
if ($pos.depth === 1)
|
|
33
|
-
return blockPos;
|
|
34
|
-
return $pos.start(1);
|
|
35
|
-
}
|
|
36
|
-
function getTopMostBlockEndForOffset(state, offset) {
|
|
37
|
-
const { doc } = state;
|
|
38
|
-
const $pos = doc.resolve(offset);
|
|
39
|
-
return $pos.end(1);
|
|
40
|
-
}
|
|
41
|
-
function getAdjacentTopBlock(state, offset) {
|
|
42
|
-
const { doc } = state;
|
|
43
|
-
if (offset < 0 || offset > doc.content.size) {
|
|
44
|
-
throw new RangeError('Offset is outside the document');
|
|
45
|
-
}
|
|
46
|
-
const $pos = doc.resolve(offset);
|
|
47
|
-
const atBlockStart = $pos.pos === $pos.start($pos.depth);
|
|
48
|
-
if (atBlockStart) {
|
|
49
|
-
return getTopMostBlockStartForOffset(state, offset);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
return getTopMostBlockEndForOffset(state, offset);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const insertBlockBefore = (pos, insert) => {
|
|
56
|
-
return (state, dispatch) => {
|
|
57
|
-
const tr = state.tr;
|
|
58
|
-
const blockPos = getTopMostBlockStartForOffset(state, tr.mapping.map(pos));
|
|
59
|
-
tr.insert(blockPos, insert);
|
|
60
|
-
if (dispatch) {
|
|
61
|
-
dispatch(tr);
|
|
62
|
-
}
|
|
63
|
-
return true;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
const insertBlockAfter = (pos, insert) => {
|
|
67
|
-
return (state, dispatch) => {
|
|
68
|
-
const tr = state.tr;
|
|
69
|
-
const blockPos = getTopMostBlockEndForOffset(state, tr.mapping.map(pos));
|
|
70
|
-
tr.insert(blockPos, insert);
|
|
71
|
-
if (dispatch) {
|
|
72
|
-
dispatch(tr);
|
|
73
|
-
}
|
|
74
|
-
return true;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
const insertBlockSmart = (pos, insert) => {
|
|
78
|
-
return (state, dispatch) => {
|
|
79
|
-
const tr = state.tr;
|
|
80
|
-
const blockPos = getAdjacentTopBlock(state, tr.mapping.map(pos));
|
|
81
|
-
tr.insert(blockPos, insert);
|
|
82
|
-
if (dispatch) {
|
|
83
|
-
dispatch(tr);
|
|
84
|
-
}
|
|
85
|
-
return true;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
export const replaceCommandFactories = {
|
|
89
|
-
replaceRangeText,
|
|
90
|
-
replaceRangeSlice,
|
|
91
|
-
insertBlockBefore,
|
|
92
|
-
insertBlockAfter,
|
|
93
|
-
insertBlockSmart,
|
|
94
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Command } from 'prosemirror-state';
|
|
2
|
-
export { Command };
|
|
3
|
-
export type CommandFactory = (...args: any[]) => Command;
|
|
4
|
-
export interface Commands {
|
|
5
|
-
[name: string]: Command;
|
|
6
|
-
}
|
|
7
|
-
export interface CommandFactories {
|
|
8
|
-
[name: string]: CommandFactory;
|
|
9
|
-
}
|
|
10
|
-
export type CommandShortcuts = {
|
|
11
|
-
[name: string]: string;
|
|
12
|
-
};
|
|
13
|
-
export type ChainedCommands = {
|
|
14
|
-
[Item in keyof Commands]: (...args: unknown[]) => ChainedCommands;
|
|
15
|
-
} & {
|
|
16
|
-
run: () => boolean;
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAEzD,MAAM,WAAW,QAAQ;IACvB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC;CAChC;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,eAAe,GACvB;KACC,IAAI,IAAI,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,eAAe;CAClE,GACC;IACA,GAAG,EAAE,MAAM,OAAO,CAAC;CACpB,CAAC"}
|
package/esm/editor/src/mod.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './CoreEditor.js';
|
|
2
|
-
export * from './Extension.js';
|
|
3
|
-
export * from './Mark.js';
|
|
4
|
-
export * from './Node.js';
|
|
5
|
-
export * from './nodeToTreeString.js';
|
|
6
|
-
export * from './types.js';
|
|
7
|
-
export * from './utilities/SmartOutput.js';
|
|
8
|
-
export * from './ui.js';
|
|
9
|
-
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/editor/src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC"}
|
package/esm/editor/src/mod.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './CoreEditor.js';
|
|
2
|
-
export * from './Extension.js';
|
|
3
|
-
export * from './Mark.js';
|
|
4
|
-
export * from './Node.js';
|
|
5
|
-
export * from './nodeToTreeString.js';
|
|
6
|
-
export * from './types.js';
|
|
7
|
-
export * from './utilities/SmartOutput.js';
|
|
8
|
-
export * from './ui.js';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Node } from 'prosemirror-model';
|
|
2
|
-
import { SmartOutput } from './utilities/SmartOutput.js';
|
|
3
|
-
export interface NodeAndPos {
|
|
4
|
-
node: Node;
|
|
5
|
-
pos: number;
|
|
6
|
-
}
|
|
7
|
-
export declare function nodeToTreeStringOutput(output: SmartOutput<NodeAndPos>, node: Node | Node[] | readonly Node[], level?: number, currentPos?: number): SmartOutput<NodeAndPos> | undefined;
|
|
8
|
-
export declare function nodeToTreeString(node: Node | Node[] | readonly Node[]): string;
|
|
9
|
-
export declare function debugNode(node: Node | Node[]): void;
|
|
10
|
-
//# sourceMappingURL=nodeToTreeString.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeToTreeString.d.ts","sourceRoot":"","sources":["../../../src/editor/src/nodeToTreeString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAYzD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,EAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,SAAS,IAAI,EAAE,EACrC,KAAK,SAAI,EACT,UAAU,SAAI,uCAmEf;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,SAAS,IAAI,EAAE,UAIrE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,QAE5C"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { SmartOutput } from './utilities/SmartOutput.js';
|
|
2
|
-
function trimText(str, maxLen = 20) {
|
|
3
|
-
str = str.replaceAll('\n', '\\n');
|
|
4
|
-
if (str.length <= maxLen) {
|
|
5
|
-
return str;
|
|
6
|
-
}
|
|
7
|
-
return str.slice(0, maxLen) + '...';
|
|
8
|
-
}
|
|
9
|
-
export function nodeToTreeStringOutput(output, node, level = 0, currentPos = 0) {
|
|
10
|
-
let delim = '';
|
|
11
|
-
for (let i = 0; i < level; i++) {
|
|
12
|
-
delim += ' ';
|
|
13
|
-
}
|
|
14
|
-
if (Array.isArray(node)) {
|
|
15
|
-
for (const child of node) {
|
|
16
|
-
output.log(delim, { node: child, pos: currentPos });
|
|
17
|
-
nodeToTreeStringOutput(output, child, level + 1, currentPos);
|
|
18
|
-
// .replace(/\s+$/gm, '') +
|
|
19
|
-
// '\n'
|
|
20
|
-
}
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
// https://prosemirror.net/docs/guide/#doc.indexing
|
|
24
|
-
let line = '';
|
|
25
|
-
// if (node.type) {
|
|
26
|
-
if ('type' in node) {
|
|
27
|
-
line += ` - [${node.type.name}] `;
|
|
28
|
-
// } else {
|
|
29
|
-
// line += ` - `;
|
|
30
|
-
// }
|
|
31
|
-
line += `pos: ${currentPos}, `;
|
|
32
|
-
line += `nodeSize: ${node.nodeSize}, `; // isLeaf ? 1 : 2 + this.content.size
|
|
33
|
-
line += `epos: ${currentPos + node.nodeSize}, `; // isLeaf ? 1 : 2 + this.content.size
|
|
34
|
-
if (node.content) {
|
|
35
|
-
line += `fragment.size: ${node.content.size}, `;
|
|
36
|
-
}
|
|
37
|
-
output.log((delim + line) + '\n', { node, pos: currentPos });
|
|
38
|
-
let marksLine = '';
|
|
39
|
-
if (node.marks) {
|
|
40
|
-
for (const mark of node.marks) {
|
|
41
|
-
marksLine += `(${mark.type.name}), `;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (marksLine) {
|
|
45
|
-
output.log((delim + ' ' + marksLine) + '\n', {
|
|
46
|
-
node,
|
|
47
|
-
pos: currentPos,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if (node.text) {
|
|
51
|
-
output.log((delim + ' "' + trimText(node.text) + '"') + '\n', {
|
|
52
|
-
node,
|
|
53
|
-
pos: currentPos,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
node.forEach((child, offset) => {
|
|
58
|
-
// output +=
|
|
59
|
-
nodeToTreeStringOutput(output, child, level + 1, currentPos + offset + 1);
|
|
60
|
-
// .replace(
|
|
61
|
-
// /\s+$/gm,
|
|
62
|
-
// '',
|
|
63
|
-
// ) + '\n'; // + (node.isLeaf ? 1 : 2)
|
|
64
|
-
});
|
|
65
|
-
return output;
|
|
66
|
-
}
|
|
67
|
-
export function nodeToTreeString(node) {
|
|
68
|
-
const output = new SmartOutput();
|
|
69
|
-
nodeToTreeStringOutput(output, node);
|
|
70
|
-
return output.toString();
|
|
71
|
-
}
|
|
72
|
-
export function debugNode(node) {
|
|
73
|
-
console.debug(nodeToTreeString(node));
|
|
74
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TrackSelecionPlugin.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/plugins/TrackSelecionPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,mBAAoB,SAAQ,MAAM;gBACjC,MAAM,EAAE,UAAU;CAsB/B"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Plugin } from 'prosemirror-state';
|
|
2
|
-
export class TrackSelecionPlugin extends Plugin {
|
|
3
|
-
constructor(editor) {
|
|
4
|
-
super({
|
|
5
|
-
view(editorView) {
|
|
6
|
-
return {
|
|
7
|
-
update(view, prevState) {
|
|
8
|
-
const state = view.state;
|
|
9
|
-
const prevSelection = prevState.selection;
|
|
10
|
-
const selection = state.selection;
|
|
11
|
-
if (!prevSelection.eq(selection)) {
|
|
12
|
-
const event = new CustomEvent('selection', {
|
|
13
|
-
detail: {
|
|
14
|
-
selection,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
editor.dispatchEvent(event);
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Command, EditorState, Plugin, Transaction } from 'prosemirror-state';
|
|
2
|
-
export declare class InputRule {
|
|
3
|
-
readonly match: RegExp;
|
|
4
|
-
handler: (state: EditorState, match: RegExpMatchArray, start: number, end: number) => Transaction | null;
|
|
5
|
-
undoable: boolean;
|
|
6
|
-
inCode: boolean | 'only';
|
|
7
|
-
constructor(match: RegExp, handler: string | ((state: EditorState, match: RegExpMatchArray, start: number, end: number) => Transaction | null), options?: {
|
|
8
|
-
undoable?: boolean;
|
|
9
|
-
inCode?: boolean | 'only';
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
type PluginState = {
|
|
13
|
-
transform: Transaction;
|
|
14
|
-
from: number;
|
|
15
|
-
to: number;
|
|
16
|
-
text: string;
|
|
17
|
-
} | null;
|
|
18
|
-
export declare class InputRulesPlugin extends Plugin<PluginState> {
|
|
19
|
-
constructor(rules: readonly InputRule[]);
|
|
20
|
-
}
|
|
21
|
-
export declare const undoInputRule: Command;
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=InputRulesPlugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InputRulesPlugin.d.ts","sourceRoot":"","sources":["../../../../../src/editor/src/plugins/input-rules/InputRulesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,WAAW,EACX,MAAM,EAEN,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAO3B,qBAAa,SAAS;IA8BlB,QAAQ,CAAC,KAAK,EAAE,MAAM;IA5BxB,OAAO,EAAE,CACP,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,KACR,WAAW,GAAG,IAAI,CAAC;IAGxB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;gBAmBd,KAAK,EAAE,MAAM,EACtB,OAAO,EACH,MAAM,GACN,CAAC,CACD,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,KACR,WAAW,GAAG,IAAI,CAAC,EAC1B,OAAO,GAAE;QAIP,QAAQ,CAAC,EAAE,OAAO,CAAC;QAInB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;KACtB;CAST;AA0BD,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,WAAW,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,IAAI,CAAC;AAKT,qBAAa,gBAAiB,SAAQ,MAAM,CAAC,WAAW,CAAC;gBAC3C,KAAK,EAAE,SAAS,SAAS,EAAE;CAgCxC;AAsCD,eAAO,MAAM,aAAa,EAAE,OA4B3B,CAAC"}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { Plugin, } from 'prosemirror-state';
|
|
2
|
-
/// Input rules are regular expressions describing a piece of text
|
|
3
|
-
/// that, when typed, causes something to happen. This might be
|
|
4
|
-
/// changing two dashes into an emdash, wrapping a paragraph starting
|
|
5
|
-
/// with `"> "` into a blockquote, or something entirely different.
|
|
6
|
-
export class InputRule {
|
|
7
|
-
// :: (RegExp, union<string, (state: EditorState, match: [string], start: number, end: number) → ?Transaction>)
|
|
8
|
-
/// Create an input rule. The rule applies when the user typed
|
|
9
|
-
/// something and the text directly in front of the cursor matches
|
|
10
|
-
/// `match`, which should end with `$`.
|
|
11
|
-
///
|
|
12
|
-
/// The `handler` can be a string, in which case the matched text, or
|
|
13
|
-
/// the first matched group in the regexp, is replaced by that
|
|
14
|
-
/// string.
|
|
15
|
-
///
|
|
16
|
-
/// Or a it can be a function, which will be called with the match
|
|
17
|
-
/// array produced by
|
|
18
|
-
/// [`RegExp.exec`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec),
|
|
19
|
-
/// as well as the start and end of the matched range, and which can
|
|
20
|
-
/// return a [transaction](#state.Transaction) that describes the
|
|
21
|
-
/// rule's effect, or null to indicate the input was not handled.
|
|
22
|
-
constructor(
|
|
23
|
-
/// @internal
|
|
24
|
-
match, handler, options = {}) {
|
|
25
|
-
Object.defineProperty(this, "match", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: match
|
|
30
|
-
});
|
|
31
|
-
/// @internal
|
|
32
|
-
Object.defineProperty(this, "handler", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: void 0
|
|
37
|
-
});
|
|
38
|
-
/// @internal
|
|
39
|
-
Object.defineProperty(this, "undoable", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true,
|
|
43
|
-
value: void 0
|
|
44
|
-
});
|
|
45
|
-
Object.defineProperty(this, "inCode", {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
configurable: true,
|
|
48
|
-
writable: true,
|
|
49
|
-
value: void 0
|
|
50
|
-
});
|
|
51
|
-
this.match = match;
|
|
52
|
-
this.handler = typeof handler == 'string'
|
|
53
|
-
? stringHandler(handler)
|
|
54
|
-
: handler;
|
|
55
|
-
this.undoable = options.undoable !== false;
|
|
56
|
-
this.inCode = options.inCode || false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function stringHandler(string) {
|
|
60
|
-
return function (state, match, start, end) {
|
|
61
|
-
let insert = string;
|
|
62
|
-
if (match[1]) {
|
|
63
|
-
let offset = match[0].lastIndexOf(match[1]);
|
|
64
|
-
insert += match[0].slice(offset + match[1].length);
|
|
65
|
-
start += offset;
|
|
66
|
-
let cutOff = start - end;
|
|
67
|
-
if (cutOff > 0) {
|
|
68
|
-
insert = match[0].slice(offset - cutOff, offset) + insert;
|
|
69
|
-
start = end;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return state.tr.insertText(insert, start, end);
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
const MAX_MATCH = 500;
|
|
76
|
-
/// Create an input rules plugin. When enabled, it will cause text
|
|
77
|
-
/// input that matches any of the given rules to trigger the rule's
|
|
78
|
-
/// action.
|
|
79
|
-
export class InputRulesPlugin extends Plugin {
|
|
80
|
-
constructor(rules) {
|
|
81
|
-
super({
|
|
82
|
-
state: {
|
|
83
|
-
init() {
|
|
84
|
-
return null;
|
|
85
|
-
},
|
|
86
|
-
apply(tr, prev) {
|
|
87
|
-
let stored = tr.getMeta(this);
|
|
88
|
-
if (stored)
|
|
89
|
-
return stored;
|
|
90
|
-
return tr.selectionSet || tr.docChanged ? null : prev;
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
props: {
|
|
94
|
-
handleTextInput(view, from, to, text) {
|
|
95
|
-
return run(view, from, to, text, rules, this);
|
|
96
|
-
},
|
|
97
|
-
handleDOMEvents: {
|
|
98
|
-
compositionend: (view) => {
|
|
99
|
-
setTimeout(() => {
|
|
100
|
-
let { $cursor } = view.state.selection;
|
|
101
|
-
if ($cursor) {
|
|
102
|
-
run(view, $cursor.pos, $cursor.pos, '', rules, this);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
isInputRules: true,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function run(view, from, to, text, rules, plugin) {
|
|
113
|
-
if (view.composing)
|
|
114
|
-
return false;
|
|
115
|
-
let state = view.state, $from = state.doc.resolve(from);
|
|
116
|
-
let textBefore = $from.parent.textBetween(Math.max(0, $from.parentOffset - MAX_MATCH), $from.parentOffset, null, '\ufffc') + text;
|
|
117
|
-
for (let i = 0; i < rules.length; i++) {
|
|
118
|
-
let rule = rules[i];
|
|
119
|
-
if ($from.parent.type.spec.code) {
|
|
120
|
-
if (!rule.inCode)
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
else if (rule.inCode === 'only') {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
let match = rule.match.exec(textBefore);
|
|
127
|
-
let tr = match &&
|
|
128
|
-
rule.handler(state, match, from - (match[0].length - text.length), to);
|
|
129
|
-
if (!tr)
|
|
130
|
-
continue;
|
|
131
|
-
if (rule.undoable)
|
|
132
|
-
tr.setMeta(plugin, { transform: tr, from, to, text });
|
|
133
|
-
view.dispatch(tr);
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
/// This is a command that will undo an input rule, if applying such a
|
|
139
|
-
/// rule was the last thing that the user did.
|
|
140
|
-
export const undoInputRule = (state, dispatch) => {
|
|
141
|
-
let plugins = state.plugins;
|
|
142
|
-
for (let i = 0; i < plugins.length; i++) {
|
|
143
|
-
let plugin = plugins[i], undoable;
|
|
144
|
-
if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {
|
|
145
|
-
if (dispatch) {
|
|
146
|
-
let tr = state.tr, toUndo = undoable.transform;
|
|
147
|
-
for (let j = toUndo.steps.length - 1; j >= 0; j--) {
|
|
148
|
-
tr.step(toUndo.steps[j].invert(toUndo.docs[j]));
|
|
149
|
-
}
|
|
150
|
-
if (undoable.text) {
|
|
151
|
-
let marks = tr.doc.resolve(undoable.from).marks();
|
|
152
|
-
tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
tr.delete(undoable.from, undoable.to);
|
|
156
|
-
}
|
|
157
|
-
dispatch(tr);
|
|
158
|
-
}
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return false;
|
|
163
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../src/editor/src/plugins/input-rules/mod.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Attrs, Node, NodeType } from 'prosemirror-model';
|
|
2
|
-
import { InputRule } from './InputRulesPlugin.js';
|
|
3
|
-
export declare function wrappingInputRule(regexp: RegExp, nodeType: NodeType, getAttrs?: Attrs | null | ((matches: RegExpMatchArray) => Attrs | null), joinPredicate?: (match: RegExpMatchArray, node: Node) => boolean): InputRule;
|
|
4
|
-
export declare function textblockTypeInputRule(regexp: RegExp, nodeType: NodeType, getAttrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null)): InputRule;
|
|
5
|
-
//# sourceMappingURL=rulebuilders.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rulebuilders.d.ts","sourceRoot":"","sources":["../../../../../src/editor/src/plugins/input-rules/rulebuilders.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAiBlD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,GAAE,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,gBAAgB,KAAK,KAAK,GAAG,IAAI,CAAQ,EAC7E,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,aAmBjE;AAQD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,GAAE,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,gBAAgB,KAAK,KAAK,GAAG,IAAI,CAAQ,aAgB5E"}
|