oasis-editor 0.0.4 → 0.0.5

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
@@ -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--PhUmweO.js").then((m) => {
2274
2274
  cancelled = true;
2275
2275
  setProgress(1);
2276
2276
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -31055,6 +31055,7 @@ async function parseRunElement(runElement, zip, relsMap, assets, parseNestedBloc
31055
31055
  const textParts = [];
31056
31056
  let image;
31057
31057
  let textBox;
31058
+ let sym;
31058
31059
  let textLength = 0;
31059
31060
  const innerBookmarks = [];
31060
31061
  const pushText = (value) => {
@@ -31116,6 +31117,13 @@ async function parseRunElement(runElement, zip, relsMap, assets, parseNestedBloc
31116
31117
  pushText("");
31117
31118
  image = vmlResult;
31118
31119
  }
31120
+ } else if (element.localName === "sym") {
31121
+ const font = getAttributeValue(element, "font") ?? "";
31122
+ const charHex = getAttributeValue(element, "char") ?? "";
31123
+ const codePoint = parseInt(charHex, 16);
31124
+ const ch = Number.isFinite(codePoint) && codePoint > 0 ? String.fromCodePoint(codePoint) : "?";
31125
+ pushText(ch);
31126
+ sym = { font, char: charHex };
31119
31127
  }
31120
31128
  } else if (element.localName === "AlternateContent") {
31121
31129
  const drawing = resolveAlternateContentDrawing(element);
@@ -31132,7 +31140,8 @@ async function parseRunElement(runElement, zip, relsMap, assets, parseNestedBloc
31132
31140
  text: textParts.join(""),
31133
31141
  image,
31134
31142
  ...textBox ? { textBox } : {},
31135
- ...innerBookmarks.length > 0 ? { innerBookmarks } : {}
31143
+ ...innerBookmarks.length > 0 ? { innerBookmarks } : {},
31144
+ ...sym ? { sym } : {}
31136
31145
  };
31137
31146
  }
31138
31147
  async function parseRunsContainer(container, numberingMaps, zip, relsMap, assets, theme, inheritedLink, parseNestedBlocks) {
@@ -31304,7 +31313,7 @@ async function parseRunsContainer(container, numberingMaps, zip, relsMap, assets
31304
31313
  });
31305
31314
  continue;
31306
31315
  }
31307
- const { text, image, textBox, innerBookmarks } = await parseRunElement(
31316
+ const { text, image, textBox, innerBookmarks, sym } = await parseRunElement(
31308
31317
  element,
31309
31318
  zip,
31310
31319
  relsMap,
@@ -31312,6 +31321,9 @@ async function parseRunsContainer(container, numberingMaps, zip, relsMap, assets
31312
31321
  parseNestedBlocks
31313
31322
  );
31314
31323
  let styles = runStyles;
31324
+ if (sym && !(styles == null ? void 0 : styles.fontFamily)) {
31325
+ (styles ?? (styles = {})).fontFamily = sym.font;
31326
+ }
31315
31327
  if (inheritedLink) {
31316
31328
  (styles ?? (styles = {})).link = inheritedLink;
31317
31329
  }
@@ -31338,6 +31350,7 @@ async function parseRunsContainer(container, numberingMaps, zip, relsMap, assets
31338
31350
  text,
31339
31351
  ...image ? { image } : {},
31340
31352
  ...textBox ? { textBox } : {},
31353
+ ...sym ? { sym } : {},
31341
31354
  ...styles ? { styles } : {}
31342
31355
  });
31343
31356
  if (innerBookmarks) {
@@ -32238,6 +32251,9 @@ function createImportedParagraph(runs, paragraphStyle, list, markRunStyle) {
32238
32251
  if (run.bookmark) {
32239
32252
  paragraph.runs[index].__importedBookmark = { ...run.bookmark };
32240
32253
  }
32254
+ if (run.sym) {
32255
+ paragraph.runs[index].sym = { ...run.sym };
32256
+ }
32241
32257
  });
32242
32258
  paragraph.style = paragraphStyle ? { ...paragraphStyle } : void 0;
32243
32259
  for (const run of paragraph.runs) {
@@ -33102,7 +33118,7 @@ function importDocxInWorker(buffer, options = {}) {
33102
33118
  const worker = new Worker(
33103
33119
  new URL(
33104
33120
  /* @vite-ignore */
33105
- "" + new URL("assets/importDocxWorker-CVDgFleW.js", import.meta.url).href,
33121
+ "" + new URL("assets/importDocxWorker-C6O0dO38.js", import.meta.url).href,
33106
33122
  import.meta.url
33107
33123
  ),
33108
33124
  {
@@ -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-Buc11g2W.js";
2
2
  export {
3
3
  aM as BalloonShell,
4
4
  bB as Button,