oasis-editor 0.0.4 → 0.0.6

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.
@@ -83,6 +83,15 @@ export interface EditorTextRun {
83
83
  * `EditorDocument.endnotes.items[endnoteReference.endnoteId]`.
84
84
  */
85
85
  endnoteReference?: EditorEndnoteReferenceData;
86
+ /**
87
+ * Round-trip metadata for `w:sym` — a glyph from a named font.
88
+ * `font` is the `w:font` attribute value; `char` is the 4-digit hex `w:char` value.
89
+ * The character is also stored in `text` so the canvas can render it.
90
+ */
91
+ sym?: {
92
+ font: string;
93
+ char: string;
94
+ };
86
95
  }
87
96
  /**
88
97
  * A drop cap (Word's `w:framePr/@dropCap`): a large initial letter sunk into
@@ -68,6 +68,8 @@ export interface EditorParagraphStyle {
68
68
  widowControl?: boolean;
69
69
  /** `w:textDirection/@w:val`: paragraph flow direction (vertical text). */
70
70
  textDirection?: "lrTb" | "tbRl" | "btLr" | "lrTbV" | "tbRlV" | null;
71
+ /** `w:outlineLvl/@w:val`: outline level 0–8 (0 = Heading 1 … 8 = Heading 9). */
72
+ outlineLevel?: number | null;
71
73
  }
72
74
  /** Row properties from a conditional format's `w:trPr`. */
73
75
  export interface EditorConditionalRowStyle {
@@ -39,4 +39,8 @@ export interface ImportedRun {
39
39
  customMark?: string;
40
40
  };
41
41
  bookmark?: ImportedBookmarkMarker;
42
+ sym?: {
43
+ font: string;
44
+ char: string;
45
+ };
42
46
  }
@@ -17,5 +17,9 @@ export declare function parseRunElement(runElement: XmlElement, zip: JSZip, rels
17
17
  offset: number;
18
18
  marker: ImportedBookmarkMarker;
19
19
  }>;
20
+ sym?: {
21
+ font: string;
22
+ char: string;
23
+ };
20
24
  }>;
21
25
  export declare function parseRunsContainer(container: XmlElement, numberingMaps: NumberingMaps, zip: JSZip, relsMap: Map<string, string>, assets: AssetRegistry, theme: DocxImportTheme, inheritedLink?: string | null, parseNestedBlocks?: ParseNestedBlocks): Promise<ImportedRun[]>;
