@openleaf-editor/core 0.1.0-beta.0 → 0.1.0-beta.1
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/dist/commands.d.ts +41 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +183 -0
- package/dist/commands.js.map +1 -1
- package/dist/css.d.ts +124 -0
- package/dist/css.d.ts.map +1 -0
- package/dist/css.js +215 -0
- package/dist/css.js.map +1 -0
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +97 -4
- package/dist/extensions.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/keymap.d.ts.map +1 -1
- package/dist/keymap.js +10 -1
- package/dist/keymap.js.map +1 -1
- package/dist/preserve.d.ts +8 -0
- package/dist/preserve.d.ts.map +1 -1
- package/dist/preserve.js +52 -2
- package/dist/preserve.js.map +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +138 -19
- package/dist/schema.js.map +1 -1
- package/package.json +1 -1
package/dist/css.js
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CSS the schema is willing to model, and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* Alignment and colour are the two formatting features that cannot be expressed
|
|
5
|
+
* as a tag. `<p align="center">` and `<font color="red">` were removed from HTML
|
|
6
|
+
* years ago; every editor this one is meant to replace -- TinyMCE, CKEditor,
|
|
7
|
+
* Google Docs -- writes `style="text-align:center"` and
|
|
8
|
+
* `<span style="color:#c00">` instead. Matching them is not a preference: it is
|
|
9
|
+
* the difference between reading a customer's existing archive and rewriting it.
|
|
10
|
+
*
|
|
11
|
+
* So OpenLeaf emits a `style` attribute, which means it owes a precise answer to
|
|
12
|
+
* "which declarations, with which values". That answer lives here, in one place,
|
|
13
|
+
* because four separate consumers need to agree on it:
|
|
14
|
+
*
|
|
15
|
+
* the schema -- parsing stored HTML and writing it back
|
|
16
|
+
* the commands -- validating what a toolbar hands them
|
|
17
|
+
* the preservation -- deciding whether a `<span style>` is fully modelled and
|
|
18
|
+
* layer can therefore be unwrapped rather than kept as an atom
|
|
19
|
+
* @openleaf-editor/sanitize -- allowing exactly these declarations server-side
|
|
20
|
+
*
|
|
21
|
+
* Four hand-written copies of a CSS allowlist is the same divergence the
|
|
22
|
+
* sanitize package exists to prevent, one layer down.
|
|
23
|
+
*
|
|
24
|
+
* ## Why a validator rather than a blocklist
|
|
25
|
+
*
|
|
26
|
+
* `style` has a genuinely bad history: `expression()` in old IE executed
|
|
27
|
+
* JavaScript, `url()` fetches, `position:fixed` lets pasted content cover the
|
|
28
|
+
* page with something that looks like your UI. None of that is reachable
|
|
29
|
+
* through a three-property allowlist whose values must match a colour or one of
|
|
30
|
+
* four keywords -- and an allowlist stays safe against whatever CSS gains next,
|
|
31
|
+
* which a list of known-bad functions does not.
|
|
32
|
+
*/
|
|
33
|
+
export const ALIGNMENTS = ['left', 'center', 'right', 'justify'];
|
|
34
|
+
/**
|
|
35
|
+
* Declarations the schema models, and therefore the only ones it will write.
|
|
36
|
+
*
|
|
37
|
+
* `@openleaf-editor/sanitize` reads this list to build its own allowlist, so a
|
|
38
|
+
* property added here reaches the server-side policy rather than being stripped
|
|
39
|
+
* from stored content by a policy that never heard of it.
|
|
40
|
+
*/
|
|
41
|
+
export const MODELLED_PROPERTIES = ['text-align', 'color', 'background-color'];
|
|
42
|
+
/**
|
|
43
|
+
* The subset a mark can represent, and therefore the subset the preservation
|
|
44
|
+
* layer may unwrap a `<span>` for. `text-align` is deliberately absent: it is a
|
|
45
|
+
* block attribute, so unwrapping the element that carries it loses it.
|
|
46
|
+
*/
|
|
47
|
+
export const COLOUR_PROPERTIES = ['color', 'background-color'];
|
|
48
|
+
/**
|
|
49
|
+
* Split a `style` attribute into declarations.
|
|
50
|
+
*
|
|
51
|
+
* Deliberately reads the raw attribute rather than the CSSOM. `element.style`
|
|
52
|
+
* normalizes as it parses -- Chrome turns `#ff0000` into `rgb(255, 0, 0)` -- and
|
|
53
|
+
* anything that reads through it rewrites every hex colour in an archive on the
|
|
54
|
+
* first save. The parse is trivial because the values that survive validation
|
|
55
|
+
* contain no semicolons or quotes; anything that does fails validation and is
|
|
56
|
+
* dropped, so a naive split cannot be tricked into producing a value the
|
|
57
|
+
* validators would not have accepted anyway.
|
|
58
|
+
*
|
|
59
|
+
* Keys are lowercased; values keep their case, because a colour may be a hex
|
|
60
|
+
* digit sequence an author wrote in capitals and there is no reason to change it.
|
|
61
|
+
*/
|
|
62
|
+
export function parseDeclarations(style) {
|
|
63
|
+
const out = new Map();
|
|
64
|
+
if (!style)
|
|
65
|
+
return out;
|
|
66
|
+
for (const part of style.split(';')) {
|
|
67
|
+
const colon = part.indexOf(':');
|
|
68
|
+
if (colon < 0)
|
|
69
|
+
continue;
|
|
70
|
+
const name = part.slice(0, colon).trim().toLowerCase();
|
|
71
|
+
const value = part.slice(colon + 1).trim();
|
|
72
|
+
if (name === '' || value === '')
|
|
73
|
+
continue;
|
|
74
|
+
out.set(name, value);
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
/** Join declarations back into a `style` attribute value, or `null` if empty. */
|
|
79
|
+
export function serializeDeclarations(declarations) {
|
|
80
|
+
if (declarations.size === 0)
|
|
81
|
+
return null;
|
|
82
|
+
return [...declarations].map(([name, value]) => `${name}:${value}`).join(';');
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The alignment this value means, or null.
|
|
86
|
+
*
|
|
87
|
+
* `start` and `end` are accepted because they are what a bidirectional-aware
|
|
88
|
+
* author writes, and they are resolved against the reading direction rather than
|
|
89
|
+
* dropped: in an RTL document `start` is the right edge. They are NOT preserved
|
|
90
|
+
* as `start`/`end`, which is a real if narrow loss -- an RTL paragraph aligned to
|
|
91
|
+
* `start` comes back as `right`, and stays right if the document's direction
|
|
92
|
+
* later changes. Modelling logical alignment properly means a second attribute
|
|
93
|
+
* and a toolbar that can express it, which is a bigger feature than this one.
|
|
94
|
+
*/
|
|
95
|
+
export function safeAlign(value, dir) {
|
|
96
|
+
if (!value)
|
|
97
|
+
return null;
|
|
98
|
+
const candidate = value.trim().toLowerCase();
|
|
99
|
+
const rtl = (dir ?? '').toLowerCase() === 'rtl';
|
|
100
|
+
if (candidate === 'start')
|
|
101
|
+
return rtl ? 'right' : 'left';
|
|
102
|
+
if (candidate === 'end')
|
|
103
|
+
return rtl ? 'left' : 'right';
|
|
104
|
+
return ALIGNMENTS.includes(candidate) ? candidate : null;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A colour value, or null when it is not one.
|
|
108
|
+
*
|
|
109
|
+
* The three accepted shapes are hex, the `rgb`/`hsl` function families, and a
|
|
110
|
+
* bare keyword. A keyword is matched as a plain identifier rather than against
|
|
111
|
+
* the 148-name CSS colour list: the list costs most of a kilobyte in a bundle
|
|
112
|
+
* with a hard budget, and an unrecognised identifier is not dangerous -- the
|
|
113
|
+
* browser discards the declaration. Every form that can actually reach outside
|
|
114
|
+
* the declaration needs a character this rejects, `(` for `expression()` and
|
|
115
|
+
* `url()` among them, and both are excluded from the keyword shape.
|
|
116
|
+
*/
|
|
117
|
+
const HEX = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
118
|
+
const FUNCTIONAL = /^(?:rgba?|hsla?)\(\s*[0-9a-z\s.,%/+-]+\)$/i;
|
|
119
|
+
const KEYWORD = /^[a-z]{3,24}$/i;
|
|
120
|
+
/** `rgb(255, 0, 0)` and friends, so a fully opaque one can become hex. */
|
|
121
|
+
const RGB_CHANNELS = /^rgba?\(\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})\s*(?:[,/]\s*(1|1?\.0+|100%)\s*)?\)$/i;
|
|
122
|
+
export function safeColor(value) {
|
|
123
|
+
if (!value)
|
|
124
|
+
return null;
|
|
125
|
+
// Collapsed rather than stripped: `rgb(255 0 0)` needs its separators.
|
|
126
|
+
const candidate = value.trim().replace(/\s+/g, ' ');
|
|
127
|
+
if (candidate === '')
|
|
128
|
+
return null;
|
|
129
|
+
const rgb = RGB_CHANNELS.exec(candidate);
|
|
130
|
+
if (rgb) {
|
|
131
|
+
// Normalized to hex, and this is what keeps a round trip stable rather than
|
|
132
|
+
// merely lossless. ProseMirror matches mark style rules through the CSSOM,
|
|
133
|
+
// which hands us `rgb(255, 0, 0)` for an authored `#ff0000` -- so without
|
|
134
|
+
// this, opening and saving a document would rewrite every hex colour in it
|
|
135
|
+
// into a longer functional form. Folding the other direction instead makes
|
|
136
|
+
// both spellings converge on the shorter one, and the second save is a
|
|
137
|
+
// no-op.
|
|
138
|
+
const channels = [rgb[1], rgb[2], rgb[3]].map((n) => Number.parseInt(n, 10));
|
|
139
|
+
if (channels.every((n) => n <= 255)) {
|
|
140
|
+
return `#${channels.map((n) => n.toString(16).padStart(2, '0')).join('')}`;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (HEX.test(candidate))
|
|
144
|
+
return candidate.toLowerCase();
|
|
145
|
+
if (FUNCTIONAL.test(candidate))
|
|
146
|
+
return candidate.toLowerCase();
|
|
147
|
+
if (KEYWORD.test(candidate))
|
|
148
|
+
return candidate.toLowerCase();
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Put CSS on an element without losing the author's spelling.
|
|
153
|
+
*
|
|
154
|
+
* ## Why this is not simply `setAttribute('style', css)`
|
|
155
|
+
*
|
|
156
|
+
* ProseMirror's DOM serializer writes `style` with `element.style.cssText = value`,
|
|
157
|
+
* which routes the declaration through the CSSOM -- and the CSSOM rewrites as it
|
|
158
|
+
* parses. `color:#cc0000` comes back out as `color: rgb(204, 0, 0)`. Measured in
|
|
159
|
+
* Chromium and WebKit: `setAttribute` preserves the string exactly, `cssText`
|
|
160
|
+
* does not.
|
|
161
|
+
*
|
|
162
|
+
* The consequence of letting the serializer do it is that opening and saving a
|
|
163
|
+
* document rewrites every hex colour in it into a longer functional form. No
|
|
164
|
+
* information is lost, so it is a normalization rather than a fidelity bug -- but
|
|
165
|
+
* it is a normalization that touches the COMMON case in inherited content, and
|
|
166
|
+
* "we changed every coloured span in your archive" is not a diff this project
|
|
167
|
+
* gets to put in somebody's revision history quietly. So the nodes and marks that
|
|
168
|
+
* emit CSS return a real element and set the attribute themselves.
|
|
169
|
+
*
|
|
170
|
+
* ## Why it then falls back to the CSSOM anyway
|
|
171
|
+
*
|
|
172
|
+
* A strict Content-Security-Policy without `unsafe-inline` in `style-src` blocks
|
|
173
|
+
* a `style` ATTRIBUTE: the attribute stays in the DOM and the browser refuses to
|
|
174
|
+
* parse it, so the paragraph renders unaligned and the console fills with
|
|
175
|
+
* violations. A CSSOM write is not blocked -- the same distinction that makes the
|
|
176
|
+
* toolbar's constructable stylesheet CSP-safe.
|
|
177
|
+
*
|
|
178
|
+
* So: set the attribute, then check whether the browser honoured it, and fall
|
|
179
|
+
* back to `cssText` if it did not. Under an ordinary CSP the author's spelling
|
|
180
|
+
* survives; under a strict one the formatting still renders, at the cost of the
|
|
181
|
+
* normalization. Getting both right in the environment that has both is not
|
|
182
|
+
* possible, and of the two, "it renders" has to win.
|
|
183
|
+
*/
|
|
184
|
+
export function applyStyleAttribute(el, css) {
|
|
185
|
+
el.setAttribute('style', css);
|
|
186
|
+
const style = el.style;
|
|
187
|
+
// `length` is zero when the attribute was set but not parsed, which is exactly
|
|
188
|
+
// the CSP-blocked case. It is also zero if the declaration was invalid, where
|
|
189
|
+
// falling through costs nothing because there was nothing to render.
|
|
190
|
+
if (style && style.length === 0)
|
|
191
|
+
style.cssText = css;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Is every declaration in this `style` attribute one the schema models?
|
|
195
|
+
*
|
|
196
|
+
* The preservation layer asks this before unwrapping a `<span style>`. A span
|
|
197
|
+
* carrying only colour is fully representable as marks, so unwrapping it loses
|
|
198
|
+
* nothing and the text inside stays editable. One carrying `font-family` as well
|
|
199
|
+
* is not, and it must stay an opaque preserved atom -- faithful, uneditable, and
|
|
200
|
+
* exactly what happens today rather than a regression.
|
|
201
|
+
*/
|
|
202
|
+
export function isFullyModelledStyle(style, properties = COLOUR_PROPERTIES) {
|
|
203
|
+
const declarations = parseDeclarations(style);
|
|
204
|
+
if (declarations.size === 0)
|
|
205
|
+
return false;
|
|
206
|
+
for (const [name, value] of declarations) {
|
|
207
|
+
if (!properties.includes(name))
|
|
208
|
+
return false;
|
|
209
|
+
const valid = name === 'text-align' ? safeAlign(value) : safeColor(value);
|
|
210
|
+
if (valid === null)
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=css.js.map
|
package/dist/css.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../src/css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH,MAAM,CAAC,MAAM,UAAU,GAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;AAElF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB,CAAC,YAAY,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAA;AAEjG;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAsB,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA;AAEjF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAgC;IAChE,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAA;IACrC,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG,CAAA;IACtB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,I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AC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QACzE,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,KAAK,CAAA;IAClC,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/extensions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../src/extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,EACL,MAAM,EAEN,KAAK,QAAQ,EACb,KAAK,QAAQ,EAGd,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../src/extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,EACL,MAAM,EAEN,KAAK,QAAQ,EACb,KAAK,QAAQ,EAGd,MAAM,mBAAmB,CAAA;AAU1B,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;IACnD,iCAAiC;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;IACnD,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACrC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAA;CAC1C;AAED,gFAAgF;AAChF,eAAO,MAAM,YAAY,sBAAsB,CAAA;AAmB/C;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,IAAI,CAe9E;AAED,wBAAgB,0BAA0B,IAAI,SAAS,eAAe,EAAE,CAEvE;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAKzE;AAED,gDAAgD;AAChD,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AAwPD,wBAAgB,YAAY,CAAC,IAAI,GAAE,SAAS,eAAe,EAAO,GAAG,MAAM,CAyB1E;AAID;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAGnC"}
|
package/dist/extensions.js
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
*/
|
|
41
41
|
import OrderedMap from 'orderedmap';
|
|
42
42
|
import { Schema, } from 'prosemirror-model';
|
|
43
|
+
import { MODELLED_PROPERTIES, applyStyleAttribute, parseDeclarations, serializeDeclarations, } from './css.js';
|
|
43
44
|
import { coreMarks, coreNodes } from './schema.js';
|
|
44
45
|
import { URL_ATTRIBUTES, isEventHandlerAttribute, isSafeUrl } from './url.js';
|
|
45
46
|
/** Where carried attributes live. Underscored: it is not for plugin authors. */
|
|
@@ -123,7 +124,93 @@ const CARRY_SCRUB = {
|
|
|
123
124
|
else
|
|
124
125
|
delete carried['class'];
|
|
125
126
|
},
|
|
127
|
+
paragraph: scrubModelledStyle,
|
|
128
|
+
heading: scrubModelledStyle,
|
|
126
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* Drop the declarations a text block now models from its carried residue.
|
|
132
|
+
*
|
|
133
|
+
* `text-align` is the node's own `align` attribute and colour is the two colour
|
|
134
|
+
* marks, so carrying either a second time emits both spellings of the same
|
|
135
|
+
* intent -- and the moment an author changes the alignment, the copy that is not
|
|
136
|
+
* modelled disagrees with the one that is. The legacy `align` attribute goes for
|
|
137
|
+
* the same reason: it is where the value may have been read from, and it is not
|
|
138
|
+
* where it is written back.
|
|
139
|
+
*
|
|
140
|
+
* Anything else in the attribute stays. A paragraph stored as
|
|
141
|
+
* `style="line-height:1.4;text-align:left"` keeps its line height, which is the
|
|
142
|
+
* whole point of the carry mechanism.
|
|
143
|
+
*/
|
|
144
|
+
function scrubModelledStyle(carried) {
|
|
145
|
+
delete carried['align'];
|
|
146
|
+
const style = carried['style'];
|
|
147
|
+
if (style === undefined)
|
|
148
|
+
return;
|
|
149
|
+
const declarations = parseDeclarations(style);
|
|
150
|
+
for (const name of MODELLED_PROPERTIES)
|
|
151
|
+
declarations.delete(name);
|
|
152
|
+
const rest = serializeDeclarations(declarations);
|
|
153
|
+
if (rest !== null)
|
|
154
|
+
carried['style'] = rest;
|
|
155
|
+
else
|
|
156
|
+
delete carried['style'];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Merge carried residue with the attributes a spec produced.
|
|
160
|
+
*
|
|
161
|
+
* Modelled attributes win, because the spec is the authority on the names it
|
|
162
|
+
* declared -- except for `style`, where winning wholesale is a content-loss bug.
|
|
163
|
+
* A paragraph whose stored style was `line-height:1.4;text-align:left` has the
|
|
164
|
+
* line height in its residue and the alignment in its `align` attribute; a plain
|
|
165
|
+
* object spread replaces the residue's `style` with the spec's and the line
|
|
166
|
+
* height is gone. So `style` is merged one declaration at a time, residue first
|
|
167
|
+
* so the modelled value overrides a stale copy of itself.
|
|
168
|
+
*/
|
|
169
|
+
/**
|
|
170
|
+
* Merge carried residue onto an element a spec built for itself.
|
|
171
|
+
*
|
|
172
|
+
* The array path below cannot cover this case, and it is not hypothetical: a
|
|
173
|
+
* paragraph carrying CSS returns a real element from `toDOM` so that its `style`
|
|
174
|
+
* attribute is not rewritten by the CSSOM. That element has to be given the
|
|
175
|
+
* residue too, or modelling `text-align` would silently drop the `line-height`
|
|
176
|
+
* next to it -- the exact loss the carry mechanism exists to prevent,
|
|
177
|
+
* reintroduced from a new direction.
|
|
178
|
+
*/
|
|
179
|
+
function applyCarriedToElement(el, carried) {
|
|
180
|
+
for (const [name, value] of Object.entries(carried)) {
|
|
181
|
+
if (name === 'style') {
|
|
182
|
+
const declarations = parseDeclarations(value);
|
|
183
|
+
// Residue first, then what the spec wrote, so a modelled declaration wins
|
|
184
|
+
// over a stale copy of itself while everything else survives.
|
|
185
|
+
for (const [property, css] of parseDeclarations(el.getAttribute('style'))) {
|
|
186
|
+
declarations.set(property, css);
|
|
187
|
+
}
|
|
188
|
+
const style = serializeDeclarations(declarations);
|
|
189
|
+
if (style !== null)
|
|
190
|
+
applyStyleAttribute(el, style);
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
// A spec's own attributes win: it is the authority on the names it declared.
|
|
194
|
+
if (!el.hasAttribute(name))
|
|
195
|
+
el.setAttribute(name, value);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function mergeCarried(carried, modelled) {
|
|
199
|
+
const merged = { ...carried, ...modelled };
|
|
200
|
+
const before = carried['style'];
|
|
201
|
+
const after = modelled['style'];
|
|
202
|
+
if (typeof before === 'string' && typeof after === 'string') {
|
|
203
|
+
const declarations = parseDeclarations(before);
|
|
204
|
+
for (const [name, value] of parseDeclarations(after))
|
|
205
|
+
declarations.set(name, value);
|
|
206
|
+
const style = serializeDeclarations(declarations);
|
|
207
|
+
if (style !== null)
|
|
208
|
+
merged['style'] = style;
|
|
209
|
+
else
|
|
210
|
+
delete merged['style'];
|
|
211
|
+
}
|
|
212
|
+
return merged;
|
|
213
|
+
}
|
|
127
214
|
/**
|
|
128
215
|
* Wrap a node spec so attributes it does not model survive the round trip.
|
|
129
216
|
*
|
|
@@ -170,13 +257,19 @@ function withCarriedAttributes(name, spec) {
|
|
|
170
257
|
? (node) => {
|
|
171
258
|
const out = originalToDOM(node);
|
|
172
259
|
const carried = node.attrs[CARRIED_ATTR];
|
|
173
|
-
if (!carried
|
|
260
|
+
if (!carried)
|
|
174
261
|
return out;
|
|
262
|
+
if (!Array.isArray(out)) {
|
|
263
|
+
// `{ dom, contentDOM }`, or a bare node. Both are legal output specs and
|
|
264
|
+
// both mean the spec built its own element.
|
|
265
|
+
const dom = isPlainObject(out) ? out.dom : out;
|
|
266
|
+
if (dom instanceof Element)
|
|
267
|
+
applyCarriedToElement(dom, carried);
|
|
268
|
+
return out;
|
|
269
|
+
}
|
|
175
270
|
const result = [...out];
|
|
176
271
|
if (isPlainObject(result[1])) {
|
|
177
|
-
|
|
178
|
-
// names it declared.
|
|
179
|
-
result[1] = { ...carried, ...result[1] };
|
|
272
|
+
result[1] = mergeCarried(carried, result[1]);
|
|
180
273
|
}
|
|
181
274
|
else {
|
|
182
275
|
result.splice(1, 0, carried);
|
package/dist/extensions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../src/extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EACL,MAAM,GAMP,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AA2B7E,gFAAgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAA;AAE/C;;wEAEwE;AAExE,MAAM,UAAU,GAAG,IAAI,GAAG,EAA2B,CAAA;AACrD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAA;AAEvC,SAAS,MAAM;IACb,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,QAAQ,EAAE,CAAA;QACZ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,0DAA0D,EAAE,KAAK,CAAC,CAAA;QAClF,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAA0B;I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,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACjD,CAAC;IACH,CAAC;IAED,OAAO,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;AACrC,CAAC;AAED,IAAI,MAAM,GAAkB,IAAI,CAAA;AAEhC;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU;IACxB,IAAI,CAAC,MAAM;QAAE,MAAM,GAAG,YAAY,CAAC,0BAA0B,EAAE,CAAC,CAAA;IAChE,OAAO,MAAM,CAAA;AACf,CAAC;AAED,wBAAwB,CAAC,GAAG,EAAE;IAC5B,MAAM,GAAG,IAAI,CAAA;AACf,CAAC,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { baseSchema, coreMarks, coreNodes } from './schema.js';
|
|
2
|
+
export { ALIGNMENTS, COLOUR_PROPERTIES, MODELLED_PROPERTIES, isFullyModelledStyle, parseDeclarations, safeAlign, safeColor, serializeDeclarations, type Align, } from './css.js';
|
|
2
3
|
export { parseHtml, serializeHtml, roundTrip, type HtmlIOOptions } from './html.js';
|
|
3
4
|
export { isLosslesslyUnwrappable, unknownBlock, unknownInline } from './preserve.js';
|
|
4
5
|
export { URL_ATTRIBUTES, isEventHandlerAttribute, isSafeUrl, safeUrlOrNull, } from './url.js';
|
|
5
|
-
export { activeHeadingLevel, activeLink, canInsert, canRedo, canUndo, isMarkActive, isNodeActive, toggleBold, toggleInlineCode, toggleItalic, toggleStrike, toggleUnderline, insertHorizontalRule, setHeading, setParagraph, toggleBlockquote, toggleCodeBlock, toggleHeading, wrapInBlockquote, indentListItem, outdentListItem, splitListItemCommand, toggleBulletList, toggleOrderedList, insertImage, setLink, unsetLink, type ImageAttrs, type LinkAttrs, redo, undo, } from './commands.js';
|
|
6
|
+
export { activeBackgroundColor, activeHeadingLevel, activeLink, activeTextAlign, activeTextColor, canInsert, canRedo, canUndo, isMarkActive, isNodeActive, toggleBold, toggleInlineCode, toggleItalic, toggleStrike, toggleUnderline, clearBackgroundColor, clearTextColor, setBackgroundColor, setTextColor, insertHorizontalRule, setHeading, setParagraph, setTextAlign, toggleBlockquote, toggleCodeBlock, toggleHeading, toggleTextAlign, wrapInBlockquote, indentListItem, outdentListItem, splitListItemCommand, toggleBulletList, toggleOrderedList, insertImage, setLink, unsetLink, type ImageAttrs, type LinkAttrs, redo, undo, } from './commands.js';
|
|
6
7
|
export { buildKeymap, shortcutFor, shortcuts, type Shortcut, } from './keymap.js';
|
|
7
8
|
export { createRegisteredPlugins, onEditorPluginsChange, registerEditorPlugin, type EditorPluginFactory, } from './plugins.js';
|
|
8
9
|
export { table, table_cell, table_header, table_row } from './tables.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAA;AACnF,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACpF,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,aAAa,GACd,MAAM,UAAU,CAAA;AACjB,OAAO,EAEL,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,OAAO,EACP,OAAO,EACP,YAAY,EACZ,YAAY,EAEZ,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,eAAe,EAEf,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAEhB,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EAEjB,WAAW,EACX,OAAO,EACP,SA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,EACZ,eAAe,EAEf,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,YAAY,EAEZ,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,eAAe,EACf,gBAAgB,EAEhB,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EAEjB,WAAW,EACX,OAAO,EACP,SAAS,EACT,KAAK,UAAU,EACf,KAAK,SAAS,EAEd,IAAI,EACJ,IAAI,GACL,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,KAAK,QAAQ,GACd,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
export { baseSchema, coreMarks, coreNodes } from './schema.js';
|
|
2
|
+
export { ALIGNMENTS, COLOUR_PROPERTIES, MODELLED_PROPERTIES, isFullyModelledStyle, parseDeclarations, safeAlign, safeColor, serializeDeclarations, } from './css.js';
|
|
2
3
|
export { parseHtml, serializeHtml, roundTrip } from './html.js';
|
|
3
4
|
export { isLosslesslyUnwrappable, unknownBlock, unknownInline } from './preserve.js';
|
|
4
5
|
export { URL_ATTRIBUTES, isEventHandlerAttribute, isSafeUrl, safeUrlOrNull, } from './url.js';
|
|
5
6
|
export {
|
|
6
7
|
// predicates
|
|
7
|
-
activeHeadingLevel, activeLink, canInsert, canRedo, canUndo, isMarkActive, isNodeActive,
|
|
8
|
+
activeBackgroundColor, activeHeadingLevel, activeLink, activeTextAlign, activeTextColor, canInsert, canRedo, canUndo, isMarkActive, isNodeActive,
|
|
8
9
|
// marks
|
|
9
10
|
toggleBold, toggleInlineCode, toggleItalic, toggleStrike, toggleUnderline,
|
|
11
|
+
// colour
|
|
12
|
+
clearBackgroundColor, clearTextColor, setBackgroundColor, setTextColor,
|
|
10
13
|
// blocks
|
|
11
|
-
insertHorizontalRule, setHeading, setParagraph, toggleBlockquote, toggleCodeBlock, toggleHeading, wrapInBlockquote,
|
|
14
|
+
insertHorizontalRule, setHeading, setParagraph, setTextAlign, toggleBlockquote, toggleCodeBlock, toggleHeading, toggleTextAlign, wrapInBlockquote,
|
|
12
15
|
// lists
|
|
13
16
|
indentListItem, outdentListItem, splitListItemCommand, toggleBulletList, toggleOrderedList,
|
|
14
17
|
// links and images
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAsB,MAAM,WAAW,CAAA;AACnF,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACpF,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,aAAa,GACd,MAAM,UAAU,CAAA;AACjB,OAAO;AACL,aAAa;AACb,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,OAAO,EACP,OAAO,EACP,YAAY,EACZ,YAAY;AACZ,QAAQ;AACR,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,eAAe;AACf,SAAS;AACT,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB;AAChB,QAAQ;AACR,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB;AACjB,mBAAmB;AACnB,WAAW,EACX,OAAO,EACP,SAAS;AAGT,UAAU;AACV,IAAI,EACJ,IAAI,GACL,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,GAEV,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GAErB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAE3B,MAAM,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,qBAAqB,GAEtB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAsB,MAAM,WAAW,CAAA;AACnF,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACpF,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,aAAa,GACd,MAAM,UAAU,CAAA;AACjB,OAAO;AACL,aAAa;AACb,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,eAAe,EACf,SAAS,EACT,OAAO,EACP,OAAO,EACP,YAAY,EACZ,YAAY;AACZ,QAAQ;AACR,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,eAAe;AACf,SAAS;AACT,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,YAAY;AACZ,SAAS;AACT,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,eAAe,EACf,gBAAgB;AAChB,QAAQ;AACR,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB;AACjB,mBAAmB;AACnB,WAAW,EACX,OAAO,EACP,SAAS;AAGT,UAAU;AACV,IAAI,EACJ,IAAI,GACL,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,GAEV,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GAErB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAE3B,MAAM,iBAAiB,CAAA"}
|
package/dist/keymap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../src/keymap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../src/keymap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAoBhD,uEAAuE;AACvE,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,EAAE,QAAQ,EAyC/B,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzB;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,UAAc,GAAG,MAAM,GAAG,IAAI,CAQ7E"}
|
package/dist/keymap.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { baseKeymap, chainCommands, exitCode } from 'prosemirror-commands';
|
|
24
24
|
import { redo, undo } from 'prosemirror-history';
|
|
25
|
-
import { indentListItem, insertHorizontalRule, outdentListItem, setParagraph, splitListItemCommand, toggleBlockquote, toggleBold, toggleBulletList, toggleCodeBlock, toggleHeading, toggleInlineCode, toggleItalic, toggleOrderedList, toggleStrike, toggleUnderline, } from './commands.js';
|
|
25
|
+
import { indentListItem, insertHorizontalRule, outdentListItem, setParagraph, toggleTextAlign, splitListItemCommand, toggleBlockquote, toggleBold, toggleBulletList, toggleCodeBlock, toggleHeading, toggleInlineCode, toggleItalic, toggleOrderedList, toggleStrike, toggleUnderline, } from './commands.js';
|
|
26
26
|
/**
|
|
27
27
|
* The default shortcut table.
|
|
28
28
|
*
|
|
@@ -50,6 +50,15 @@ export const shortcuts = [
|
|
|
50
50
|
{ keys: 'Mod-Shift-.', command: toggleBlockquote, label: 'Blockquote' },
|
|
51
51
|
{ keys: 'Mod-Alt-c', command: toggleCodeBlock, label: 'Code block' },
|
|
52
52
|
{ keys: 'Mod-Shift-Enter', command: insertHorizontalRule, label: 'Horizontal rule' },
|
|
53
|
+
// Alignment. Mod-Shift-L/E/R/J is Word and Google Docs, unchanged since the
|
|
54
|
+
// nineties, and it is one of the few shortcut families authors actually have
|
|
55
|
+
// in their fingers. There is deliberately no binding for "clear alignment":
|
|
56
|
+
// pressing the one already in force does that, which is what the same keys do
|
|
57
|
+
// in both of those editors.
|
|
58
|
+
{ keys: 'Mod-Shift-l', command: toggleTextAlign('left'), label: 'Align left' },
|
|
59
|
+
{ keys: 'Mod-Shift-e', command: toggleTextAlign('center'), label: 'Align centre' },
|
|
60
|
+
{ keys: 'Mod-Shift-r', command: toggleTextAlign('right'), label: 'Align right' },
|
|
61
|
+
{ keys: 'Mod-Shift-j', command: toggleTextAlign('justify'), label: 'Justify' },
|
|
53
62
|
// Lists. Mod-Shift-7/8 matches Word and Google Docs.
|
|
54
63
|
{ keys: 'Mod-Shift-7', command: toggleOrderedList, label: 'Numbered list' },
|
|
55
64
|
{ keys: 'Mod-Shift-8', command: toggleBulletList, label: 'Bulleted list' },
|
package/dist/keymap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keymap.js","sourceRoot":"","sources":["../src/keymap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,eAAe,GAChB,MAAM,eAAe,CAAA;AAStB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAe;IACnC,uEAAuE;IACvE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAA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AAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAA;IACtD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,OAAO,KAAK,CAAC,IAAI;SACd,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;SACrC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;SACpC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC;SACxC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACpC,CAAC;AAED,SAAS,SAAS;IAChB,IAAI,OAAO,SAAS,KAAK,WAAW;QAAE,OAAO,KAAK,CAAA;IAClD,OAAO,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,SAAS,CAAC,CAAA;AAC/E,CAAC"}
|
package/dist/preserve.d.ts
CHANGED
|
@@ -39,6 +39,14 @@ import type { NodeSpec } from 'prosemirror-model';
|
|
|
39
39
|
export declare function isLosslesslyUnwrappable(el: Element): boolean;
|
|
40
40
|
/** Run `fn` with preserved-node serialization targeting this Document. */
|
|
41
41
|
export declare function withSerializationDocument<T>(doc: Document, fn: () => T): T;
|
|
42
|
+
/**
|
|
43
|
+
* The Document that serialization should build into.
|
|
44
|
+
*
|
|
45
|
+
* Exported because schema.ts needs it for the same reason this file does: a node
|
|
46
|
+
* that builds a real element in `toDOM` has nowhere else to get a Document, since
|
|
47
|
+
* ProseMirror does not pass the one given to `serializeFragment` down to `toDOM`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function serializationTarget(): Document;
|
|
42
50
|
/** True when this element, or an ancestor, was rendered from preserved markup. */
|
|
43
51
|
export declare function isInsidePreserved(node: Element | null): boolean;
|
|
44
52
|
/**
|
package/dist/preserve.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preserve.d.ts","sourceRoot":"","sources":["../src/preserve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"preserve.d.ts","sourceRoot":"","sources":["../src/preserve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAwGjD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAyC5D;AAoBD,0EAA0E;AAC1E,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQ1E;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,QAAQ,CAE9C;AAwCD,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAK/D;AAeD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,QA4B1B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,QA4B3B,CAAA"}
|
package/dist/preserve.js
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* element carries an attribute we cannot represent, it becomes opaque
|
|
27
27
|
* and is preserved intact.
|
|
28
28
|
*/
|
|
29
|
+
import { isFullyModelledStyle } from './css.js';
|
|
29
30
|
import { URL_ATTRIBUTES, isEventHandlerAttribute, isSafeUrl } from './url.js';
|
|
30
31
|
/**
|
|
31
32
|
* Elements that are never preserved, and whose contents are discarded with them.
|
|
@@ -131,9 +132,48 @@ const TRANSPARENT_CONTAINERS = new Set([
|
|
|
131
132
|
* preserving is invisible and permanent.
|
|
132
133
|
*/
|
|
133
134
|
export function isLosslesslyUnwrappable(el) {
|
|
134
|
-
|
|
135
|
+
const name = el.nodeName.toLowerCase();
|
|
136
|
+
if (!TRANSPARENT_CONTAINERS.has(name))
|
|
135
137
|
return false;
|
|
136
|
-
|
|
138
|
+
if (el.attributes.length === 0)
|
|
139
|
+
return true;
|
|
140
|
+
/*
|
|
141
|
+
* One exception, and it is deliberately the narrowest one that works: a
|
|
142
|
+
* `<span>` whose only attribute is a style the colour marks fully model.
|
|
143
|
+
*
|
|
144
|
+
* Without it, colour is a fidelity regression dressed as a feature. Every
|
|
145
|
+
* `<span style="color:#c00">` in an inherited archive is preserved as an
|
|
146
|
+
* opaque atom -- a grey card where a sentence used to be, its text
|
|
147
|
+
* unselectable and unspellcheckable. Declining the rule here lets the span
|
|
148
|
+
* unwrap, and ProseMirror's style rules then re-apply the colour as a mark on
|
|
149
|
+
* the text inside, which is both editable and byte-identical on the way out.
|
|
150
|
+
*
|
|
151
|
+
* `text-align` is not in the accepted set, because unwrapping the element that
|
|
152
|
+
* carries it would drop it: it is a property of the block, and the block here
|
|
153
|
+
* is somebody else. Two attributes, or one attribute the marks cannot fully
|
|
154
|
+
* express, and the element stays preserved exactly as it does today.
|
|
155
|
+
*/
|
|
156
|
+
if (el.attributes.length !== 1 || name !== 'span')
|
|
157
|
+
return false;
|
|
158
|
+
/*
|
|
159
|
+
* Unwrap only if the marks will actually pick the declarations up.
|
|
160
|
+
*
|
|
161
|
+
* ProseMirror matches mark style rules through the CSSOM, and there are two
|
|
162
|
+
* situations where the CSSOM reports nothing for a style attribute that is
|
|
163
|
+
* plainly there: the declaration is invalid, and -- the one that matters -- a
|
|
164
|
+
* Content-Security-Policy with no `unsafe-inline` in `style-src`, under which
|
|
165
|
+
* the browser leaves the attribute in the DOM and refuses to parse it.
|
|
166
|
+
*
|
|
167
|
+
* Unwrapping in that case destroys the colour: the span goes, no mark replaces
|
|
168
|
+
* it, and the author's red text is black on the next save. An empty CSSOM is
|
|
169
|
+
* therefore a reason to leave the element to the preservation layer, where it
|
|
170
|
+
* stays verbatim and uneditable -- exactly what happened before colour was
|
|
171
|
+
* modelled at all. Degrading to the old behaviour is acceptable; losing content
|
|
172
|
+
* is not.
|
|
173
|
+
*/
|
|
174
|
+
if (el.style?.length === 0)
|
|
175
|
+
return false;
|
|
176
|
+
return isFullyModelledStyle(el.getAttribute('style'));
|
|
137
177
|
}
|
|
138
178
|
/** Rebuild a DOM element from stored markup. `<template>` is used because
|
|
139
179
|
* its parsing context permits otherwise-illegal fragments such as a bare
|
|
@@ -162,6 +202,16 @@ export function withSerializationDocument(doc, fn) {
|
|
|
162
202
|
serializationDocument = previous;
|
|
163
203
|
}
|
|
164
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* The Document that serialization should build into.
|
|
207
|
+
*
|
|
208
|
+
* Exported because schema.ts needs it for the same reason this file does: a node
|
|
209
|
+
* that builds a real element in `toDOM` has nowhere else to get a Document, since
|
|
210
|
+
* ProseMirror does not pass the one given to `serializeFragment` down to `toDOM`.
|
|
211
|
+
*/
|
|
212
|
+
export function serializationTarget() {
|
|
213
|
+
return ownerDocument();
|
|
214
|
+
}
|
|
165
215
|
function ownerDocument() {
|
|
166
216
|
if (serializationDocument)
|
|
167
217
|
return serializationDocument;
|
package/dist/preserve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preserve.js","sourceRoot":"","sources":["../src/preserve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAE7E;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,cAAc,GAAsB;IACxC,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,O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