@kerebron/editor 0.4.7 → 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/CoreEditor.js +9 -39
- package/esm/DummyEditorView.js +11 -46
- package/esm/Extension.js +5 -24
- package/esm/ExtensionManager.js +10 -48
- package/esm/Mark.js +6 -30
- package/esm/Node.js +6 -30
- package/esm/commands/CommandManager.js +5 -24
- package/esm/plugins/input-rules/InputRulesPlugin.js +7 -26
- package/esm/search/query.js +30 -93
- package/esm/search/search.js +6 -18
- package/esm/utilities/SmartOutput.js +5 -32
- package/package.json +4 -1
package/esm/CoreEditor.js
CHANGED
|
@@ -15,47 +15,17 @@ function ensureDocSchema(doc, schema) {
|
|
|
15
15
|
return ProseMirrorNode.fromJSON(schema, json);
|
|
16
16
|
}
|
|
17
17
|
export class CoreEditor extends EventTarget {
|
|
18
|
+
config = {
|
|
19
|
+
element: undefined,
|
|
20
|
+
extensions: [],
|
|
21
|
+
};
|
|
22
|
+
extensionManager;
|
|
23
|
+
commandManager;
|
|
24
|
+
view;
|
|
25
|
+
state;
|
|
26
|
+
ui = defaultUi(this);
|
|
18
27
|
constructor(config = {}) {
|
|
19
28
|
super();
|
|
20
|
-
Object.defineProperty(this, "config", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: {
|
|
25
|
-
element: undefined,
|
|
26
|
-
extensions: [],
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
Object.defineProperty(this, "extensionManager", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true,
|
|
33
|
-
value: void 0
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(this, "commandManager", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: void 0
|
|
40
|
-
});
|
|
41
|
-
Object.defineProperty(this, "view", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true,
|
|
45
|
-
value: void 0
|
|
46
|
-
});
|
|
47
|
-
Object.defineProperty(this, "state", {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
configurable: true,
|
|
50
|
-
writable: true,
|
|
51
|
-
value: void 0
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(this, "ui", {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
configurable: true,
|
|
56
|
-
writable: true,
|
|
57
|
-
value: defaultUi(this)
|
|
58
|
-
});
|
|
59
29
|
this.config = {
|
|
60
30
|
...this.config,
|
|
61
31
|
...config,
|
package/esm/DummyEditorView.js
CHANGED
|
@@ -4,58 +4,21 @@
|
|
|
4
4
|
/// editable document. Its state and behavior are determined by its
|
|
5
5
|
/// [props](#view.DirectEditorProps).
|
|
6
6
|
export class DummyEditorView {
|
|
7
|
+
/// @internal
|
|
8
|
+
_props;
|
|
9
|
+
directPlugins;
|
|
10
|
+
/// @internal
|
|
11
|
+
nodeViews;
|
|
12
|
+
prevDirectPlugins = [];
|
|
13
|
+
pluginViews = [];
|
|
14
|
+
/// The view's current [state](#state.EditorState).
|
|
15
|
+
state;
|
|
7
16
|
/// Create a view. `place` may be a DOM node that the editor should
|
|
8
17
|
/// be appended to, a function that will place it into the document,
|
|
9
18
|
/// or an object whose `mount` property holds the node to use as the
|
|
10
19
|
/// document container. If it is `null`, the editor will not be
|
|
11
20
|
/// added to the document.
|
|
12
21
|
constructor(props) {
|
|
13
|
-
/// @internal
|
|
14
|
-
Object.defineProperty(this, "_props", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true,
|
|
18
|
-
value: void 0
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(this, "directPlugins", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: void 0
|
|
25
|
-
});
|
|
26
|
-
/// @internal
|
|
27
|
-
Object.defineProperty(this, "nodeViews", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true,
|
|
30
|
-
writable: true,
|
|
31
|
-
value: void 0
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(this, "prevDirectPlugins", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true,
|
|
37
|
-
value: []
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(this, "pluginViews", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true,
|
|
43
|
-
value: []
|
|
44
|
-
});
|
|
45
|
-
/// The view's current [state](#state.EditorState).
|
|
46
|
-
Object.defineProperty(this, "state", {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
configurable: true,
|
|
49
|
-
writable: true,
|
|
50
|
-
value: void 0
|
|
51
|
-
});
|
|
52
|
-
/// Indicates whether the editor is currently [editable](#view.EditorProps.editable).
|
|
53
|
-
Object.defineProperty(this, "editable", {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
configurable: true,
|
|
56
|
-
writable: true,
|
|
57
|
-
value: void 0
|
|
58
|
-
});
|
|
59
22
|
this._props = props;
|
|
60
23
|
this.state = props.state;
|
|
61
24
|
this.directPlugins = props.plugins || [];
|
|
@@ -66,6 +29,8 @@ export class DummyEditorView {
|
|
|
66
29
|
// TODO initInput(this)
|
|
67
30
|
this.updatePluginViews();
|
|
68
31
|
}
|
|
32
|
+
/// Indicates whether the editor is currently [editable](#view.EditorProps.editable).
|
|
33
|
+
editable;
|
|
69
34
|
/// Holds `true` when a
|
|
70
35
|
/// [composition](https://w3c.github.io/uievents/#events-compositionevents)
|
|
71
36
|
/// is active.
|
package/esm/Extension.js
CHANGED
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
export class Extension {
|
|
2
|
+
config;
|
|
3
|
+
type = 'extension';
|
|
4
|
+
editor;
|
|
5
|
+
conflicts;
|
|
2
6
|
constructor(config = {}) {
|
|
3
|
-
|
|
4
|
-
enumerable: true,
|
|
5
|
-
configurable: true,
|
|
6
|
-
writable: true,
|
|
7
|
-
value: config
|
|
8
|
-
});
|
|
9
|
-
Object.defineProperty(this, "type", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: 'extension'
|
|
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
|
-
});
|
|
7
|
+
this.config = config;
|
|
27
8
|
}
|
|
28
9
|
setEditor(editor) {
|
|
29
10
|
this.editor = editor;
|
package/esm/ExtensionManager.js
CHANGED
|
@@ -19,55 +19,17 @@ export function splitExtensions(extensions) {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
export class ExtensionManager {
|
|
22
|
+
editor;
|
|
23
|
+
commandManager;
|
|
24
|
+
schema;
|
|
25
|
+
extensions = new Set();
|
|
26
|
+
plugins = [];
|
|
27
|
+
nodeViews = {};
|
|
28
|
+
converters = {};
|
|
29
|
+
debug = true;
|
|
22
30
|
constructor(extensions, editor, commandManager) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true,
|
|
27
|
-
value: editor
|
|
28
|
-
});
|
|
29
|
-
Object.defineProperty(this, "commandManager", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true,
|
|
33
|
-
value: commandManager
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(this, "schema", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: void 0
|
|
40
|
-
});
|
|
41
|
-
Object.defineProperty(this, "extensions", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true,
|
|
45
|
-
value: new Set()
|
|
46
|
-
});
|
|
47
|
-
Object.defineProperty(this, "plugins", {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
configurable: true,
|
|
50
|
-
writable: true,
|
|
51
|
-
value: []
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(this, "nodeViews", {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
configurable: true,
|
|
56
|
-
writable: true,
|
|
57
|
-
value: {}
|
|
58
|
-
});
|
|
59
|
-
Object.defineProperty(this, "converters", {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
configurable: true,
|
|
62
|
-
writable: true,
|
|
63
|
-
value: {}
|
|
64
|
-
});
|
|
65
|
-
Object.defineProperty(this, "debug", {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
configurable: true,
|
|
68
|
-
writable: true,
|
|
69
|
-
value: true
|
|
70
|
-
});
|
|
31
|
+
this.editor = editor;
|
|
32
|
+
this.commandManager = commandManager;
|
|
71
33
|
this.setupExtensions(new Set(extensions));
|
|
72
34
|
this.schema = this.getSchemaByResolvedExtensions(editor);
|
|
73
35
|
const event = new CustomEvent('schema:ready', {
|
package/esm/Mark.js
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
1
|
export class Mark {
|
|
2
|
+
config;
|
|
3
|
+
type = 'mark';
|
|
4
|
+
name = 'node';
|
|
5
|
+
editor;
|
|
6
|
+
attributes = {};
|
|
2
7
|
constructor(config = {}) {
|
|
3
|
-
|
|
4
|
-
enumerable: true,
|
|
5
|
-
configurable: true,
|
|
6
|
-
writable: true,
|
|
7
|
-
value: config
|
|
8
|
-
});
|
|
9
|
-
Object.defineProperty(this, "type", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: 'mark'
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(this, "name", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: 'node'
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(this, "editor", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
configurable: true,
|
|
24
|
-
writable: true,
|
|
25
|
-
value: void 0
|
|
26
|
-
});
|
|
27
|
-
Object.defineProperty(this, "attributes", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true,
|
|
30
|
-
writable: true,
|
|
31
|
-
value: {}
|
|
32
|
-
});
|
|
8
|
+
this.config = config;
|
|
33
9
|
}
|
|
34
10
|
setEditor(editor) {
|
|
35
11
|
this.editor = editor;
|
package/esm/Node.js
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
1
|
export class Node {
|
|
2
|
+
config;
|
|
3
|
+
type = 'node';
|
|
4
|
+
name = 'node';
|
|
5
|
+
editor;
|
|
6
|
+
attributes = {};
|
|
2
7
|
constructor(config = {}) {
|
|
3
|
-
|
|
4
|
-
enumerable: true,
|
|
5
|
-
configurable: true,
|
|
6
|
-
writable: true,
|
|
7
|
-
value: config
|
|
8
|
-
});
|
|
9
|
-
Object.defineProperty(this, "type", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: 'node'
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(this, "name", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: 'node'
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(this, "editor", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
configurable: true,
|
|
24
|
-
writable: true,
|
|
25
|
-
value: void 0
|
|
26
|
-
});
|
|
27
|
-
Object.defineProperty(this, "attributes", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true,
|
|
30
|
-
writable: true,
|
|
31
|
-
value: {}
|
|
32
|
-
});
|
|
8
|
+
this.config = config;
|
|
33
9
|
}
|
|
34
10
|
setEditor(editor) {
|
|
35
11
|
this.editor = editor;
|
|
@@ -4,31 +4,12 @@ import { baseCommandFactories } from './baseCommandFactories.js';
|
|
|
4
4
|
import { keyCommandFactories } from './keyCommandFactories.js';
|
|
5
5
|
import { replaceCommandFactories } from './replaceCommandFactories.js';
|
|
6
6
|
export class CommandManager {
|
|
7
|
+
editor;
|
|
8
|
+
commandFactories = {};
|
|
9
|
+
run = {};
|
|
10
|
+
debug = true;
|
|
7
11
|
constructor(editor) {
|
|
8
|
-
|
|
9
|
-
enumerable: true,
|
|
10
|
-
configurable: true,
|
|
11
|
-
writable: true,
|
|
12
|
-
value: editor
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(this, "commandFactories", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true,
|
|
18
|
-
value: {}
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(this, "run", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: {}
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(this, "debug", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: true
|
|
31
|
-
});
|
|
12
|
+
this.editor = editor;
|
|
32
13
|
this.mergeCommandFactories(baseCommandFactories, 'baseCommand');
|
|
33
14
|
this.mergeCommandFactories(keyCommandFactories, 'key');
|
|
34
15
|
this.mergeCommandFactories(replaceCommandFactories, 'replace');
|
|
@@ -4,6 +4,12 @@ import { Plugin, } from 'prosemirror-state';
|
|
|
4
4
|
/// changing two dashes into an emdash, wrapping a paragraph starting
|
|
5
5
|
/// with `"> "` into a blockquote, or something entirely different.
|
|
6
6
|
export class InputRule {
|
|
7
|
+
match;
|
|
8
|
+
/// @internal
|
|
9
|
+
handler;
|
|
10
|
+
/// @internal
|
|
11
|
+
undoable;
|
|
12
|
+
inCode;
|
|
7
13
|
// :: (RegExp, union<string, (state: EditorState, match: [string], start: number, end: number) → ?Transaction>)
|
|
8
14
|
/// Create an input rule. The rule applies when the user typed
|
|
9
15
|
/// something and the text directly in front of the cursor matches
|
|
@@ -22,32 +28,7 @@ export class InputRule {
|
|
|
22
28
|
constructor(
|
|
23
29
|
/// @internal
|
|
24
30
|
match, handler, options = {}) {
|
|
25
|
-
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: match
|
|
30
|
-
});
|
|
31
|
-
/// @internal
|
|
32
|
-
Object.defineProperty(this, "handler", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: void 0
|
|
37
|
-
});
|
|
38
|
-
/// @internal
|
|
39
|
-
Object.defineProperty(this, "undoable", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true,
|
|
43
|
-
value: void 0
|
|
44
|
-
});
|
|
45
|
-
Object.defineProperty(this, "inCode", {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
configurable: true,
|
|
48
|
-
writable: true,
|
|
49
|
-
value: void 0
|
|
50
|
-
});
|
|
31
|
+
this.match = match;
|
|
51
32
|
this.match = match;
|
|
52
33
|
this.handler = typeof handler == 'string'
|
|
53
34
|
? stringHandler(handler)
|
package/esm/search/query.js
CHANGED
|
@@ -1,76 +1,31 @@
|
|
|
1
1
|
import { Fragment, Slice } from 'prosemirror-model';
|
|
2
2
|
export class SearchQuery {
|
|
3
|
+
/// The search string (or regular expression).
|
|
4
|
+
search;
|
|
5
|
+
/// Indicates whether the search is case-sensitive.
|
|
6
|
+
caseSensitive;
|
|
7
|
+
/// By default, string search will replace `\n`, `\r`, and `\t` in
|
|
8
|
+
/// the query with newline, return, and tab characters. When this
|
|
9
|
+
/// is set to true, that behavior is disabled.
|
|
10
|
+
literal;
|
|
11
|
+
/// When true, the search string is interpreted as a regular
|
|
12
|
+
/// expression.
|
|
13
|
+
regexp;
|
|
14
|
+
/// The replace text, or the empty string if no replace text has
|
|
15
|
+
/// been given.
|
|
16
|
+
replace;
|
|
17
|
+
/// Whether this query is non-empty and, in case of a regular
|
|
18
|
+
/// expression search, syntactically valid.
|
|
19
|
+
valid;
|
|
20
|
+
/// When true, matches that contain words are ignored when there are
|
|
21
|
+
/// further word characters around them.
|
|
22
|
+
wholeWord;
|
|
23
|
+
/// An optional filter that causes some results to be ignored.
|
|
24
|
+
filter;
|
|
25
|
+
/// @internal
|
|
26
|
+
impl;
|
|
3
27
|
/// Create a query object.
|
|
4
28
|
constructor(config) {
|
|
5
|
-
/// The search string (or regular expression).
|
|
6
|
-
Object.defineProperty(this, "search", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
configurable: true,
|
|
9
|
-
writable: true,
|
|
10
|
-
value: void 0
|
|
11
|
-
});
|
|
12
|
-
/// Indicates whether the search is case-sensitive.
|
|
13
|
-
Object.defineProperty(this, "caseSensitive", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: void 0
|
|
18
|
-
});
|
|
19
|
-
/// By default, string search will replace `\n`, `\r`, and `\t` in
|
|
20
|
-
/// the query with newline, return, and tab characters. When this
|
|
21
|
-
/// is set to true, that behavior is disabled.
|
|
22
|
-
Object.defineProperty(this, "literal", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true,
|
|
25
|
-
writable: true,
|
|
26
|
-
value: void 0
|
|
27
|
-
});
|
|
28
|
-
/// When true, the search string is interpreted as a regular
|
|
29
|
-
/// expression.
|
|
30
|
-
Object.defineProperty(this, "regexp", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true,
|
|
34
|
-
value: void 0
|
|
35
|
-
});
|
|
36
|
-
/// The replace text, or the empty string if no replace text has
|
|
37
|
-
/// been given.
|
|
38
|
-
Object.defineProperty(this, "replace", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: true,
|
|
41
|
-
writable: true,
|
|
42
|
-
value: void 0
|
|
43
|
-
});
|
|
44
|
-
/// Whether this query is non-empty and, in case of a regular
|
|
45
|
-
/// expression search, syntactically valid.
|
|
46
|
-
Object.defineProperty(this, "valid", {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
configurable: true,
|
|
49
|
-
writable: true,
|
|
50
|
-
value: void 0
|
|
51
|
-
});
|
|
52
|
-
/// When true, matches that contain words are ignored when there are
|
|
53
|
-
/// further word characters around them.
|
|
54
|
-
Object.defineProperty(this, "wholeWord", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
configurable: true,
|
|
57
|
-
writable: true,
|
|
58
|
-
value: void 0
|
|
59
|
-
});
|
|
60
|
-
/// An optional filter that causes some results to be ignored.
|
|
61
|
-
Object.defineProperty(this, "filter", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
configurable: true,
|
|
64
|
-
writable: true,
|
|
65
|
-
value: void 0
|
|
66
|
-
});
|
|
67
|
-
/// @internal
|
|
68
|
-
Object.defineProperty(this, "impl", {
|
|
69
|
-
enumerable: true,
|
|
70
|
-
configurable: true,
|
|
71
|
-
writable: true,
|
|
72
|
-
value: void 0
|
|
73
|
-
});
|
|
74
29
|
this.search = config.search;
|
|
75
30
|
this.caseSensitive = !!config.caseSensitive;
|
|
76
31
|
this.literal = !!config.literal;
|
|
@@ -186,19 +141,10 @@ const nullQuery = new class {
|
|
|
186
141
|
}
|
|
187
142
|
}();
|
|
188
143
|
class StringQuery {
|
|
144
|
+
query;
|
|
145
|
+
string;
|
|
189
146
|
constructor(query) {
|
|
190
|
-
|
|
191
|
-
enumerable: true,
|
|
192
|
-
configurable: true,
|
|
193
|
-
writable: true,
|
|
194
|
-
value: query
|
|
195
|
-
});
|
|
196
|
-
Object.defineProperty(this, "string", {
|
|
197
|
-
enumerable: true,
|
|
198
|
-
configurable: true,
|
|
199
|
-
writable: true,
|
|
200
|
-
value: void 0
|
|
201
|
-
});
|
|
147
|
+
this.query = query;
|
|
202
148
|
let string = query.unquote(query.search);
|
|
203
149
|
if (!query.caseSensitive)
|
|
204
150
|
string = string.toLowerCase();
|
|
@@ -237,19 +183,10 @@ class StringQuery {
|
|
|
237
183
|
const baseFlags = 'g' + (/x/.unicode == null ? '' : 'u') +
|
|
238
184
|
(/x/.hasIndices == null ? '' : 'd');
|
|
239
185
|
class RegExpQuery {
|
|
186
|
+
query;
|
|
187
|
+
regexp;
|
|
240
188
|
constructor(query) {
|
|
241
|
-
|
|
242
|
-
enumerable: true,
|
|
243
|
-
configurable: true,
|
|
244
|
-
writable: true,
|
|
245
|
-
value: query
|
|
246
|
-
});
|
|
247
|
-
Object.defineProperty(this, "regexp", {
|
|
248
|
-
enumerable: true,
|
|
249
|
-
configurable: true,
|
|
250
|
-
writable: true,
|
|
251
|
-
value: void 0
|
|
252
|
-
});
|
|
189
|
+
this.query = query;
|
|
253
190
|
this.regexp = new RegExp(query.search, baseFlags + (query.caseSensitive ? '' : 'i'));
|
|
254
191
|
}
|
|
255
192
|
findNext(state, from, to) {
|
package/esm/search/search.js
CHANGED
|
@@ -2,25 +2,13 @@ import { Plugin, PluginKey, TextSelection, } from 'prosemirror-state';
|
|
|
2
2
|
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
3
3
|
import { SearchQuery } from './query.js';
|
|
4
4
|
class SearchState {
|
|
5
|
+
query;
|
|
6
|
+
range;
|
|
7
|
+
deco;
|
|
5
8
|
constructor(query, range, deco) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
writable: true,
|
|
10
|
-
value: query
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(this, "range", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true,
|
|
16
|
-
value: range
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(this, "deco", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: deco
|
|
23
|
-
});
|
|
9
|
+
this.query = query;
|
|
10
|
+
this.range = range;
|
|
11
|
+
this.deco = deco;
|
|
24
12
|
}
|
|
25
13
|
}
|
|
26
14
|
function buildMatchDeco(state, query, range) {
|
|
@@ -1,36 +1,9 @@
|
|
|
1
1
|
export class SmartOutput {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
value: 0
|
|
8
|
-
});
|
|
9
|
-
Object.defineProperty(this, "_colPos", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: 0
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(this, "_pos", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: 0
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(this, "chunks", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
configurable: true,
|
|
24
|
-
writable: true,
|
|
25
|
-
value: []
|
|
26
|
-
});
|
|
27
|
-
Object.defineProperty(this, "metas", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true,
|
|
30
|
-
writable: true,
|
|
31
|
-
value: []
|
|
32
|
-
});
|
|
33
|
-
}
|
|
2
|
+
_rowPos = 0;
|
|
3
|
+
_colPos = 0;
|
|
4
|
+
_pos = 0;
|
|
5
|
+
chunks = [];
|
|
6
|
+
metas = [];
|
|
34
7
|
log(text, item) {
|
|
35
8
|
if (text.length === 0) {
|
|
36
9
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kerebron/editor",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"module": "./esm/mod.js",
|
|
6
6
|
"exports": {
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"./utilities": {
|
|
26
26
|
"import": "./esm/utilities/mod.js"
|
|
27
|
+
},
|
|
28
|
+
"./assets/*.css": {
|
|
29
|
+
"import": "./assets/*.css"
|
|
27
30
|
}
|
|
28
31
|
},
|
|
29
32
|
"scripts": {},
|