@@ -2270,7 +2270,7 @@ function OasisEditorAppLazy(props = {}) {
2270
2270
  onCleanup(() => {
2271
2271
  cancelled = true;
2272
2272
  });
2273
- import("./OasisEditorApp-DD-ts2_v.js").then((m) => {
2273
+ import("./OasisEditorApp-Co_pXhKM.js").then((m) => {
2274
2274
  cancelled = true;
2275
2275
  setProgress(1);
2276
2276
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -2849,7 +2849,8 @@ const DEFAULT_PARAGRAPH_STYLE = asRequired({
2849
2849
  keepWithNext: false,
2850
2850
  keepLinesTogether: false,
2851
2851
  widowControl: true,
2852
- textDirection: null
2852
+ textDirection: null,
2853
+ outlineLevel: null
2853
2854
  });
2854
2855
  const DEFAULT_EDITOR_PAGE_SETTINGS = {
2855
2856
  width: 816,
@@ -29899,7 +29900,8 @@ function normalizeImportedParagraphStyle(style2) {
29899
29900
  borderBottom: style2.borderBottom ?? void 0,
29900
29901
  borderLeft: style2.borderLeft ?? void 0,
29901
29902
  tabs: style2.tabs ?? void 0,
29902
- textDirection: style2.textDirection ?? void 0
29903
+ textDirection: style2.textDirection ?? void 0,
29904
+ outlineLevel: style2.outlineLevel ?? void 0
29903
29905
  });
29904
29906
  return normalized;
29905
29907
  }
@@ -30074,6 +30076,18 @@ function parseParagraphStyle$1(paragraphProperties) {
30074
30076
  if (textDirection) {
30075
30077
  style2.textDirection = textDirection;
30076
30078
  }
30079
+ const outlineLvlEl = getFirstChildByTagNameNS(
30080
+ paragraphProperties,
30081
+ WORD_NS,
30082
+ "outlineLvl"
30083
+ );
30084
+ const outlineLvlVal = getAttributeValue(outlineLvlEl, "val");
30085
+ if (outlineLvlVal !== void 0) {
30086
+ const level = Number(outlineLvlVal);
30087
+ if (Number.isFinite(level) && level >= 0 && level <= 8) {
30088
+ style2.outlineLevel = level;
30089
+ }
30090
+ }
30077
30091
  return emptyOrUndefined(style2);
30078
30092
  }
30079
30093
  function parseConditionalRowStyle(trPr) {
@@ -31055,6 +31069,7 @@ async function parseRunElement(runElement, zip, relsMap, assets, parseNestedBloc
31055
31069
  const textParts = [];
31056
31070
  let image;
31057
31071
  let textBox;
31072
+ let sym;
31058
31073
  let textLength = 0;
31059
31074
  const innerBookmarks = [];
31060
31075
  const pushText = (value) => {
@@ -31116,6 +31131,13 @@ async function parseRunElement(runElement, zip, relsMap, assets, parseNestedBloc
31116
31131
  pushText("");
31117
31132
  image = vmlResult;
31118
31133
  }
31134
+ } else if (element.localName === "sym") {
31135
+ const font = getAttributeValue(element, "font") ?? "";
31136
+ const charHex = getAttributeValue(element, "char") ?? "";
31137
+ const codePoint = parseInt(charHex, 16);
31138
+ const ch = Number.isFinite(codePoint) && codePoint > 0 ? String.fromCodePoint(codePoint) : "?";
31139
+ pushText(ch);
31140
+ sym = { font, char: charHex };
31119
31141
  }
31120
31142
  } else if (element.localName === "AlternateContent") {
31121
31143
  const drawing = resolveAlternateContentDrawing(element);
@@ -31132,7 +31154,8 @@ async function parseRunElement(runElement, zip, relsMap, assets, parseNestedBloc
31132
31154
  text: textParts.join(""),
31133
31155
  image,
31134
31156
  ...textBox ? { textBox } : {},
31135
- ...innerBookmarks.length > 0 ? { innerBookmarks } : {}
31157
+ ...innerBookmarks.length > 0 ? { innerBookmarks } : {},
31158
+ ...sym ? { sym } : {}
31136
31159
  };
31137
31160
  }
31138
31161
  async function parseRunsContainer(container, numberingMaps, zip, relsMap, assets, theme, inheritedLink, parseNestedBlocks) {
@@ -31304,7 +31327,7 @@ async function parseRunsContainer(container, numberingMaps, zip, relsMap, assets
31304
31327
  });
31305
31328
  continue;
31306
31329
  }
31307
- const { text, image, textBox, innerBookmarks } = await parseRunElement(
31330
+ const { text, image, textBox, innerBookmarks, sym } = await parseRunElement(
31308
31331
  element,
31309
31332
  zip,
31310
31333
  relsMap,
@@ -31312,6 +31335,9 @@ async function parseRunsContainer(container, numberingMaps, zip, relsMap, assets
31312
31335
  parseNestedBlocks
31313
31336
  );
31314
31337
  let styles = runStyles;
31338
+ if (sym && !(styles == null ? void 0 : styles.fontFamily)) {
31339
+ (styles ?? (styles = {})).fontFamily = sym.font;
31340
+ }
31315
31341
  if (inheritedLink) {
31316
31342
  (styles ?? (styles = {})).link = inheritedLink;
31317
31343
  }
@@ -31338,6 +31364,7 @@ async function parseRunsContainer(container, numberingMaps, zip, relsMap, assets
31338
31364
  text,
31339
31365
  ...image ? { image } : {},
31340
31366
  ...textBox ? { textBox } : {},
31367
+ ...sym ? { sym } : {},
31341
31368
  ...styles ? { styles } : {}
31342
31369
  });
31343
31370
  if (innerBookmarks) {
@@ -32238,6 +32265,9 @@ function createImportedParagraph(runs, paragraphStyle, list, markRunStyle) {
32238
32265
  if (run.bookmark) {
32239
32266
  paragraph.runs[index].__importedBookmark = { ...run.bookmark };
32240
32267
  }
32268
+ if (run.sym) {
32269
+ paragraph.runs[index].sym = { ...run.sym };
32270
+ }
32241
32271
  });
32242
32272
  paragraph.style = paragraphStyle ? { ...paragraphStyle } : void 0;
32243
32273
  for (const run of paragraph.runs) {
@@ -33102,7 +33132,7 @@ function importDocxInWorker(buffer, options = {}) {
33102
33132
  const worker = new Worker(
33103
33133
  new URL(
33104
33134
  /* @vite-ignore */
33105
- "" + new URL("assets/importDocxWorker-CVDgFleW.js", import.meta.url).href,
33135
+ "" + new URL("assets/importDocxWorker-CtfvrAfg.js", import.meta.url).href,
33106
33136
  import.meta.url
33107
33137
  ),
33108
33138
  {
@@ -1,4 +1,4 @@
1
- import { aM, bB, bC, bD, bE, bF, b1, bG, aN, aI, bH, bI, bJ, aL, bK, aG, bL, bM, bN, bO, bP, bx, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ, b6, b_, bw, b$, bD as bD2, bI as bI2, bK as bK2, bS as bS2, bU as bU2, bZ as bZ2, aK, aE, c0, c1, c2, aH, c3, c4, aJ } from "./index-C-nGWNHh.js";
1
+ import { aM, bB, bC, bD, bE, bF, b1, bG, aN, aI, bH, bI, bJ, aL, bK, aG, bL, bM, bN, bO, bP, bx, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ, b6, b_, bw, b$, bD as bD2, bI as bI2, bK as bK2, bS as bS2, bU as bU2, bZ as bZ2, aK, aE, c0, c1, c2, aH, c3, c4, aJ } from "./index-BYewCj77.js";
2
2
  export {
3
3
  aM as BalloonShell,
4
4
  bB as Button,