@kerebron/editor-kits 0.4.26 → 0.4.27
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/package.json +14 -13
- package/assets/AdvancedEditorKit.css +0 -4
- package/assets/CodeEditorKit.css +0 -2
- package/assets/DevAdvancedEditorKit.css +0 -6
- package/esm/AdvancedEditorKit.d.ts +0 -8
- package/esm/AdvancedEditorKit.d.ts.map +0 -1
- package/esm/AdvancedEditorKit.js +0 -27
- package/esm/CodeEditorKit.d.ts +0 -7
- package/esm/CodeEditorKit.d.ts.map +0 -1
- package/esm/CodeEditorKit.js +0 -23
- package/esm/DevAdvancedEditorKit.d.ts +0 -8
- package/esm/DevAdvancedEditorKit.d.ts.map +0 -1
- package/esm/DevAdvancedEditorKit.js +0 -27
- package/esm/LspEditorKit.d.ts +0 -15
- package/esm/LspEditorKit.d.ts.map +0 -1
- package/esm/LspEditorKit.js +0 -54
- package/esm/YjsEditorKit.d.ts +0 -12
- package/esm/YjsEditorKit.d.ts.map +0 -1
- package/esm/YjsEditorKit.js +0 -34
- package/esm/mod.d.ts +0 -1
- package/esm/mod.d.ts.map +0 -1
- package/esm/mod.js +0 -1
- package/esm/package.json +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kerebron/editor-kits",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.27",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"module": "./esm/mod.js",
|
|
6
6
|
"exports": {
|
|
@@ -27,19 +27,20 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"scripts": {},
|
|
30
|
+
"files": [],
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@kerebron/editor": "0.4.
|
|
32
|
-
"@kerebron/extension-basic-editor": "0.4.
|
|
33
|
-
"@kerebron/extension-codejar": "0.4.
|
|
34
|
-
"@kerebron/extension-codemirror": "0.4.
|
|
35
|
-
"@kerebron/extension-dev-toolkit": "0.4.
|
|
36
|
-
"@kerebron/extension-lsp": "0.4.
|
|
37
|
-
"@kerebron/extension-markdown": "0.4.
|
|
38
|
-
"@kerebron/extension-menu": "0.4.
|
|
39
|
-
"@kerebron/extension-menu-legacy": "0.4.
|
|
40
|
-
"@kerebron/extension-odt": "0.4.
|
|
41
|
-
"@kerebron/extension-tables": "0.4.
|
|
42
|
-
"@kerebron/extension-yjs": "0.4.
|
|
32
|
+
"@kerebron/editor": "0.4.27",
|
|
33
|
+
"@kerebron/extension-basic-editor": "0.4.27",
|
|
34
|
+
"@kerebron/extension-codejar": "0.4.27",
|
|
35
|
+
"@kerebron/extension-codemirror": "0.4.27",
|
|
36
|
+
"@kerebron/extension-dev-toolkit": "0.4.27",
|
|
37
|
+
"@kerebron/extension-lsp": "0.4.27",
|
|
38
|
+
"@kerebron/extension-markdown": "0.4.27",
|
|
39
|
+
"@kerebron/extension-menu": "0.4.27",
|
|
40
|
+
"@kerebron/extension-menu-legacy": "0.4.27",
|
|
41
|
+
"@kerebron/extension-odt": "0.4.27",
|
|
42
|
+
"@kerebron/extension-tables": "0.4.27",
|
|
43
|
+
"@kerebron/extension-yjs": "0.4.27",
|
|
43
44
|
"lib0": "0.2.109",
|
|
44
45
|
"thememirror": "2.0.1",
|
|
45
46
|
"y-websocket": "3.0.0",
|
package/assets/CodeEditorKit.css
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
@import '@kerebron/extension-tables/assets/tables.css';
|
|
2
|
-
/*@import '@kerebron/extension-menu/assets/custom-menu.css';*/
|
|
3
|
-
@import '@kerebron/extension-menu-legacy/assets/menu.css';
|
|
4
|
-
@import '@kerebron/extension-codemirror/assets/codemirror.css';
|
|
5
|
-
@import '@kerebron/extension-codejar/assets/codejar.css';
|
|
6
|
-
@import '@kerebron/extension-autocomplete/assets/autocomplete.css';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AnyExtensionOrReq, Extension } from '@kerebron/editor';
|
|
2
|
-
import { ExtensionCustomMenu } from '@kerebron/extension-menu';
|
|
3
|
-
export declare class AdvancedEditorKit extends Extension {
|
|
4
|
-
name: string;
|
|
5
|
-
requires: AnyExtensionOrReq[];
|
|
6
|
-
constructor(menu?: ConstructorParameters<typeof ExtensionCustomMenu>[0]);
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=AdvancedEditorKit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/esm/AdvancedEditorKit.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { dracula } from 'thememirror';
|
|
2
|
-
import { Extension } from '@kerebron/editor';
|
|
3
|
-
import { ExtensionBasicEditor } from '@kerebron/extension-basic-editor/ExtensionBasicEditor';
|
|
4
|
-
import { ExtensionMarkdown } from '@kerebron/extension-markdown';
|
|
5
|
-
import { ExtensionOdt } from '@kerebron/extension-odt';
|
|
6
|
-
import { ExtensionTables } from '@kerebron/extension-tables';
|
|
7
|
-
import { ExtensionDevToolkit } from '@kerebron/extension-dev-toolkit';
|
|
8
|
-
import { ExtensionCustomMenu } from '@kerebron/extension-menu';
|
|
9
|
-
import { ExtensionCodeMirror } from '@kerebron/extension-codemirror';
|
|
10
|
-
export class AdvancedEditorKit extends Extension {
|
|
11
|
-
name = 'advanced-editor';
|
|
12
|
-
requires;
|
|
13
|
-
constructor(menu) {
|
|
14
|
-
super();
|
|
15
|
-
this.requires = [
|
|
16
|
-
new ExtensionBasicEditor(),
|
|
17
|
-
new ExtensionMarkdown(),
|
|
18
|
-
new ExtensionOdt(),
|
|
19
|
-
new ExtensionTables(),
|
|
20
|
-
new ExtensionDevToolkit(),
|
|
21
|
-
new ExtensionCustomMenu(menu),
|
|
22
|
-
new ExtensionCodeMirror({
|
|
23
|
-
theme: [dracula],
|
|
24
|
-
}),
|
|
25
|
-
];
|
|
26
|
-
}
|
|
27
|
-
}
|
package/esm/CodeEditorKit.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/esm/CodeEditorKit.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@kerebron/editor';
|
|
2
|
-
import { ExtensionBasicCodeEditor } from '@kerebron/extension-basic-editor/ExtensionBasicCodeEditor';
|
|
3
|
-
import { ExtensionMarkdown } from '@kerebron/extension-markdown';
|
|
4
|
-
import { ExtensionDevToolkit } from '@kerebron/extension-dev-toolkit';
|
|
5
|
-
// import { ExtensionCodeMirror } from '@kerebron/extension-codemirror';
|
|
6
|
-
import { ExtensionCodeJar } from '@kerebron/extension-codejar';
|
|
7
|
-
export class CodeEditorKit extends Extension {
|
|
8
|
-
name = 'dev-advanced-editor';
|
|
9
|
-
requires;
|
|
10
|
-
constructor(lang) {
|
|
11
|
-
super();
|
|
12
|
-
this.requires = [
|
|
13
|
-
new ExtensionBasicCodeEditor({ lang }),
|
|
14
|
-
new ExtensionMarkdown(),
|
|
15
|
-
new ExtensionDevToolkit(),
|
|
16
|
-
// new ExtensionCodeMirror({
|
|
17
|
-
// languageWhitelist: [lang],
|
|
18
|
-
// readOnly: false,
|
|
19
|
-
// }),
|
|
20
|
-
new ExtensionCodeJar({ lang }),
|
|
21
|
-
];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AnyExtensionOrReq, Extension } from '@kerebron/editor';
|
|
2
|
-
import { ExtensionMenuLegacy } from '@kerebron/extension-menu-legacy';
|
|
3
|
-
export declare class DevAdvancedEditorKit extends Extension {
|
|
4
|
-
name: string;
|
|
5
|
-
requires: AnyExtensionOrReq[];
|
|
6
|
-
constructor(menu?: ConstructorParameters<typeof ExtensionMenuLegacy>[0]);
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=DevAdvancedEditorKit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,27 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@kerebron/editor';
|
|
2
|
-
import { ExtensionBasicEditor } from '@kerebron/extension-basic-editor/ExtensionBasicEditor';
|
|
3
|
-
import { ExtensionMarkdown } from '@kerebron/extension-markdown';
|
|
4
|
-
import { ExtensionOdt } from '@kerebron/extension-odt';
|
|
5
|
-
import { ExtensionTables } from '@kerebron/extension-tables';
|
|
6
|
-
import { ExtensionDevToolkit } from '@kerebron/extension-dev-toolkit';
|
|
7
|
-
import { ExtensionMenuLegacy } from '@kerebron/extension-menu-legacy';
|
|
8
|
-
import { ExtensionCodeJar } from '@kerebron/extension-codejar';
|
|
9
|
-
export class DevAdvancedEditorKit extends Extension {
|
|
10
|
-
name = 'dev-advanced-editor';
|
|
11
|
-
requires;
|
|
12
|
-
constructor(menu) {
|
|
13
|
-
super();
|
|
14
|
-
this.requires = [
|
|
15
|
-
new ExtensionBasicEditor(),
|
|
16
|
-
new ExtensionMarkdown(),
|
|
17
|
-
new ExtensionOdt(),
|
|
18
|
-
new ExtensionTables(),
|
|
19
|
-
new ExtensionDevToolkit(),
|
|
20
|
-
new ExtensionMenuLegacy(menu),
|
|
21
|
-
// new ExtensionCodeMirror({
|
|
22
|
-
// theme: [dracula],
|
|
23
|
-
// }),
|
|
24
|
-
new ExtensionCodeJar(),
|
|
25
|
-
];
|
|
26
|
-
}
|
|
27
|
-
}
|
package/esm/LspEditorKit.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@kerebron/editor';
|
|
2
|
-
import type { AnyExtensionOrReq } from '@kerebron/editor';
|
|
3
|
-
import { type LspTransportGetter } from '@kerebron/extension-lsp';
|
|
4
|
-
export interface LspEditorKitConfig {
|
|
5
|
-
getLspTransport: LspTransportGetter;
|
|
6
|
-
}
|
|
7
|
-
export declare class LspEditorKit extends Extension {
|
|
8
|
-
name: string;
|
|
9
|
-
requires: AnyExtensionOrReq[];
|
|
10
|
-
md: string;
|
|
11
|
-
static createFrom(config?: LspEditorKitConfig): LspEditorKit;
|
|
12
|
-
constructor(config: ConstructorParameters<typeof Extension>[0]);
|
|
13
|
-
created(): void;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=LspEditorKit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/esm/LspEditorKit.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@kerebron/editor';
|
|
2
|
-
import { LspWebSocketTransport } from '@kerebron/extension-lsp/LspWebSocketTransport';
|
|
3
|
-
import { ExtensionLsp } from '@kerebron/extension-lsp';
|
|
4
|
-
const defaultGetLspTransport = (lang) => {
|
|
5
|
-
const protocol = globalThis.location.protocol === 'http:' ? 'ws:' : 'wss:';
|
|
6
|
-
const uri = protocol + '//' + globalThis.location.host + '/lsp';
|
|
7
|
-
switch (lang) {
|
|
8
|
-
case 'json':
|
|
9
|
-
return new LspWebSocketTransport(uri);
|
|
10
|
-
}
|
|
11
|
-
return undefined;
|
|
12
|
-
};
|
|
13
|
-
export class LspEditorKit extends Extension {
|
|
14
|
-
name = 'lsp-kit';
|
|
15
|
-
requires;
|
|
16
|
-
md = '';
|
|
17
|
-
static createFrom(config) {
|
|
18
|
-
return new LspEditorKit(config);
|
|
19
|
-
}
|
|
20
|
-
constructor(config) {
|
|
21
|
-
super(config);
|
|
22
|
-
const getLspTransport = config?.getLspTransport || defaultGetLspTransport;
|
|
23
|
-
this.requires = [
|
|
24
|
-
new ExtensionLsp({ getLspTransport: getLspTransport }),
|
|
25
|
-
];
|
|
26
|
-
}
|
|
27
|
-
created() {
|
|
28
|
-
this.editor.addEventListener('selection', async (ev) => {
|
|
29
|
-
const selection = ev.detail.selection;
|
|
30
|
-
if (selection) {
|
|
31
|
-
const from = Math.min(selection.$anchor.pos, selection.$head.pos);
|
|
32
|
-
const to = Math.max(selection.$anchor.pos, selection.$head.pos);
|
|
33
|
-
// console.log('lsp.sel', from, to);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
this.editor.addEventListener('transaction', async (ev) => {
|
|
37
|
-
// this.lastValue = ev.detail.transaction.doc;
|
|
38
|
-
const buffer = await this.editor.saveDocument('text/x-markdown');
|
|
39
|
-
this.md = new TextDecoder().decode(buffer);
|
|
40
|
-
// this.$emit('input', this.lastValue);
|
|
41
|
-
});
|
|
42
|
-
this.editor.addEventListener('md:output', async (ev) => {
|
|
43
|
-
const output = ev.detail.output;
|
|
44
|
-
const mapping = output
|
|
45
|
-
.getMetas()
|
|
46
|
-
.filter((meta) => +(meta?.item?.map?.length) > 0 && meta?.item?.type === 'text')
|
|
47
|
-
.map((meta) => ({
|
|
48
|
-
pmPos: meta.item?.map?.[0] || -1,
|
|
49
|
-
mdPos: meta.pos,
|
|
50
|
-
item: meta.item,
|
|
51
|
-
}));
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
package/esm/YjsEditorKit.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as Y from 'yjs';
|
|
2
|
-
import { Extension } from '@kerebron/editor';
|
|
3
|
-
import type { AnyExtensionOrReq } from '@kerebron/editor';
|
|
4
|
-
import { YjsProvider } from '@kerebron/extension-yjs';
|
|
5
|
-
export declare class YjsEditorKit extends Extension {
|
|
6
|
-
private ydoc;
|
|
7
|
-
name: string;
|
|
8
|
-
requires: AnyExtensionOrReq[];
|
|
9
|
-
static createFrom(ydoc: Y.Doc, roomId: string): YjsEditorKit;
|
|
10
|
-
constructor(wsProvider: YjsProvider, ydoc: Y.Doc);
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=YjsEditorKit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/esm/YjsEditorKit.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as random from 'lib0/random';
|
|
2
|
-
import { WebsocketProvider } from 'y-websocket';
|
|
3
|
-
import { Extension } from '@kerebron/editor';
|
|
4
|
-
import { userColors } from '@kerebron/extension-yjs/userColors';
|
|
5
|
-
import { ExtensionYjs } from '@kerebron/extension-yjs';
|
|
6
|
-
export class YjsEditorKit extends Extension {
|
|
7
|
-
ydoc;
|
|
8
|
-
name = 'yjs-editor';
|
|
9
|
-
requires;
|
|
10
|
-
static createFrom(ydoc, roomId) {
|
|
11
|
-
const userColor = userColors[random.uint32() % userColors.length];
|
|
12
|
-
if (!roomId) {
|
|
13
|
-
throw new Error('No room id');
|
|
14
|
-
}
|
|
15
|
-
const protocol = globalThis.location.protocol === 'http:' ? 'ws:' : 'wss:';
|
|
16
|
-
const wsProvider = new WebsocketProvider(protocol + '//' + globalThis.location.host + '/yjs', roomId, ydoc);
|
|
17
|
-
wsProvider.on('status', (event) => {
|
|
18
|
-
console.log('wsProvider status', event.status); // logs "connected" or "disconnected"
|
|
19
|
-
});
|
|
20
|
-
wsProvider.awareness.setLocalStateField('user', {
|
|
21
|
-
name: 'Anonymous ' + Math.floor(Math.random() * 100),
|
|
22
|
-
color: userColor.color,
|
|
23
|
-
colorLight: userColor.light,
|
|
24
|
-
});
|
|
25
|
-
return new YjsEditorKit(wsProvider, ydoc);
|
|
26
|
-
}
|
|
27
|
-
constructor(wsProvider, ydoc) {
|
|
28
|
-
super();
|
|
29
|
-
this.ydoc = ydoc;
|
|
30
|
-
this.requires = [
|
|
31
|
-
new ExtensionYjs({ ydoc: this.ydoc, provider: wsProvider }),
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
}
|
package/esm/mod.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=mod.d.ts.map
|
package/esm/mod.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":""}
|
package/esm/mod.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/esm/package.json
DELETED