@openleaf-editor/core 0.1.0-beta.1 → 0.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/autolink.d.ts +12 -0
  2. package/dist/autolink.d.ts.map +1 -0
  3. package/dist/autolink.js +98 -0
  4. package/dist/autolink.js.map +1 -0
  5. package/dist/commands.d.ts +69 -2
  6. package/dist/commands.d.ts.map +1 -1
  7. package/dist/commands.js +464 -18
  8. package/dist/commands.js.map +1 -1
  9. package/dist/css.d.ts +61 -9
  10. package/dist/css.d.ts.map +1 -1
  11. package/dist/css.js +315 -13
  12. package/dist/css.js.map +1 -1
  13. package/dist/embed.d.ts +52 -0
  14. package/dist/embed.d.ts.map +1 -0
  15. package/dist/embed.js +116 -0
  16. package/dist/embed.js.map +1 -0
  17. package/dist/extensions.d.ts.map +1 -1
  18. package/dist/extensions.js +22 -15
  19. package/dist/extensions.js.map +1 -1
  20. package/dist/formats.d.ts +44 -0
  21. package/dist/formats.d.ts.map +1 -0
  22. package/dist/formats.js +111 -0
  23. package/dist/formats.js.map +1 -0
  24. package/dist/index.d.ts +9 -3
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +14 -6
  27. package/dist/index.js.map +1 -1
  28. package/dist/keymap.d.ts.map +1 -1
  29. package/dist/keymap.js +6 -3
  30. package/dist/keymap.js.map +1 -1
  31. package/dist/noneditable.d.ts +14 -0
  32. package/dist/noneditable.d.ts.map +1 -0
  33. package/dist/noneditable.js +93 -0
  34. package/dist/noneditable.js.map +1 -0
  35. package/dist/preserve.d.ts +45 -0
  36. package/dist/preserve.d.ts.map +1 -1
  37. package/dist/preserve.js +113 -34
  38. package/dist/preserve.js.map +1 -1
  39. package/dist/schema.d.ts.map +1 -1
  40. package/dist/schema.js +211 -60
  41. package/dist/schema.js.map +1 -1
  42. package/dist/structure.d.ts +44 -0
  43. package/dist/structure.d.ts.map +1 -0
  44. package/dist/structure.js +379 -0
  45. package/dist/structure.js.map +1 -0
  46. package/dist/tables.d.ts +13 -0
  47. package/dist/tables.d.ts.map +1 -1
  48. package/dist/tables.js +224 -19
  49. package/dist/tables.js.map +1 -1
  50. package/dist/tokens.d.ts +28 -0
  51. package/dist/tokens.d.ts.map +1 -0
  52. package/dist/tokens.js +68 -0
  53. package/dist/tokens.js.map +1 -0
  54. package/dist/visual-aids.d.ts +10 -0
  55. package/dist/visual-aids.d.ts.map +1 -0
  56. package/dist/visual-aids.js +61 -0
  57. package/dist/visual-aids.js.map +1 -0
  58. package/package.json +3 -2
package/dist/tables.js CHANGED
@@ -35,10 +35,81 @@
35
35
  * is what tells a screen reader which cells a header governs. Dropping it turns
36
36
  * a navigable table into a grid of unrelated values.
37
37
  */
38
+ import { applyStyleAttribute, parseDeclarations, safeColor, serializeDeclarations, } from './css.js';
39
+ import { isSerializing, scrub, serializationTarget } from './preserve.js';
38
40
  /** Presentational attributes legacy CMS content puts on `<table>`. */
39
41
  const TABLE_LEGACY_ATTRS = ['border', 'cellpadding', 'cellspacing', 'width', 'align', 'summary', 'class'];
40
42
  /** Attributes legacy content puts on cells, plus the accessibility-critical ones. */
41
43
  const CELL_LEGACY_ATTRS = ['align', 'valign', 'width', 'height', 'class', 'scope', 'headers', 'abbr'];
