@shadow-garden/bapbong-model 0.11.0 → 0.11.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.
package/dist/index.cjs CHANGED
@@ -87,6 +87,7 @@ function pastedParagraphAttrs(el, heading) {
87
87
  heading,
88
88
  align: m ? m[1].toLowerCase() : null,
89
89
  borders: dataJson(el, "data-borders"),
90
+ markFont: dataJson(el, "data-mark-font"),
90
91
  carry: dataJson(el, "data-carry")
91
92
  };
92
93
  }
@@ -220,6 +221,13 @@ var schema = new import_prosemirror_model.Schema({
220
221
  // null). Painted behind the paragraph's lines, in the same box the
221
222
  // borders use.
222
223
  shading: { default: null },
224
+ // The paragraph MARK's own font ({ family?, sizePt?, bold?, italic? }
225
+ // or null) — w:pPr/w:rPr resolved through the same cascade a run gets.
226
+ // Set only on paragraphs imported EMPTY, where the mark is the only
227
+ // thing on the line and therefore sets its height. `carry.markRPr`
228
+ // keeps the same rPr verbatim for export; this is the measured
229
+ // reading of it, and nothing writes it back.
230
+ markFont: { default: null },
223
231
  // Carry-through fidelity (docx round-trip): OOXML paragraph
224
232
  // properties the model does NOT represent, preserved verbatim so a
225
233
  // customer's save never drops them. { pPr?: string, markRPr?: string }
@@ -247,6 +255,8 @@ var schema = new import_prosemirror_model.Schema({
247
255
  dom["data-borders"] = JSON.stringify(node.attrs["borders"]);
248
256
  if (node.attrs["shading"])
249
257
  dom["data-shading"] = String(node.attrs["shading"]);
258
+ if (node.attrs["markFont"])
259
+ dom["data-mark-font"] = JSON.stringify(node.attrs["markFont"]);
250
260
  if (node.attrs["carry"])
251
261
  dom["data-carry"] = JSON.stringify(node.attrs["carry"]);
252
262
  return [tag, dom, 0];
@@ -262,6 +272,18 @@ var schema = new import_prosemirror_model.Schema({
262
272
  parseDOM: [{ tag: "br" }],
263
273
  toDOM: () => ["br"]
264
274
  },
275
+ // A column break (w:br w:type="column"). Inline, not a paragraph flag:
276
+ // ST_BrType `column` restarts "the next character in the document … in a
277
+ // new text column", so it cuts WHERE IT SITS. A factsheet in the corpus
278
+ // proves the difference — its break has a floating table anchored in the
279
+ // run BEFORE it, which belongs to the column being left behind.
280
+ column_break: {
281
+ inline: true,
282
+ group: "inline",
283
+ selectable: false,
284
+ parseDOM: [{ tag: "br.column-break" }],
285
+ toDOM: () => ["br", { class: "column-break" }]
286
+ },
265
287
  // Inline image. `src` is typically a data URL (the importer inlines the
266
288
  // embedded media); width/height are CSS pixels, null if unspecified.
267
289
  image: {
package/dist/index.js CHANGED
@@ -55,6 +55,7 @@ function pastedParagraphAttrs(el, heading) {
55
55
  heading,
56
56
  align: m ? m[1].toLowerCase() : null,
57
57
  borders: dataJson(el, "data-borders"),
58
+ markFont: dataJson(el, "data-mark-font"),
58
59
  carry: dataJson(el, "data-carry")
59
60
  };
60
61
  }
@@ -188,6 +189,13 @@ var schema = new Schema({
188
189
  // null). Painted behind the paragraph's lines, in the same box the
189
190
  // borders use.
190
191
  shading: { default: null },
192
+ // The paragraph MARK's own font ({ family?, sizePt?, bold?, italic? }
193
+ // or null) — w:pPr/w:rPr resolved through the same cascade a run gets.
194
+ // Set only on paragraphs imported EMPTY, where the mark is the only
195
+ // thing on the line and therefore sets its height. `carry.markRPr`
196
+ // keeps the same rPr verbatim for export; this is the measured
197
+ // reading of it, and nothing writes it back.
198
+ markFont: { default: null },
191
199
  // Carry-through fidelity (docx round-trip): OOXML paragraph
192
200
  // properties the model does NOT represent, preserved verbatim so a
193
201
  // customer's save never drops them. { pPr?: string, markRPr?: string }
@@ -215,6 +223,8 @@ var schema = new Schema({
215
223
  dom["data-borders"] = JSON.stringify(node.attrs["borders"]);
216
224
  if (node.attrs["shading"])
217
225
  dom["data-shading"] = String(node.attrs["shading"]);
226
+ if (node.attrs["markFont"])
227
+ dom["data-mark-font"] = JSON.stringify(node.attrs["markFont"]);
218
228
  if (node.attrs["carry"])
219
229
  dom["data-carry"] = JSON.stringify(node.attrs["carry"]);
220
230
  return [tag, dom, 0];
@@ -230,6 +240,18 @@ var schema = new Schema({
230
240
  parseDOM: [{ tag: "br" }],
231
241
  toDOM: () => ["br"]
232
242
  },
243
+ // A column break (w:br w:type="column"). Inline, not a paragraph flag:
244
+ // ST_BrType `column` restarts "the next character in the document … in a
245
+ // new text column", so it cuts WHERE IT SITS. A factsheet in the corpus
246
+ // proves the difference — its break has a floating table anchored in the
247
+ // run BEFORE it, which belongs to the column being left behind.
248
+ column_break: {
249
+ inline: true,
250
+ group: "inline",
251
+ selectable: false,
252
+ parseDOM: [{ tag: "br.column-break" }],
253
+ toDOM: () => ["br", { class: "column-break" }]
254
+ },
233
255
  // Inline image. `src` is typically a data URL (the importer inlines the
234
256
  // embedded media); width/height are CSS pixels, null if unspecified.
235
257
  image: {
@@ -8,7 +8,7 @@ import { Schema } from 'prosemirror-model';
8
8
  * extend THIS schema so the importer, layout engine, and (canvas) painter all
9
9
  * agree on one document model.
10
10
  */
11
- export declare const schema: Schema<"paragraph" | "doc" | "text" | "hard_break" | "image" | "page_field" | "table" | "table_row" | "table_cell", "strong" | "em" | "underline" | "strike" | "dstrike" | "smallCaps" | "textColor" | "fontSize" | "vertAlign" | "letterSpacing" | "kern" | "charScale" | "position" | "highlight" | "fontFamily" | "link" | "footnote" | "carryRPr">;
11
+ export declare const schema: Schema<"paragraph" | "doc" | "text" | "hard_break" | "column_break" | "image" | "page_field" | "table" | "table_row" | "table_cell", "strong" | "em" | "underline" | "strike" | "dstrike" | "smallCaps" | "textColor" | "fontSize" | "vertAlign" | "letterSpacing" | "kern" | "charScale" | "position" | "highlight" | "fontFamily" | "link" | "footnote" | "carryRPr">;
12
12
  /** Concrete schema type, handy for typing Node/Mark across packages. */
13
13
  export type BapbongSchema = typeof schema;
14
14
  /**
@@ -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;AAwF3C;;;;;;;;GAQG;AACH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G,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.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "bapbong — ProseMirror document model / schema",
5
5
  "license": "MIT",
6
6
  "repository": {