@shadow-garden/bapbong-model 0.14.0 → 0.15.0
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/index.cjs +93 -23
- package/dist/index.js +93 -23
- package/dist/lib/model.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -170,11 +170,13 @@ var scr = (slots) => ({
|
|
|
170
170
|
sup: [],
|
|
171
171
|
slots
|
|
172
172
|
});
|
|
173
|
-
var rad = (
|
|
173
|
+
var rad = (deg) => ({
|
|
174
174
|
t: "rad",
|
|
175
|
-
|
|
175
|
+
// A degree the template fills in — the 3 of a cube root — is content like
|
|
176
|
+
// any other: the caret can reach it and type over it.
|
|
177
|
+
deg: deg ? upright(deg) : [],
|
|
176
178
|
body: [],
|
|
177
|
-
showDeg
|
|
179
|
+
showDeg: deg !== null
|
|
178
180
|
});
|
|
179
181
|
var fence = (l, r) => ({
|
|
180
182
|
t: "fence",
|
|
@@ -189,6 +191,11 @@ var func = (name) => ({
|
|
|
189
191
|
body: []
|
|
190
192
|
});
|
|
191
193
|
var acc = (chr) => ({ t: "acc", chr, body: [] });
|
|
194
|
+
var funcSub = (name) => ({
|
|
195
|
+
t: "func",
|
|
196
|
+
name: [{ t: "scr", base: upright(name), sub: [], sup: [], slots: "sub" }],
|
|
197
|
+
body: []
|
|
198
|
+
});
|
|
192
199
|
var mat = (rows, cols) => ({
|
|
193
200
|
t: "mat",
|
|
194
201
|
cols,
|
|
@@ -200,11 +207,10 @@ var braced = (l, r, rows, cols) => ({
|
|
|
200
207
|
r,
|
|
201
208
|
body: [mat(rows, cols)]
|
|
202
209
|
});
|
|
203
|
-
var
|
|
204
|
-
t: "
|
|
205
|
-
base: upright(name),
|
|
206
|
-
|
|
207
|
-
below
|
|
210
|
+
var limFunc = (name) => ({
|
|
211
|
+
t: "func",
|
|
212
|
+
name: [{ t: "lim", base: upright(name), lim: [], below: true }],
|
|
213
|
+
body: []
|
|
208
214
|
});
|
|
209
215
|
var big = (op, limits = false) => ({
|
|
210
216
|
t: "big",
|
|
@@ -217,11 +223,17 @@ var big = (op, limits = false) => ({
|
|
|
217
223
|
});
|
|
218
224
|
var EQ_STRUCTURES = [
|
|
219
225
|
{ group: "Fraction", name: "Stacked", node: frac(), focus: ["num"] },
|
|
220
|
-
{ group: "Script", name: "Superscript", node: scr("sup"), focus: ["
|
|
221
|
-
{ group: "Script", name: "Subscript", node: scr("sub"), focus: ["
|
|
222
|
-
{
|
|
223
|
-
|
|
224
|
-
|
|
226
|
+
{ group: "Script", name: "Superscript", node: scr("sup"), focus: ["base"] },
|
|
227
|
+
{ group: "Script", name: "Subscript", node: scr("sub"), focus: ["base"] },
|
|
228
|
+
{
|
|
229
|
+
group: "Script",
|
|
230
|
+
name: "Sub and super",
|
|
231
|
+
node: scr("both"),
|
|
232
|
+
focus: ["base"]
|
|
233
|
+
},
|
|
234
|
+
{ group: "Radical", name: "Square root", node: rad(null), focus: ["body"] },
|
|
235
|
+
{ group: "Radical", name: "Cube root", node: rad("3"), focus: ["body"] },
|
|
236
|
+
{ group: "Radical", name: "Nth root", node: rad(""), focus: ["deg"] },
|
|
225
237
|
{ group: "Integral", name: "Integral", node: big("\u222B"), focus: ["body"] },
|
|
226
238
|
{ group: "Integral", name: "Definite", node: big("\u222B", true), focus: ["lo"] },
|
|
227
239
|
{ group: "Integral", name: "Double", node: big("\u222C"), focus: ["body"] },
|
|
@@ -279,8 +291,14 @@ var EQ_STRUCTURES = [
|
|
|
279
291
|
{ group: "Function", name: "cos", node: func("cos"), focus: ["body"] },
|
|
280
292
|
{ group: "Function", name: "tan", node: func("tan"), focus: ["body"] },
|
|
281
293
|
{ group: "Function", name: "cot", node: func("cot"), focus: ["body"] },
|
|
282
|
-
{ group: "Function", name: "
|
|
283
|
-
{ group: "Function", name: "
|
|
294
|
+
{ group: "Function", name: "sec", node: func("sec"), focus: ["body"] },
|
|
295
|
+
{ group: "Function", name: "csc", node: func("csc"), focus: ["body"] },
|
|
296
|
+
{ group: "Function", name: "arcsin", node: func("arcsin"), focus: ["body"] },
|
|
297
|
+
{ group: "Function", name: "arccos", node: func("arccos"), focus: ["body"] },
|
|
298
|
+
{ group: "Function", name: "arctan", node: func("arctan"), focus: ["body"] },
|
|
299
|
+
{ group: "Function", name: "sinh", node: func("sinh"), focus: ["body"] },
|
|
300
|
+
{ group: "Function", name: "cosh", node: func("cosh"), focus: ["body"] },
|
|
301
|
+
{ group: "Function", name: "tanh", node: func("tanh"), focus: ["body"] },
|
|
284
302
|
{ group: "Function", name: "exp", node: func("exp"), focus: ["body"] },
|
|
285
303
|
// The name is empty and editable — for anything the list does not carry.
|
|
286
304
|
{ group: "Function", name: "Custom", node: func(""), focus: ["name"] },
|
|
@@ -290,10 +308,37 @@ var EQ_STRUCTURES = [
|
|
|
290
308
|
{ group: "Accent", name: "Tilde", node: acc("\u0303"), focus: ["body"] },
|
|
291
309
|
{ group: "Accent", name: "Dot", node: acc("\u0307"), focus: ["body"] },
|
|
292
310
|
{ group: "Accent", name: "Double dot", node: acc("\u0308"), focus: ["body"] },
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
311
|
+
// Word keeps the logarithms and the limit operators in ONE gallery, and so
|
|
312
|
+
// do we: they are the same shape — a name that may carry something under
|
|
313
|
+
// or beside it, applied to an expression.
|
|
314
|
+
// The base rides the NAME, not the argument, and the caret opens on it —
|
|
315
|
+
// it is the part you came to this entry to type.
|
|
316
|
+
{
|
|
317
|
+
group: "Limit and log",
|
|
318
|
+
name: "log base",
|
|
319
|
+
node: funcSub("log"),
|
|
320
|
+
focus: ["name", 0, "sub"]
|
|
321
|
+
},
|
|
322
|
+
{ group: "Limit and log", name: "log", node: func("log"), focus: ["body"] },
|
|
323
|
+
{
|
|
324
|
+
group: "Limit and log",
|
|
325
|
+
name: "lim",
|
|
326
|
+
node: limFunc("lim"),
|
|
327
|
+
focus: ["name", 0, "lim"]
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
group: "Limit and log",
|
|
331
|
+
name: "min",
|
|
332
|
+
node: limFunc("min"),
|
|
333
|
+
focus: ["name", 0, "lim"]
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
group: "Limit and log",
|
|
337
|
+
name: "max",
|
|
338
|
+
node: limFunc("max"),
|
|
339
|
+
focus: ["name", 0, "lim"]
|
|
340
|
+
},
|
|
341
|
+
{ group: "Limit and log", name: "ln", node: func("ln"), focus: ["body"] },
|
|
297
342
|
{ group: "Matrix", name: "1\xD72", node: mat(1, 2), focus: ["c0"] },
|
|
298
343
|
{ group: "Matrix", name: "2\xD71", node: mat(2, 1), focus: ["c0"] },
|
|
299
344
|
{ group: "Matrix", name: "2\xD72", node: mat(2, 2), focus: ["c0"] },
|
|
@@ -382,8 +427,8 @@ function pastedCellAttrs(el) {
|
|
|
382
427
|
colspan: span("colspan"),
|
|
383
428
|
rowspan: span("rowspan"),
|
|
384
429
|
colwidth: dataJson(el, "data-colwidth"),
|
|
385
|
-
background: bg ? bg[1].trim() : null,
|
|
386
|
-
vAlign: e.getAttribute("data-valign"),
|
|
430
|
+
background: bg ? bg[1].trim() : e.getAttribute("data-background") === "none" ? false : null,
|
|
431
|
+
vAlign: e.getAttribute("data-valign") === "none" ? false : e.getAttribute("data-valign"),
|
|
387
432
|
borders: dataJson(el, "data-borders"),
|
|
388
433
|
diagonals: dataJson(el, "data-diagonals"),
|
|
389
434
|
padding: dataJson(el, "data-padding"),
|
|
@@ -413,6 +458,13 @@ var schema = new import_prosemirror_model.Schema({
|
|
|
413
458
|
// CommentNode[] (contracts) — comment threads keyed to `comment` marks.
|
|
414
459
|
// Edited via setDocAttribute so add/reply/resolve/delete undo cleanly.
|
|
415
460
|
comments: { default: null },
|
|
461
|
+
// TableStyleSheet (contracts) — every table style the document's
|
|
462
|
+
// tables name, fully resolved (basedOn rolled up, theme colours hex).
|
|
463
|
+
// LIVE data, not a bake: tables carry styleId/look attrs and the
|
|
464
|
+
// layout applies the sheet per cell, so flipping a tblLook gate or
|
|
465
|
+
// switching styles is one small attr transaction. Importer-set;
|
|
466
|
+
// extended when the editor applies a style the sheet lacks.
|
|
467
|
+
tableStyles: { default: null },
|
|
416
468
|
// Per-section header/footer story OVERRIDES, keyed by section index →
|
|
417
469
|
// story ('headers'|'footers') → variant ('default'|'first'|'even') →
|
|
418
470
|
// the full story doc as JSON. The first chrome EDIT the model supports
|
|
@@ -696,6 +748,14 @@ var schema = new import_prosemirror_model.Schema({
|
|
|
696
748
|
// the importer). null = Word's implicit outdent by the left cell
|
|
697
749
|
// margin. Importer-set; the element itself rides carry for export.
|
|
698
750
|
indent: { default: null },
|
|
751
|
+
// w:tblStyle — the table style this table names, or null. The style's
|
|
752
|
+
// definition lives in doc.attrs.tableStyles; the LAYOUT applies it,
|
|
753
|
+
// so this attr (with `look`) is the whole apply-a-style transaction.
|
|
754
|
+
styleId: { default: null },
|
|
755
|
+
// w:tblLook — the six conditional-formatting gates (TableLook,
|
|
756
|
+
// contracts), or null for Word's default 04A0 (firstRow + firstCol +
|
|
757
|
+
// hBand on).
|
|
758
|
+
look: { default: null },
|
|
699
759
|
// Carry-through fidelity: unmodelled w:tblPr children (tblStyle,
|
|
700
760
|
// tblLayout, tblLook, tblInd, floating tblpPr, …) as one raw XML
|
|
701
761
|
// string ({ tblPr: string }), or null. Importer-set; the exporter
|
|
@@ -713,6 +773,8 @@ var schema = new import_prosemirror_model.Schema({
|
|
|
713
773
|
cellPadding: dataJson(el, "data-cell-padding"),
|
|
714
774
|
align: el.getAttribute("data-align"),
|
|
715
775
|
indent: dataJson(el, "data-indent"),
|
|
776
|
+
styleId: el.getAttribute("data-style-id"),
|
|
777
|
+
look: dataJson(el, "data-look"),
|
|
716
778
|
carry: dataJson(el, "data-carry")
|
|
717
779
|
})
|
|
718
780
|
}
|
|
@@ -725,6 +787,8 @@ var schema = new import_prosemirror_model.Schema({
|
|
|
725
787
|
dom["data-cell-padding"] = JSON.stringify(a["cellPadding"]);
|
|
726
788
|
if (a["align"]) dom["data-align"] = String(a["align"]);
|
|
727
789
|
if (a["indent"] != null) dom["data-indent"] = String(a["indent"]);
|
|
790
|
+
if (a["styleId"]) dom["data-style-id"] = String(a["styleId"]);
|
|
791
|
+
if (a["look"]) dom["data-look"] = JSON.stringify(a["look"]);
|
|
728
792
|
if (a["carry"]) dom["data-carry"] = JSON.stringify(a["carry"]);
|
|
729
793
|
return ["table", dom, ["tbody", 0]];
|
|
730
794
|
}
|
|
@@ -773,10 +837,13 @@ var schema = new import_prosemirror_model.Schema({
|
|
|
773
837
|
rowspan: { default: 1 },
|
|
774
838
|
colwidth: { default: null },
|
|
775
839
|
// px widths of the spanned columns, or null
|
|
840
|
+
// w:shd w:fill — cell fill "#RRGGBB". `false` is an EXPLICIT no-fill
|
|
841
|
+
// (w:fill="auto"), which must beat a table style's fill; null means
|
|
842
|
+
// the cell says nothing and the style layer may paint.
|
|
776
843
|
background: { default: null },
|
|
777
|
-
// w:
|
|
844
|
+
// w:vAlign — 'center' | 'bottom' (top is Word's default). `false` is
|
|
845
|
+
// an explicit reset ("top"/"both" declared), beating a style's.
|
|
778
846
|
vAlign: { default: null },
|
|
779
|
-
// w:vAlign — 'center' | 'bottom' (top default)
|
|
780
847
|
borders: { default: null },
|
|
781
848
|
// w:tcBorders per-side visibility override
|
|
782
849
|
// w:tcBorders/w:tl2br + w:br2tl — rules across the cell's corners
|
|
@@ -799,10 +866,13 @@ var schema = new import_prosemirror_model.Schema({
|
|
|
799
866
|
attrs["rowspan"] = String(node.attrs["rowspan"]);
|
|
800
867
|
if (node.attrs["background"])
|
|
801
868
|
attrs["style"] = `background-color: ${node.attrs["background"]}`;
|
|
869
|
+
else if (node.attrs["background"] === false)
|
|
870
|
+
attrs["data-background"] = "none";
|
|
802
871
|
if (node.attrs["colwidth"])
|
|
803
872
|
attrs["data-colwidth"] = JSON.stringify(node.attrs["colwidth"]);
|
|
804
873
|
if (node.attrs["vAlign"])
|
|
805
874
|
attrs["data-valign"] = String(node.attrs["vAlign"]);
|
|
875
|
+
else if (node.attrs["vAlign"] === false) attrs["data-valign"] = "none";
|
|
806
876
|
if (node.attrs["borders"])
|
|
807
877
|
attrs["data-borders"] = JSON.stringify(node.attrs["borders"]);
|
|
808
878
|
if (node.attrs["diagonals"])
|
package/dist/index.js
CHANGED
|
@@ -138,11 +138,13 @@ var scr = (slots) => ({
|
|
|
138
138
|
sup: [],
|
|
139
139
|
slots
|
|
140
140
|
});
|
|
141
|
-
var rad = (
|
|
141
|
+
var rad = (deg) => ({
|
|
142
142
|
t: "rad",
|
|
143
|
-
|
|
143
|
+
// A degree the template fills in — the 3 of a cube root — is content like
|
|
144
|
+
// any other: the caret can reach it and type over it.
|
|
145
|
+
deg: deg ? upright(deg) : [],
|
|
144
146
|
body: [],
|
|
145
|
-
showDeg
|
|
147
|
+
showDeg: deg !== null
|
|
146
148
|
});
|
|
147
149
|
var fence = (l, r) => ({
|
|
148
150
|
t: "fence",
|
|
@@ -157,6 +159,11 @@ var func = (name) => ({
|
|
|
157
159
|
body: []
|
|
158
160
|
});
|
|
159
161
|
var acc = (chr) => ({ t: "acc", chr, body: [] });
|
|
162
|
+
var funcSub = (name) => ({
|
|
163
|
+
t: "func",
|
|
164
|
+
name: [{ t: "scr", base: upright(name), sub: [], sup: [], slots: "sub" }],
|
|
165
|
+
body: []
|
|
166
|
+
});
|
|
160
167
|
var mat = (rows, cols) => ({
|
|
161
168
|
t: "mat",
|
|
162
169
|
cols,
|
|
@@ -168,11 +175,10 @@ var braced = (l, r, rows, cols) => ({
|
|
|
168
175
|
r,
|
|
169
176
|
body: [mat(rows, cols)]
|
|
170
177
|
});
|
|
171
|
-
var
|
|
172
|
-
t: "
|
|
173
|
-
base: upright(name),
|
|
174
|
-
|
|
175
|
-
below
|
|
178
|
+
var limFunc = (name) => ({
|
|
179
|
+
t: "func",
|
|
180
|
+
name: [{ t: "lim", base: upright(name), lim: [], below: true }],
|
|
181
|
+
body: []
|
|
176
182
|
});
|
|
177
183
|
var big = (op, limits = false) => ({
|
|
178
184
|
t: "big",
|
|
@@ -185,11 +191,17 @@ var big = (op, limits = false) => ({
|
|
|
185
191
|
});
|
|
186
192
|
var EQ_STRUCTURES = [
|
|
187
193
|
{ group: "Fraction", name: "Stacked", node: frac(), focus: ["num"] },
|
|
188
|
-
{ group: "Script", name: "Superscript", node: scr("sup"), focus: ["
|
|
189
|
-
{ group: "Script", name: "Subscript", node: scr("sub"), focus: ["
|
|
190
|
-
{
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
{ group: "Script", name: "Superscript", node: scr("sup"), focus: ["base"] },
|
|
195
|
+
{ group: "Script", name: "Subscript", node: scr("sub"), focus: ["base"] },
|
|
196
|
+
{
|
|
197
|
+
group: "Script",
|
|
198
|
+
name: "Sub and super",
|
|
199
|
+
node: scr("both"),
|
|
200
|
+
focus: ["base"]
|
|
201
|
+
},
|
|
202
|
+
{ group: "Radical", name: "Square root", node: rad(null), focus: ["body"] },
|
|
203
|
+
{ group: "Radical", name: "Cube root", node: rad("3"), focus: ["body"] },
|
|
204
|
+
{ group: "Radical", name: "Nth root", node: rad(""), focus: ["deg"] },
|
|
193
205
|
{ group: "Integral", name: "Integral", node: big("\u222B"), focus: ["body"] },
|
|
194
206
|
{ group: "Integral", name: "Definite", node: big("\u222B", true), focus: ["lo"] },
|
|
195
207
|
{ group: "Integral", name: "Double", node: big("\u222C"), focus: ["body"] },
|
|
@@ -247,8 +259,14 @@ var EQ_STRUCTURES = [
|
|
|
247
259
|
{ group: "Function", name: "cos", node: func("cos"), focus: ["body"] },
|
|
248
260
|
{ group: "Function", name: "tan", node: func("tan"), focus: ["body"] },
|
|
249
261
|
{ group: "Function", name: "cot", node: func("cot"), focus: ["body"] },
|
|
250
|
-
{ group: "Function", name: "
|
|
251
|
-
{ group: "Function", name: "
|
|
262
|
+
{ group: "Function", name: "sec", node: func("sec"), focus: ["body"] },
|
|
263
|
+
{ group: "Function", name: "csc", node: func("csc"), focus: ["body"] },
|
|
264
|
+
{ group: "Function", name: "arcsin", node: func("arcsin"), focus: ["body"] },
|
|
265
|
+
{ group: "Function", name: "arccos", node: func("arccos"), focus: ["body"] },
|
|
266
|
+
{ group: "Function", name: "arctan", node: func("arctan"), focus: ["body"] },
|
|
267
|
+
{ group: "Function", name: "sinh", node: func("sinh"), focus: ["body"] },
|
|
268
|
+
{ group: "Function", name: "cosh", node: func("cosh"), focus: ["body"] },
|
|
269
|
+
{ group: "Function", name: "tanh", node: func("tanh"), focus: ["body"] },
|
|
252
270
|
{ group: "Function", name: "exp", node: func("exp"), focus: ["body"] },
|
|
253
271
|
// The name is empty and editable — for anything the list does not carry.
|
|
254
272
|
{ group: "Function", name: "Custom", node: func(""), focus: ["name"] },
|
|
@@ -258,10 +276,37 @@ var EQ_STRUCTURES = [
|
|
|
258
276
|
{ group: "Accent", name: "Tilde", node: acc("\u0303"), focus: ["body"] },
|
|
259
277
|
{ group: "Accent", name: "Dot", node: acc("\u0307"), focus: ["body"] },
|
|
260
278
|
{ group: "Accent", name: "Double dot", node: acc("\u0308"), focus: ["body"] },
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
279
|
+
// Word keeps the logarithms and the limit operators in ONE gallery, and so
|
|
280
|
+
// do we: they are the same shape — a name that may carry something under
|
|
281
|
+
// or beside it, applied to an expression.
|
|
282
|
+
// The base rides the NAME, not the argument, and the caret opens on it —
|
|
283
|
+
// it is the part you came to this entry to type.
|
|
284
|
+
{
|
|
285
|
+
group: "Limit and log",
|
|
286
|
+
name: "log base",
|
|
287
|
+
node: funcSub("log"),
|
|
288
|
+
focus: ["name", 0, "sub"]
|
|
289
|
+
},
|
|
290
|
+
{ group: "Limit and log", name: "log", node: func("log"), focus: ["body"] },
|
|
291
|
+
{
|
|
292
|
+
group: "Limit and log",
|
|
293
|
+
name: "lim",
|
|
294
|
+
node: limFunc("lim"),
|
|
295
|
+
focus: ["name", 0, "lim"]
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
group: "Limit and log",
|
|
299
|
+
name: "min",
|
|
300
|
+
node: limFunc("min"),
|
|
301
|
+
focus: ["name", 0, "lim"]
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
group: "Limit and log",
|
|
305
|
+
name: "max",
|
|
306
|
+
node: limFunc("max"),
|
|
307
|
+
focus: ["name", 0, "lim"]
|
|
308
|
+
},
|
|
309
|
+
{ group: "Limit and log", name: "ln", node: func("ln"), focus: ["body"] },
|
|
265
310
|
{ group: "Matrix", name: "1\xD72", node: mat(1, 2), focus: ["c0"] },
|
|
266
311
|
{ group: "Matrix", name: "2\xD71", node: mat(2, 1), focus: ["c0"] },
|
|
267
312
|
{ group: "Matrix", name: "2\xD72", node: mat(2, 2), focus: ["c0"] },
|
|
@@ -350,8 +395,8 @@ function pastedCellAttrs(el) {
|
|
|
350
395
|
colspan: span("colspan"),
|
|
351
396
|
rowspan: span("rowspan"),
|
|
352
397
|
colwidth: dataJson(el, "data-colwidth"),
|
|
353
|
-
background: bg ? bg[1].trim() : null,
|
|
354
|
-
vAlign: e.getAttribute("data-valign"),
|
|
398
|
+
background: bg ? bg[1].trim() : e.getAttribute("data-background") === "none" ? false : null,
|
|
399
|
+
vAlign: e.getAttribute("data-valign") === "none" ? false : e.getAttribute("data-valign"),
|
|
355
400
|
borders: dataJson(el, "data-borders"),
|
|
356
401
|
diagonals: dataJson(el, "data-diagonals"),
|
|
357
402
|
padding: dataJson(el, "data-padding"),
|
|
@@ -381,6 +426,13 @@ var schema = new Schema({
|
|
|
381
426
|
// CommentNode[] (contracts) — comment threads keyed to `comment` marks.
|
|
382
427
|
// Edited via setDocAttribute so add/reply/resolve/delete undo cleanly.
|
|
383
428
|
comments: { default: null },
|
|
429
|
+
// TableStyleSheet (contracts) — every table style the document's
|
|
430
|
+
// tables name, fully resolved (basedOn rolled up, theme colours hex).
|
|
431
|
+
// LIVE data, not a bake: tables carry styleId/look attrs and the
|
|
432
|
+
// layout applies the sheet per cell, so flipping a tblLook gate or
|
|
433
|
+
// switching styles is one small attr transaction. Importer-set;
|
|
434
|
+
// extended when the editor applies a style the sheet lacks.
|
|
435
|
+
tableStyles: { default: null },
|
|
384
436
|
// Per-section header/footer story OVERRIDES, keyed by section index →
|
|
385
437
|
// story ('headers'|'footers') → variant ('default'|'first'|'even') →
|
|
386
438
|
// the full story doc as JSON. The first chrome EDIT the model supports
|
|
@@ -664,6 +716,14 @@ var schema = new Schema({
|
|
|
664
716
|
// the importer). null = Word's implicit outdent by the left cell
|
|
665
717
|
// margin. Importer-set; the element itself rides carry for export.
|
|
666
718
|
indent: { default: null },
|
|
719
|
+
// w:tblStyle — the table style this table names, or null. The style's
|
|
720
|
+
// definition lives in doc.attrs.tableStyles; the LAYOUT applies it,
|
|
721
|
+
// so this attr (with `look`) is the whole apply-a-style transaction.
|
|
722
|
+
styleId: { default: null },
|
|
723
|
+
// w:tblLook — the six conditional-formatting gates (TableLook,
|
|
724
|
+
// contracts), or null for Word's default 04A0 (firstRow + firstCol +
|
|
725
|
+
// hBand on).
|
|
726
|
+
look: { default: null },
|
|
667
727
|
// Carry-through fidelity: unmodelled w:tblPr children (tblStyle,
|
|
668
728
|
// tblLayout, tblLook, tblInd, floating tblpPr, …) as one raw XML
|
|
669
729
|
// string ({ tblPr: string }), or null. Importer-set; the exporter
|
|
@@ -681,6 +741,8 @@ var schema = new Schema({
|
|
|
681
741
|
cellPadding: dataJson(el, "data-cell-padding"),
|
|
682
742
|
align: el.getAttribute("data-align"),
|
|
683
743
|
indent: dataJson(el, "data-indent"),
|
|
744
|
+
styleId: el.getAttribute("data-style-id"),
|
|
745
|
+
look: dataJson(el, "data-look"),
|
|
684
746
|
carry: dataJson(el, "data-carry")
|
|
685
747
|
})
|
|
686
748
|
}
|
|
@@ -693,6 +755,8 @@ var schema = new Schema({
|
|
|
693
755
|
dom["data-cell-padding"] = JSON.stringify(a["cellPadding"]);
|
|
694
756
|
if (a["align"]) dom["data-align"] = String(a["align"]);
|
|
695
757
|
if (a["indent"] != null) dom["data-indent"] = String(a["indent"]);
|
|
758
|
+
if (a["styleId"]) dom["data-style-id"] = String(a["styleId"]);
|
|
759
|
+
if (a["look"]) dom["data-look"] = JSON.stringify(a["look"]);
|
|
696
760
|
if (a["carry"]) dom["data-carry"] = JSON.stringify(a["carry"]);
|
|
697
761
|
return ["table", dom, ["tbody", 0]];
|
|
698
762
|
}
|
|
@@ -741,10 +805,13 @@ var schema = new Schema({
|
|
|
741
805
|
rowspan: { default: 1 },
|
|
742
806
|
colwidth: { default: null },
|
|
743
807
|
// px widths of the spanned columns, or null
|
|
808
|
+
// w:shd w:fill — cell fill "#RRGGBB". `false` is an EXPLICIT no-fill
|
|
809
|
+
// (w:fill="auto"), which must beat a table style's fill; null means
|
|
810
|
+
// the cell says nothing and the style layer may paint.
|
|
744
811
|
background: { default: null },
|
|
745
|
-
// w:
|
|
812
|
+
// w:vAlign — 'center' | 'bottom' (top is Word's default). `false` is
|
|
813
|
+
// an explicit reset ("top"/"both" declared), beating a style's.
|
|
746
814
|
vAlign: { default: null },
|
|
747
|
-
// w:vAlign — 'center' | 'bottom' (top default)
|
|
748
815
|
borders: { default: null },
|
|
749
816
|
// w:tcBorders per-side visibility override
|
|
750
817
|
// w:tcBorders/w:tl2br + w:br2tl — rules across the cell's corners
|
|
@@ -767,10 +834,13 @@ var schema = new Schema({
|
|
|
767
834
|
attrs["rowspan"] = String(node.attrs["rowspan"]);
|
|
768
835
|
if (node.attrs["background"])
|
|
769
836
|
attrs["style"] = `background-color: ${node.attrs["background"]}`;
|
|
837
|
+
else if (node.attrs["background"] === false)
|
|
838
|
+
attrs["data-background"] = "none";
|
|
770
839
|
if (node.attrs["colwidth"])
|
|
771
840
|
attrs["data-colwidth"] = JSON.stringify(node.attrs["colwidth"]);
|
|
772
841
|
if (node.attrs["vAlign"])
|
|
773
842
|
attrs["data-valign"] = String(node.attrs["vAlign"]);
|
|
843
|
+
else if (node.attrs["vAlign"] === false) attrs["data-valign"] = "none";
|
|
774
844
|
if (node.attrs["borders"])
|
|
775
845
|
attrs["data-borders"] = JSON.stringify(node.attrs["borders"]);
|
|
776
846
|
if (node.attrs["diagonals"])
|
package/dist/lib/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAkG3C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,+XAswBjB,CAAC;AAEH,wEAAwE;AACxE,MAAM,MAAM,aAAa,GAAG,OAAO,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,aAAa,yDA0CxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC;AAEjD,qDAAqD;AACrD,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAE5D;+EAC+E;AAC/E,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,2EAA2E;AAC3E,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACxC;;;6EAGyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAAC;CACvC;AA0BD;;;4EAG4E;AAC5E,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shadow-garden/bapbong-model",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "bapbong — ProseMirror document model / schema",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"prosemirror-model": "^1.25.7",
|
|
58
|
-
"@shadow-garden/bapbong-contracts": "^0.
|
|
58
|
+
"@shadow-garden/bapbong-contracts": "^0.16.0"
|
|
59
59
|
}
|
|
60
60
|
}
|