44
+ const ROW_ATTRS = ['class', 'align', 'valign'];
45
+ /**
46
+ * Style properties the table schema models. Kept here rather than in
47
+ * `MODELLED_PROPERTIES` because those drive span-unwrapping; a span with
48
+ * `padding` is still an opaque atom, a cell with `padding` is a cell.
49
+ */
50
+ const TABLE_STYLE_PROPS = ['background-color', 'width', 'height'];
51
+ const ROW_STYLE_PROPS = ['background-color', 'height'];
52
+ const CELL_STYLE_PROPS = ['background-color', 'padding'];
53
+ const LENGTH = /^-?\d+(?:\.\d+)?(?:px|em|rem|%|pt|ex|ch)?$/i;
54
+ const VALIGN = new Set(['top', 'middle', 'bottom', 'baseline']);
55
+ function safeLength(value) {
56
+ const candidate = value.trim();
57
+ return LENGTH.test(candidate) ? candidate : null;
58
+ }
59
+ function safePadding(value) {
60
+ const parts = value.trim().split(/\s+/);
61
+ if (parts.length < 1 || parts.length > 4)
62
+ return null;
63
+ const safe = parts.map(safeLength);
64
+ return safe.every((part) => part !== null) ? safe.join(' ') : null;
65
+ }
66
+ function safeVAlign(value) {
67
+ if (!value)
68
+ return null;
69
+ const candidate = value.trim().toLowerCase();
70
+ return VALIGN.has(candidate) ? candidate : null;
71
+ }
72
+ /**
73
+ * The one validator for a table style declaration, on the way in or out.
74
+ *
75
+ * Exported because the property dialogs in `@openleaf-editor/plugins-table`
76
+ * write node attributes directly, which does not go through any parse rule. A
77
+ * dialog with its own idea of an acceptable padding would drift from this one,
78
+ * and `padding: 0;position:fixed;inset:0` is what that drift looks like: the
79
+ * value becomes two more declarations when the style attribute is serialized.
80
+ *
81
+ * Returns null for a property this schema does not model, so an unrecognised
82
+ * name is dropped rather than trusted.
83
+ */
84
+ export function safeTableStyleValue(property, value) {
85
+ if (!value)
86
+ return null;
87
+ if (property === 'background-color')
88
+ return safeColor(value);
89
+ if (property === 'padding')
90
+ return safePadding(value);
91
+ if (property === 'width' || property === 'height')
92
+ return safeLength(value);
93
+ return null;
94
+ }
95
+ function safeStyleValue(property, value) {
96
+ return safeTableStyleValue(property, value);
97
+ }
98
+ function readStyle(el, properties) {
99
+ const declarations = parseDeclarations(el.getAttribute('style'));
100
+ const out = new Map();
101
+ for (const name of properties) {
102
+ const safe = safeStyleValue(name, declarations.get(name));
103
+ if (safe)
104
+ out.set(name, safe);
105
+ }
106
+ if (!out.has('background-color')) {
107
+ const bg = safeColor(el.getAttribute('bgcolor'));
108
+ if (bg)
109
+ out.set('background-color', bg);
110
+ }
111
+ return serializeDeclarations(out);
112
+ }
42
113
  function readAttrs(el, names) {
43
114
  const out = {};
44
115
  for (const name of names)
@@ -76,15 +147,34 @@ const cellAttrs = {
76
147
  rowspan: { default: 1 },
77
148
  colwidth: { default: null },
78
149
  ...legacyDefaults(CELL_LEGACY_ATTRS),
150
+ style: { default: null },
79
151
  };
80
152
  function cellGetAttrs(dom) {
81
153
  const el = dom;
82
- return {
154
+ const attrs = {
83
155
  colspan: Number.parseInt(el.getAttribute('colspan') ?? '1', 10) || 1,
84
156
  rowspan: Number.parseInt(el.getAttribute('rowspan') ?? '1', 10) || 1,
85
157
  colwidth: readColwidth(el),
86
158
  ...readAttrs(el, CELL_LEGACY_ATTRS),
159
+ style: readStyle(el, CELL_STYLE_PROPS),
87
160
  };
161
+ // Fold CSS vertical-align into the HTML attribute the commands already edit,
162
+ // so an inherited `style="vertical-align:middle"` is not a second, uneditable
163
+ // spelling of the same fact.
164
+ if (!attrs['valign']) {
165
+ const fromStyle = safeVAlign(parseDeclarations(el.getAttribute('style')).get('vertical-align'));
166
+ if (fromStyle)
167
+ attrs['valign'] = fromStyle;
168
+ }
169
+ return attrs;
170
+ }
171
+ function styledElement(tag, attrs, style) {
172
+ const el = serializationTarget().createElement(tag);
173
+ for (const [name, value] of Object.entries(attrs))
174
+ el.setAttribute(name, value);
175
+ if (style)
176
+ applyStyleAttribute(el, style);
177
+ return { dom: el, contentDOM: el };
88
178
  }
89
179
  function cellToDOM(tag) {
90
180
  return (node) => {
@@ -98,17 +188,99 @@ function cellToDOM(tag) {
98
188
  const colwidth = node.attrs['colwidth'];
99
189
  if (colwidth)
100
190
  attrs['data-colwidth'] = colwidth.join(',');
191
+ const style = node.attrs['style'];
192
+ if (style)
193
+ return styledElement(tag, attrs, style);
101
194
  return [tag, attrs, 0];
102
195
  };
103
196
  }
197
+ /**
198
+ * `<caption>` and `<colgroup>`/`<col>`: preserved as markup on the table node.
199
+ *
200
+ * These are the two parts of a table that are neither rows nor cells, and until
201
+ * now both were discarded on parse. For a caption that is not a cosmetic loss:
202
+ * a caption is a table's accessible name, so opening and saving an inherited
203
+ * document silently stripped the one element telling a screen-reader user what
204
+ * the table is. Column widths in a `<colgroup>` went the same way, taking the
205
+ * page's layout with them.
206
+ *
207
+ * They are attributes rather than child nodes, which is the compromise and is
208
+ * worth being precise about. The natural model is a `caption` node as the
209
+ * table's first child. It cannot work today: `prosemirror-tables` computes its
210
+ * cell map with `height = table.childCount` and reads `table.child(row)` as a
211
+ * row, so any non-row child shifts every coordinate the library derives, and
212
+ * cell selection, column resizing and the row/column commands all index into
213
+ * the wrong place. Storing markup on an attribute keeps the node's children
214
+ * exactly what that library requires while making the round-trip lossless.
215
+ *
216
+ * The cost is that the caption is not editable in place -- it renders, it
217
+ * survives, it cannot be typed into. That is a real limitation and it is the
218
+ * same bargain the preservation layer already strikes everywhere else: content
219
+ * kept intact and inert beats content silently deleted. Editing it needs the
220
+ * upstream indexing fix, at which point this becomes a node and the attribute
221
+ * migrates.
222
+ *
223
+ * Scrubbed on the way in with the preservation layer's own scrubber, so a
224
+ * `<caption onclick="...">` cannot ride in on a code path whose entire promise
225
+ * is to hand markup back unmodified.
226
+ */
227
+ const FURNITURE_TAGS = new Set(['caption', 'colgroup', 'col']);
228
+ /** Serialized direct children of `el` matching `tags`, in document order. */
229
+ function readFurniture(el, tags) {
230
+ let html = '';
231
+ for (const child of Array.from(el.children)) {
232
+ if (!tags.includes(child.nodeName.toLowerCase()))
233
+ continue;
234
+ html += scrub(child);
235
+ // HTML permits exactly one caption; a second is somebody else's bug and
236
+ // concatenating it would render two. Take the first and stop.
237
+ if (child.nodeName.toLowerCase() === 'caption')
238
+ break;
239
+ }
240
+ return html || null;
241
+ }
242
+ /**
243
+ * Rebuild stored furniture markup and append it to the table being built.
244
+ *
245
+ * `<template>` is the parsing context because a bare `<caption>` or `<col>` is
246
+ * illegal inside a `<div>` and would be silently discarded there -- the same
247
+ * reason the preservation layer uses one.
248
+ */
249
+ function appendFurniture(table, html, doc, inert) {
250
+ const tpl = doc.createElement('template');
251
+ tpl.innerHTML = html;
252
+ for (const child of Array.from(tpl.content.children)) {
253
+ if (!FURNITURE_TAGS.has(child.nodeName.toLowerCase()))
254
+ continue;
255
+ // Editor only. A caption sits inside the editable area but outside the
256
+ // node's contentDOM, so without this a caret can enter text ProseMirror
257
+ // will discard on its next redraw.
258
+ if (inert)
259
+ child.setAttribute('contenteditable', 'false');
260
+ table.appendChild(child);
261
+ }
262
+ }
104
263
  export const table = {
105
264
  content: 'table_row+',
106
265
  tableRole: 'table',
107
266
  isolating: true,
108
267
  group: 'block',
109
- attrs: legacyDefaults(TABLE_LEGACY_ATTRS),
268
+ attrs: {
269
+ ...legacyDefaults(TABLE_LEGACY_ATTRS),
270
+ caption: { default: null },
271
+ colgroup: { default: null },
272
+ style: { default: null },
273
+ },
110
274
  parseDOM: [
111
- { tag: 'table', getAttrs: (dom) => readAttrs(dom, TABLE_LEGACY_ATTRS) },
275
+ {
276
+ tag: 'table',
277
+ getAttrs: (dom) => ({
278
+ ...readAttrs(dom, TABLE_LEGACY_ATTRS),
279
+ caption: readFurniture(dom, ['caption']),
280
+ colgroup: readFurniture(dom, ['colgroup', 'col']),
281
+ style: readStyle(dom, TABLE_STYLE_PROPS),
282
+ }),
283
+ },
112
284
  /*
113
285
  * `tbody`, `thead` and `tfoot` are SKIPPED rather than ignored: the wrapper
114
286
  * itself carries nothing, but its rows are the entire content. `ignore`
@@ -122,35 +294,68 @@ export const table = {
122
294
  { tag: 'thead', skip: true },
123
295
  { tag: 'tfoot', skip: true },
124
296
  /*
125
- * KNOWN LIMITATION, declared rather than hidden.
126
- *
127
- * `<colgroup>`/`<col>` are dropped, and `<caption>` is dropped with its
128
- * text. Both should be preserved and neither can be today: a caption node
129
- * would have to be the table's first child, and `prosemirror-tables`
130
- * computes its cell map by treating every child of a table as a row, so a
131
- * leading caption breaks its indexing.
297
+ * `caption`, `colgroup` and `col` are ignored as CONTENT and captured as
298
+ * ATTRIBUTES instead -- see `readFurniture` for why they cannot be nodes.
132
299
  *
133
- * Dropping a caption is a real accessibility regression -- a caption is a
134
- * table's accessible name -- so this is tracked as a bug to fix by adding a
135
- * caption node and contributing the indexing fix upstream, not as a design
136
- * decision. There is a fixture asserting the current behaviour so it cannot
137
- * regress further without someone noticing.
300
+ * The `ignore` rules are still load-bearing after that capture. Without
301
+ * them the preservation layer's catch-all claims a `<caption>` as an
302
+ * unrecognised block, and `table_row+` refuses to accept it, so the caption
303
+ * is dropped a second way by a different mechanism.
138
304
  */
139
305
  { tag: 'colgroup', ignore: true },
140
306
  { tag: 'col', ignore: true },
141
307
  { tag: 'caption', ignore: true },
142
308
  ],
143
309
  toDOM(node) {
144
- return ['table', writeAttrs(node.attrs, TABLE_LEGACY_ATTRS), ['tbody', 0]];
310
+ const attrs = writeAttrs(node.attrs, TABLE_LEGACY_ATTRS);
311
+ const caption = node.attrs['caption'];
312
+ const colgroup = node.attrs['colgroup'];
313
+ const style = node.attrs['style'];
314
+ if (!caption && !colgroup && !style)
315
+ return ['table', attrs, ['tbody', 0]];
316
+ /*
317
+ * Furniture forces a real element rather than an output-spec array, because
318
+ * an array cannot express "these children, then the content hole inside a
319
+ * LATER child". `{ dom, contentDOM }` can, and ProseMirror accepts it from
320
+ * both the editor's node renderer and DOMSerializer.
321
+ */
322
+ const doc = serializationTarget();
323
+ const table = doc.createElement('table');
324
+ for (const [name, value] of Object.entries(attrs))
325
+ table.setAttribute(name, value);
326
+ if (style)
327
+ applyStyleAttribute(table, style);
328
+ // Document order is fixed by HTML: caption first, then colgroup, then rows.
329
+ // Emitting them in any other order produces markup browsers reshuffle, which
330
+ // would make the round-trip lossy again by a subtler route.
331
+ if (caption)
332
+ appendFurniture(table, caption, doc, !isSerializing());
333
+ if (colgroup)
334
+ appendFurniture(table, colgroup, doc, false);
335
+ const tbody = doc.createElement('tbody');
336
+ table.appendChild(tbody);
337
+ return { dom: table, contentDOM: tbody };
145
338
  },
146
339
  };
147
340
  export const table_row = {
148
341
  content: '(table_cell | table_header)*',
149
342
  tableRole: 'row',
150
- attrs: { class: { default: null }, align: { default: null } },
151
- parseDOM: [{ tag: 'tr', getAttrs: (dom) => readAttrs(dom, ['class', 'align']) }],
343
+ attrs: { ...legacyDefaults(ROW_ATTRS), style: { default: null } },
344
+ parseDOM: [
345
+ {
346
+ tag: 'tr',
347
+ getAttrs: (dom) => ({
348
+ ...readAttrs(dom, ROW_ATTRS),
349
+ style: readStyle(dom, ROW_STYLE_PROPS),
350
+ }),
351
+ },
352
+ ],
152
353
  toDOM(node) {
153
- return ['tr', writeAttrs(node.attrs, ['class', 'align']), 0];
354
+ const attrs = writeAttrs(node.attrs, ROW_ATTRS);
355
+ const style = node.attrs['style'];
356
+ if (style)
357
+ return styledElement('tr', attrs, style);
358
+ return ['tr', attrs, 0];
154
359
  },
155
360
  };
156
361
  export const table_cell = {
@@ -1 +1 @@
1
- {"version":3,"file":"tables.js","sourceRoot":"","sources":["../src/tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAIH,sEAAsE;AACtE,MAAM,kBAAkB,GAAG,CAAC,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAU,CAAA;AAElH,qFAAqF;AACrF,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAU,CAAA;AAE9G,SAAS,SAAS,CAAC,EAAW,EAAE,KAAwB;IACtD,MAAM,GAAG,GAAkC,EAAE,CAAA;IAC7C,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;IAC3D,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,UAAU,CACjB,KAA8B,EAC9B,KAAwB;IAExB,MAAM,GAAG,GAA2B,EAAE,CAAA;IACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;QACzB,IAAI,KAAK,KAAK,IA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f,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;IACjD,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC;CACvB,CAAA"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Tokens the schema is willing to write onto `id` and `class`.
3
+ *
4
+ * Both attributes are how an author names a thing in the page, and both are
5
+ * how pasted content impersonates the page. The checks here are deliberately
6
+ * syntactic: they refuse characters that would let a value escape the
7
+ * attribute, and they do not try to guess whether a class name is "yours".
8
+ * Which class names a deployment offers in a pick list is an integrator
9
+ * decision; which characters may appear in one is not.
10
+ */
11
+ /** An `id` the schema will store, or null. */
12
+ export declare function safeId(value: string | null | undefined): string | null;
13
+ /**
14
+ * Class tokens the schema will store, or null when none survive.
15
+ *
16
+ * Known alignment classes are stripped here when `exclude` is given, so an
17
+ * image can carry `ol-float-left` as its modelled `align` without also
18
+ * writing it twice in `class`.
19
+ */
20
+ export declare function safeClassList(value: string | null | undefined, exclude?: ReadonlySet<string>): string | null;
21
+ /** Image floats the toolbar can express. Centre is not a float: it is a block. */
22
+ export type ImageAlign = 'left' | 'right' | 'center';
23
+ export declare const IMAGE_ALIGNMENTS: readonly ImageAlign[];
24
+ export declare const IMAGE_ALIGN_CLASS: Readonly<Record<ImageAlign, string>>;
25
+ /** The modelled alignment class in this list, if any. */
26
+ export declare function imageAlignFromClass(value: string | null | undefined): ImageAlign | null;
27
+ export declare const IMAGE_ALIGN_CLASSES: ReadonlySet<string>;
28
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,8CAA8C;AAC9C,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAKtE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,OAAO,GAAE,WAAW,CAAC,MAAM,CAAa,GACvC,MAAM,GAAG,IAAI,CAWf;AAED,kFAAkF;AAClF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEpD,eAAO,MAAM,gBAAgB,EAAE,SAAS,UAAU,EAAgC,CAAA;AAElF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAIlE,CAAA;AASD,yDAAyD;AACzD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,IAAI,CAOvF;AAED,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAA6C,CAAA"}
package/dist/tokens.js ADDED
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Tokens the schema is willing to write onto `id` and `class`.
3
+ *
4
+ * Both attributes are how an author names a thing in the page, and both are
5
+ * how pasted content impersonates the page. The checks here are deliberately
6
+ * syntactic: they refuse characters that would let a value escape the
7
+ * attribute, and they do not try to guess whether a class name is "yours".
8
+ * Which class names a deployment offers in a pick list is an integrator
9
+ * decision; which characters may appear in one is not.
10
+ */
11
+ /** HTML5 ids: no spaces, not empty. */
12
+ const ID = /^[^\s]+$/;
13
+ /** A single class token. */
14
+ const CLASS_TOKEN = /^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$/;
15
+ /** An `id` the schema will store, or null. */
16
+ export function safeId(value) {
17
+ if (value === null || value === undefined)
18
+ return null;
19
+ const candidate = value.trim();
20
+ if (candidate === '' || !ID.test(candidate))
21
+ return null;
22
+ return candidate;
23
+ }
24
+ /**
25
+ * Class tokens the schema will store, or null when none survive.
26
+ *
27
+ * Known alignment classes are stripped here when `exclude` is given, so an
28
+ * image can carry `ol-float-left` as its modelled `align` without also
29
+ * writing it twice in `class`.
30
+ */
31
+ export function safeClassList(value, exclude = new Set()) {
32
+ if (value === null || value === undefined)
33
+ return null;
34
+ const kept = [];
35
+ const seen = new Set();
36
+ for (const token of value.trim().split(/\s+/)) {
37
+ if (token === '' || exclude.has(token) || !CLASS_TOKEN.test(token))
38
+ continue;
39
+ if (seen.has(token))
40
+ continue;
41
+ seen.add(token);
42
+ kept.push(token);
43
+ }
44
+ return kept.length > 0 ? kept.join(' ') : null;
45
+ }
46
+ export const IMAGE_ALIGNMENTS = ['left', 'right', 'center'];
47
+ export const IMAGE_ALIGN_CLASS = {
48
+ left: 'ol-float-left',
49
+ right: 'ol-float-right',
50
+ center: 'ol-align-center',
51
+ };
52
+ const CLASS_TO_ALIGN = new Map(Object.entries(IMAGE_ALIGN_CLASS).map(([align, name]) => [
53
+ name,
54
+ align,
55
+ ]));
56
+ /** The modelled alignment class in this list, if any. */
57
+ export function imageAlignFromClass(value) {
58
+ if (!value)
59
+ return null;
60
+ for (const token of value.split(/\s+/)) {
61
+ const align = CLASS_TO_ALIGN.get(token);
62
+ if (align)
63
+ return align;
64
+ }
65
+ return null;
66
+ }
67
+ export const IMAGE_ALIGN_CLASSES = new Set(Object.values(IMAGE_ALIGN_CLASS));
68
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,uCAAuC;AACvC,MAAM,EAAE,GAAG,UAAU,CAAA;AAErB,4BAA4B;AAC5B,MAAM,WAAW,GAAG,8BAA8B,CAAA;AAElD,8CAA8C;AAC9C,MAAM,UAAU,MAAM,CAAC,KAAgC;IACrD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IACtD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAC9B,IAAI,SAAS,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,S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IACxF,IAAI;IACJ,KAAK;CACN,CAAC,CACH,CAAA;AAED,yDAAyD;AACzD,MAAM,UAAU,mBAAmB,CAAC,KAAgC;IAClE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAA;IACzB,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Decorations that make empty blocks, non-breaking spaces, and preserved
3
+ * atoms visible while editing.
4
+ *
5
+ * These marks are view-only. They must never reach serialized HTML: an empty
6
+ * paragraph is still an empty paragraph, and a `&nbsp;` is still a nbsp.
7
+ */
8
+ import { Plugin } from 'prosemirror-state';
9
+ export declare function visualAidsPlugin(): Plugin;
10
+ //# sourceMappingURL=visual-aids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visual-aids.d.ts","sourceRoot":"","sources":["../src/visual-aids.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,MAAM,EAAa,MAAM,mBAAmB,CAAA;AAsBrD,wBAAgB,gBAAgB,IAAI,MAAM,CAqCzC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Decorations that make empty blocks, non-breaking spaces, and preserved
3
+ * atoms visible while editing.
4
+ *
5
+ * These marks are view-only. They must never reach serialized HTML: an empty
6
+ * paragraph is still an empty paragraph, and a `&nbsp;` is still a nbsp.
7
+ */
8
+ import { Plugin, PluginKey } from 'prosemirror-state';
9
+ import { Decoration, DecorationSet } from 'prosemirror-view';
10
+ const key = new PluginKey('openleaf-visual-aids');
11
+ /**
12
+ * True when this position is the last character of its text block.
13
+ *
14
+ * ProseMirror renders a document space in that position as a non-breaking space
15
+ * itself, so the browser does not collapse it. Decorating it wraps that
16
+ * rendering artifact in a span, and the editor then reads the nbsp back as the
17
+ * author's own character -- so every space typed at the end of a paragraph
18
+ * became a nbsp in the stored HTML, and the next one after it too.
19
+ *
20
+ * A genuinely stored trailing nbsp therefore goes unmarked. That is the price of
21
+ * the aid never changing the document it describes.
22
+ */
23
+ function isBlockFinal(doc, at) {
24
+ const $at = doc.resolve(at);
25
+ return $at.parentOffset + 1 >= $at.parent.content.size;
26
+ }
27
+ export function visualAidsPlugin() {
28
+ return new Plugin({
29
+ key,
30
+ props: {
31
+ decorations(state) {
32
+ const decorations = [];
33
+ state.doc.descendants((node, pos) => {
34
+ if (node.isTextblock && node.content.size === 0) {
35
+ decorations.push(Decoration.node(pos, pos + node.nodeSize, { class: 'ol-empty-block' }));
36
+ }
37
+ if (node.type.name === 'unknown_block' || node.type.name === 'unknown_inline') {
38
+ decorations.push(Decoration.node(pos, pos + node.nodeSize, { class: 'ol-hidden-structure' }));
39
+ }
40
+ if (node.isText) {
41
+ const text = node.text ?? '';
42
+ for (let i = 0; i < text.length; i += 1) {
43
+ if (text.charCodeAt(i) !== 0xa0)
44
+ continue;
45
+ // `pos` already addresses the first character: a text node has no
46
+ // opening token to step over, unlike a node. Adding one marked the
47
+ // character after each nbsp, and ran off the end of the node when
48
+ // the nbsp was last -- where the decoration disappeared entirely.
49
+ const at = pos + i;
50
+ if (isBlockFinal(state.doc, at))
51
+ continue;
52
+ decorations.push(Decoration.inline(at, at + 1, { class: 'ol-nbsp' }));
53
+ }
54
+ }
55
+ });
56
+ return DecorationSet.create(state.doc, decorations);
57
+ },
58
+ },
59
+ });
60
+ }
61
+ //# sourceMappingURL=visual-aids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visual-aids.js","sourceRoot":"","sources":["../src/visual-aids.ts"],"names":[],"mappings":"A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I,CAAC,MAAM,EAAE,CAAC;wBAChB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAA;wBAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;4BACxC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI;gCAAE,SAAQ;4BACzC,kEAAkE;4BAClE,mEAAmE;4BACnE,kEAAkE;4BAClE,kEAAkE;4BAClE,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC,CAAA;4BAClB,IAAI,YAAY,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC;gCAAE,SAAQ;4BACzC,WAAW,CAAC,IAAI,CACd,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CACpD,CAAA;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC,CAAC,CAAA;gBACF,OAAO,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;YACrD,CAAC;SACF;KACF,CAAC,CAAA;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openleaf-editor/core",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.2",
4
4
  "description": "OpenLeaf editing core: ProseMirror schema, HTML I/O, and the content-preservation layer. No UI, no framework dependencies.",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -35,7 +35,8 @@
35
35
  "prosemirror-model": "^1.24.1",
36
36
  "prosemirror-schema-list": "^1.5.1",
37
37
  "prosemirror-state": "^1.4.3",
38
- "prosemirror-transform": "^1.10.2"
38
+ "prosemirror-transform": "^1.10.2",
39
+ "prosemirror-view": "^1.37.0"
39
40
  },
40
41
  "scripts": {
41
42
  "build": "tsc -p tsconfig.json"