@kerebron/editor 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.
Files changed (110) hide show
  1. package/package.json +2 -1
  2. package/assets/base.css +0 -107
  3. package/assets/content.css +0 -35
  4. package/assets/gapcursor.css +0 -25
  5. package/assets/index.css +0 -2
  6. package/assets/main.css +0 -8
  7. package/assets/mobile.css +0 -33
  8. package/assets/prosemirror.css +0 -20
  9. package/assets/search.css +0 -6
  10. package/assets/vars.css +0 -97
  11. package/esm/CoreEditor.d.ts +0 -40
  12. package/esm/CoreEditor.d.ts.map +0 -1
  13. package/esm/CoreEditor.js +0 -223
  14. package/esm/DummyEditorView.d.ts +0 -60
  15. package/esm/DummyEditorView.d.ts.map +0 -1
  16. package/esm/DummyEditorView.js +0 -242
  17. package/esm/Extension.d.ts +0 -31
  18. package/esm/Extension.d.ts.map +0 -1
  19. package/esm/Extension.js +0 -34
  20. package/esm/ExtensionManager.d.ts +0 -32
  21. package/esm/ExtensionManager.d.ts.map +0 -1
  22. package/esm/ExtensionManager.js +0 -222
  23. package/esm/Mark.d.ts +0 -23
  24. package/esm/Mark.d.ts.map +0 -1
  25. package/esm/Mark.js +0 -27
  26. package/esm/Node.d.ts +0 -32
  27. package/esm/Node.d.ts.map +0 -1
  28. package/esm/Node.js +0 -36
  29. package/esm/commands/CommandManager.d.ts +0 -24
  30. package/esm/commands/CommandManager.d.ts.map +0 -1
  31. package/esm/commands/CommandManager.js +0 -100
  32. package/esm/commands/baseCommandFactories.d.ts +0 -3
  33. package/esm/commands/baseCommandFactories.d.ts.map +0 -1
  34. package/esm/commands/baseCommandFactories.js +0 -836
  35. package/esm/commands/createChainableState.d.ts +0 -3
  36. package/esm/commands/createChainableState.d.ts.map +0 -1
  37. package/esm/commands/createChainableState.js +0 -29
  38. package/esm/commands/keyCommandFactories.d.ts +0 -3
  39. package/esm/commands/keyCommandFactories.d.ts.map +0 -1
  40. package/esm/commands/keyCommandFactories.js +0 -10
  41. package/esm/commands/mod.d.ts +0 -7
  42. package/esm/commands/mod.d.ts.map +0 -1
  43. package/esm/commands/mod.js +0 -76
  44. package/esm/commands/replaceCommandFactories.d.ts +0 -3
  45. package/esm/commands/replaceCommandFactories.d.ts.map +0 -1
  46. package/esm/commands/replaceCommandFactories.js +0 -94
  47. package/esm/commands/types.d.ts +0 -18
  48. package/esm/commands/types.d.ts.map +0 -1
  49. package/esm/commands/types.js +0 -1
  50. package/esm/mod.d.ts +0 -9
  51. package/esm/mod.d.ts.map +0 -1
  52. package/esm/mod.js +0 -8
  53. package/esm/nodeToTreeString.d.ts +0 -10
  54. package/esm/nodeToTreeString.d.ts.map +0 -1
  55. package/esm/nodeToTreeString.js +0 -74
  56. package/esm/package.json +0 -3
  57. package/esm/plugins/TrackSelecionPlugin.d.ts +0 -6
  58. package/esm/plugins/TrackSelecionPlugin.d.ts.map +0 -1
  59. package/esm/plugins/TrackSelecionPlugin.js +0 -24
  60. package/esm/plugins/input-rules/InputRulesPlugin.d.ts +0 -23
  61. package/esm/plugins/input-rules/InputRulesPlugin.d.ts.map +0 -1
  62. package/esm/plugins/input-rules/InputRulesPlugin.js +0 -144
  63. package/esm/plugins/input-rules/mod.d.ts +0 -3
  64. package/esm/plugins/input-rules/mod.d.ts.map +0 -1
  65. package/esm/plugins/input-rules/mod.js +0 -2
  66. package/esm/plugins/input-rules/rulebuilders.d.ts +0 -5
  67. package/esm/plugins/input-rules/rulebuilders.d.ts.map +0 -1
  68. package/esm/plugins/input-rules/rulebuilders.js +0 -50
  69. package/esm/plugins/keymap/keymap.d.ts +0 -11
  70. package/esm/plugins/keymap/keymap.d.ts.map +0 -1
  71. package/esm/plugins/keymap/keymap.js +0 -125
  72. package/esm/plugins/keymap/mod.d.ts +0 -2
  73. package/esm/plugins/keymap/mod.d.ts.map +0 -1
  74. package/esm/plugins/keymap/mod.js +0 -1
  75. package/esm/plugins/keymap/w3c-keyname.d.ts +0 -4
  76. package/esm/plugins/keymap/w3c-keyname.d.ts.map +0 -1
  77. package/esm/plugins/keymap/w3c-keyname.js +0 -124
  78. package/esm/search/mod.d.ts +0 -3
  79. package/esm/search/mod.d.ts.map +0 -1
  80. package/esm/search/mod.js +0 -2
  81. package/esm/search/query.d.ts +0 -45
  82. package/esm/search/query.d.ts.map +0 -1
  83. package/esm/search/query.js +0 -334
  84. package/esm/search/search.d.ts +0 -31
  85. package/esm/search/search.d.ts.map +0 -1
  86. package/esm/search/search.js +0 -199
  87. package/esm/types.d.ts +0 -59
  88. package/esm/types.d.ts.map +0 -1
  89. package/esm/types.js +0 -1
  90. package/esm/ui.d.ts +0 -15
  91. package/esm/ui.d.ts.map +0 -1
  92. package/esm/ui.js +0 -16
  93. package/esm/utilities/SmartOutput.d.ts +0 -41
  94. package/esm/utilities/SmartOutput.d.ts.map +0 -1
  95. package/esm/utilities/SmartOutput.js +0 -201
  96. package/esm/utilities/createNodeFromContent.d.ts +0 -9
  97. package/esm/utilities/createNodeFromContent.d.ts.map +0 -1
  98. package/esm/utilities/createNodeFromContent.js +0 -32
  99. package/esm/utilities/getHtmlAttributes.d.ts +0 -9
  100. package/esm/utilities/getHtmlAttributes.d.ts.map +0 -1
  101. package/esm/utilities/getHtmlAttributes.js +0 -47
  102. package/esm/utilities/getShadowRoot.d.ts +0 -2
  103. package/esm/utilities/getShadowRoot.d.ts.map +0 -1
  104. package/esm/utilities/getShadowRoot.js +0 -16
  105. package/esm/utilities/mod.d.ts +0 -6
  106. package/esm/utilities/mod.d.ts.map +0 -1
  107. package/esm/utilities/mod.js +0 -5
  108. package/esm/utilities/toRawTextResult.d.ts +0 -3
  109. package/esm/utilities/toRawTextResult.d.ts.map +0 -1
  110. package/esm/utilities/toRawTextResult.js +0 -21
