From d8ea19e7cf308a9a9b94472a92fa8bd9e16566a0 Mon Sep 17 00:00:00 2001 From: bokuweb Date: Fri, 28 Feb 2020 03:12:36 +0900 Subject: [PATCH] fix: indent (#44) --- docx-wasm/js/json/indent.ts | 8 ++++++++ docx-wasm/js/json/index.ts | 13 +++++-------- docx-wasm/js/json/numbering.ts | 5 +++++ docx-wasm/js/json/paragraph.ts | 2 ++ docx-wasm/js/json/styles.ts | 2 +- docx-wasm/package.json | 2 +- 6 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 docx-wasm/js/json/indent.ts diff --git a/docx-wasm/js/json/indent.ts b/docx-wasm/js/json/indent.ts new file mode 100644 index 0000000..223f7eb --- /dev/null +++ b/docx-wasm/js/json/indent.ts @@ -0,0 +1,8 @@ +export type IndentJSON = { + start: number; + end: number | null; + specialIndent: { + type: "firstLine" | "hanging"; + val: number; + } | null; +}; diff --git a/docx-wasm/js/json/index.ts b/docx-wasm/js/json/index.ts index 39a0f18..8376234 100644 --- a/docx-wasm/js/json/index.ts +++ b/docx-wasm/js/json/index.ts @@ -1,6 +1,6 @@ -import { Styles } from "./styles"; +import { StylesJSON } from "./styles"; import { DocumentJSON } from "./document"; -import { AbstractNumberingJSON, NumberingJSON } from "./numbering"; +import { NumberingsJSON } from "./numbering"; export type DocxJSON = { contentType: { @@ -28,15 +28,12 @@ export type DocxJSON = { }; }; }; - styles: Styles; + styles: StylesJSON; document: DocumentJSON; comments: { - comments: any[]; - }; - numberings: { - abstractNums: AbstractNumberingJSON[]; - numberings: NumberingJSON[]; + comments: any[]; // TODO: }; + numberings: NumberingsJSON; settings: { defaultTabStop: number; zoom: number; diff --git a/docx-wasm/js/json/numbering.ts b/docx-wasm/js/json/numbering.ts index d4263e0..9d98e70 100644 --- a/docx-wasm/js/json/numbering.ts +++ b/docx-wasm/js/json/numbering.ts @@ -21,3 +21,8 @@ export type NumberingJSON = { id: number; abstractNumId: number; }; + +export type NumberingsJSON = { + abstractNums: AbstractNumberingJSON[]; + numberings: NumberingJSON[]; +}; diff --git a/docx-wasm/js/json/paragraph.ts b/docx-wasm/js/json/paragraph.ts index 10003cb..f73c761 100644 --- a/docx-wasm/js/json/paragraph.ts +++ b/docx-wasm/js/json/paragraph.ts @@ -1,4 +1,5 @@ import { RunJSON, RunChildJSON } from "./run"; +import { IndentJSON } from "./indent"; export type ParagraphChildJSON = | RunJSON @@ -17,6 +18,7 @@ export type ParagraphPropertyJSON = { style: string | null; numberingProperty: NumberingPropertyJSON | null; alignment: "left" | "center" | "right" | "justified" | "both"; + indent: IndentJSON | null; }; export type ParagraphJSON = { diff --git a/docx-wasm/js/json/styles.ts b/docx-wasm/js/json/styles.ts index 28af03e..94d25c2 100644 --- a/docx-wasm/js/json/styles.ts +++ b/docx-wasm/js/json/styles.ts @@ -9,7 +9,7 @@ export type StyleJSON = { paragraphProperty: ParagraphPropertyJSON; }; -export type Styles = { +export type StylesJSON = { docDefaults: { runPropertyDefault: RunPropertyJSON; }; diff --git a/docx-wasm/package.json b/docx-wasm/package.json index 0b79f30..3e2144c 100644 --- a/docx-wasm/package.json +++ b/docx-wasm/package.json @@ -1,6 +1,6 @@ { "name": "docx-wasm", - "version": "0.0.35", + "version": "0.0.37", "main": "dist/node/index.js", "browser": "dist/web/index.js", "author": "bokuweb ",