@kerebron/editor 0.4.25 → 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
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export interface OutputMeta<K> {
|
|
2
|
-
pos: number;
|
|
3
|
-
rowPos: number;
|
|
4
|
-
colPos: number;
|
|
5
|
-
item?: K;
|
|
6
|
-
}
|
|
7
|
-
interface Mapping {
|
|
8
|
-
sourceNo: number;
|
|
9
|
-
sourceRowPos: number;
|
|
10
|
-
sourceColPos: number;
|
|
11
|
-
}
|
|
12
|
-
export interface SourceMap {
|
|
13
|
-
'version': 3;
|
|
14
|
-
'file': string;
|
|
15
|
-
'sourceRoot': string;
|
|
16
|
-
'sources': Array<string>;
|
|
17
|
-
'sourcesContent': Array<string>;
|
|
18
|
-
'names': Array<string>;
|
|
19
|
-
'mappings': string;
|
|
20
|
-
}
|
|
21
|
-
export declare class SmartOutput<K> {
|
|
22
|
-
private _rowPos;
|
|
23
|
-
private _colPos;
|
|
24
|
-
private _pos;
|
|
25
|
-
private chunks;
|
|
26
|
-
private metas;
|
|
27
|
-
log(text: string, item?: K): void;
|
|
28
|
-
getMetas(): OutputMeta<K>[];
|
|
29
|
-
get chunkPos(): number;
|
|
30
|
-
rollback(pos: number): void;
|
|
31
|
-
get rowPos(): number;
|
|
32
|
-
get colPos(): number;
|
|
33
|
-
get pos(): number;
|
|
34
|
-
endsWith(text: string): boolean;
|
|
35
|
-
toString(): string;
|
|
36
|
-
getSourceMap(mapper: (rowPos: number, colPos: number, pos: number, item?: K) => Mapping | void): SourceMap;
|
|
37
|
-
}
|
|
38
|
-
export declare function decode(string: string): number[];
|
|
39
|
-
export declare function encode(value: number | number[]): string;
|
|
40
|
-
export {};
|
|
41
|
-
//# sourceMappingURL=SmartOutput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SmartOutput.d.ts","sourceRoot":"","sources":["../../src/utilities/SmartOutput.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,CAAC,CAAC;CACV;AAED,UAAU,OAAO;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,CAAC,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,WAAW,CAAC,CAAC;IACxB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,IAAI,CAAK;IAEjB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,KAAK,CAA4B;IAEzC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;IAyB1B,QAAQ;IAIR,IAAI,QAAQ,WAEX;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM;IAKpB,IAAI,MAAM,WAET;IAED,IAAI,MAAM,WAET;IAED,IAAI,GAAG,WAEN;IAED,QAAQ,CAAC,IAAI,EAAE,MAAM;IAIrB,QAAQ;IAIR,YAAY,CACV,MAAM,EAAE,CACN,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,CAAC,KACL,OAAO,GAAG,IAAI,GAClB,SAAS;CA4Db;AAuDD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,YAoCpC;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,UAW9C"}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
export class SmartOutput {
|
|
2
|
-
_rowPos = 0;
|
|
3
|
-
_colPos = 0;
|
|
4
|
-
_pos = 0;
|
|
5
|
-
chunks = [];
|
|
6
|
-
metas = [];
|
|
7
|
-
log(text, item) {
|
|
8
|
-
if (text.length === 0) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
this.chunks.push(text);
|
|
12
|
-
this.metas.push({
|
|
13
|
-
pos: this._pos,
|
|
14
|
-
colPos: this._colPos,
|
|
15
|
-
rowPos: this._rowPos,
|
|
16
|
-
item,
|
|
17
|
-
});
|
|
18
|
-
const lines = text.split('\n');
|
|
19
|
-
if (lines.length === 1) {
|
|
20
|
-
this._colPos += lines[lines.length - 1].length;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this._rowPos += lines.length - 1;
|
|
24
|
-
this._colPos = lines[lines.length - 1].length;
|
|
25
|
-
}
|
|
26
|
-
this._pos += text.length;
|
|
27
|
-
}
|
|
28
|
-
getMetas() {
|
|
29
|
-
return this.metas;
|
|
30
|
-
}
|
|
31
|
-
get chunkPos() {
|
|
32
|
-
return this.chunks.length;
|
|
33
|
-
}
|
|
34
|
-
rollback(pos) {
|
|
35
|
-
this.chunks.splice(pos);
|
|
36
|
-
this.metas.splice(pos);
|
|
37
|
-
}
|
|
38
|
-
get rowPos() {
|
|
39
|
-
return this._rowPos;
|
|
40
|
-
}
|
|
41
|
-
get colPos() {
|
|
42
|
-
return this._colPos;
|
|
43
|
-
}
|
|
44
|
-
get pos() {
|
|
45
|
-
return this._pos;
|
|
46
|
-
}
|
|
47
|
-
endsWith(text) {
|
|
48
|
-
return this.chunks.join('').endsWith(text);
|
|
49
|
-
}
|
|
50
|
-
toString() {
|
|
51
|
-
return this.chunks.join('');
|
|
52
|
-
}
|
|
53
|
-
getSourceMap(mapper) {
|
|
54
|
-
const mappingRows = [];
|
|
55
|
-
let lastRow = -1;
|
|
56
|
-
let lastCol = -1;
|
|
57
|
-
let prevSourceNo = 0;
|
|
58
|
-
let prevSourceRowPos = 0;
|
|
59
|
-
let prevSourceColPos = 0;
|
|
60
|
-
let prevColPos = 0;
|
|
61
|
-
for (const meta of this.metas) {
|
|
62
|
-
while (meta.rowPos >= mappingRows.length) {
|
|
63
|
-
mappingRows.push([]);
|
|
64
|
-
}
|
|
65
|
-
if (lastRow != meta.rowPos || lastCol != meta.colPos) {
|
|
66
|
-
const currentRow = mappingRows[meta.rowPos];
|
|
67
|
-
if (lastRow != meta.rowPos) {
|
|
68
|
-
prevColPos = 0;
|
|
69
|
-
}
|
|
70
|
-
const mapping = mapper(meta.rowPos, meta.colPos, meta.pos, meta.item);
|
|
71
|
-
if (mapping) {
|
|
72
|
-
currentRow.push([
|
|
73
|
-
meta.colPos - prevColPos,
|
|
74
|
-
mapping.sourceNo - prevSourceNo,
|
|
75
|
-
mapping.sourceRowPos - prevSourceRowPos,
|
|
76
|
-
mapping.sourceColPos - prevSourceColPos,
|
|
77
|
-
]);
|
|
78
|
-
prevColPos = meta.colPos;
|
|
79
|
-
prevSourceNo = mapping.sourceNo;
|
|
80
|
-
prevSourceRowPos = mapping.sourceRowPos;
|
|
81
|
-
prevSourceColPos = mapping.sourceColPos;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
lastRow = meta.rowPos;
|
|
85
|
-
lastCol = meta.colPos;
|
|
86
|
-
}
|
|
87
|
-
const mappings = mappingRows
|
|
88
|
-
.map((row) => row.map((group) => encode(group))
|
|
89
|
-
.join(','))
|
|
90
|
-
.join(';');
|
|
91
|
-
return {
|
|
92
|
-
version: 3,
|
|
93
|
-
file: '',
|
|
94
|
-
sourceRoot: '',
|
|
95
|
-
sources: [],
|
|
96
|
-
sourcesContent: [],
|
|
97
|
-
names: [],
|
|
98
|
-
mappings,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
const BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
103
|
-
function toVLQ(value) {
|
|
104
|
-
const vlq = [];
|
|
105
|
-
const isNegative = value < 0;
|
|
106
|
-
value = Math.abs(value);
|
|
107
|
-
if (value === 0) {
|
|
108
|
-
vlq.push(0);
|
|
109
|
-
return vlq;
|
|
110
|
-
}
|
|
111
|
-
while (value > 0) {
|
|
112
|
-
let digit = value & 0x1F;
|
|
113
|
-
value >>= 5;
|
|
114
|
-
if (value > 0) {
|
|
115
|
-
digit |= 0x20;
|
|
116
|
-
}
|
|
117
|
-
vlq.push(digit);
|
|
118
|
-
if (vlq.length === 1) {
|
|
119
|
-
digit = isNegative ? (digit | 0x1) : (digit & ~0x1);
|
|
120
|
-
vlq[0] = digit;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return vlq;
|
|
124
|
-
}
|
|
125
|
-
function encodeVLQ(input) {
|
|
126
|
-
const numbers = Array.isArray(input) ? input : [input];
|
|
127
|
-
let result = '';
|
|
128
|
-
for (const num of numbers) {
|
|
129
|
-
const vlq = toVLQ(num);
|
|
130
|
-
for (const digit of vlq) {
|
|
131
|
-
result += BASE64_CHARS[digit];
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return result;
|
|
135
|
-
}
|
|
136
|
-
const char_to_integer = {};
|
|
137
|
-
const integer_to_char = {};
|
|
138
|
-
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
|
139
|
-
.split('')
|
|
140
|
-
.forEach(function (char, i) {
|
|
141
|
-
char_to_integer[char] = i;
|
|
142
|
-
integer_to_char[i] = char;
|
|
143
|
-
});
|
|
144
|
-
export function decode(string) {
|
|
145
|
-
let result = [];
|
|
146
|
-
let shift = 0;
|
|
147
|
-
let value = 0;
|
|
148
|
-
for (let i = 0; i < string.length; i += 1) {
|
|
149
|
-
let integer = char_to_integer[string[i]];
|
|
150
|
-
if (integer === undefined) {
|
|
151
|
-
throw new Error('Invalid character (' + string[i] + ')');
|
|
152
|
-
}
|
|
153
|
-
const has_continuation_bit = integer & 32;
|
|
154
|
-
integer &= 31;
|
|
155
|
-
value += integer << shift;
|
|
156
|
-
if (has_continuation_bit) {
|
|
157
|
-
shift += 5;
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
const should_negate = value & 1;
|
|
161
|
-
value >>>= 1;
|
|
162
|
-
if (should_negate) {
|
|
163
|
-
result.push(value === 0 ? -0x80000000 : -value);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
result.push(value);
|
|
167
|
-
}
|
|
168
|
-
// reset
|
|
169
|
-
value = shift = 0;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return result;
|
|
173
|
-
}
|
|
174
|
-
export function encode(value) {
|
|
175
|
-
if (typeof value === 'number') {
|
|
176
|
-
return encode_integer(value);
|
|
177
|
-
}
|
|
178
|
-
let result = '';
|
|
179
|
-
for (let i = 0; i < value.length; i += 1) {
|
|
180
|
-
result += encode_integer(value[i]);
|
|
181
|
-
}
|
|
182
|
-
return result;
|
|
183
|
-
}
|
|
184
|
-
function encode_integer(num) {
|
|
185
|
-
let result = '';
|
|
186
|
-
if (num < 0) {
|
|
187
|
-
num = (-num << 1) | 1;
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
num <<= 1;
|
|
191
|
-
}
|
|
192
|
-
do {
|
|
193
|
-
let clamped = num & 31;
|
|
194
|
-
num >>>= 5;
|
|
195
|
-
if (num > 0) {
|
|
196
|
-
clamped |= 32;
|
|
197
|
-
}
|
|
198
|
-
result += integer_to_char[clamped];
|
|
199
|
-
} while (num > 0);
|
|
200
|
-
return result;
|
|
201
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Fragment, Node as ProseMirrorNode, Schema } from 'prosemirror-model';
|
|
2
|
-
import type { JSONContent } from '../types.js';
|
|
3
|
-
export type CreateNodeFromContentOptions = {
|
|
4
|
-
errorOnInvalidContent?: boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare function createNodeFromObject(content: JSONContent | ProseMirrorNode | Fragment, schema: Schema, options?: CreateNodeFromContentOptions): ProseMirrorNode;
|
|
7
|
-
export declare function createNodeFromArray(content: JSONContent[], schema: Schema): Fragment;
|
|
8
|
-
export declare function createNodeFromContent(content: JSONContent | ProseMirrorNode | Fragment, schema: Schema, options?: CreateNodeFromContentOptions): ProseMirrorNode | Fragment;
|
|
9
|
-
//# sourceMappingURL=createNodeFromContent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createNodeFromContent.d.ts","sourceRoot":"","sources":["../../src/utilities/createNodeFromContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,4BAA4B,GAAG;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,WAAW,GAAG,eAAe,GAAG,QAAQ,EACjD,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,eAAe,CA0BjB;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,EAAE,EACtB,MAAM,EAAE,MAAM,GACb,QAAQ,CAIV;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,WAAW,GAAG,eAAe,GAAG,QAAQ,EACjD,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,eAAe,GAAG,QAAQ,CAY5B"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Fragment, Node as ProseMirrorNode } from 'prosemirror-model';
|
|
2
|
-
export function createNodeFromObject(content, schema, options) {
|
|
3
|
-
try {
|
|
4
|
-
const node = schema.nodeFromJSON(content);
|
|
5
|
-
if (options?.errorOnInvalidContent) {
|
|
6
|
-
node.check();
|
|
7
|
-
}
|
|
8
|
-
return node;
|
|
9
|
-
}
|
|
10
|
-
catch (error) {
|
|
11
|
-
if (options?.errorOnInvalidContent) {
|
|
12
|
-
throw new Error('Invalid JSON content', {
|
|
13
|
-
cause: error,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
console.warn('Invalid content.', 'Passed value:', content, 'Error:', error);
|
|
17
|
-
return schema.topNodeType.createAndFill(null, []);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export function createNodeFromArray(content, schema) {
|
|
21
|
-
return Fragment.fromArray(content.map((item) => schema.nodeFromJSON(item)));
|
|
22
|
-
}
|
|
23
|
-
export function createNodeFromContent(content, schema, options) {
|
|
24
|
-
if (content instanceof ProseMirrorNode || content instanceof Fragment) {
|
|
25
|
-
return content;
|
|
26
|
-
}
|
|
27
|
-
const isJSONContent = typeof content === 'object' && content !== null;
|
|
28
|
-
if (isJSONContent) {
|
|
29
|
-
return createNodeFromObject(content, schema, options);
|
|
30
|
-
}
|
|
31
|
-
return schema.topNodeType.createAndFill(null, []);
|
|
32
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { MarkSpec, Node as ProseMirrorNode, NodeSpec } from 'prosemirror-model';
|
|
2
|
-
import type { Mark } from '../Mark.js';
|
|
3
|
-
import type { Node } from '../Node.js';
|
|
4
|
-
type MarkOfNode = Mark | Node;
|
|
5
|
-
export declare function getHtmlAttributes(extension: MarkOfNode, node: ProseMirrorNode): Record<string, any>;
|
|
6
|
-
export declare function setHtmlAttributes(extension: MarkOfNode, element: HTMLElement): Record<string, any>;
|
|
7
|
-
export declare function addAttributesToSchema(spec: MarkSpec | NodeSpec, extension: MarkOfNode): void;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=getHtmlAttributes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getHtmlAttributes.d.ts","sourceRoot":"","sources":["../../src/utilities/getHtmlAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,IAAI,IAAI,eAAe,EACvB,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9B,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,UAAU,EACrB,IAAI,EAAE,eAAe,uBAmBtB;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,uBAc5E;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,QAAQ,GAAG,QAAQ,EACzB,SAAS,EAAE,UAAU,QAetB"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export function getHtmlAttributes(extension, node) {
|
|
2
|
-
const attrs = {};
|
|
3
|
-
if (extension.attributes) {
|
|
4
|
-
for (const [key, value] of Object.entries(extension.attributes)) {
|
|
5
|
-
if ('undefined' !== typeof node.attrs[key]) {
|
|
6
|
-
attrs[key] = node.attrs[key];
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
if (value.toDom) {
|
|
10
|
-
attrs[key] = value.toDom(node);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
attrs[key] = value.default;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return attrs;
|
|
19
|
-
}
|
|
20
|
-
export function setHtmlAttributes(extension, element) {
|
|
21
|
-
const attrs = {};
|
|
22
|
-
if (extension.attributes) {
|
|
23
|
-
for (const [key, value] of Object.entries(extension.attributes)) {
|
|
24
|
-
if (value.fromDom) {
|
|
25
|
-
attrs[key] = value.fromDom(element);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
attrs[key] = value.default;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return attrs;
|
|
33
|
-
}
|
|
34
|
-
export function addAttributesToSchema(spec, extension) {
|
|
35
|
-
const attrs = {};
|
|
36
|
-
if (extension.attributes) {
|
|
37
|
-
if (!spec.attrs) {
|
|
38
|
-
spec.attrs = {};
|
|
39
|
-
}
|
|
40
|
-
for (const [key, value] of Object.entries(extension.attributes)) {
|
|
41
|
-
spec.attrs[key] = value;
|
|
42
|
-
if (!value.toDom) {
|
|
43
|
-
value.toDom = (node) => node.attrs[key];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getShadowRoot.d.ts","sourceRoot":"","sources":["../../src/utilities/getShadowRoot.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAiBvE"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export function getShadowRoot(element) {
|
|
2
|
-
let current = element;
|
|
3
|
-
while (current) {
|
|
4
|
-
if (current.toString() === '[object ShadowRoot]') {
|
|
5
|
-
return current;
|
|
6
|
-
}
|
|
7
|
-
if (current instanceof ShadowRoot) {
|
|
8
|
-
if (current.host) {
|
|
9
|
-
return current.host.shadowRoot || undefined;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
current = current.parentElement ||
|
|
13
|
-
((current instanceof ShadowRoot) ? current.host : undefined);
|
|
14
|
-
}
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
package/esm/utilities/mod.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/utilities/mod.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
|
package/esm/utilities/mod.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toRawTextResult.d.ts","sourceRoot":"","sources":["../../src/utilities/toRawTextResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE7D,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,aAAa,CAwB3E"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export function toRawTextResult(content, nodeIdx = 0) {
|
|
2
|
-
const lines = content.split('\n');
|
|
3
|
-
const rawTextMap = [];
|
|
4
|
-
let targetPos = 0;
|
|
5
|
-
let targetRow = 0;
|
|
6
|
-
for (const line of lines) {
|
|
7
|
-
rawTextMap.push({
|
|
8
|
-
nodeIdx,
|
|
9
|
-
targetRow,
|
|
10
|
-
targetCol: 0,
|
|
11
|
-
targetPos,
|
|
12
|
-
});
|
|
13
|
-
targetRow++;
|
|
14
|
-
targetPos += line.length + 1;
|
|
15
|
-
nodeIdx += line.length + 1;
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
content,
|
|
19
|
-
rawTextMap,
|
|
20
|
-
};
|
|
21
|
-
}
|