oasis-editor 0.0.6 → 0.0.7

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.
@@ -1,5 +1,9 @@
1
+ import { EditorFootnoteSettings, EditorEndnoteSettings } from '../../../../core/model.js';
2
+
1
3
  export interface DocxSettings {
2
4
  adjustLineHeightInTable: boolean;
3
5
  defaultTabStop?: number;
6
+ footnoteSettings?: EditorFootnoteSettings;
7
+ endnoteSettings?: EditorEndnoteSettings;
4
8
  }
5
9
  export declare function parseSettings(xml: string | null): DocxSettings;
@@ -2270,7 +2270,7 @@ function OasisEditorAppLazy(props = {}) {
2270
2270
  onCleanup(() => {
2271
2271
  cancelled = true;
2272
2272
  });
2273
- import("./OasisEditorApp-Co_pXhKM.js").then((m) => {
2273
+ import("./OasisEditorApp-Ck4oFAf-.js").then((m) => {
2274
2274
  cancelled = true;
2275
2275
  setProgress(1);
2276
2276
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -29249,6 +29249,47 @@ function parseDocxTheme(themeXml) {
29249
29249
  colors: extractThemeColors(themeElements)
29250
29250
  };
29251
29251
  }
29252
+ const NOTE_NUMBER_FORMATS = {
29253
+ decimal: "decimal",
29254
+ lowerRoman: "lowerRoman",
29255
+ upperRoman: "upperRoman",
29256
+ lowerLetter: "lowerLetter",
29257
+ upperLetter: "upperLetter",
29258
+ symbol: "symbol"
29259
+ };
29260
+ const NOTE_RESTARTS = {
29261
+ continuous: "continuous",
29262
+ eachSect: "eachSection"
29263
+ };
29264
+ function parseNoteSettings(element) {
29265
+ if (!element) return void 0;
29266
+ const settings = {};
29267
+ const numFmt = getAttributeValue(
29268
+ getFirstChildByTagNameNS(element, WORD_NS, "numFmt"),
29269
+ "val"
29270
+ );
29271
+ if (numFmt && NOTE_NUMBER_FORMATS[numFmt]) {
29272
+ settings.numberFormat = NOTE_NUMBER_FORMATS[numFmt];
29273
+ }
29274
+ const numStart = Number.parseInt(
29275
+ getAttributeValue(
29276
+ getFirstChildByTagNameNS(element, WORD_NS, "numStart"),
29277
+ "val"
29278
+ ) ?? "",
29279
+ 10
29280
+ );
29281
+ if (Number.isFinite(numStart) && numStart > 0) {
29282
+ settings.startAt = numStart;
29283
+ }
29284
+ const numRestart = getAttributeValue(
29285
+ getFirstChildByTagNameNS(element, WORD_NS, "numRestart"),
29286
+ "val"
29287
+ );
29288
+ if (numRestart && NOTE_RESTARTS[numRestart]) {
29289
+ settings.restart = NOTE_RESTARTS[numRestart];
29290
+ }
29291
+ return Object.keys(settings).length > 0 ? settings : void 0;
29292
+ }
29252
29293
  function parseSettings(xml) {
29253
29294
  const settings = {
29254
29295
  adjustLineHeightInTable: true
@@ -29267,6 +29308,12 @@ function parseSettings(xml) {
29267
29308
  if (defaultTabStop !== void 0) {
29268
29309
  settings.defaultTabStop = defaultTabStop;
29269
29310
  }
29311
+ settings.footnoteSettings = parseNoteSettings(
29312
+ getFirstChildByTagNameNS(doc.documentElement, WORD_NS, "footnotePr")
29313
+ );
29314
+ settings.endnoteSettings = parseNoteSettings(
29315
+ getFirstChildByTagNameNS(doc.documentElement, WORD_NS, "endnotePr")
29316
+ );
29270
29317
  const compat = getFirstChildByTagNameNS(
29271
29318
  doc.documentElement,
29272
29319
  WORD_NS,
@@ -32971,7 +33018,10 @@ async function importDocxToEditorDocument(buffer, options = {}) {
32971
33018
  theme,
32972
33019
  importedStyles
32973
33020
  );
32974
- const editorFootnotes = Object.keys(parsedFootnotes.footnotes.items).length > 0 || parsedFootnotes.footnotes.separator || parsedFootnotes.footnotes.continuationSeparator ? parsedFootnotes.footnotes : void 0;
33021
+ if (docSettings.footnoteSettings) {
33022
+ parsedFootnotes.footnotes.settings = docSettings.footnoteSettings;
33023
+ }
33024
+ const editorFootnotes = Object.keys(parsedFootnotes.footnotes.items).length > 0 || parsedFootnotes.footnotes.separator || parsedFootnotes.footnotes.continuationSeparator || parsedFootnotes.footnotes.settings ? parsedFootnotes.footnotes : void 0;
32975
33025
  remapImportedFootnoteRefsInSections(sections, parsedFootnotes.byDocxId);
32976
33026
  const endnotesXml = await ((_k = zip.file("word/endnotes.xml")) == null ? void 0 : _k.async("string")) ?? null;
32977
33027
  const endnotesPartRels = endnotesXml ? await loadPartRelationships(zip, "word/endnotes.xml") : /* @__PURE__ */ new Map();
@@ -32984,7 +33034,10 @@ async function importDocxToEditorDocument(buffer, options = {}) {
32984
33034
  theme,
32985
33035
  importedStyles
32986
33036
  );
32987
- const editorEndnotes = Object.keys(parsedEndnotes.endnotes.items).length > 0 ? parsedEndnotes.endnotes : void 0;
33037
+ if (docSettings.endnoteSettings) {
33038
+ parsedEndnotes.endnotes.settings = docSettings.endnoteSettings;
33039
+ }
33040
+ const editorEndnotes = Object.keys(parsedEndnotes.endnotes.items).length > 0 || parsedEndnotes.endnotes.separator || parsedEndnotes.endnotes.continuationSeparator || parsedEndnotes.endnotes.settings ? parsedEndnotes.endnotes : void 0;
32988
33041
  remapImportedEndnoteRefsInSections(sections, parsedEndnotes.byDocxId);
32989
33042
  const editorBookmarks = extractBookmarksFromSections(sections);
32990
33043
  const shouldPreserveSections = sections.length > 1 || sections.some(
@@ -33132,7 +33185,7 @@ function importDocxInWorker(buffer, options = {}) {
33132
33185
  const worker = new Worker(
33133
33186
  new URL(
33134
33187
  /* @vite-ignore */
33135
- "" + new URL("assets/importDocxWorker-CtfvrAfg.js", import.meta.url).href,
33188
+ "" + new URL("assets/importDocxWorker-DbiKelzX.js", import.meta.url).href,
33136
33189
  import.meta.url
33137
33190
  ),
33138
33191
  {
@@ -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-BYewCj77.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-BGcbqj0Q.js";
2
2
  export {
3
3
  aM as BalloonShell,
4
4
  bB as Button,