@kerebron/editor-kits 0.4.8 → 0.4.9
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/AdvancedEditorKit.d.ts.map +1 -0
- package/esm/{editor-kits/src/AdvancedEditorKit.js → AdvancedEditorKit.js} +3 -13
- package/esm/CodeEditorKit.d.ts.map +1 -0
- package/esm/{editor-kits/src/CodeEditorKit.js → CodeEditorKit.js} +3 -13
- package/esm/DevAdvancedEditorKit.d.ts.map +1 -0
- package/esm/{editor-kits/src/DevAdvancedEditorKit.js → DevAdvancedEditorKit.js} +3 -13
- package/esm/LspEditorKit.d.ts.map +1 -0
- package/esm/{editor-kits/src/LspEditorKit.js → LspEditorKit.js} +3 -18
- package/esm/YjsEditorKit.d.ts.map +1 -0
- package/esm/{editor-kits/src/YjsEditorKit.js → YjsEditorKit.js} +4 -18
- package/esm/mod.d.ts +1 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +1 -0
- package/package.json +20 -24
- 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/types.d.ts +0 -18
- package/esm/editor/src/commands/types.d.ts.map +0 -1
- package/esm/editor/src/commands/types.js +0 -1
- 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/mod.d.ts +0 -2
- package/esm/editor/src/plugins/keymap/mod.d.ts.map +0 -1
- package/esm/editor/src/plugins/keymap/mod.js +0 -1
- 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-kits/src/AdvancedEditorKit.d.ts.map +0 -1
- package/esm/editor-kits/src/CodeEditorKit.d.ts.map +0 -1
- package/esm/editor-kits/src/DevAdvancedEditorKit.d.ts.map +0 -1
- package/esm/editor-kits/src/LspEditorKit.d.ts.map +0 -1
- package/esm/editor-kits/src/YjsEditorKit.d.ts.map +0 -1
- package/esm/editor-kits/src/mod.d.ts +0 -5
- package/esm/editor-kits/src/mod.d.ts.map +0 -1
- package/esm/editor-kits/src/mod.js +0 -4
- package/esm/extension-basic-editor/src/ExtensionBaseKeymap.d.ts +0 -7
- package/esm/extension-basic-editor/src/ExtensionBaseKeymap.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/ExtensionBaseKeymap.js +0 -63
- package/esm/extension-basic-editor/src/ExtensionBasicCodeEditor.d.ts +0 -11
- package/esm/extension-basic-editor/src/ExtensionBasicCodeEditor.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/ExtensionBasicCodeEditor.js +0 -71
- package/esm/extension-basic-editor/src/ExtensionDropcursor.d.ts +0 -19
- package/esm/extension-basic-editor/src/ExtensionDropcursor.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/ExtensionDropcursor.js +0 -238
- package/esm/extension-basic-editor/src/ExtensionGapcursor.d.ts +0 -32
- package/esm/extension-basic-editor/src/ExtensionGapcursor.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/ExtensionGapcursor.js +0 -266
- 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/ExtensionSelection.d.ts +0 -11
- package/esm/extension-basic-editor/src/ExtensionSelection.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/ExtensionSelection.js +0 -237
- package/esm/extension-basic-editor/src/NodeDocumentCode.d.ts +0 -7
- package/esm/extension-basic-editor/src/NodeDocumentCode.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/NodeDocumentCode.js +0 -37
- package/esm/extension-basic-editor/src/NodeText.d.ts +0 -7
- package/esm/extension-basic-editor/src/NodeText.d.ts.map +0 -1
- package/esm/extension-basic-editor/src/NodeText.js +0 -17
- 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/{editor-kits/src/AdvancedEditorKit.d.ts → AdvancedEditorKit.d.ts} +0 -0
- /package/esm/{editor-kits/src/CodeEditorKit.d.ts → CodeEditorKit.d.ts} +0 -0
- /package/esm/{editor-kits/src/DevAdvancedEditorKit.d.ts → DevAdvancedEditorKit.d.ts} +0 -0
- /package/esm/{editor-kits/src/LspEditorKit.d.ts → LspEditorKit.d.ts} +0 -0
- /package/esm/{editor-kits/src/YjsEditorKit.d.ts → YjsEditorKit.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdvancedEditorKit.d.ts","sourceRoot":"","sources":["../src/AdvancedEditorKit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAMhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D,qBAAa,iBAAkB,SAAQ,SAAS;IACrC,IAAI,SAAqB;IAClC,QAAQ,EAAE,iBAAiB,EAAE,CAAC;gBAElB,IAAI,CAAC,EAAE,qBAAqB,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAcxE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dracula } from 'thememirror';
|
|
2
2
|
import { Extension } from '@kerebron/editor';
|
|
3
|
-
import { ExtensionBasicEditor } from '@kerebron/extension-basic-editor';
|
|
3
|
+
import { ExtensionBasicEditor } from '@kerebron/extension-basic-editor/ExtensionBasicEditor';
|
|
4
4
|
import { ExtensionMarkdown } from '@kerebron/extension-markdown';
|
|
5
5
|
import { ExtensionOdt } from '@kerebron/extension-odt';
|
|
6
6
|
import { ExtensionTables } from '@kerebron/extension-tables';
|
|
@@ -8,20 +8,10 @@ import { ExtensionDevToolkit } from '@kerebron/extension-dev-toolkit';
|
|
|
8
8
|
import { ExtensionCustomMenu } from '@kerebron/extension-menu';
|
|
9
9
|
import { ExtensionCodeMirror } from '@kerebron/extension-codemirror';
|
|
10
10
|
export class AdvancedEditorKit extends Extension {
|
|
11
|
+
name = 'advanced-editor';
|
|
12
|
+
requires;
|
|
11
13
|
constructor(menu) {
|
|
12
14
|
super();
|
|
13
|
-
Object.defineProperty(this, "name", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: 'advanced-editor'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(this, "requires", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
configurable: true,
|
|
22
|
-
writable: true,
|
|
23
|
-
value: void 0
|
|
24
|
-
});
|
|
25
15
|
this.requires = [
|
|
26
16
|
new ExtensionBasicEditor(),
|
|
27
17
|
new ExtensionMarkdown(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeEditorKit.d.ts","sourceRoot":"","sources":["../src/CodeEditorKit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAOhE,qBAAa,aAAc,SAAQ,SAAS;IACjC,IAAI,SAAyB;IACtC,QAAQ,EAAE,iBAAiB,EAAE,CAAC;gBAElB,IAAI,EAAE,MAAM;CAazB"}
|
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
import { Extension } from '@kerebron/editor';
|
|
2
|
-
import { ExtensionBasicCodeEditor } from '
|
|
2
|
+
import { ExtensionBasicCodeEditor } from '@kerebron/extension-basic-editor/ExtensionBasicCodeEditor';
|
|
3
3
|
import { ExtensionMarkdown } from '@kerebron/extension-markdown';
|
|
4
4
|
import { ExtensionDevToolkit } from '@kerebron/extension-dev-toolkit';
|
|
5
5
|
// import { ExtensionCodeMirror } from '@kerebron/extension-codemirror';
|
|
6
6
|
import { ExtensionCodeJar } from '@kerebron/extension-codejar';
|
|
7
7
|
export class CodeEditorKit extends Extension {
|
|
8
|
+
name = 'dev-advanced-editor';
|
|
9
|
+
requires;
|
|
8
10
|
constructor(lang) {
|
|
9
11
|
super();
|
|
10
|
-
Object.defineProperty(this, "name", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: 'dev-advanced-editor'
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(this, "requires", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
12
|
this.requires = [
|
|
23
13
|
new ExtensionBasicCodeEditor({ lang }),
|
|
24
14
|
new ExtensionMarkdown(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DevAdvancedEditorKit.d.ts","sourceRoot":"","sources":["../src/DevAdvancedEditorKit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAMhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAItE,qBAAa,oBAAqB,SAAQ,SAAS;IACxC,IAAI,SAAyB;IACtC,QAAQ,EAAE,iBAAiB,EAAE,CAAC;gBAElB,IAAI,CAAC,EAAE,qBAAqB,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAexE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Extension } from '@kerebron/editor';
|
|
2
|
-
import { ExtensionBasicEditor } from '@kerebron/extension-basic-editor';
|
|
2
|
+
import { ExtensionBasicEditor } from '@kerebron/extension-basic-editor/ExtensionBasicEditor';
|
|
3
3
|
import { ExtensionMarkdown } from '@kerebron/extension-markdown';
|
|
4
4
|
import { ExtensionOdt } from '@kerebron/extension-odt';
|
|
5
5
|
import { ExtensionTables } from '@kerebron/extension-tables';
|
|
@@ -7,20 +7,10 @@ import { ExtensionDevToolkit } from '@kerebron/extension-dev-toolkit';
|
|
|
7
7
|
import { ExtensionMenuLegacy } from '@kerebron/extension-menu-legacy';
|
|
8
8
|
import { ExtensionCodeJar } from '@kerebron/extension-codejar';
|
|
9
9
|
export class DevAdvancedEditorKit extends Extension {
|
|
10
|
+
name = 'dev-advanced-editor';
|
|
11
|
+
requires;
|
|
10
12
|
constructor(menu) {
|
|
11
13
|
super();
|
|
12
|
-
Object.defineProperty(this, "name", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true,
|
|
16
|
-
value: 'dev-advanced-editor'
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(this, "requires", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: void 0
|
|
23
|
-
});
|
|
24
14
|
this.requires = [
|
|
25
15
|
new ExtensionBasicEditor(),
|
|
26
16
|
new ExtensionMarkdown(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LspEditorKit.d.ts","sourceRoot":"","sources":["../src/LspEditorKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAMhF,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,kBAAkB,CAAC;CACrC;AAeD,qBAAa,YAAa,SAAQ,SAAS;IAChC,IAAI,SAAa;IAC1B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAE9B,EAAE,EAAE,MAAM,CAAM;IAEhB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,kBAAkB;gBAK3C,MAAM,EAAE,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;IAW3C,OAAO;CAkCjB"}
|
|
@@ -11,29 +11,14 @@ const defaultGetLspTransport = (lang) => {
|
|
|
11
11
|
return undefined;
|
|
12
12
|
};
|
|
13
13
|
export class LspEditorKit extends Extension {
|
|
14
|
+
name = 'lsp-kit';
|
|
15
|
+
requires;
|
|
16
|
+
md = '';
|
|
14
17
|
static createFrom(config) {
|
|
15
18
|
return new LspEditorKit(config);
|
|
16
19
|
}
|
|
17
20
|
constructor(config) {
|
|
18
21
|
super(config);
|
|
19
|
-
Object.defineProperty(this, "name", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
configurable: true,
|
|
22
|
-
writable: true,
|
|
23
|
-
value: 'lsp-kit'
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(this, "requires", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: void 0
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(this, "md", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
configurable: true,
|
|
34
|
-
writable: true,
|
|
35
|
-
value: ''
|
|
36
|
-
});
|
|
37
22
|
const getLspTransport = config?.getLspTransport || defaultGetLspTransport;
|
|
38
23
|
this.requires = [
|
|
39
24
|
new ExtensionLsp({ getLspTransport: getLspTransport }),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YjsEditorKit.d.ts","sourceRoot":"","sources":["../src/YjsEditorKit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAgB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEpE,qBAAa,YAAa,SAAQ,SAAS;IA8BJ,OAAO,CAAC,IAAI;IA7BxC,IAAI,SAAgB;IAC7B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAE9B,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM;gBA0BjC,UAAU,EAAE,WAAW,EAAU,IAAI,EAAE,CAAC,CAAC,GAAG;CAOzD"}
|
|
@@ -4,6 +4,9 @@ import { Extension } from '@kerebron/editor';
|
|
|
4
4
|
import { userColors } from '@kerebron/extension-yjs/userColors';
|
|
5
5
|
import { ExtensionYjs } from '@kerebron/extension-yjs';
|
|
6
6
|
export class YjsEditorKit extends Extension {
|
|
7
|
+
ydoc;
|
|
8
|
+
name = 'yjs-editor';
|
|
9
|
+
requires;
|
|
7
10
|
static createFrom(ydoc, roomId) {
|
|
8
11
|
const userColor = userColors[random.uint32() % userColors.length];
|
|
9
12
|
if (!roomId) {
|
|
@@ -23,24 +26,7 @@ export class YjsEditorKit extends Extension {
|
|
|
23
26
|
}
|
|
24
27
|
constructor(wsProvider, ydoc) {
|
|
25
28
|
super();
|
|
26
|
-
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: ydoc
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(this, "name", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: 'yjs-editor'
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(this, "requires", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: true,
|
|
41
|
-
writable: true,
|
|
42
|
-
value: void 0
|
|
43
|
-
});
|
|
29
|
+
this.ydoc = ydoc;
|
|
44
30
|
this.requires = [
|
|
45
31
|
new ExtensionYjs({ ydoc: this.ydoc, provider: wsProvider }),
|
|
46
32
|
];
|
package/esm/mod.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=mod.d.ts.map
|
package/esm/mod.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":""}
|
package/esm/mod.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/package.json
CHANGED
|
@@ -1,47 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kerebron/editor-kits",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"module": "./esm/
|
|
5
|
+
"module": "./esm/mod.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"import": "./esm/
|
|
8
|
+
"import": "./esm/mod.js"
|
|
9
9
|
},
|
|
10
10
|
"./AdvancedEditorKit": {
|
|
11
|
-
"import": "./esm/
|
|
11
|
+
"import": "./esm/AdvancedEditorKit.js"
|
|
12
12
|
},
|
|
13
13
|
"./DevAdvancedEditorKit": {
|
|
14
|
-
"import": "./esm/
|
|
14
|
+
"import": "./esm/DevAdvancedEditorKit.js"
|
|
15
15
|
},
|
|
16
16
|
"./LspEditorKit": {
|
|
17
|
-
"import": "./esm/
|
|
17
|
+
"import": "./esm/LspEditorKit.js"
|
|
18
18
|
},
|
|
19
19
|
"./YjsEditorKit": {
|
|
20
|
-
"import": "./esm/
|
|
20
|
+
"import": "./esm/YjsEditorKit.js"
|
|
21
21
|
},
|
|
22
22
|
"./CodeEditorKit": {
|
|
23
|
-
"import": "./esm/
|
|
23
|
+
"import": "./esm/CodeEditorKit.js"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"scripts": {},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@kerebron/editor": "0.4.
|
|
29
|
-
"@kerebron/extension-basic-editor": "0.4.
|
|
30
|
-
"@kerebron/extension-codejar": "0.4.
|
|
31
|
-
"@kerebron/extension-codemirror": "0.4.
|
|
32
|
-
"@kerebron/extension-dev-toolkit": "0.4.
|
|
33
|
-
"@kerebron/extension-lsp": "0.4.
|
|
34
|
-
"@kerebron/extension-markdown": "0.4.
|
|
35
|
-
"@kerebron/extension-menu": "0.4.
|
|
36
|
-
"@kerebron/extension-menu-legacy": "0.4.
|
|
37
|
-
"@kerebron/extension-odt": "0.4.
|
|
38
|
-
"@kerebron/extension-tables": "0.4.
|
|
39
|
-
"@kerebron/extension-yjs": "0.4.
|
|
28
|
+
"@kerebron/editor": "0.4.9",
|
|
29
|
+
"@kerebron/extension-basic-editor": "0.4.9",
|
|
30
|
+
"@kerebron/extension-codejar": "0.4.9",
|
|
31
|
+
"@kerebron/extension-codemirror": "0.4.9",
|
|
32
|
+
"@kerebron/extension-dev-toolkit": "0.4.9",
|
|
33
|
+
"@kerebron/extension-lsp": "0.4.9",
|
|
34
|
+
"@kerebron/extension-markdown": "0.4.9",
|
|
35
|
+
"@kerebron/extension-menu": "0.4.9",
|
|
36
|
+
"@kerebron/extension-menu-legacy": "0.4.9",
|
|
37
|
+
"@kerebron/extension-odt": "0.4.9",
|
|
38
|
+
"@kerebron/extension-tables": "0.4.9",
|
|
39
|
+
"@kerebron/extension-yjs": "0.4.9",
|
|
40
40
|
"lib0": "0.2.109",
|
|
41
|
-
"prosemirror-model": "1.25.3",
|
|
42
|
-
"prosemirror-state": "1.4.3",
|
|
43
|
-
"prosemirror-transform": "1.10.4",
|
|
44
|
-
"prosemirror-view": "1.40.0",
|
|
45
41
|
"thememirror": "2.0.1",
|
|
46
42
|
"y-websocket": "2.1.0",
|
|
47
43
|
"yjs": "13.6.24"
|
|
@@ -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,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Command, Plugin } from 'prosemirror-state';
|
|
2
|
-
import { EditorView } from 'prosemirror-view';
|
|
3
|
-
export declare class KeymapPlugin extends Plugin {
|
|
4
|
-
constructor(bindings: {
|
|
5
|
-
[key: string]: Command;
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
export declare function keydownHandler(bindings: {
|
|
9
|
-
[key: string]: Command;
|
|
10
|
-
}): (view: EditorView, event: KeyboardEvent) => boolean;
|
|
11
|
-
//# sourceMappingURL=keymap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../../../../../src/editor/src/plugins/keymap/keymap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAyE9C,qBAAa,YAAa,SAAQ,MAAM;gBAC1B,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE;CAGjD;AAKD,wBAAgB,cAAc,CAC5B,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GACnC,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,KAAK,OAAO,CA6BrD"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { Plugin } from 'prosemirror-state';
|
|
2
|
-
import { base, keyName } from './w3c-keyname.js';
|
|
3
|
-
const mac = typeof navigator != 'undefined' &&
|
|
4
|
-
/Mac|iP(hone|[oa]d)/.test(navigator?.platform);
|
|
5
|
-
const windows = typeof navigator != 'undefined' &&
|
|
6
|
-
/Win/.test(navigator?.platform);
|
|
7
|
-
function normalizeKeyName(name) {
|
|
8
|
-
let parts = name.split(/-(?!$)/), result = parts[parts.length - 1];
|
|
9
|
-
if (result == 'Space')
|
|
10
|
-
result = ' ';
|
|
11
|
-
let alt, ctrl, shift, meta;
|
|
12
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
13
|
-
let mod = parts[i];
|
|
14
|
-
if (/^(cmd|meta|m)$/i.test(mod))
|
|
15
|
-
meta = true;
|
|
16
|
-
else if (/^a(lt)?$/i.test(mod))
|
|
17
|
-
alt = true;
|
|
18
|
-
else if (/^(c|ctrl|control)$/i.test(mod))
|
|
19
|
-
ctrl = true;
|
|
20
|
-
else if (/^s(hift)?$/i.test(mod))
|
|
21
|
-
shift = true;
|
|
22
|
-
else if (/^mod$/i.test(mod)) {
|
|
23
|
-
if (mac)
|
|
24
|
-
meta = true;
|
|
25
|
-
else
|
|
26
|
-
ctrl = true;
|
|
27
|
-
}
|
|
28
|
-
else
|
|
29
|
-
throw new Error('Unrecognized modifier name: ' + mod);
|
|
30
|
-
}
|
|
31
|
-
if (alt)
|
|
32
|
-
result = 'Alt-' + result;
|
|
33
|
-
if (ctrl)
|
|
34
|
-
result = 'Ctrl-' + result;
|
|
35
|
-
if (meta)
|
|
36
|
-
result = 'Meta-' + result;
|
|
37
|
-
if (shift)
|
|
38
|
-
result = 'Shift-' + result;
|
|
39
|
-
return result;
|
|
40
|
-
}
|
|
41
|
-
function normalize(map) {
|
|
42
|
-
let copy = Object.create(null);
|
|
43
|
-
for (let prop in map)
|
|
44
|
-
copy[normalizeKeyName(prop)] = map[prop];
|
|
45
|
-
return copy;
|
|
46
|
-
}
|
|
47
|
-
function modifiers(name, event, shift = true) {
|
|
48
|
-
if (event.altKey)
|
|
49
|
-
name = 'Alt-' + name;
|
|
50
|
-
if (event.ctrlKey)
|
|
51
|
-
name = 'Ctrl-' + name;
|
|
52
|
-
if (event.metaKey)
|
|
53
|
-
name = 'Meta-' + name;
|
|
54
|
-
if (shift && event.shiftKey)
|
|
55
|
-
name = 'Shift-' + name;
|
|
56
|
-
return name;
|
|
57
|
-
}
|
|
58
|
-
/// Create a keymap plugin for the given set of bindings.
|
|
59
|
-
///
|
|
60
|
-
/// Bindings should map key names to [command](#commands)-style
|
|
61
|
-
/// functions, which will be called with `(EditorState, dispatch,
|
|
62
|
-
/// EditorView)` arguments, and should return true when they've handled
|
|
63
|
-
/// the key. Note that the view argument isn't part of the command
|
|
64
|
-
/// protocol, but can be used as an escape hatch if a binding needs to
|
|
65
|
-
/// directly interact with the UI.
|
|
66
|
-
///
|
|
67
|
-
/// Key names may be strings like `"Shift-Ctrl-Enter"`—a key
|
|
68
|
-
/// identifier prefixed with zero or more modifiers. Key identifiers
|
|
69
|
-
/// are based on the strings that can appear in
|
|
70
|
-
/// [`KeyEvent.key`](https:///developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).
|
|
71
|
-
/// Use lowercase letters to refer to letter keys (or uppercase letters
|
|
72
|
-
/// if you want shift to be held). You may use `"Space"` as an alias
|
|
73
|
-
/// for the `" "` name.
|
|
74
|
-
///
|
|
75
|
-
/// Modifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or
|
|
76
|
-
/// `a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or
|
|
77
|
-
/// `Meta-`) are recognized. For characters that are created by holding
|
|
78
|
-
/// shift, the `Shift-` prefix is implied, and should not be added
|
|
79
|
-
/// explicitly.
|
|
80
|
-
///
|
|
81
|
-
/// You can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on
|
|
82
|
-
/// other platforms.
|
|
83
|
-
///
|
|
84
|
-
/// You can add multiple keymap plugins to an editor. The order in
|
|
85
|
-
/// which they appear determines their precedence (the ones early in
|
|
86
|
-
/// the array get to dispatch first).
|
|
87
|
-
export class KeymapPlugin extends Plugin {
|
|
88
|
-
constructor(bindings) {
|
|
89
|
-
super({ props: { handleKeyDown: keydownHandler(bindings) } });
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
/// Given a set of bindings (using the same format as
|
|
93
|
-
/// [`keymap`](#keymap.keymap)), return a [keydown
|
|
94
|
-
/// handler](#view.EditorProps.handleKeyDown) that handles them.
|
|
95
|
-
export function keydownHandler(bindings) {
|
|
96
|
-
let map = normalize(bindings);
|
|
97
|
-
return function (view, event) {
|
|
98
|
-
let name = keyName(event), baseName, direct = map[modifiers(name, event)];
|
|
99
|
-
if (direct && direct(view.state, view.dispatch, view))
|
|
100
|
-
return true;
|
|
101
|
-
// A character key
|
|
102
|
-
if (name.length == 1 && name != ' ') {
|
|
103
|
-
if (event.shiftKey) {
|
|
104
|
-
// In case the name was already modified by shift, try looking
|
|
105
|
-
// it up without its shift modifier
|
|
106
|
-
let noShift = map[modifiers(name, event, false)];
|
|
107
|
-
if (noShift && noShift(view.state, view.dispatch, view))
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
if ((event.altKey || event.metaKey || event.ctrlKey) &&
|
|
111
|
-
// Ctrl-Alt may be used for AltGr on Windows
|
|
112
|
-
!(windows && event.ctrlKey && event.altKey) &&
|
|
113
|
-
(baseName = base[event.keyCode]) && baseName != name) {
|
|
114
|
-
// Try falling back to the keyCode when there's a modifier
|
|
115
|
-
// active or the character produced isn't ASCII, and our table
|
|
116
|
-
// produces a different name from the the keyCode. See #668,
|
|
117
|
-
// #1060, #1529.
|
|
118
|
-
let fromCode = map[modifiers(baseName, event)];
|
|
119
|
-
if (fromCode && fromCode(view.state, view.dispatch, view))
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return false;
|
|
124
|
-
};
|
|
125
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../src/editor/src/plugins/keymap/mod.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './keymap.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"w3c-keyname.d.ts","sourceRoot":"","sources":["../../../../../src/editor/src/plugins/keymap/w3c-keyname.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqDvC,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyBxC,CAAC;AAuBF,wBAAgB,OAAO,CAAC,KAAK,EAAE,aAAa,UAmB3C"}
|