@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.
- package/package.json +2 -1
- package/assets/base.css +0 -107
- package/assets/content.css +0 -35
- package/assets/gapcursor.css +0 -25
- package/assets/index.css +0 -2
- package/assets/main.css +0 -8
- package/assets/mobile.css +0 -33
- package/assets/prosemirror.css +0 -20
- package/assets/search.css +0 -6
- package/assets/vars.css +0 -97
- package/esm/CoreEditor.d.ts +0 -40
- package/esm/CoreEditor.d.ts.map +0 -1
- package/esm/CoreEditor.js +0 -223
- package/esm/DummyEditorView.d.ts +0 -60
- package/esm/DummyEditorView.d.ts.map +0 -1
- package/esm/DummyEditorView.js +0 -242
- package/esm/Extension.d.ts +0 -31
- package/esm/Extension.d.ts.map +0 -1
- package/esm/Extension.js +0 -34
- package/esm/ExtensionManager.d.ts +0 -32
- package/esm/ExtensionManager.d.ts.map +0 -1
- package/esm/ExtensionManager.js +0 -222
- package/esm/Mark.d.ts +0 -23
- package/esm/Mark.d.ts.map +0 -1
- package/esm/Mark.js +0 -27
- package/esm/Node.d.ts +0 -32
- package/esm/Node.d.ts.map +0 -1
- package/esm/Node.js +0 -36
- package/esm/commands/CommandManager.d.ts +0 -24
- package/esm/commands/CommandManager.d.ts.map +0 -1
- package/esm/commands/CommandManager.js +0 -100
- package/esm/commands/baseCommandFactories.d.ts +0 -3
- package/esm/commands/baseCommandFactories.d.ts.map +0 -1
- package/esm/commands/baseCommandFactories.js +0 -836
- package/esm/commands/createChainableState.d.ts +0 -3
- package/esm/commands/createChainableState.d.ts.map +0 -1
- package/esm/commands/createChainableState.js +0 -29
- package/esm/commands/keyCommandFactories.d.ts +0 -3
- package/esm/commands/keyCommandFactories.d.ts.map +0 -1
- package/esm/commands/keyCommandFactories.js +0 -10
- package/esm/commands/mod.d.ts +0 -7
- package/esm/commands/mod.d.ts.map +0 -1
- package/esm/commands/mod.js +0 -76
- package/esm/commands/replaceCommandFactories.d.ts +0 -3
- package/esm/commands/replaceCommandFactories.d.ts.map +0 -1
- package/esm/commands/replaceCommandFactories.js +0 -94
- package/esm/commands/types.d.ts +0 -18
- package/esm/commands/types.d.ts.map +0 -1
- package/esm/commands/types.js +0 -1
- package/esm/mod.d.ts +0 -9
- package/esm/mod.d.ts.map +0 -1
- package/esm/mod.js +0 -8
- package/esm/nodeToTreeString.d.ts +0 -10
- package/esm/nodeToTreeString.d.ts.map +0 -1
- package/esm/nodeToTreeString.js +0 -74
- package/esm/package.json +0 -3
- package/esm/plugins/TrackSelecionPlugin.d.ts +0 -6
- package/esm/plugins/TrackSelecionPlugin.d.ts.map +0 -1
- package/esm/plugins/TrackSelecionPlugin.js +0 -24
- package/esm/plugins/input-rules/InputRulesPlugin.d.ts +0 -23
- package/esm/plugins/input-rules/InputRulesPlugin.d.ts.map +0 -1
- package/esm/plugins/input-rules/InputRulesPlugin.js +0 -144
- package/esm/plugins/input-rules/mod.d.ts +0 -3
- package/esm/plugins/input-rules/mod.d.ts.map +0 -1
- package/esm/plugins/input-rules/mod.js +0 -2
- package/esm/plugins/input-rules/rulebuilders.d.ts +0 -5
- package/esm/plugins/input-rules/rulebuilders.d.ts.map +0 -1
- package/esm/plugins/input-rules/rulebuilders.js +0 -50
- package/esm/plugins/keymap/keymap.d.ts +0 -11
- package/esm/plugins/keymap/keymap.d.ts.map +0 -1
- package/esm/plugins/keymap/keymap.js +0 -125
- package/esm/plugins/keymap/mod.d.ts +0 -2
- package/esm/plugins/keymap/mod.d.ts.map +0 -1
- package/esm/plugins/keymap/mod.js +0 -1
- package/esm/plugins/keymap/w3c-keyname.d.ts +0 -4
- package/esm/plugins/keymap/w3c-keyname.d.ts.map +0 -1
- package/esm/plugins/keymap/w3c-keyname.js +0 -124
- package/esm/search/mod.d.ts +0 -3
- package/esm/search/mod.d.ts.map +0 -1
- package/esm/search/mod.js +0 -2
- package/esm/search/query.d.ts +0 -45
- package/esm/search/query.d.ts.map +0 -1
- package/esm/search/query.js +0 -334
- package/esm/search/search.d.ts +0 -31
- package/esm/search/search.d.ts.map +0 -1
- package/esm/search/search.js +0 -199
- package/esm/types.d.ts +0 -59
- package/esm/types.d.ts.map +0 -1
- package/esm/types.js +0 -1
- package/esm/ui.d.ts +0 -15
- package/esm/ui.d.ts.map +0 -1
- package/esm/ui.js +0 -16
- package/esm/utilities/SmartOutput.d.ts +0 -41
- package/esm/utilities/SmartOutput.d.ts.map +0 -1
- package/esm/utilities/SmartOutput.js +0 -201
- package/esm/utilities/createNodeFromContent.d.ts +0 -9
- package/esm/utilities/createNodeFromContent.d.ts.map +0 -1
- package/esm/utilities/createNodeFromContent.js +0 -32
- package/esm/utilities/getHtmlAttributes.d.ts +0 -9
- package/esm/utilities/getHtmlAttributes.d.ts.map +0 -1
- package/esm/utilities/getHtmlAttributes.js +0 -47
- package/esm/utilities/getShadowRoot.d.ts +0 -2
- package/esm/utilities/getShadowRoot.d.ts.map +0 -1
- package/esm/utilities/getShadowRoot.js +0 -16
- package/esm/utilities/mod.d.ts +0 -6
- package/esm/utilities/mod.d.ts.map +0 -1
- package/esm/utilities/mod.js +0 -5
- package/esm/utilities/toRawTextResult.d.ts +0 -3
- package/esm/utilities/toRawTextResult.d.ts.map +0 -1
- 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 +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"}
|