@shadow-garden/bapbong-model 0.7.0 → 0.8.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 +63 -0
- package/dist/index.js +63 -0
- package/dist/lib/model.d.ts +1 -1
- package/dist/lib/model.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -511,6 +511,69 @@ var schema = new import_prosemirror_model.Schema({
|
|
|
511
511
|
],
|
|
512
512
|
toDOM: (mark) => [mark.attrs["value"] === "sub" ? "sub" : "sup", 0]
|
|
513
513
|
},
|
|
514
|
+
// w:spacing (rPr) — tracking in twips, positive = expanded. Absolute:
|
|
515
|
+
// unlike the font size it does not shrink for superscript or small caps.
|
|
516
|
+
letterSpacing: {
|
|
517
|
+
attrs: { twips: {} },
|
|
518
|
+
parseDOM: [
|
|
519
|
+
{
|
|
520
|
+
style: "letter-spacing",
|
|
521
|
+
getAttrs: (value) => {
|
|
522
|
+
const m = /^(-?[\d.]+)pt$/.exec(String(value));
|
|
523
|
+
return m ? { twips: Math.round(Number(m[1]) * 20) } : false;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
],
|
|
527
|
+
toDOM: (mark) => [
|
|
528
|
+
"span",
|
|
529
|
+
{ style: `letter-spacing: ${mark.attrs["twips"] / 20}pt` },
|
|
530
|
+
0
|
|
531
|
+
]
|
|
532
|
+
},
|
|
533
|
+
// w:w — horizontal glyph scale as a PERCENT (100 = normal). Squeezes the
|
|
534
|
+
// glyphs and their advances; independent of letterSpacing, which rides on
|
|
535
|
+
// top at its absolute value.
|
|
536
|
+
charScale: {
|
|
537
|
+
attrs: { percent: {} },
|
|
538
|
+
parseDOM: [
|
|
539
|
+
{
|
|
540
|
+
style: "transform",
|
|
541
|
+
getAttrs: (value) => {
|
|
542
|
+
const m = /^scaleX\(([\d.]+)\)$/.exec(String(value).trim());
|
|
543
|
+
return m ? { percent: Math.round(Number(m[1]) * 100) } : false;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
],
|
|
547
|
+
toDOM: (mark) => [
|
|
548
|
+
"span",
|
|
549
|
+
{
|
|
550
|
+
style: `display: inline-block; transform: scaleX(${mark.attrs["percent"] / 100})`
|
|
551
|
+
},
|
|
552
|
+
0
|
|
553
|
+
]
|
|
554
|
+
},
|
|
555
|
+
// w:position — baseline shift in half-points, positive up. Unlike
|
|
556
|
+
// super/subscript this does NOT resize the glyphs; Word treats the two
|
|
557
|
+
// as independent and documents combine them.
|
|
558
|
+
position: {
|
|
559
|
+
attrs: { halfPoints: {} },
|
|
560
|
+
parseDOM: [
|
|
561
|
+
{
|
|
562
|
+
style: "vertical-align",
|
|
563
|
+
getAttrs: (value) => {
|
|
564
|
+
const m = /^(-?[\d.]+)pt$/.exec(String(value));
|
|
565
|
+
return m ? { halfPoints: Number(m[1]) * 2 } : false;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
],
|
|
569
|
+
toDOM: (mark) => [
|
|
570
|
+
"span",
|
|
571
|
+
{
|
|
572
|
+
style: `vertical-align: ${mark.attrs["halfPoints"] / 2}pt`
|
|
573
|
+
},
|
|
574
|
+
0
|
|
575
|
+
]
|
|
576
|
+
},
|
|
514
577
|
// w:highlight / w:shd w:fill — run background color ("#RRGGBB")
|
|
515
578
|
highlight: {
|
|
516
579
|
attrs: { color: {} },
|
package/dist/index.js
CHANGED
|
@@ -479,6 +479,69 @@ var schema = new Schema({
|
|
|
479
479
|
],
|
|
480
480
|
toDOM: (mark) => [mark.attrs["value"] === "sub" ? "sub" : "sup", 0]
|
|
481
481
|
},
|
|
482
|
+
// w:spacing (rPr) — tracking in twips, positive = expanded. Absolute:
|
|
483
|
+
// unlike the font size it does not shrink for superscript or small caps.
|
|
484
|
+
letterSpacing: {
|
|
485
|
+
attrs: { twips: {} },
|
|
486
|
+
parseDOM: [
|
|
487
|
+
{
|
|
488
|
+
style: "letter-spacing",
|
|
489
|
+
getAttrs: (value) => {
|
|
490
|
+
const m = /^(-?[\d.]+)pt$/.exec(String(value));
|
|
491
|
+
return m ? { twips: Math.round(Number(m[1]) * 20) } : false;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
],
|
|
495
|
+
toDOM: (mark) => [
|
|
496
|
+
"span",
|
|
497
|
+
{ style: `letter-spacing: ${mark.attrs["twips"] / 20}pt` },
|
|
498
|
+
0
|
|
499
|
+
]
|
|
500
|
+
},
|
|
501
|
+
// w:w — horizontal glyph scale as a PERCENT (100 = normal). Squeezes the
|
|
502
|
+
// glyphs and their advances; independent of letterSpacing, which rides on
|
|
503
|
+
// top at its absolute value.
|
|
504
|
+
charScale: {
|
|
505
|
+
attrs: { percent: {} },
|
|
506
|
+
parseDOM: [
|
|
507
|
+
{
|
|
508
|
+
style: "transform",
|
|
509
|
+
getAttrs: (value) => {
|
|
510
|
+
const m = /^scaleX\(([\d.]+)\)$/.exec(String(value).trim());
|
|
511
|
+
return m ? { percent: Math.round(Number(m[1]) * 100) } : false;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
],
|
|
515
|
+
toDOM: (mark) => [
|
|
516
|
+
"span",
|
|
517
|
+
{
|
|
518
|
+
style: `display: inline-block; transform: scaleX(${mark.attrs["percent"] / 100})`
|
|
519
|
+
},
|
|
520
|
+
0
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
// w:position — baseline shift in half-points, positive up. Unlike
|
|
524
|
+
// super/subscript this does NOT resize the glyphs; Word treats the two
|
|
525
|
+
// as independent and documents combine them.
|
|
526
|
+
position: {
|
|
527
|
+
attrs: { halfPoints: {} },
|
|
528
|
+
parseDOM: [
|
|
529
|
+
{
|
|
530
|
+
style: "vertical-align",
|
|
531
|
+
getAttrs: (value) => {
|
|
532
|
+
const m = /^(-?[\d.]+)pt$/.exec(String(value));
|
|
533
|
+
return m ? { halfPoints: Number(m[1]) * 2 } : false;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
],
|
|
537
|
+
toDOM: (mark) => [
|
|
538
|
+
"span",
|
|
539
|
+
{
|
|
540
|
+
style: `vertical-align: ${mark.attrs["halfPoints"] / 2}pt`
|
|
541
|
+
},
|
|
542
|
+
0
|
|
543
|
+
]
|
|
544
|
+
},
|
|
482
545
|
// w:highlight / w:shd w:fill — run background color ("#RRGGBB")
|
|
483
546
|
highlight: {
|
|
484
547
|
attrs: { color: {} },
|
package/dist/lib/model.d.ts
CHANGED
|
@@ -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" | "highlight" | "fontFamily" | "link" | "footnote" | "carryRPr">;
|
|
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" | "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
|
/**
|
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;AAkF3C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,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