oasis-editor 0.0.5 → 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.
@@ -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 {
@@ -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--PhUmweO.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);
@@ -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,
@@ -29248,6 +29249,47 @@ function parseDocxTheme(themeXml) {
29248
29249
  colors: extractThemeColors(themeElements)
29249
29250
  };
29250
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
+ }
29251
29293
  function parseSettings(xml) {
29252
29294
  const settings = {
29253
29295
  adjustLineHeightInTable: true
@@ -29266,6 +29308,12 @@ function parseSettings(xml) {
29266
29308
  if (defaultTabStop !== void 0) {
29267
29309
  settings.defaultTabStop = defaultTabStop;
29268
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
+ );
29269
29317
  const compat = getFirstChildByTagNameNS(
29270
29318
  doc.documentElement,
29271
29319
  WORD_NS,
@@ -29899,7 +29947,8 @@ function normalizeImportedParagraphStyle(style2) {
29899
29947
  borderBottom: style2.borderBottom ?? void 0,
29900
29948
  borderLeft: style2.borderLeft ?? void 0,
29901
29949
  tabs: style2.tabs ?? void 0,
29902
- textDirection: style2.textDirection ?? void 0
29950
+ textDirection: style2.textDirection ?? void 0,
29951
+ outlineLevel: style2.outlineLevel ?? void 0
29903
29952
  });
29904
29953
  return normalized;
29905
29954
  }
@@ -30074,6 +30123,18 @@ function parseParagraphStyle$1(paragraphProperties) {
30074
30123
  if (textDirection) {
30075
30124
  style2.textDirection = textDirection;
30076
30125
  }
30126
+ const outlineLvlEl = getFirstChildByTagNameNS(
30127
+ paragraphProperties,
30128
+ WORD_NS,
30129
+ "outlineLvl"
30130
+ );
30131
+ const outlineLvlVal = getAttributeValue(outlineLvlEl, "val");
30132
+ if (outlineLvlVal !== void 0) {
30133
+ const level = Number(outlineLvlVal);
30134
+ if (Number.isFinite(level) && level >= 0 && level <= 8) {
30135
+ style2.outlineLevel = level;
30136
+ }
30137
+ }
30077
30138
  return emptyOrUndefined(style2);
30078
30139
  }
30079
30140
  function parseConditionalRowStyle(trPr) {
@@ -32957,7 +33018,10 @@ async function importDocxToEditorDocument(buffer, options = {}) {
32957
33018
  theme,
32958
33019
  importedStyles
32959
33020
  );
32960
- 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;
32961
33025
  remapImportedFootnoteRefsInSections(sections, parsedFootnotes.byDocxId);
32962
33026
  const endnotesXml = await ((_k = zip.file("word/endnotes.xml")) == null ? void 0 : _k.async("string")) ?? null;
32963
33027
  const endnotesPartRels = endnotesXml ? await loadPartRelationships(zip, "word/endnotes.xml") : /* @__PURE__ */ new Map();
@@ -32970,7 +33034,10 @@ async function importDocxToEditorDocument(buffer, options = {}) {
32970
33034
  theme,
32971
33035
  importedStyles
32972
33036
  );
32973
- 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;
32974
33041
  remapImportedEndnoteRefsInSections(sections, parsedEndnotes.byDocxId);
32975
33042
  const editorBookmarks = extractBookmarksFromSections(sections);
32976
33043
  const shouldPreserveSections = sections.length > 1 || sections.some(
@@ -33118,7 +33185,7 @@ function importDocxInWorker(buffer, options = {}) {
33118
33185
  const worker = new Worker(
33119
33186
  new URL(
33120
33187
  /* @vite-ignore */
33121
- "" + new URL("assets/importDocxWorker-C6O0dO38.js", import.meta.url).href,
33188
+ "" + new URL("assets/importDocxWorker-DbiKelzX.js", import.meta.url).href,
33122
33189
  import.meta.url
33123
33190
  ),
33124
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-Buc11g2W.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,