@kerebron/extension-yjs 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +82 -0
  3. package/esm/editor/src/CoreEditor.d.ts +13 -4
  4. package/esm/editor/src/CoreEditor.d.ts.map +1 -1
  5. package/esm/editor/src/CoreEditor.js +64 -12
  6. package/esm/editor/src/Extension.d.ts +6 -1
  7. package/esm/editor/src/Extension.d.ts.map +1 -1
  8. package/esm/editor/src/Extension.js +21 -1
  9. package/esm/editor/src/ExtensionManager.d.ts +5 -6
  10. package/esm/editor/src/ExtensionManager.d.ts.map +1 -1
  11. package/esm/editor/src/ExtensionManager.js +43 -55
  12. package/esm/editor/src/Mark.d.ts +3 -0
  13. package/esm/editor/src/Mark.d.ts.map +1 -1
  14. package/esm/editor/src/Mark.js +11 -0
  15. package/esm/editor/src/Node.d.ts +5 -2
  16. package/esm/editor/src/Node.d.ts.map +1 -1
  17. package/esm/editor/src/Node.js +13 -2
  18. package/esm/editor/src/commands/CommandManager.d.ts +13 -6
  19. package/esm/editor/src/commands/CommandManager.d.ts.map +1 -1
  20. package/esm/editor/src/commands/CommandManager.js +59 -2
  21. package/esm/editor/src/commands/baseCommandFactories.d.ts +3 -0
  22. package/esm/editor/src/commands/baseCommandFactories.d.ts.map +1 -0
  23. package/esm/editor/src/commands/baseCommandFactories.js +836 -0
  24. package/esm/editor/src/commands/keyCommandFactories.d.ts +3 -0
  25. package/esm/editor/src/commands/keyCommandFactories.d.ts.map +1 -0
  26. package/esm/editor/src/commands/keyCommandFactories.js +10 -0
  27. package/esm/editor/src/commands/mod.d.ts +5 -53
  28. package/esm/editor/src/commands/mod.d.ts.map +1 -1
  29. package/esm/editor/src/commands/mod.js +14 -821
  30. package/esm/editor/src/commands/replaceCommandFactories.d.ts +3 -0
  31. package/esm/editor/src/commands/replaceCommandFactories.d.ts.map +1 -0
  32. package/esm/editor/src/commands/replaceCommandFactories.js +94 -0
  33. package/esm/editor/src/commands/types.d.ts +18 -0
  34. package/esm/editor/src/commands/types.d.ts.map +1 -0
  35. package/esm/editor/src/commands/types.js +1 -0
  36. package/esm/editor/src/mod.d.ts +2 -0
  37. package/esm/editor/src/mod.d.ts.map +1 -1
  38. package/esm/editor/src/mod.js +2 -0
  39. package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts +6 -0
  40. package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts.map +1 -0
  41. package/esm/editor/src/plugins/TrackSelecionPlugin.js +24 -0
  42. package/esm/editor/src/types.d.ts +20 -2
  43. package/esm/editor/src/types.d.ts.map +1 -1
  44. package/esm/editor/src/ui.d.ts +15 -0
  45. package/esm/editor/src/ui.d.ts.map +1 -0
  46. package/esm/editor/src/ui.js +16 -0
  47. package/esm/editor/src/utilities/SmartOutput.d.ts +9 -7
  48. package/esm/editor/src/utilities/SmartOutput.d.ts.map +1 -1
  49. package/esm/editor/src/utilities/SmartOutput.js +35 -20
  50. package/esm/extension-basic-editor/src/remote-selection/ExtensionRemoteSelection.d.ts +24 -0
  51. package/esm/extension-basic-editor/src/remote-selection/ExtensionRemoteSelection.d.ts.map +1 -0
  52. package/esm/extension-basic-editor/src/remote-selection/ExtensionRemoteSelection.js +35 -0
  53. package/esm/extension-basic-editor/src/remote-selection/remoteSelectionPlugin.d.ts +25 -0
  54. package/esm/extension-basic-editor/src/remote-selection/remoteSelectionPlugin.d.ts.map +1 -0
  55. package/esm/extension-basic-editor/src/remote-selection/remoteSelectionPlugin.js +96 -0
  56. package/esm/extension-yjs/src/ExtensionYjs.d.ts +9 -4
  57. package/esm/extension-yjs/src/ExtensionYjs.d.ts.map +1 -1
  58. package/esm/extension-yjs/src/ExtensionYjs.js +13 -7
  59. package/esm/extension-yjs/src/convertUtils.d.ts +59 -0
  60. package/esm/extension-yjs/src/convertUtils.d.ts.map +1 -0
  61. package/esm/extension-yjs/src/convertUtils.js +88 -0
  62. package/esm/extension-yjs/src/keys.d.ts +0 -4
  63. package/esm/extension-yjs/src/keys.d.ts.map +1 -1
  64. package/esm/extension-yjs/src/keys.js +0 -4
  65. package/esm/extension-yjs/src/lib.d.ts +15 -0
  66. package/esm/extension-yjs/src/lib.d.ts.map +1 -0
  67. package/esm/extension-yjs/src/lib.js +24 -103
  68. package/esm/extension-yjs/src/yPositionPlugin.d.ts +14 -0
  69. package/esm/extension-yjs/src/yPositionPlugin.d.ts.map +1 -0
  70. package/esm/extension-yjs/src/yPositionPlugin.js +121 -0
  71. package/esm/extension-yjs/src/ySyncPlugin.d.ts +37 -30
  72. package/esm/extension-yjs/src/ySyncPlugin.d.ts.map +1 -1
  73. package/esm/extension-yjs/src/ySyncPlugin.js +99 -77
  74. package/esm/extension-yjs/src/yUndoPlugin.d.ts.map +1 -1
  75. package/esm/extension-yjs/src/yUndoPlugin.js +18 -15
  76. package/esm/package.json +3 -0
  77. package/package.json +2 -2
  78. package/esm/extension-yjs/src/yCursorPlugin.d.ts +0 -29
  79. package/esm/extension-yjs/src/yCursorPlugin.d.ts.map +0 -1
  80. package/esm/extension-yjs/src/yCursorPlugin.js +0 -177
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Permission is hereby granted, free of charge, to any
2
+ person obtaining a copy of this software and associated
3
+ documentation files (the "Software"), to deal in the
4
+ Software without restriction, including without
5
+ limitation the rights to use, copy, modify, merge,
6
+ publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software
8
+ is furnished to do so, subject to the following
9
+ conditions:
10
+
11
+ The above copyright notice and this permission notice
12
+ shall be included in all copies or substantial portions
13
+ of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
18
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
19
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
22
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # Kerebron - Prosemirror based online editor kit
2
+
3
+ ## Watch a Demo
4
+
5
+ <a href="https://youtube.com/shorts/OdJjhAPj-wA?feature=share" target="_blank">
6
+ <img src="https://github.com/user-attachments/assets/b63ec84a-0ed2-4f98-920c-76f6d3215168" alt="Alt Text" width="200">
7
+ </a>
8
+
9
+ ## Playground Demo
10
+
11
+ [playground](https://demo.kerebron.com) - be nice.
12
+
13
+ ## Overview
14
+
15
+ Using vanilla Prosemirror modules is often impossible because of
16
+ incompatibilities.
17
+
18
+ Kerebron forks several prosemirror projects into one monorepo in order to keep
19
+ them in sync.
20
+
21
+ Project is inspired on https://tiptap.dev/, but instead of building wrapper
22
+ around a wrapper it borrows concept of extension and command manager.
23
+
24
+ It has simplified tooling (deno), fewer dependencies and resulting in lower
25
+ number of output npm modules.
26
+
27
+ **Work in progress**
28
+
29
+
30
+ ## Build
31
+
32
+ ### Build static examples and `.wasm` files
33
+
34
+ ```sh
35
+ deno task build
36
+ ```
37
+
38
+ ## Development
39
+
40
+ To start example server:
41
+
42
+ ```sh
43
+ deno task -f server-deno-hono start
44
+ ```
45
+
46
+ ## Examples
47
+
48
+ TODO
49
+
50
+ ### NPM packages are generated using DNT
51
+
52
+ - https://deno.com/blog/publish-esm-cjs-module-dnt - the easiest way to publish
53
+ a hybrid npm module for ESM and CommonJS
54
+ - https://github.com/denoland/dnt
55
+ - https://gaubee.com/article/Publishing-Your-Deno-Project-as-a-Monorepo-using-dnt/
56
+
57
+ To generate npm packages
58
+
59
+ ```sh
60
+ deno -A ./build/build_npm.ts
61
+ ```
62
+
63
+ ## Run through docker
64
+
65
+ ```sh
66
+ docker build . -t editor-test
67
+ docker run -it -p 8000:8000 -v $PWD:/usr/src/app editor-test
68
+ ```
69
+
70
+ ## Prerequisites
71
+
72
+ Install deno
73
+
74
+ ```
75
+ npm install -g deno
76
+ ```
77
+
78
+ Install rust
79
+
80
+ ```
81
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
82
+ ```
@@ -1,19 +1,27 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
2
  import { Node as ProseMirrorNode, Schema } from 'prosemirror-model';
3
- import type { EditorOptions, JSONContent } from './types.js';
3
+ import type { EditorConfig, JSONContent } from './types.js';
4
4
  import { EditorState, Transaction } from 'prosemirror-state';
5
5
  import { DummyEditorView } from './DummyEditorView.js';
6
6
  import { ChainedCommands } from './commands/mod.js';
7
7
  import { Extension } from './Extension.js';
8
+ import { EditorUi } from './ui.js';
8
9
  export declare class CoreEditor extends EventTarget {
9
- readonly options: Partial<EditorOptions>;
10
+ readonly config: Partial<EditorConfig>;
10
11
  private extensionManager;
11
12
  private commandManager;
12
13
  view: EditorView | DummyEditorView;
13
14
  state: EditorState;
14
- constructor(options?: Partial<EditorOptions>);
15
+ ui: EditorUi;
16
+ constructor(config?: Partial<EditorConfig>);
15
17
  getExtension<T extends Extension>(name: string): T | undefined;
16
18
  get schema(): Schema<any, any>;
19
+ get run(): {
20
+ [key: string]: (...args: any[]) => boolean;
21
+ };
22
+ get commandFactories(): {
23
+ [key: string]: import("./commands/types.js").CommandFactory;
24
+ };
17
25
  chain(): ChainedCommands;
18
26
  can(): ChainedCommands;
19
27
  private createView;
@@ -25,7 +33,8 @@ export declare class CoreEditor extends EventTarget {
25
33
  loadDocument(mediaType: string, content: Uint8Array): Promise<void>;
26
34
  saveDocument(mediaType: string): Promise<Uint8Array>;
27
35
  getJSON(): JSONContent;
28
- clone(options?: Partial<EditorOptions>): CoreEditor;
36
+ clone(options?: Partial<EditorConfig>): CoreEditor;
29
37
  debug(doc?: ProseMirrorNode): void;
38
+ destroy(): void;
30
39
  }
31
40
  //# sourceMappingURL=CoreEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CoreEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/src/CoreEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGpE,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAc3C,qBAAa,UAAW,SAAQ,WAAW;IACzC,SAAgB,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAG7C;IACF,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAiB;IAChC,IAAI,EAAG,UAAU,GAAG,eAAe,CAAC;IACpC,KAAK,EAAG,WAAW,CAAC;gBAEf,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM;IA4BhD,YAAY,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAI9D,IAAW,MAAM,qBAEhB;IAEM,KAAK,IAAI,eAAe;IAIxB,GAAG,IAAI,eAAe;IAI7B,OAAO,CAAC,UAAU;IAqBX,mBAAmB,CAAC,WAAW,EAAE,WAAW;IAcnD,OAAO,CAAC,YAAY;IAcb,aAAa;IASb,WAAW,CAAC,OAAO,EAAE,GAAG;IAyBxB,WAAW;IAIL,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU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IAEM,KAAK,IAAI,eAAe;IAIxB,GAAG,IAAI,eAAe;IAI7B,OAAO,CAAC,UAAU;IA8CX,mBAAmB,CAAC,WAAW,EAAE,WAAW;IAsBnD,OAAO,CAAC,YAAY;IAcb,aAAa;IASb,WAAW,CAAC,OAAO,EAAE,GAAG;IAyBxB,WAAW;IAIL,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IA0BnD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAY1D,OAAO,IAAI,WAAW;IAItB,KAAK,CAAC,OAAO,GAAE,OAAO,CAAC,YAAY,CAAM,GAAG,UAAU;IAOtD,KAAK,CAAC,GAAG,CAAC,EAAE,eAAe;IAO3B,OAAO;CAOf"}
@@ -6,6 +6,7 @@ import { CommandManager } from './commands/CommandManager.js';
6
6
  import { nodeToTreeString } from './nodeToTreeString.js';
7
7
  import { DummyEditorView } from './DummyEditorView.js';
8
8
  import { createNodeFromObject } from './utilities/createNodeFromContent.js';
9
+ import { defaultUi } from './ui.js';
9
10
  function ensureDocSchema(doc, schema) {
10
11
  if (doc.type.schema === schema) {
11
12
  return doc;
@@ -14,9 +15,9 @@ function ensureDocSchema(doc, schema) {
14
15
  return ProseMirrorNode.fromJSON(schema, json);
15
16
  }
16
17
  export class CoreEditor extends EventTarget {
17
- constructor(options = {}) {
18
+ constructor(config = {}) {
18
19
  super();
19
- Object.defineProperty(this, "options", {
20
+ Object.defineProperty(this, "config", {
20
21
  enumerable: true,
21
22
  configurable: true,
22
23
  writable: true,
@@ -49,20 +50,27 @@ export class CoreEditor extends EventTarget {
49
50
  writable: true,
50
51
  value: void 0
51
52
  });
52
- this.options = {
53
- ...this.options,
54
- ...options,
53
+ Object.defineProperty(this, "ui", {
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true,
57
+ value: defaultUi(this)
58
+ });
59
+ this.config = {
60
+ ...this.config,
61
+ ...config,
55
62
  };
56
- this.extensionManager = new ExtensionManager(this.options.extensions || [], this);
63
+ this.commandManager = new CommandManager(this);
64
+ this.extensionManager = new ExtensionManager(this.config.extensions || [], this, this.commandManager);
65
+ this.extensionManager.created();
57
66
  // const content = this.options.content ? this.options.content : {
58
67
  // type: this.extensionManager.schema.topNodeType.name,
59
68
  // content: this.extensionManager.schema.topNodeType.spec.EMPTY_DOC,
60
69
  // };
61
- const content = this.options.content
62
- ? this.options.content
70
+ const content = this.config.content
71
+ ? this.config.content
63
72
  : this.extensionManager.schema.topNodeType.spec.EMPTY_DOC;
64
73
  this.createView(content);
65
- this.commandManager = new CommandManager(this, this.extensionManager.commandFactories);
66
74
  this.setupPlugins();
67
75
  }
68
76
  getExtension(name) {
@@ -71,6 +79,12 @@ export class CoreEditor extends EventTarget {
71
79
  get schema() {
72
80
  return this.extensionManager.schema;
73
81
  }
82
+ get run() {
83
+ return this.commandManager.run;
84
+ }
85
+ get commandFactories() {
86
+ return this.commandManager.commandFactories;
87
+ }
74
88
  chain() {
75
89
  return this.commandManager.createChain();
76
90
  }
@@ -80,14 +94,30 @@ export class CoreEditor extends EventTarget {
80
94
  createView(content) {
81
95
  const doc = createNodeFromObject(content, this.schema);
82
96
  this.state = EditorState.create({ doc });
83
- if (this.options.element) {
84
- this.view = new EditorView(this.options.element, {
97
+ if (this.config.element) {
98
+ const view = new EditorView(this.config.element, {
85
99
  state: this.state,
86
100
  attributes: {
87
101
  class: 'kb-editor',
88
102
  },
89
103
  dispatchTransaction: (tx) => this.dispatchTransaction(tx),
90
104
  });
105
+ this.view = view;
106
+ const parent = this.config.element.parentNode;
107
+ if (parent) {
108
+ const observer = new MutationObserver((mutations) => {
109
+ for (const mutation of mutations) {
110
+ for (const removedNode of mutation.removedNodes) {
111
+ if (removedNode.contains(view.dom)) {
112
+ // Editor DOM was removed
113
+ observer.disconnect(); // Prevent multiple calls
114
+ view.destroy();
115
+ return;
116
+ }
117
+ }
118
+ }
119
+ });
120
+ }
91
121
  }
92
122
  else {
93
123
  this.view = new DummyEditorView({
@@ -95,6 +125,13 @@ export class CoreEditor extends EventTarget {
95
125
  dispatchTransaction: (tx) => this.dispatchTransaction(tx),
96
126
  });
97
127
  }
128
+ const event = new CustomEvent('doc:loaded', {
129
+ detail: {
130
+ editor: this,
131
+ doc,
132
+ },
133
+ });
134
+ this.dispatchEvent(event);
98
135
  }
99
136
  dispatchTransaction(transaction) {
100
137
  this.state = this.state.apply(transaction);
@@ -108,6 +145,14 @@ export class CoreEditor extends EventTarget {
108
145
  });
109
146
  this.dispatchEvent(event);
110
147
  }
148
+ if (transaction.docChanged) {
149
+ const event = new CustomEvent('changed', {
150
+ detail: {
151
+ editor: this,
152
+ },
153
+ });
154
+ this.dispatchEvent(event);
155
+ }
111
156
  }
112
157
  setupPlugins() {
113
158
  this.state = this.state.reconfigure({
@@ -188,7 +233,7 @@ export class CoreEditor extends EventTarget {
188
233
  clone(options = {}) {
189
234
  return new CoreEditor({
190
235
  ...options,
191
- extensions: [...(this.options.extensions || [])],
236
+ extensions: [...(this.config.extensions || [])],
192
237
  });
193
238
  }
194
239
  debug(doc) {
@@ -197,4 +242,11 @@ export class CoreEditor extends EventTarget {
197
242
  }
198
243
  console.debug(nodeToTreeString(doc));
199
244
  }
245
+ destroy() {
246
+ const event = new CustomEvent('beforeDestroy', {
247
+ detail: {},
248
+ });
249
+ this.dispatchEvent(event);
250
+ this.view.destroy();
251
+ }
200
252
  }
@@ -15,9 +15,14 @@ export declare abstract class Extension {
15
15
  protected config: Partial<ExtensionConfig>;
16
16
  readonly type = "extension";
17
17
  abstract name: string;
18
+ protected editor: CoreEditor;
19
+ readonly conflicts?: Array<string>;
18
20
  constructor(config?: Partial<ExtensionConfig>);
21
+ setEditor(editor: CoreEditor): void;
22
+ getEditor(): CoreEditor;
23
+ created(): void;
19
24
  getInputRules(): InputRule[];
20
- getProseMirrorPlugins(editor: CoreEditor, schema: Schema): Plugin[];
25
+ getProseMirrorPlugins(): Plugin[];
21
26
  getCommandFactories(editor: CoreEditor): Partial<CommandFactories>;
22
27
  getKeyboardShortcuts(editor: CoreEditor): Partial<CommandShortcuts>;
23
28
  getConverters(editor: CoreEditor, schema: Schema): Record<string, Converter>;
@@ -1 +1 @@
1
- {"version":3,"file":"Extension.d.ts","sourceRoot":"","sources":["../../../src/editor/src/Extension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,WAAW,eAAe;IAE9B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAEnB,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7C,KAAK,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;AAED,8BAAsB,SAAS;IAIV,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC;IAH7D,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEO,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM;IAGlE,aAAa,IAAI,SAAS,EAAE;IAI5B,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;IAInE,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIlE,oBAA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AGlE,SAAS,CAAC,MAAM,EAAE,UAAU;IAI5B,SAAS;IAIT,OAAO;IAGP,aAAa,IAAI,SAAS,EAAE;IAI5B,qBAAqB,IAAI,MAAM,EAAE;IAIjC,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIlE,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAInE,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;IAI5E,SAAS,CAAC,IAAI,EAAE,UAAU;CAE3B"}
@@ -12,11 +12,31 @@ export class Extension {
12
12
  writable: true,
13
13
  value: 'extension'
14
14
  });
15
+ Object.defineProperty(this, "editor", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: void 0
20
+ });
21
+ Object.defineProperty(this, "conflicts", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: void 0
26
+ });
27
+ }
28
+ setEditor(editor) {
29
+ this.editor = editor;
30
+ }
31
+ getEditor() {
32
+ return this.editor;
33
+ }
34
+ created() {
15
35
  }
16
36
  getInputRules() {
17
37
  return [];
18
38
  }
19
- getProseMirrorPlugins(editor, schema) {
39
+ getProseMirrorPlugins() {
20
40
  return [];
21
41
  }
22
42
  getCommandFactories(editor) {
@@ -6,7 +6,7 @@ import { AnyExtension, AnyExtensionOrReq } from './types.js';
6
6
  import { CoreEditor } from './CoreEditor.js';
7
7
  import { Mark } from './Mark.js';
8
8
  import { Node } from './Node.js';
9
- import { CommandFactory } from './commands/mod.js';
9
+ import { type CommandManager } from './commands/CommandManager.js';
10
10
  export declare function findDuplicates(items: any[]): any[];
11
11
  export declare function splitExtensions(extensions: Iterable<AnyExtension>): {
12
12
  baseExtensions: Extension[];
@@ -15,19 +15,18 @@ export declare function splitExtensions(extensions: Iterable<AnyExtension>): {
15
15
  };
16
16
  export declare class ExtensionManager {
17
17
  private editor;
18
+ private commandManager;
18
19
  readonly schema: Schema;
19
20
  private extensions;
20
21
  readonly plugins: Plugin[];
21
22
  readonly nodeViews: Record<string, NodeViewConstructor>;
22
- readonly commandFactories: {
23
- [key: string]: CommandFactory;
24
- };
25
23
  converters: Record<string, Converter>;
26
24
  private debug;
27
- constructor(extensions: AnyExtensionOrReq[], editor: CoreEditor);
25
+ constructor(extensions: AnyExtensionOrReq[], editor: CoreEditor, commandManager: CommandManager);
28
26
  getExtension<T extends Extension>(name: string): T | undefined;
29
- private getPlugins;
27
+ private initPlugins;
30
28
  private setupExtensions;
31
29
  getSchemaByResolvedExtensions(editor: CoreEditor): Schema;
30
+ created(): void;
32
31
  }
33
32
  //# sourceMappingURL=ExtensionManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExtensionManager.d.ts","sourceRoot":"","sources":["../../../src/editor/src/ExtensionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMjC,OAAO,EAGL,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAK3B,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAIlD;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC;;;;EAgBjE;AAED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Ac,EAAE,MAAM,8BAA8B,CAAC;AAGnE,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAIlD;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC;;;;EAgBjE;AAED,qBAAa,gBAAgB;IAazB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,cAAc;IAbxB,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,OAAO,CAAC,UAAU,CAAgC;IAClD,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAM;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAM;IAEtD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAM;IAElD,OAAO,CAAC,KAAK,CAAQ;gBAGnB,UAAU,EAAE,iBAAiB,EAAE,EACvB,MAAM,EAAE,UAAU,EAClB,cAAc,EAAE,cAAc;IAcxC,YAAY,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAY9D,OAAO,CAAC,WAAW;IAkHnB,OAAO,CAAC,eAAe;IAwEvB,6BAA6B,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;IAkDzD,OAAO;CAOR"}
@@ -1,8 +1,9 @@
1
1
  import { Schema } from 'prosemirror-model';
2
2
  import { InputRulesPlugin, } from './plugins/input-rules/InputRulesPlugin.js';
3
3
  import { KeymapPlugin } from './plugins/keymap/keymap.js';
4
- import { chainCommands, } from './commands/mod.js';
4
+ import { firstCommand } from './commands/mod.js';
5
5
  import { addAttributesToSchema } from './utilities/getHtmlAttributes.js';
6
+ import { TrackSelecionPlugin } from './plugins/TrackSelecionPlugin.js';
6
7
  export function findDuplicates(items) {
7
8
  const filtered = items.filter((el, index) => items.indexOf(el) !== index);
8
9
  return Array.from(new Set(filtered));
@@ -18,13 +19,19 @@ export function splitExtensions(extensions) {
18
19
  };
19
20
  }
20
21
  export class ExtensionManager {
21
- constructor(extensions, editor) {
22
+ constructor(extensions, editor, commandManager) {
22
23
  Object.defineProperty(this, "editor", {
23
24
  enumerable: true,
24
25
  configurable: true,
25
26
  writable: true,
26
27
  value: editor
27
28
  });
29
+ Object.defineProperty(this, "commandManager", {
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true,
33
+ value: commandManager
34
+ });
28
35
  Object.defineProperty(this, "schema", {
29
36
  enumerable: true,
30
37
  configurable: true,
@@ -41,7 +48,7 @@ export class ExtensionManager {
41
48
  enumerable: true,
42
49
  configurable: true,
43
50
  writable: true,
44
- value: void 0
51
+ value: []
45
52
  });
46
53
  Object.defineProperty(this, "nodeViews", {
47
54
  enumerable: true,
@@ -49,12 +56,6 @@ export class ExtensionManager {
49
56
  writable: true,
50
57
  value: {}
51
58
  });
52
- Object.defineProperty(this, "commandFactories", {
53
- enumerable: true,
54
- configurable: true,
55
- writable: true,
56
- value: {}
57
- });
58
59
  Object.defineProperty(this, "converters", {
59
60
  enumerable: true,
60
61
  configurable: true,
@@ -76,7 +77,6 @@ export class ExtensionManager {
76
77
  },
77
78
  });
78
79
  editor.dispatchEvent(event);
79
- this.plugins = this.getPlugins();
80
80
  }
81
81
  getExtension(name) {
82
82
  const { nodeExtensions, markExtensions, baseExtensions } = splitExtensions(this.extensions);
@@ -86,43 +86,15 @@ export class ExtensionManager {
86
86
  }
87
87
  }
88
88
  }
89
- getPlugins() {
90
- const plugins = [];
89
+ initPlugins() {
91
90
  const inputRules = [];
92
- const commands = new Map();
93
91
  const keyBindings = new Map();
94
- const mergeCommands = (toInsert, extName) => {
95
- for (const key in toInsert) {
96
- const commandFactory = toInsert[key];
97
- if (!commandFactory) {
98
- continue;
99
- }
100
- if (this.debug) {
101
- const wrappedFactory = (...args) => {
102
- const realCommand = commandFactory(...args);
103
- const command = (state, dispatch, view) => {
104
- if (dispatch) {
105
- console.debug(`Command: ${extName}.${key}`);
106
- }
107
- return realCommand(state, dispatch, view);
108
- };
109
- return command;
110
- };
111
- commands.set(key, wrappedFactory);
112
- this.commandFactories[key] = wrappedFactory;
113
- }
114
- else {
115
- commands.set(key, commandFactory);
116
- this.commandFactories[key] = commandFactory;
117
- }
118
- }
119
- };
120
- function mergeShortcuts(toInsert, extName) {
92
+ const mergeShortcuts = (toInsert, extName) => {
121
93
  for (const key in toInsert) {
122
94
  if (!toInsert[key]) {
123
95
  continue;
124
96
  }
125
- const commandFactory = commands.get(toInsert[key]);
97
+ const commandFactory = this.commandManager.commandFactories[toInsert[key]];
126
98
  if (!commandFactory) {
127
99
  console.warn(`No command constructor: ${toInsert[key]}`);
128
100
  continue;
@@ -130,26 +102,27 @@ export class ExtensionManager {
130
102
  const command = commandFactory();
131
103
  const keyBinding = keyBindings.get(key);
132
104
  if (keyBinding) {
133
- keyBindings.set(key, chainCommands(keyBinding, command));
105
+ keyBindings.set(key, firstCommand(command, keyBinding));
134
106
  }
135
107
  else {
136
108
  keyBindings.set(key, command);
137
109
  }
138
110
  }
139
- }
111
+ };
140
112
  let converters = {};
141
113
  for (const extension of this.extensions) {
114
+ extension.setEditor(this.editor);
142
115
  if (extension.type === 'node') {
143
116
  const nodeType = this.schema.nodes[extension.name];
144
117
  inputRules.push(...extension.getInputRules(nodeType));
145
- plugins.push(...extension.getProseMirrorPlugins(this.editor, this.schema));
146
- mergeCommands(extension.getCommandFactories(this.editor, nodeType), extension.name);
118
+ this.plugins.push(...extension.getProseMirrorPlugins());
119
+ this.commandManager.mergeCommandFactories(extension.getCommandFactories(this.editor, nodeType), extension.name);
147
120
  mergeShortcuts(extension.getKeyboardShortcuts(this.editor), extension.name);
148
121
  converters = {
149
122
  ...converters,
150
123
  ...extension.getConverters(this.editor, this.schema),
151
124
  };
152
- const nodeView = extension.getNodeView();
125
+ const nodeView = extension.getNodeView(this.editor);
153
126
  if (nodeView) {
154
127
  this.nodeViews[extension.name] = nodeView;
155
128
  }
@@ -157,12 +130,12 @@ export class ExtensionManager {
157
130
  if (extension.type === 'mark') {
158
131
  const markType = this.schema.marks[extension.name];
159
132
  inputRules.push(...extension.getInputRules(markType));
160
- mergeCommands(extension.getCommandFactories(this.editor, markType), extension.name);
133
+ this.commandManager.mergeCommandFactories(extension.getCommandFactories(this.editor, markType), extension.name);
161
134
  mergeShortcuts(extension.getKeyboardShortcuts(this.editor), extension.name);
162
135
  }
163
136
  if (extension.type === 'extension') {
164
- plugins.push(...extension.getProseMirrorPlugins(this.editor, this.schema));
165
- mergeCommands(extension.getCommandFactories(this.editor), extension.name);
137
+ this.plugins.push(...extension.getProseMirrorPlugins());
138
+ this.commandManager.mergeCommandFactories(extension.getCommandFactories(this.editor), extension.name);
166
139
  mergeShortcuts(extension.getKeyboardShortcuts(this.editor), extension.name);
167
140
  converters = {
168
141
  ...converters,
@@ -180,13 +153,13 @@ export class ExtensionManager {
180
153
  console.debug(`Key: ${key}`);
181
154
  return true;
182
155
  };
183
- keyBindings.set(key, chainCommands(wrapperCommand, keyBinding));
156
+ keyBindings.set(key, firstCommand(wrapperCommand, keyBinding));
184
157
  }
185
158
  }
186
159
  this.converters = converters;
187
- plugins.push(new InputRulesPlugin(inputRules));
188
- plugins.push(new KeymapPlugin(Object.fromEntries(keyBindings)));
189
- return plugins;
160
+ this.plugins.push(new InputRulesPlugin(inputRules));
161
+ this.plugins.push(new KeymapPlugin(Object.fromEntries(keyBindings)));
162
+ this.plugins.push(new TrackSelecionPlugin(this.editor));
190
163
  }
191
164
  setupExtensions(extensions) {
192
165
  const allExtensions = new Map();
@@ -218,7 +191,7 @@ export class ExtensionManager {
218
191
  if (!initialized.has(require)) {
219
192
  const requiredExtension = allExtensions.get(require);
220
193
  if (!requiredExtension) {
221
- throw new Error('Required extension not found: ' + require);
194
+ throw new Error(`Required extension for (${'name' in extension ? extension.name : extension}) not found: ${require}`);
222
195
  }
223
196
  recursiveInitializeExtension(requiredExtension);
224
197
  }
@@ -240,6 +213,15 @@ export class ExtensionManager {
240
213
  }
241
214
  getSchemaByResolvedExtensions(editor) {
242
215
  const { nodeExtensions, markExtensions, baseExtensions } = splitExtensions(this.extensions);
216
+ for (const extension of baseExtensions) {
217
+ if (Array.isArray(extension.conflicts)) {
218
+ for (const name of extension.conflicts) {
219
+ if (this.getExtension(name)) {
220
+ throw new Error(`Extension conflict: ${extension.name} vs ${name}`);
221
+ }
222
+ }
223
+ }
224
+ }
243
225
  const nodes = {};
244
226
  for (const extension of nodeExtensions) {
245
227
  nodes[extension.name] = extension.getNodeSpec();
@@ -251,7 +233,7 @@ export class ExtensionManager {
251
233
  addAttributesToSchema(marks[extension.name], extension);
252
234
  }
253
235
  const spec = {
254
- topNode: this.editor.options.topNode || 'doc',
236
+ topNode: this.editor.config.topNode || 'doc',
255
237
  nodes,
256
238
  marks,
257
239
  };
@@ -269,4 +251,10 @@ export class ExtensionManager {
269
251
  editor.dispatchEvent(event);
270
252
  return new Schema(spec);
271
253
  }
254
+ created() {
255
+ this.initPlugins();
256
+ for (const extension of this.extensions) {
257
+ extension.created();
258
+ }
259
+ }
272
260
  }
@@ -10,8 +10,11 @@ export declare abstract class Mark {
10
10
  protected config: Partial<MarkConfig>;
11
11
  readonly type = "mark";
12
12
  name: string;
13
+ protected editor: CoreEditor;
13
14
  readonly attributes: Record<string, Attribute<any>>;
14
15
  constructor(config?: Partial<MarkConfig>);
16
+ setEditor(editor: CoreEditor): void;
17
+ created(): void;
15
18
  getMarkSpec(): MarkSpec;
16
19
  getInputRules(type: MarkType): InputRule[];
17
20
  getCommandFactories(editor: CoreEditor, type: MarkType): Partial<CommandFactories>;
@@ -1 +1 @@
1
- {"version":3,"file":"Mark.d.ts","sourceRoot":"","sources":["../../../src/editor/src/Mark.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EA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B,IAAI;IAOL,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC;IANxD,QAAQ,CAAC,IAAI,UAAU;IACvB,IAAI,EAAE,MAAM,CAAU;IACtB,SAAS,CAAC,MAAM,EAAG,UAAU,CAAC;IAE9B,SAAgB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAM;gBAEnC,MAAM,GAAE,OAAO,CAAC,UAAU,CAAM;IAE7D,SAAS,CAAC,MAAM,EAAE,UAAU;IAI5B,OAAO;IAGP,WAAW,IAAI,QAAQ;IAIvB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,EAAE;IAI1C,mBAAmB,CACjB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,gBAAgB,CAAC;IAI5B,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAGpE"}
@@ -18,6 +18,12 @@ export class Mark {
18
18
  writable: true,
19
19
  value: 'node'
20
20
  });
21
+ Object.defineProperty(this, "editor", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: void 0
26
+ });
21
27
  Object.defineProperty(this, "attributes", {
22
28
  enumerable: true,
23
29
  configurable: true,
@@ -25,6 +31,11 @@ export class Mark {
25
31
  value: {}
26
32
  });
27
33
  }
34
+ setEditor(editor) {
35
+ this.editor = editor;
36
+ }
37
+ created() {
38
+ }
28
39
  getMarkSpec() {
29
40
  throw new Error('MarkSpec not defined: ' + this.name);
30
41
  }