package/esm/Node.js DELETED
@@ -1,36 +0,0 @@
1
- export class Node {
2
- config;
3
- type = 'node';
4
- name = 'node';
5
- editor;
6
- attributes = {};
7
- constructor(config = {}) {
8
- this.config = config;
9
- }
10
- setEditor(editor) {
11
- this.editor = editor;
12
- }
13
- created() {
14
- }
15
- getNodeSpec() {
16
- throw new Error('NodeSpec not defined: ' + this.name);
17
- }
18
- getInputRules(type) {
19
- return [];
20
- }
21
- getProseMirrorPlugins() {
22
- return [];
23
- }
24
- getCommandFactories(editor, type) {
25
- return {};
26
- }
27
- getKeyboardShortcuts(editor) {
28
- return {};
29
- }
30
- getNodeView(editor) {
31
- return undefined;
32
- }
33
- getConverters(editor, schema) {
34
- return {};
35
- }
36
- }
@@ -1,24 +0,0 @@
1
- import type { EditorState, Transaction } from 'prosemirror-state';
2
- import type { CoreEditor } from '../CoreEditor.js';
3
- import type { ChainedCommands, CommandFactories, CommandFactory } from './types.js';
4
- type CommandRunner = (...args: any[]) => boolean;
5
- export declare class CommandManager {
6
- private editor;
7
- readonly commandFactories: {
8
- [key: string]: CommandFactory;
9
- };
10
- readonly run: {
11
- [key: string]: CommandRunner;
12
- };
13
- private debug;
14
- constructor(editor: CoreEditor);
15
- mergeCommandFactories(toInsert: Partial<CommandFactories>, extName: string): void;
16
- private overwriteCommandFactory;
17
- get state(): EditorState;
18
- get chain(): () => ChainedCommands;
19
- get can(): () => ChainedCommands;
20
- createChain(startTr?: Transaction, shouldDispatch?: boolean): ChainedCommands;
21
- createCan(startTr?: Transaction): ChainedCommands;
22
- }
23
- export {};
24
- //# sourceMappingURL=CommandManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CommandManager.d.ts","sourceRoot":"","sources":["../../src/commands/CommandManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EACV,eAAe,EAEf,gBAAgB,EAChB,cAAc,EACf,MAAM,YAAY,CAAC;AAMpB,KAAK,aAAa,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAEjD,qBAAa,cAAc;IAOvB,OAAO,CAAC,MAAM;IANhB,SAAgB,gBAAgB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,CAAM;IACzE,SAAgB,GAAG,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;KAAE,CAAM;IAE3D,OAAO,CAAC,KAAK,CAAQ;gBAGX,MAAM,EAAE,UAAU;IAOrB,qBAAqB,CAC1B,QAAQ,EAAE,OAAO,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAE,MAAM;IAWjB,OAAO,CAAC,uBAAuB;IAqC/B,IAAI,KAAK,IAAI,WAAW,CAEvB;IAED,IAAI,KAAK,IAAI,MAAM,eAAe,CAEjC;IAED,IAAI,GAAG,IAAI,MAAM,eAAe,CAE/B;IAEM,WAAW,CAChB,OAAO,CAAC,EAAE,WAAW,EACrB,cAAc,UAAO,GACpB,eAAe;IA4CX,SAAS,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,eAAe;CAGzD"}
@@ -1,100 +0,0 @@
1
- import { EditorView } from 'prosemirror-view';
2
- import { createChainableState } from './createChainableState.js';
3
- import { baseCommandFactories } from './baseCommandFactories.js';
4
- import { keyCommandFactories } from './keyCommandFactories.js';
5
- import { replaceCommandFactories } from './replaceCommandFactories.js';
6
- export class CommandManager {
7
- editor;
8
- commandFactories = {};
9
- run = {};
10
- debug = true;
11
- constructor(editor) {
12
- this.editor = editor;
13
- this.mergeCommandFactories(baseCommandFactories, 'baseCommand');
14
- this.mergeCommandFactories(keyCommandFactories, 'key');
15
- this.mergeCommandFactories(replaceCommandFactories, 'replace');
16
- }
17
- mergeCommandFactories(toInsert, extName) {
18
- for (const key in toInsert) {
19
- const commandFactory = toInsert[key];
20
- if (!commandFactory) {
21
- continue;
22
- }
23
- this.overwriteCommandFactory(extName, key, commandFactory);
24
- }
25
- }
26
- overwriteCommandFactory(extName, name, commandFactory) {
27
- if (this.debug) {
28
- const wrappedFactory = (...args) => {
29
- const realCommand = commandFactory(...args);
30
- const command = (state, dispatch, view) => {
31
- if (dispatch) {
32
- console.debug(`Command: ${extName}.${name}`);
33
- }
34
- return realCommand(state, dispatch, view);
35
- };
36
- return command;
37
- };
38
- this.commandFactories[name] = wrappedFactory;
39
- }
40
- else {
41
- this.commandFactories[name] = commandFactory;
42
- }
43
- this.run[name] = (...args) => {
44
- const factory = this.commandFactories[name];
45
- const command = factory(...args);
46
- const state = this.editor.state;
47
- const view = this.editor.view;
48
- if (view instanceof EditorView) {
49
- return command(state, view.dispatch, view);
50
- }
51
- else {
52
- return command(state, view.dispatch);
53
- }
54
- };
55
- }
56
- get state() {
57
- return this.editor.state;
58
- }
59
- get chain() {
60
- return () => this.createChain();
61
- }
62
- get can() {
63
- return () => this.createCan();
64
- }
65
- createChain(startTr, shouldDispatch = true) {
66
- const { commandFactories, editor, state } = this;
67
- const { view } = editor;
68
- const callbacks = [];
69
- const hasStartTransaction = !!startTr;
70
- const tr = startTr || state.tr;
71
- const chainedState = createChainableState(tr, state);
72
- const fakeDispatch = () => undefined;
73
- const chain = {
74
- ...Object.fromEntries(Object.entries(commandFactories).map(([name, commandFactory]) => {
75
- const chainedCommand = (...args) => {
76
- const command = commandFactory(...args);
77
- const callback = command(chainedState, shouldDispatch ? fakeDispatch : undefined);
78
- callbacks.push(callback);
79
- return chain;
80
- };
81
- return [name, chainedCommand];
82
- })),
83
- run: () => {
84
- if (!hasStartTransaction &&
85
- shouldDispatch &&
86
- !tr.getMeta('preventDispatch')) {
87
- view.dispatch(tr);
88
- }
89
- return callbacks.every((callback) => callback === true);
90
- },
91
- chain: () => {
92
- return this.createChain(tr, shouldDispatch);
93
- },
94
- };
95
- return chain;
96
- }
97
- createCan(startTr) {
98
- return this.createChain(startTr, false);
99
- }
100
- }
@@ -1,3 +0,0 @@
1
- import { CommandFactory } from './types.js';
2
- export declare const baseCommandFactories: Record<string, CommandFactory>;
3
- //# sourceMappingURL=baseCommandFactories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"baseCommandFactories.d.ts","sourceRoot":"","sources":["../../src/commands/baseCommandFactories.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAgB,cAAc,EAAE,MAAM,YAAY,CAAC;AAo/B1D,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CA2B/D,CAAC"}