diff --git a/amis.code-workspace b/amis.code-workspace index 407500fb5..aef0586e9 100644 --- a/amis.code-workspace +++ b/amis.code-workspace @@ -17,7 +17,7 @@ "path": "./packages/amis" }, { - "path": "./packages/office-viewer" + "path": "./packages/ooxml-viewer" } ] } diff --git a/fis-conf.js b/fis-conf.js index 16c3b30b6..7397a2897 100644 --- a/fis-conf.js +++ b/fis-conf.js @@ -490,7 +490,7 @@ if (fis.project.currentMedia() === 'publish-sdk') { '!markdown-it/**', '!markdown-it-html5-media/**', '!punycode/**', - '!office-viewer/**', + '!ooxml-viewer/**', '!fflate/**' ], @@ -532,7 +532,7 @@ if (fis.project.currentMedia() === 'publish-sdk') { 'charts.js': ['zrender/**', 'echarts/**', 'echarts-stat/**'], - 'office-viewer.js': ['office-viewer/**', 'fflate/**'], + 'ooxml-viewer.js': ['ooxml-viewer/**', 'fflate/**'], 'rest.js': [ '*.js', @@ -555,7 +555,7 @@ if (fis.project.currentMedia() === 'publish-sdk') { '!uc.micro/**', '!markdown-it/**', '!markdown-it-html5-media/**', - '!office-viewer/**', + '!ooxml-viewer/**', '!fflate/**' ] }), @@ -784,7 +784,7 @@ if (fis.project.currentMedia() === 'publish-sdk') { '!punycode/**', '!amis-formula/**', '!fflate/**', - '!office-viewer/**', + '!ooxml-viewer/**', '!amis-core/**', '!amis-ui/**', '!amis/**' @@ -843,7 +843,7 @@ if (fis.project.currentMedia() === 'publish-sdk') { '!/examples/components/EChartsEditor/Common.tsx' ], - 'pkg/office-viewer.js': ['office-viewer/**', 'fflate/**'], + 'pkg/ooxml-viewer.js': ['ooxml-viewer/**', 'fflate/**'], 'pkg/rest.js': [ '**.{js,jsx,ts,tsx}', diff --git a/lerna.json b/lerna.json index 6fd75ab73..5e202a023 100644 --- a/lerna.json +++ b/lerna.json @@ -4,7 +4,7 @@ "packages/amis-core", "packages/amis-ui", "packages/amis", - "packages/office-viewer" + "packages/ooxml-viewer" ], "version": "2.9.0" } diff --git a/package.json b/package.json index 78f54fcb4..a9a74ca4e 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "packages/amis", "packages/amis-editor-core", "packages/amis-editor", - "packages/office-viewer" + "packages/ooxml-viewer" ], "scripts": { "fis3-serve": "fis3 server start --www ./public --port 8888 --no-daemon --no-browse", @@ -103,7 +103,7 @@ "^amis\\-ui$": "/packages/amis-ui/src/index.tsx", "^amis\\-core$": "/packages/amis-core/src/index.tsx", "^amis\\-formula$": "/packages/amis-formula/src/index.ts", - "^office\\-viewer$": "/packages/office-viewer/src/index.ts", + "^office\\-viewer$": "/packages/ooxml-viewer/src/index.ts", "^amis$": "/packages/amis/src/index.tsx" }, "setupFilesAfterEnv": [ @@ -118,4 +118,4 @@ "printBasicPrototype": false } } -} +} \ No newline at end of file diff --git a/packages/amis/package.json b/packages/amis/package.json index 087d2baaf..b9a038a5f 100644 --- a/packages/amis/package.json +++ b/packages/amis/package.json @@ -64,7 +64,7 @@ "mobx-state-tree": "^3.17.3", "moment": "^2.19.4", "mpegts.js": "^1.6.10", - "office-viewer": "0.1.0", + "ooxml-viewer": "0.1.0", "prop-types": "^15.6.1", "qrcode.react": "^3.1.0", "rc-overflow": "^1.2.4", @@ -238,7 +238,7 @@ "peerDependencies": { "amis-core": "*", "amis-ui": "*", - "office-viewer": "*", + "ooxml-viewer": "*", "react": ">=16.8.6", "react-dom": ">=16.8.6" }, diff --git a/packages/amis/rollup.config.js b/packages/amis/rollup.config.js index 3b24ab90e..380efa55c 100644 --- a/packages/amis/rollup.config.js +++ b/packages/amis/rollup.config.js @@ -119,7 +119,7 @@ function getPlugins(format = 'esm') { 'amis-formula', 'amis-core', 'amis-ui', - 'office-viewer' + 'ooxml-viewer' ].reduce( (prev, current) => ({ ...prev, diff --git a/packages/amis/src/renderers/OfficeViewer.tsx b/packages/amis/src/renderers/OfficeViewer.tsx index 370afae3e..5082ce404 100644 --- a/packages/amis/src/renderers/OfficeViewer.tsx +++ b/packages/amis/src/renderers/OfficeViewer.tsx @@ -15,7 +15,7 @@ import { resolveVariableAndFilter, ScopedContext } from 'amis-core'; -import type {Word} from 'office-viewer'; +import type {Word} from 'ooxml-viewer'; import {Spinner} from 'amis-ui'; export interface OfficeViewerSchema extends BaseSchema { @@ -137,7 +137,7 @@ export default class OfficeViewer extends React.Component< responseType: 'arraybuffer' }); - import('office-viewer').then(async (officeViewer: any) => { + import('ooxml-viewer').then(async (officeViewer: any) => { const Word = officeViewer.Word; const word = new Word(response.data, { ...wordOptions, @@ -164,7 +164,7 @@ export default class OfficeViewer extends React.Component< reader.onload = _e => { const data = reader.result as ArrayBuffer; - import('office-viewer').then(async (officeViewer: any) => { + import('ooxml-viewer').then(async (officeViewer: any) => { const Word = officeViewer.Word; const word = new Word(data, { ...wordOptions, @@ -187,12 +187,13 @@ export default class OfficeViewer extends React.Component< loading = false, src, name, + display, loadingConfig } = this.props; return ( -
+
{/* 避免没内容时编辑器都选不了 */} - {(!src || !name) && ( + {display !== false && !src && !name && ( - - - - - - - - - - - US is about 400,000 and over two million - - - - - - people - - - - - - are - - - - - - - - - - - - ADDIN EN.REFLIST - - - - - - - - - - 1. - - - - Orton SM, Herrera BM, Yee IM, et al. Sex ratio of multiple sclerosis in Canada: a longitudinal study. Lancet Neurol 2006;5:932-6. - - - - - - - - - - 2. - - - - Kister I, Chamot E, Salter AR, Cutter GR, Bacon TE, Herbert J. Disability in multiple sclerosis: a reference for patients and clinicians. Neurology 2013;80:1018-24. - - - - - - - - - - 3. - - - - Mayr WT, Pittock SJ, McClelland RL, Jorgensen NW, Noseworthy JH, Rodriguez M. Incidence and prevalence of multiple sclerosis in Olmsted County, Minnesota, 1985-2000. Neurology 2003;61:1373-7. - - - - - - - - - - - - - - - - - - - - - - - expected - - - - - - increase in the number of cases in future - - - - diff --git a/packages/office-viewer/__tests__/docx/dedocx/fields/fields-single.xml b/packages/office-viewer/__tests__/docx/dedocx/fields/fields-single.xml deleted file mode 100755 index 70fc51a28..000000000 --- a/packages/office-viewer/__tests__/docx/dedocx/fields/fields-single.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - HYPERLINK \l "_ENREF_95" \o "Kappos, 2010 #67" - - - - - - - - - - - - - - diff --git a/packages/office-viewer/__tests__/docx/dedocx/fields/fields-three.xml b/packages/office-viewer/__tests__/docx/dedocx/fields/fields-three.xml deleted file mode 100755 index 0b67cd177..000000000 --- a/packages/office-viewer/__tests__/docx/dedocx/fields/fields-three.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - HYPERLINK \l "_ENREF_95" \o "Kappos, 2010 #67" - - - - - - - - - - - XXX - - - - - - - - ADDIN EN.CITE - - - - - - - - XXX - - - - - - - - ADDIN EN.CITE.DATA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 95-98 - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/office-viewer/__tests__/docx/dedocx/fields/fields-trivial-instr.xml b/packages/office-viewer/__tests__/docx/dedocx/fields/fields-trivial-instr.xml deleted file mode 100755 index 928f28090..000000000 --- a/packages/office-viewer/__tests__/docx/dedocx/fields/fields-trivial-instr.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - HYPERLINK \l "_ENREF_95" \o "Kappos, 2010 #67" - - - - - - HYPERLINK \l "_ENREF_2" \o "Kappos, 2010 #67" - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/office-viewer/__tests__/docx/dedocx/fields/fields-trivial.xml b/packages/office-viewer/__tests__/docx/dedocx/fields/fields-trivial.xml deleted file mode 100755 index ad3cea54b..000000000 --- a/packages/office-viewer/__tests__/docx/dedocx/fields/fields-trivial.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - HYPERLINK \l "_ENREF_95" \o "Kappos, 2010 #67" - - - - - - - - - HYPERLINK \l "_ENREF_2" \o "Kappos, 2010 #67" - - - - - - - - - - - - - - - - - - - - diff --git a/packages/office-viewer/.gitignore b/packages/ooxml-viewer/.gitignore similarity index 100% rename from packages/office-viewer/.gitignore rename to packages/ooxml-viewer/.gitignore diff --git a/packages/office-viewer/README.md b/packages/ooxml-viewer/README.md similarity index 100% rename from packages/office-viewer/README.md rename to packages/ooxml-viewer/README.md diff --git a/packages/office-viewer/__tests__/EmptyWord.ts b/packages/ooxml-viewer/__tests__/EmptyWord.ts similarity index 100% rename from packages/office-viewer/__tests__/EmptyWord.ts rename to packages/ooxml-viewer/__tests__/EmptyWord.ts diff --git a/packages/office-viewer/__tests__/OpenXML.test.ts b/packages/ooxml-viewer/__tests__/OpenXML.test.ts similarity index 100% rename from packages/office-viewer/__tests__/OpenXML.test.ts rename to packages/ooxml-viewer/__tests__/OpenXML.test.ts diff --git a/packages/office-viewer/__tests__/README.md b/packages/ooxml-viewer/__tests__/README.md similarity index 100% rename from packages/office-viewer/__tests__/README.md rename to packages/ooxml-viewer/__tests__/README.md diff --git a/packages/office-viewer/__tests__/docx/dedocx/README.md b/packages/ooxml-viewer/__tests__/docx/dedocx/README.md similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/README.md rename to packages/ooxml-viewer/__tests__/docx/dedocx/README.md diff --git a/packages/office-viewer/__tests__/docx/dedocx/custom-list.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/custom-list.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/custom-list.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/custom-list.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/footnotes-and-endnotes-multiple-repeated.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/footnotes-and-endnotes-multiple-repeated.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/footnotes-and-endnotes-multiple-repeated.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/footnotes-and-endnotes-multiple-repeated.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/footnotes-repeated.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/footnotes-repeated.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/footnotes-repeated.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/footnotes-repeated.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/footnotes.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/footnotes.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/footnotes.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/footnotes.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/full-tables.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/full-tables.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/full-tables.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/full-tables.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/inline-and-block-image-styles.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/inline-and-block-image-styles.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/inline-and-block-image-styles.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/inline-and-block-image-styles.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/list-of-citations.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/list-of-citations.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/list-of-citations.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/list-of-citations.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/list-test.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/list-test.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/list-test.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/list-test.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/lists.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/lists.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/lists.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/lists.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/minimum-test-document.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/minimum-test-document.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/minimum-test-document.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/minimum-test-document.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/picture-grid.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/picture-grid.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/picture-grid.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/picture-grid.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/playground.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/playground.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/playground.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/playground.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/runs.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/runs.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/runs.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/runs.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/section-links.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/section-links.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/section-links.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/section-links.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/symbols.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/symbols.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/symbols.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/symbols.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/tables-with-equations.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/tables-with-equations.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/tables-with-equations.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/tables-with-equations.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/tables.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/tables.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/tables.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/tables.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/textboxes.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/textboxes.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/textboxes.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/textboxes.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/tooltip.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/tooltip.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/tooltip.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/tooltip.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/uncaptioned-images.ds3.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/uncaptioned-images.ds3.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/uncaptioned-images.ds3.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/uncaptioned-images.ds3.docx diff --git a/packages/office-viewer/__tests__/docx/dedocx/undefined-bookmarks.docx b/packages/ooxml-viewer/__tests__/docx/dedocx/undefined-bookmarks.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/dedocx/undefined-bookmarks.docx rename to packages/ooxml-viewer/__tests__/docx/dedocx/undefined-bookmarks.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/2003/word2003-vml.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/2003/word2003-vml.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2003/word2003-vml.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/2003/word2003-vml.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/2003/word2003xml.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/2003/word2003xml.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2003/word2003xml.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/2003/word2003xml.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/2010/2010-glow-then-AlternateContent.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-glow-then-AlternateContent.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2010/2010-glow-then-AlternateContent.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-glow-then-AlternateContent.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-MDP.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-MDP.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-MDP.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-MDP.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-in-header.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-in-header.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-in-header.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-in-header.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-in-header.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-in-header.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-in-header.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent-in-header.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-mcAlternateContent.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/2010/2010-sample1.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-sample1.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2010/2010-sample1.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/2010/2010-sample1.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/2010/DrawingML_GraphicData_wps.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/2010/DrawingML_GraphicData_wps.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2010/DrawingML_GraphicData_wps.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/2010/DrawingML_GraphicData_wps.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/2010/w14_mcIgnorable-in-other-parts.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/2010/w14_mcIgnorable-in-other-parts.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2010/w14_mcIgnorable-in-other-parts.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/2010/w14_mcIgnorable-in-other-parts.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/2010/w14_texteffects.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/2010/w14_texteffects.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2010/w14_texteffects.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/2010/w14_texteffects.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/2016/2016_image.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/2016/2016_image.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2016/2016_image.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/2016/2016_image.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/2016/2016_image_with_text_effects.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/2016/2016_image_with_text_effects.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/2016/2016_image_with_text_effects.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/2016/2016_image_with_text_effects.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/ArialUnicodeMS.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/ArialUnicodeMS.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/ArialUnicodeMS.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/ArialUnicodeMS.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/DOCPROP_builtin.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/DOCPROP_builtin.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/DOCPROP_builtin.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/DOCPROP_builtin.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/Symbols.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/Symbols.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/Symbols.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/Symbols.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/Word2007-fonts.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/Word2007-fonts.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/Word2007-fonts.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/Word2007-fonts.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/WordOnline/HelloWordOnline.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/WordOnline/HelloWordOnline.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/WordOnline/HelloWordOnline.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/WordOnline/HelloWordOnline.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/WordOnline/README.txt b/packages/ooxml-viewer/__tests__/docx/docx4j/WordOnline/README.txt similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/WordOnline/README.txt rename to packages/ooxml-viewer/__tests__/docx/docx4j/WordOnline/README.txt diff --git a/packages/office-viewer/__tests__/docx/docx4j/chart.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/chart.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/chart.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/chart.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/CountryRegions.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/CountryRegions.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/CountryRegions.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/CountryRegions.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/NumberSearch.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/NumberSearch.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/NumberSearch.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/NumberSearch.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/WordAddIn_walkthrough.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/WordAddIn_walkthrough.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/WordAddIn_walkthrough.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/WordAddIn_walkthrough.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/WordAddIn_walkthrough.pdf b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/WordAddIn_walkthrough.pdf similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/WordAddIn_walkthrough.pdf rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/WordAddIn_walkthrough.pdf diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/binding-simple-data.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/binding-simple-data.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/binding-simple-data.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/binding-simple-data.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/binding-simple.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/binding-simple.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/binding-simple.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/binding-simple.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/component-host.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/component-host.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/component-host.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/component-host.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/component-subdoc.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/component-subdoc.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/component-subdoc.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/component-subdoc.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/conventions.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/conventions.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/conventions.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/conventions.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/hyperlink-binding-test.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/hyperlink-binding-test.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/hyperlink-binding-test.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/hyperlink-binding-test.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/invoice-data.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/invoice-data.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/invoice-data.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/invoice-data.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/invoice.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/invoice.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/invoice.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/invoice.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/invoice2013.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/invoice2013.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/invoice2013.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/invoice2013.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/invoice2013.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/invoice2013.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/invoice2013.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/invoice2013.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/invoice_Saxon_XPath2.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/invoice_Saxon_XPath2.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/invoice_Saxon_XPath2.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/invoice_Saxon_XPath2.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/non-element-bind.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/non-element-bind.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/non-element-bind.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/non-element-bind.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/databinding/picture.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/databinding/picture.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/databinding/picture.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/databinding/picture.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/decracdiscrim1.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/decracdiscrim1.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/decracdiscrim1.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/decracdiscrim1.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/docProps.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/docProps.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/docProps.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/docProps.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/fonts-modesOfApplication.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/fonts-modesOfApplication.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/fonts-modesOfApplication.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/fonts-modesOfApplication.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/hyperlinks-internal.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/hyperlinks-internal.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/hyperlinks-internal.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/hyperlinks-internal.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/numberingrestart.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/numberingrestart.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/numberingrestart.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/numberingrestart.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/sample-docx.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/sample-docx.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/sample-docx.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/sample-docx.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/table-features.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/table-features.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/table-features.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/table-features.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/table-spans.xml b/packages/ooxml-viewer/__tests__/docx/docx4j/table-spans.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/table-spans.xml rename to packages/ooxml-viewer/__tests__/docx/docx4j/table-spans.xml diff --git a/packages/office-viewer/__tests__/docx/docx4j/toc.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/toc.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/toc.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/toc.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/unmarshallFromTemplateDirtyExample.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/unmarshallFromTemplateDirtyExample.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/unmarshallFromTemplateDirtyExample.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/unmarshallFromTemplateDirtyExample.docx diff --git a/packages/office-viewer/__tests__/docx/docx4j/unmarshallFromTemplateExample.docx b/packages/ooxml-viewer/__tests__/docx/docx4j/unmarshallFromTemplateExample.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/docx4j/unmarshallFromTemplateExample.docx rename to packages/ooxml-viewer/__tests__/docx/docx4j/unmarshallFromTemplateExample.docx diff --git a/packages/office-viewer/__tests__/docx/empty.xml b/packages/ooxml-viewer/__tests__/docx/empty.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/empty.xml rename to packages/ooxml-viewer/__tests__/docx/empty.xml diff --git a/packages/office-viewer/__tests__/docx/simple/alt-text.xml b/packages/ooxml-viewer/__tests__/docx/simple/alt-text.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/alt-text.xml rename to packages/ooxml-viewer/__tests__/docx/simple/alt-text.xml diff --git a/packages/office-viewer/__tests__/docx/simple/art.xml b/packages/ooxml-viewer/__tests__/docx/simple/art.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/art.xml rename to packages/ooxml-viewer/__tests__/docx/simple/art.xml diff --git a/packages/office-viewer/__tests__/docx/simple/bold.xml b/packages/ooxml-viewer/__tests__/docx/simple/bold.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/bold.xml rename to packages/ooxml-viewer/__tests__/docx/simple/bold.xml diff --git a/packages/office-viewer/__tests__/docx/simple/br.xml b/packages/ooxml-viewer/__tests__/docx/simple/br.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/br.xml rename to packages/ooxml-viewer/__tests__/docx/simple/br.xml diff --git a/packages/office-viewer/__tests__/docx/simple/cr.xml b/packages/ooxml-viewer/__tests__/docx/simple/cr.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/cr.xml rename to packages/ooxml-viewer/__tests__/docx/simple/cr.xml diff --git a/packages/office-viewer/__tests__/docx/simple/drop-cap.xml b/packages/ooxml-viewer/__tests__/docx/simple/drop-cap.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/drop-cap.xml rename to packages/ooxml-viewer/__tests__/docx/simple/drop-cap.xml diff --git a/packages/office-viewer/__tests__/docx/simple/em.xml b/packages/ooxml-viewer/__tests__/docx/simple/em.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/em.xml rename to packages/ooxml-viewer/__tests__/docx/simple/em.xml diff --git a/packages/office-viewer/__tests__/docx/simple/embed-font.xml b/packages/ooxml-viewer/__tests__/docx/simple/embed-font.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/embed-font.xml rename to packages/ooxml-viewer/__tests__/docx/simple/embed-font.xml diff --git a/packages/ooxml-viewer/__tests__/docx/simple/eq-br.xml b/packages/ooxml-viewer/__tests__/docx/simple/eq-br.xml new file mode 100644 index 000000000..493297fbf --- /dev/null +++ b/packages/ooxml-viewer/__tests__/docx/simple/eq-br.xml @@ -0,0 +1,1087 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3x+2y-z=1 + + + + + + + + + + + + + + + + + 2x-2y+4z= -2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + administrator + + + administrator + 1 + 2023-03-30T11:15:00Z + 2023-03-30T11:16:00Z + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 4 + 25 + Microsoft Office Word + 0 + 1 + 1 + false + + false + 28 + false + false + 16.0000 + + + + \ No newline at end of file diff --git a/packages/office-viewer/__tests__/docx/simple/header.xml b/packages/ooxml-viewer/__tests__/docx/simple/header.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/header.xml rename to packages/ooxml-viewer/__tests__/docx/simple/header.xml diff --git a/packages/office-viewer/__tests__/docx/simple/hideMark.xml b/packages/ooxml-viewer/__tests__/docx/simple/hideMark.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/hideMark.xml rename to packages/ooxml-viewer/__tests__/docx/simple/hideMark.xml diff --git a/packages/office-viewer/__tests__/docx/simple/highlight.xml b/packages/ooxml-viewer/__tests__/docx/simple/highlight.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/highlight.xml rename to packages/ooxml-viewer/__tests__/docx/simple/highlight.xml diff --git a/packages/office-viewer/__tests__/docx/simple/image.xml b/packages/ooxml-viewer/__tests__/docx/simple/image.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/image.xml rename to packages/ooxml-viewer/__tests__/docx/simple/image.xml diff --git a/packages/office-viewer/__tests__/docx/simple/info.xml b/packages/ooxml-viewer/__tests__/docx/simple/info.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/info.xml rename to packages/ooxml-viewer/__tests__/docx/simple/info.xml diff --git a/packages/ooxml-viewer/__tests__/docx/simple/inline-code.xml b/packages/ooxml-viewer/__tests__/docx/simple/inline-code.xml new file mode 100644 index 000000000..1f5720219 --- /dev/null +++ b/packages/ooxml-viewer/__tests__/docx/simple/inline-code.xml @@ -0,0 +1,1087 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Inline code + + + + + + + + str.length + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + administrator + + + administrator + 1 + 2023-03-30T09:05:00Z + 2023-03-30T09:06:00Z + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 3 + 20 + Microsoft Office Word + 0 + 1 + 1 + false + + false + 22 + false + false + 16.0000 + + + + \ No newline at end of file diff --git a/packages/office-viewer/__tests__/docx/simple/link.xml b/packages/ooxml-viewer/__tests__/docx/simple/link.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/link.xml rename to packages/ooxml-viewer/__tests__/docx/simple/link.xml diff --git a/packages/office-viewer/__tests__/docx/simple/list.xml b/packages/ooxml-viewer/__tests__/docx/simple/list.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/list.xml rename to packages/ooxml-viewer/__tests__/docx/simple/list.xml diff --git a/packages/office-viewer/__tests__/docx/simple/math.xml b/packages/ooxml-viewer/__tests__/docx/simple/math.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/math.xml rename to packages/ooxml-viewer/__tests__/docx/simple/math.xml diff --git a/packages/office-viewer/__tests__/docx/simple/noBreakHyphen.xml b/packages/ooxml-viewer/__tests__/docx/simple/noBreakHyphen.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/noBreakHyphen.xml rename to packages/ooxml-viewer/__tests__/docx/simple/noBreakHyphen.xml diff --git a/packages/office-viewer/__tests__/docx/simple/pinyin.xml b/packages/ooxml-viewer/__tests__/docx/simple/pinyin.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/pinyin.xml rename to packages/ooxml-viewer/__tests__/docx/simple/pinyin.xml diff --git a/packages/ooxml-viewer/__tests__/docx/simple/sdt.xml b/packages/ooxml-viewer/__tests__/docx/simple/sdt.xml new file mode 100644 index 000000000..c037418f8 --- /dev/null +++ b/packages/ooxml-viewer/__tests__/docx/simple/sdt.xml @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + start + + + + + + + + + + + + + CITATION Ber17 \l 1033 + + + + + + + + + (sdt) + + + + + + + + + + + + + + + CITATION Ber17 \l 1033 + + + + + + + + + (embed sdt) + + + + + + + + + + + + + + + + + + + CITATION Bla10 \l 1033 \m Bog14 + + + + + + + + + (Blank 2010, T. Bogich 2014) + + + + + + + + + . + + + + end + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/office-viewer/__tests__/docx/simple/shadow.xml b/packages/ooxml-viewer/__tests__/docx/simple/shadow.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/shadow.xml rename to packages/ooxml-viewer/__tests__/docx/simple/shadow.xml diff --git a/packages/office-viewer/__tests__/docx/simple/shape-ellipse.xml b/packages/ooxml-viewer/__tests__/docx/simple/shape-ellipse.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/shape-ellipse.xml rename to packages/ooxml-viewer/__tests__/docx/simple/shape-ellipse.xml diff --git a/packages/office-viewer/__tests__/docx/simple/svg.xml b/packages/ooxml-viewer/__tests__/docx/simple/svg.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/svg.xml rename to packages/ooxml-viewer/__tests__/docx/simple/svg.xml diff --git a/packages/office-viewer/__tests__/docx/simple/sym.xml b/packages/ooxml-viewer/__tests__/docx/simple/sym.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/sym.xml rename to packages/ooxml-viewer/__tests__/docx/simple/sym.xml diff --git a/packages/office-viewer/__tests__/docx/simple/tableborder.xml b/packages/ooxml-viewer/__tests__/docx/simple/tableborder.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/tableborder.xml rename to packages/ooxml-viewer/__tests__/docx/simple/tableborder.xml diff --git a/packages/office-viewer/__tests__/docx/simple/tablestyle.xml b/packages/ooxml-viewer/__tests__/docx/simple/tablestyle.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/tablestyle.xml rename to packages/ooxml-viewer/__tests__/docx/simple/tablestyle.xml diff --git a/packages/office-viewer/__tests__/docx/simple/textbox-background.xml b/packages/ooxml-viewer/__tests__/docx/simple/textbox-background.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/textbox-background.xml rename to packages/ooxml-viewer/__tests__/docx/simple/textbox-background.xml diff --git a/packages/office-viewer/__tests__/docx/simple/textbox-behindDoc.xml b/packages/ooxml-viewer/__tests__/docx/simple/textbox-behindDoc.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/textbox-behindDoc.xml rename to packages/ooxml-viewer/__tests__/docx/simple/textbox-behindDoc.xml diff --git a/packages/office-viewer/__tests__/docx/simple/textbox-order.xml b/packages/ooxml-viewer/__tests__/docx/simple/textbox-order.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/textbox-order.xml rename to packages/ooxml-viewer/__tests__/docx/simple/textbox-order.xml diff --git a/packages/office-viewer/__tests__/docx/simple/textbox-rotation.xml b/packages/ooxml-viewer/__tests__/docx/simple/textbox-rotation.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/textbox-rotation.xml rename to packages/ooxml-viewer/__tests__/docx/simple/textbox-rotation.xml diff --git a/packages/office-viewer/__tests__/docx/simple/textbox-vert.xml b/packages/ooxml-viewer/__tests__/docx/simple/textbox-vert.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/textbox-vert.xml rename to packages/ooxml-viewer/__tests__/docx/simple/textbox-vert.xml diff --git a/packages/office-viewer/__tests__/docx/simple/textbox.xml b/packages/ooxml-viewer/__tests__/docx/simple/textbox.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/textbox.xml rename to packages/ooxml-viewer/__tests__/docx/simple/textbox.xml diff --git a/packages/office-viewer/__tests__/docx/simple/tooltip.xml b/packages/ooxml-viewer/__tests__/docx/simple/tooltip.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/tooltip.xml rename to packages/ooxml-viewer/__tests__/docx/simple/tooltip.xml diff --git a/packages/office-viewer/__tests__/docx/simple/w.xml b/packages/ooxml-viewer/__tests__/docx/simple/w.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/simple/w.xml rename to packages/ooxml-viewer/__tests__/docx/simple/w.xml diff --git a/packages/office-viewer/__tests__/docx/unsupport/pinyin-old.docx b/packages/ooxml-viewer/__tests__/docx/unsupport/pinyin-old.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/unsupport/pinyin-old.docx rename to packages/ooxml-viewer/__tests__/docx/unsupport/pinyin-old.docx diff --git a/packages/office-viewer/__tests__/docx/unsupport/textbox-background.xml b/packages/ooxml-viewer/__tests__/docx/unsupport/textbox-background.xml similarity index 100% rename from packages/office-viewer/__tests__/docx/unsupport/textbox-background.xml rename to packages/ooxml-viewer/__tests__/docx/unsupport/textbox-background.xml diff --git a/packages/office-viewer/__tests__/docx/unsupport/unsupport-visio.docx b/packages/ooxml-viewer/__tests__/docx/unsupport/unsupport-visio.docx similarity index 100% rename from packages/office-viewer/__tests__/docx/unsupport/unsupport-visio.docx rename to packages/ooxml-viewer/__tests__/docx/unsupport/unsupport-visio.docx diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/bold.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/bold.test.ts.snap similarity index 90% rename from packages/office-viewer/__tests__/simple/__snapshots__/bold.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/bold.test.ts.snap index aa45a972a..0edca13dc 100644 --- a/packages/office-viewer/__tests__/simple/__snapshots__/bold.test.ts.snap +++ b/packages/ooxml-viewer/__tests__/simple/__snapshots__/bold.test.ts.snap @@ -548,5 +548,55 @@ font-size: 16.00px; style="position: relative;" /> +
+
+

+ +

+
+
+

+ +


+ +

+
+
+

+ +

+
+
+

+ +


+ +

+
+
`; diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/br.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/br.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/br.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/br.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/drop-cap.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/drop-cap.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/drop-cap.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/drop-cap.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/em.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/em.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/em.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/em.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/embed-font.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/embed-font.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/embed-font.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/embed-font.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/hideMark.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/hideMark.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/hideMark.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/hideMark.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/highlight.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/highlight.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/highlight.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/highlight.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/image.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/image.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/image.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/image.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/info.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/info.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/info.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/info.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/link.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/link.test.ts.snap similarity index 93% rename from packages/office-viewer/__tests__/simple/__snapshots__/link.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/link.test.ts.snap index 8dd477935..1d7019cdb 100644 --- a/packages/office-viewer/__tests__/simple/__snapshots__/link.test.ts.snap +++ b/packages/ooxml-viewer/__tests__/simple/__snapshots__/link.test.ts.snap @@ -121,11 +121,13 @@ background-color: #E1DFDD; > a mis diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/list.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/list.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/list.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/list.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/noBreakHyphen.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/noBreakHyphen.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/noBreakHyphen.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/noBreakHyphen.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/pinyin.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/pinyin.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/pinyin.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/pinyin.test.ts.snap diff --git a/packages/ooxml-viewer/__tests__/simple/__snapshots__/sdt.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/sdt.test.ts.snap new file mode 100644 index 000000000..acb429401 --- /dev/null +++ b/packages/ooxml-viewer/__tests__/simple/__snapshots__/sdt.test.ts.snap @@ -0,0 +1,204 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`sdt 1`] = ` +
+ +
+
+

+ + start + + + + + + + + (sdt) + + + + + + + + + (embed sdt) + + + + + + + + + (Blank 2010, T. Bogich 2014) + + + + . + + + end + +

+
+
+
+
+`; diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/svg.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/svg.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/svg.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/svg.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/sym.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/sym.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/sym.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/sym.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/tableborder.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/tableborder.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/tableborder.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/tableborder.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/tablestyle.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/tablestyle.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/tablestyle.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/tablestyle.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/textbox-background.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/textbox-background.test.ts.snap similarity index 93% rename from packages/office-viewer/__tests__/simple/__snapshots__/textbox-background.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/textbox-background.test.ts.snap index 9ddf8f331..d73624bbb 100644 --- a/packages/office-viewer/__tests__/simple/__snapshots__/textbox-background.test.ts.snap +++ b/packages/ooxml-viewer/__tests__/simple/__snapshots__/textbox-background.test.ts.snap @@ -685,5 +685,51 @@ border-right: 0.67px solid black; style="position: relative;" /> +
+
+

+ +

+
+
+

+ +


+ +

+
+
+

+ +

+
+
+

+ +


+ +

+
+
`; diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/textbox-behindDoc.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/textbox-behindDoc.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/textbox-behindDoc.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/textbox-behindDoc.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/textbox-rotation.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/textbox-rotation.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/textbox-rotation.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/textbox-rotation.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/textbox-vert.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/textbox-vert.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/textbox-vert.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/textbox-vert.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/textbox.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/textbox.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/textbox.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/textbox.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/tooltip.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/tooltip.test.ts.snap similarity index 97% rename from packages/office-viewer/__tests__/simple/__snapshots__/tooltip.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/tooltip.test.ts.snap index 517245c08..ee4961180 100644 --- a/packages/office-viewer/__tests__/simple/__snapshots__/tooltip.test.ts.snap +++ b/packages/ooxml-viewer/__tests__/simple/__snapshots__/tooltip.test.ts.snap @@ -149,6 +149,7 @@ text-decoration: underline; > hyperlink with a tooltip diff --git a/packages/office-viewer/__tests__/simple/__snapshots__/w.test.ts.snap b/packages/ooxml-viewer/__tests__/simple/__snapshots__/w.test.ts.snap similarity index 100% rename from packages/office-viewer/__tests__/simple/__snapshots__/w.test.ts.snap rename to packages/ooxml-viewer/__tests__/simple/__snapshots__/w.test.ts.snap diff --git a/packages/office-viewer/__tests__/simple/bold.test.ts b/packages/ooxml-viewer/__tests__/simple/bold.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/bold.test.ts rename to packages/ooxml-viewer/__tests__/simple/bold.test.ts diff --git a/packages/office-viewer/__tests__/simple/br.test.ts b/packages/ooxml-viewer/__tests__/simple/br.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/br.test.ts rename to packages/ooxml-viewer/__tests__/simple/br.test.ts diff --git a/packages/office-viewer/__tests__/simple/drop-cap.test.ts b/packages/ooxml-viewer/__tests__/simple/drop-cap.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/drop-cap.test.ts rename to packages/ooxml-viewer/__tests__/simple/drop-cap.test.ts diff --git a/packages/office-viewer/__tests__/simple/em.test.ts b/packages/ooxml-viewer/__tests__/simple/em.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/em.test.ts rename to packages/ooxml-viewer/__tests__/simple/em.test.ts diff --git a/packages/office-viewer/__tests__/simple/embed-font.test.ts b/packages/ooxml-viewer/__tests__/simple/embed-font.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/embed-font.test.ts rename to packages/ooxml-viewer/__tests__/simple/embed-font.test.ts diff --git a/packages/office-viewer/__tests__/simple/hideMark.test.ts b/packages/ooxml-viewer/__tests__/simple/hideMark.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/hideMark.test.ts rename to packages/ooxml-viewer/__tests__/simple/hideMark.test.ts diff --git a/packages/office-viewer/__tests__/simple/highlight.test.ts b/packages/ooxml-viewer/__tests__/simple/highlight.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/highlight.test.ts rename to packages/ooxml-viewer/__tests__/simple/highlight.test.ts diff --git a/packages/office-viewer/__tests__/simple/image.test.ts b/packages/ooxml-viewer/__tests__/simple/image.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/image.test.ts rename to packages/ooxml-viewer/__tests__/simple/image.test.ts diff --git a/packages/office-viewer/__tests__/simple/info.test.ts b/packages/ooxml-viewer/__tests__/simple/info.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/info.test.ts rename to packages/ooxml-viewer/__tests__/simple/info.test.ts diff --git a/packages/office-viewer/__tests__/simple/link.test.ts b/packages/ooxml-viewer/__tests__/simple/link.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/link.test.ts rename to packages/ooxml-viewer/__tests__/simple/link.test.ts diff --git a/packages/office-viewer/__tests__/simple/list.test.ts b/packages/ooxml-viewer/__tests__/simple/list.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/list.test.ts rename to packages/ooxml-viewer/__tests__/simple/list.test.ts diff --git a/packages/office-viewer/__tests__/simple/noBreakHyphen.test.ts b/packages/ooxml-viewer/__tests__/simple/noBreakHyphen.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/noBreakHyphen.test.ts rename to packages/ooxml-viewer/__tests__/simple/noBreakHyphen.test.ts diff --git a/packages/office-viewer/__tests__/simple/pinyin.test.ts b/packages/ooxml-viewer/__tests__/simple/pinyin.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/pinyin.test.ts rename to packages/ooxml-viewer/__tests__/simple/pinyin.test.ts diff --git a/packages/ooxml-viewer/__tests__/simple/sdt.test.ts b/packages/ooxml-viewer/__tests__/simple/sdt.test.ts new file mode 100644 index 000000000..0e8a77e87 --- /dev/null +++ b/packages/ooxml-viewer/__tests__/simple/sdt.test.ts @@ -0,0 +1,5 @@ +import {snapShotTest} from '../snapShotTest'; + +test('sdt', async () => { + snapShotTest('./docx/simple/sdt.xml'); +}); diff --git a/packages/office-viewer/__tests__/simple/svg.test.ts b/packages/ooxml-viewer/__tests__/simple/svg.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/svg.test.ts rename to packages/ooxml-viewer/__tests__/simple/svg.test.ts diff --git a/packages/office-viewer/__tests__/simple/sym.test.ts b/packages/ooxml-viewer/__tests__/simple/sym.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/sym.test.ts rename to packages/ooxml-viewer/__tests__/simple/sym.test.ts diff --git a/packages/office-viewer/__tests__/simple/tableborder.test.ts b/packages/ooxml-viewer/__tests__/simple/tableborder.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/tableborder.test.ts rename to packages/ooxml-viewer/__tests__/simple/tableborder.test.ts diff --git a/packages/office-viewer/__tests__/simple/tablestyle.test.ts b/packages/ooxml-viewer/__tests__/simple/tablestyle.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/tablestyle.test.ts rename to packages/ooxml-viewer/__tests__/simple/tablestyle.test.ts diff --git a/packages/office-viewer/__tests__/simple/textbox-background.test.ts b/packages/ooxml-viewer/__tests__/simple/textbox-background.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/textbox-background.test.ts rename to packages/ooxml-viewer/__tests__/simple/textbox-background.test.ts diff --git a/packages/office-viewer/__tests__/simple/textbox-behindDoc.test.ts b/packages/ooxml-viewer/__tests__/simple/textbox-behindDoc.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/textbox-behindDoc.test.ts rename to packages/ooxml-viewer/__tests__/simple/textbox-behindDoc.test.ts diff --git a/packages/office-viewer/__tests__/simple/textbox-rotation.test.ts b/packages/ooxml-viewer/__tests__/simple/textbox-rotation.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/textbox-rotation.test.ts rename to packages/ooxml-viewer/__tests__/simple/textbox-rotation.test.ts diff --git a/packages/office-viewer/__tests__/simple/textbox-vert.test.ts b/packages/ooxml-viewer/__tests__/simple/textbox-vert.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/textbox-vert.test.ts rename to packages/ooxml-viewer/__tests__/simple/textbox-vert.test.ts diff --git a/packages/office-viewer/__tests__/simple/textbox.test.ts b/packages/ooxml-viewer/__tests__/simple/textbox.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/textbox.test.ts rename to packages/ooxml-viewer/__tests__/simple/textbox.test.ts diff --git a/packages/office-viewer/__tests__/simple/tooltip.test.ts b/packages/ooxml-viewer/__tests__/simple/tooltip.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/tooltip.test.ts rename to packages/ooxml-viewer/__tests__/simple/tooltip.test.ts diff --git a/packages/office-viewer/__tests__/simple/w.test.ts b/packages/ooxml-viewer/__tests__/simple/w.test.ts similarity index 100% rename from packages/office-viewer/__tests__/simple/w.test.ts rename to packages/ooxml-viewer/__tests__/simple/w.test.ts diff --git a/packages/office-viewer/__tests__/snapShotTest.ts b/packages/ooxml-viewer/__tests__/snapShotTest.ts similarity index 100% rename from packages/office-viewer/__tests__/snapShotTest.ts rename to packages/ooxml-viewer/__tests__/snapShotTest.ts diff --git a/packages/office-viewer/__tests__/util/autoSpace.test.ts b/packages/ooxml-viewer/__tests__/util/autoSpace.test.ts similarity index 100% rename from packages/office-viewer/__tests__/util/autoSpace.test.ts rename to packages/ooxml-viewer/__tests__/util/autoSpace.test.ts diff --git a/packages/office-viewer/__tests__/util/color.test.ts b/packages/ooxml-viewer/__tests__/util/color.test.ts similarity index 100% rename from packages/office-viewer/__tests__/util/color.test.ts rename to packages/ooxml-viewer/__tests__/util/color.test.ts diff --git a/packages/office-viewer/__tests__/util/replaceVar.test.ts b/packages/ooxml-viewer/__tests__/util/replaceVar.test.ts similarity index 100% rename from packages/office-viewer/__tests__/util/replaceVar.test.ts rename to packages/ooxml-viewer/__tests__/util/replaceVar.test.ts diff --git a/packages/office-viewer/__tests__/util/var/table-list.docx b/packages/ooxml-viewer/__tests__/util/var/table-list.docx similarity index 100% rename from packages/office-viewer/__tests__/util/var/table-list.docx rename to packages/ooxml-viewer/__tests__/util/var/table-list.docx diff --git a/packages/office-viewer/__tests__/util/var/table-list.xml b/packages/ooxml-viewer/__tests__/util/var/table-list.xml similarity index 100% rename from packages/office-viewer/__tests__/util/var/table-list.xml rename to packages/ooxml-viewer/__tests__/util/var/table-list.xml diff --git a/packages/office-viewer/examples/app.ts b/packages/ooxml-viewer/examples/app.ts similarity index 100% rename from packages/office-viewer/examples/app.ts rename to packages/ooxml-viewer/examples/app.ts diff --git a/packages/office-viewer/examples/static/css/app.css b/packages/ooxml-viewer/examples/static/css/app.css similarity index 100% rename from packages/office-viewer/examples/static/css/app.css rename to packages/ooxml-viewer/examples/static/css/app.css diff --git a/packages/office-viewer/examples/static/font/symbol.ttf b/packages/ooxml-viewer/examples/static/font/symbol.ttf similarity index 100% rename from packages/office-viewer/examples/static/font/symbol.ttf rename to packages/ooxml-viewer/examples/static/font/symbol.ttf diff --git a/packages/office-viewer/examples/static/font/wingding.ttf b/packages/ooxml-viewer/examples/static/font/wingding.ttf similarity index 100% rename from packages/office-viewer/examples/static/font/wingding.ttf rename to packages/ooxml-viewer/examples/static/font/wingding.ttf diff --git a/packages/office-viewer/index.html b/packages/ooxml-viewer/index.html similarity index 100% rename from packages/office-viewer/index.html rename to packages/ooxml-viewer/index.html diff --git a/packages/office-viewer/package.json b/packages/ooxml-viewer/package.json similarity index 98% rename from packages/office-viewer/package.json rename to packages/ooxml-viewer/package.json index b42a76627..141454958 100644 --- a/packages/office-viewer/package.json +++ b/packages/ooxml-viewer/package.json @@ -1,5 +1,5 @@ { - "name": "office-viewer", + "name": "ooxml-viewer", "version": "0.1.0", "description": "office 文档在线预览", "main": "lib/index.js", @@ -93,4 +93,4 @@ "printBasicPrototype": false } } -} +} \ No newline at end of file diff --git a/packages/office-viewer/rollup.config.js b/packages/ooxml-viewer/rollup.config.js similarity index 100% rename from packages/office-viewer/rollup.config.js rename to packages/ooxml-viewer/rollup.config.js diff --git a/packages/office-viewer/src/OpenXML.ts b/packages/ooxml-viewer/src/OpenXML.ts similarity index 100% rename from packages/office-viewer/src/OpenXML.ts rename to packages/ooxml-viewer/src/OpenXML.ts diff --git a/packages/office-viewer/src/Word.ts b/packages/ooxml-viewer/src/Word.ts similarity index 93% rename from packages/office-viewer/src/Word.ts rename to packages/ooxml-viewer/src/Word.ts index 8599339e3..e8fcfe76c 100644 --- a/packages/office-viewer/src/Word.ts +++ b/packages/ooxml-viewer/src/Word.ts @@ -23,6 +23,10 @@ import {Paragraph} from './openxml/word/Paragraph'; import {deobfuscate} from './openxml/word/Font'; import {renderFont} from './render/renderFont'; import {replaceT, replaceVar} from './util/replaceVar'; +import {Note} from './openxml/word/Note'; +import {parseFootnotes} from './parse/Footnotes'; +import {parseEndnotes} from './parse/parseEndnotes'; +import {renderNotes} from './render/renderNotes'; /** * 渲染配置 @@ -203,6 +207,10 @@ export default class Word { */ currentParagraph: Paragraph; + footNotes: Record = {}; + + endNotes: Record = {}; + /** * 构建 word * @@ -240,6 +248,8 @@ export default class Word { this.initStyle(); this.initNumbering(); + this.initNotes(); + this.inited = true; } @@ -330,6 +340,19 @@ export default class Word { } } + initNotes() { + for (const override of this.conentTypes.overrides) { + if (override.partName.startsWith('/word/footnotes.xml')) { + const notesData = this.parser.getXML(override.partName); + this.footNotes = parseFootnotes(this, notesData); + } + if (override.partName.startsWith('/word/endnotes.xml')) { + const notesData = this.parser.getXML(override.partName); + this.endNotes = parseEndnotes(this, notesData); + } + } + } + /** * 获取全局关系 */ @@ -476,6 +499,14 @@ export default class Word { return classNames; } + /** + * 根据 id 获取样式 + * @param styleId + */ + getStyle(styleId: string) { + return this.styles.styleMap[styleId]; + } + /** * 渲染时的 css 类前缀 */ @@ -592,5 +623,7 @@ export default class Word { appendChild(root, renderStyle(this)); appendChild(root, renderFont(this.fontTable)); appendChild(root, documentElement); + + appendChild(root, renderNotes(this)); } } diff --git a/packages/office-viewer/src/index.ts b/packages/ooxml-viewer/src/index.ts similarity index 100% rename from packages/office-viewer/src/index.ts rename to packages/ooxml-viewer/src/index.ts diff --git a/packages/office-viewer/src/openxml/ContentType.ts b/packages/ooxml-viewer/src/openxml/ContentType.ts similarity index 100% rename from packages/office-viewer/src/openxml/ContentType.ts rename to packages/ooxml-viewer/src/openxml/ContentType.ts diff --git a/packages/office-viewer/src/openxml/Style.ts b/packages/ooxml-viewer/src/openxml/Style.ts similarity index 100% rename from packages/office-viewer/src/openxml/Style.ts rename to packages/ooxml-viewer/src/openxml/Style.ts diff --git a/packages/office-viewer/src/openxml/Theme.ts b/packages/ooxml-viewer/src/openxml/Theme.ts similarity index 99% rename from packages/office-viewer/src/openxml/Theme.ts rename to packages/ooxml-viewer/src/openxml/Theme.ts index 9e560a2a8..0db408340 100644 --- a/packages/office-viewer/src/openxml/Theme.ts +++ b/packages/ooxml-viewer/src/openxml/Theme.ts @@ -16,6 +16,7 @@ function parseClrScheme(doc: Element | null): ClrScheme { if (!doc) { return scheme; } + scheme.name = doc.getAttribute('name') || ''; for (const child of doc.children) { const colorName = child.tagName.replace('a:', ''); diff --git a/packages/office-viewer/src/openxml/Types.ts b/packages/ooxml-viewer/src/openxml/Types.ts similarity index 100% rename from packages/office-viewer/src/openxml/Types.ts rename to packages/ooxml-viewer/src/openxml/Types.ts diff --git a/packages/office-viewer/src/openxml/math/OMML2MML.XSL b/packages/ooxml-viewer/src/openxml/math/OMML2MML.XSL similarity index 100% rename from packages/office-viewer/src/openxml/math/OMML2MML.XSL rename to packages/ooxml-viewer/src/openxml/math/OMML2MML.XSL diff --git a/packages/office-viewer/src/openxml/math/OMath.ts b/packages/ooxml-viewer/src/openxml/math/OMath.ts similarity index 100% rename from packages/office-viewer/src/openxml/math/OMath.ts rename to packages/ooxml-viewer/src/openxml/math/OMath.ts diff --git a/packages/office-viewer/src/openxml/math/README.md b/packages/ooxml-viewer/src/openxml/math/README.md similarity index 100% rename from packages/office-viewer/src/openxml/math/README.md rename to packages/ooxml-viewer/src/openxml/math/README.md diff --git a/packages/office-viewer/src/openxml/math/convertOOML.ts b/packages/ooxml-viewer/src/openxml/math/convertOOML.ts similarity index 100% rename from packages/office-viewer/src/openxml/math/convertOOML.ts rename to packages/ooxml-viewer/src/openxml/math/convertOOML.ts diff --git a/packages/office-viewer/src/openxml/math/xsl.ts b/packages/ooxml-viewer/src/openxml/math/xsl.ts similarity index 100% rename from packages/office-viewer/src/openxml/math/xsl.ts rename to packages/ooxml-viewer/src/openxml/math/xsl.ts diff --git a/packages/office-viewer/src/openxml/word/Background.ts b/packages/ooxml-viewer/src/openxml/word/Background.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Background.ts rename to packages/ooxml-viewer/src/openxml/word/Background.ts diff --git a/packages/office-viewer/src/openxml/word/Body.ts b/packages/ooxml-viewer/src/openxml/word/Body.ts similarity index 84% rename from packages/office-viewer/src/openxml/word/Body.ts rename to packages/ooxml-viewer/src/openxml/word/Body.ts index cb7454663..3122739cc 100644 --- a/packages/office-viewer/src/openxml/word/Body.ts +++ b/packages/ooxml-viewer/src/openxml/word/Body.ts @@ -1,4 +1,4 @@ -import {parseSdt} from '../../parse/parseSdt'; +import {mergeSdt} from '../../parse/mergeSdt'; import {parseTable} from '../../parse/parseTable'; import Word from '../../Word'; import {Paragraph} from './Paragraph'; @@ -36,8 +36,7 @@ export class Body { static fromXML(word: Word, element: Element): Body { const body = new Body(); - const arr = [].slice.call(element.children); - for (const child of arr) { + for (const child of mergeSdt(element)) { const tagName = child.tagName; switch (tagName) { case 'w:p': @@ -45,10 +44,6 @@ export class Body { body.addChild(paragraph); break; - case 'w:sectPr': - body.addSection(Section.parsePr(word, child, body)); - break; - case 'w:tbl': const table = parseTable(word, child); body.addChild(table); @@ -58,12 +53,8 @@ export class Body { case 'w:bookmarkEnd': break; - case 'w:sdt': - parseSdt(child, arr); - break; - - case 'w:customXml': - arr.push(...[].slice.call(child.children)); + case 'w:sectPr': + body.addSection(Section.parsePr(word, child, body)); break; default: diff --git a/packages/office-viewer/src/openxml/word/Bookmark.ts b/packages/ooxml-viewer/src/openxml/word/Bookmark.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Bookmark.ts rename to packages/ooxml-viewer/src/openxml/word/Bookmark.ts diff --git a/packages/office-viewer/src/openxml/word/Border.ts b/packages/ooxml-viewer/src/openxml/word/Border.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Border.ts rename to packages/ooxml-viewer/src/openxml/word/Border.ts diff --git a/packages/office-viewer/src/openxml/word/Break.ts b/packages/ooxml-viewer/src/openxml/word/Break.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Break.ts rename to packages/ooxml-viewer/src/openxml/word/Break.ts diff --git a/packages/office-viewer/src/openxml/word/FldSimple.ts b/packages/ooxml-viewer/src/openxml/word/FldSimple.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/FldSimple.ts rename to packages/ooxml-viewer/src/openxml/word/FldSimple.ts diff --git a/packages/office-viewer/src/openxml/word/Font.ts b/packages/ooxml-viewer/src/openxml/word/Font.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Font.ts rename to packages/ooxml-viewer/src/openxml/word/Font.ts diff --git a/packages/office-viewer/src/openxml/word/FontTable.ts b/packages/ooxml-viewer/src/openxml/word/FontTable.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/FontTable.ts rename to packages/ooxml-viewer/src/openxml/word/FontTable.ts diff --git a/packages/office-viewer/src/openxml/word/FrameProperties.ts b/packages/ooxml-viewer/src/openxml/word/FrameProperties.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/FrameProperties.ts rename to packages/ooxml-viewer/src/openxml/word/FrameProperties.ts diff --git a/packages/office-viewer/src/openxml/word/Hyperlink.ts b/packages/ooxml-viewer/src/openxml/word/Hyperlink.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Hyperlink.ts rename to packages/ooxml-viewer/src/openxml/word/Hyperlink.ts diff --git a/packages/office-viewer/src/openxml/word/Indent.ts b/packages/ooxml-viewer/src/openxml/word/Indent.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Indent.ts rename to packages/ooxml-viewer/src/openxml/word/Indent.ts diff --git a/packages/office-viewer/src/openxml/word/InlineText.ts b/packages/ooxml-viewer/src/openxml/word/InlineText.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/InlineText.ts rename to packages/ooxml-viewer/src/openxml/word/InlineText.ts diff --git a/packages/office-viewer/src/openxml/word/InstrText.ts b/packages/ooxml-viewer/src/openxml/word/InstrText.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/InstrText.ts rename to packages/ooxml-viewer/src/openxml/word/InstrText.ts diff --git a/packages/office-viewer/src/openxml/word/NoBreakHyphen.ts b/packages/ooxml-viewer/src/openxml/word/NoBreakHyphen.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/NoBreakHyphen.ts rename to packages/ooxml-viewer/src/openxml/word/NoBreakHyphen.ts diff --git a/packages/ooxml-viewer/src/openxml/word/Note.ts b/packages/ooxml-viewer/src/openxml/word/Note.ts new file mode 100644 index 000000000..fa834b4e4 --- /dev/null +++ b/packages/ooxml-viewer/src/openxml/word/Note.ts @@ -0,0 +1,40 @@ +/** + * footnote 和 endnote 的结构几乎是一样的,所以统一叫 Note 了 + */ + +import {parseTable} from '../../parse/parseTable'; +import Word from '../../Word'; +import {Paragraph} from './Paragraph'; +import {Table} from './Table'; + +export type NoteChild = Paragraph | Table; + +export class Note { + children: NoteChild[] = []; + + addChild(child: NoteChild) { + this.children.push(child); + } + + static fromXML(word: Word, element: Element): Note { + const note = new Note(); + for (const child of element.children) { + const tagName = child.tagName; + switch (tagName) { + case 'w:p': + const paragraph = Paragraph.fromXML(word, child); + note.addChild(paragraph); + break; + + case 'w:tbl': + const table = parseTable(word, child); + note.addChild(table); + break; + + default: + console.warn('Note.fromXML unknown tag', tagName, child); + } + } + return note; + } +} diff --git a/packages/office-viewer/src/openxml/word/Paragraph.ts b/packages/ooxml-viewer/src/openxml/word/Paragraph.ts similarity index 92% rename from packages/office-viewer/src/openxml/word/Paragraph.ts rename to packages/ooxml-viewer/src/openxml/word/Paragraph.ts index 7a13875fb..ebd96ec80 100644 --- a/packages/office-viewer/src/openxml/word/Paragraph.ts +++ b/packages/ooxml-viewer/src/openxml/word/Paragraph.ts @@ -13,7 +13,7 @@ import {Run, RunPr} from './Run'; import {Tab} from './Tab'; import {FldSimple} from './FldSimple'; import {OMath} from '../math/OMath'; -import {parseSdt} from '../../parse/parseSdt'; +import {mergeSdt} from '../../parse/mergeSdt'; /** * 这里简化了很多,如果能用 CSS 表示就直接用 CSS 表示 @@ -100,8 +100,7 @@ export class Paragraph { paragraph.fldSimples = []; paragraph.paraId = element.getAttribute('w14:paraId') || ''; - const arr = [].slice.call(element.children); - for (const child of arr) { + for (const child of mergeSdt(element)) { const tagName = child.tagName; switch (tagName) { case 'w:pPr': @@ -112,11 +111,6 @@ export class Paragraph { paragraph.addChild(Run.fromXML(word, child)); break; - case 'w:smartTag': - case 'w:customXml': - arr.push(...[].slice.call(child.children)); - break; - case 'w:hyperlink': paragraph.addChild(Hyperlink.fromXML(word, child)); break; @@ -149,10 +143,6 @@ export class Paragraph { paragraph.addChild(OMath.fromXML(word, child)); break; - case 'w:sdt': - parseSdt(child, arr); - break; - default: console.warn('parse Paragraph: Unknown key', tagName, child); } diff --git a/packages/office-viewer/src/openxml/word/Pict.ts b/packages/ooxml-viewer/src/openxml/word/Pict.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Pict.ts rename to packages/ooxml-viewer/src/openxml/word/Pict.ts diff --git a/packages/office-viewer/src/openxml/word/Ruby.ts b/packages/ooxml-viewer/src/openxml/word/Ruby.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Ruby.ts rename to packages/ooxml-viewer/src/openxml/word/Ruby.ts diff --git a/packages/office-viewer/src/openxml/word/Run.ts b/packages/ooxml-viewer/src/openxml/word/Run.ts similarity index 93% rename from packages/office-viewer/src/openxml/word/Run.ts rename to packages/ooxml-viewer/src/openxml/word/Run.ts index 79ec7f2b0..baf2a8fd0 100644 --- a/packages/office-viewer/src/openxml/word/Run.ts +++ b/packages/ooxml-viewer/src/openxml/word/Run.ts @@ -9,6 +9,7 @@ import {NoBreakHyphen} from './NoBreakHyphen'; import {Pict} from './Pict'; import {Properties} from './properties/Properties'; import {Ruby} from './Ruby'; +import {Separator} from './Separator'; import {SoftHyphen} from './SoftHyphen'; import {Sym} from './Sym'; import {Tab} from './Tab'; @@ -39,6 +40,7 @@ type RunChild = | InstrText | Sym | SoftHyphen + | Separator | NoBreakHyphen; export class Run { @@ -132,6 +134,14 @@ export class Run { run.addChild(new NoBreakHyphen()); break; + case 'w:separator': + run.addChild(new Separator()); + break; + + case 'w:continuationSeparator': + // TODO: 还不知道是啥 + break; + default: console.warn('parse Run: Unknown key', tagName, child); } diff --git a/packages/office-viewer/src/openxml/word/Section.ts b/packages/ooxml-viewer/src/openxml/word/Section.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Section.ts rename to packages/ooxml-viewer/src/openxml/word/Section.ts diff --git a/packages/ooxml-viewer/src/openxml/word/Separator.ts b/packages/ooxml-viewer/src/openxml/word/Separator.ts new file mode 100644 index 000000000..e5e5d203d --- /dev/null +++ b/packages/ooxml-viewer/src/openxml/word/Separator.ts @@ -0,0 +1,5 @@ +/** + * endnote 和 footnote 的分隔符 + */ + +export class Separator {} diff --git a/packages/office-viewer/src/openxml/word/Settings.ts b/packages/ooxml-viewer/src/openxml/word/Settings.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Settings.ts rename to packages/ooxml-viewer/src/openxml/word/Settings.ts diff --git a/packages/office-viewer/src/openxml/word/Shading.ts b/packages/ooxml-viewer/src/openxml/word/Shading.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Shading.ts rename to packages/ooxml-viewer/src/openxml/word/Shading.ts diff --git a/packages/office-viewer/src/openxml/word/SoftHyphen.ts b/packages/ooxml-viewer/src/openxml/word/SoftHyphen.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/SoftHyphen.ts rename to packages/ooxml-viewer/src/openxml/word/SoftHyphen.ts diff --git a/packages/office-viewer/src/openxml/word/Spacing.ts b/packages/ooxml-viewer/src/openxml/word/Spacing.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Spacing.ts rename to packages/ooxml-viewer/src/openxml/word/Spacing.ts diff --git a/packages/office-viewer/src/openxml/word/Sym.ts b/packages/ooxml-viewer/src/openxml/word/Sym.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Sym.ts rename to packages/ooxml-viewer/src/openxml/word/Sym.ts diff --git a/packages/office-viewer/src/openxml/word/Tab.ts b/packages/ooxml-viewer/src/openxml/word/Tab.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Tab.ts rename to packages/ooxml-viewer/src/openxml/word/Tab.ts diff --git a/packages/office-viewer/src/openxml/word/Table.ts b/packages/ooxml-viewer/src/openxml/word/Table.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/Table.ts rename to packages/ooxml-viewer/src/openxml/word/Table.ts diff --git a/packages/office-viewer/src/openxml/word/VerticalAlign.ts b/packages/ooxml-viewer/src/openxml/word/VerticalAlign.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/VerticalAlign.ts rename to packages/ooxml-viewer/src/openxml/word/VerticalAlign.ts diff --git a/packages/office-viewer/src/openxml/word/WDocument.ts b/packages/ooxml-viewer/src/openxml/word/WDocument.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/WDocument.ts rename to packages/ooxml-viewer/src/openxml/word/WDocument.ts diff --git a/packages/office-viewer/src/openxml/word/drawing/Blip.ts b/packages/ooxml-viewer/src/openxml/word/drawing/Blip.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/drawing/Blip.ts rename to packages/ooxml-viewer/src/openxml/word/drawing/Blip.ts diff --git a/packages/office-viewer/src/openxml/word/drawing/BlipFill.ts b/packages/ooxml-viewer/src/openxml/word/drawing/BlipFill.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/drawing/BlipFill.ts rename to packages/ooxml-viewer/src/openxml/word/drawing/BlipFill.ts diff --git a/packages/office-viewer/src/openxml/word/drawing/Drawing.ts b/packages/ooxml-viewer/src/openxml/word/drawing/Drawing.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/drawing/Drawing.ts rename to packages/ooxml-viewer/src/openxml/word/drawing/Drawing.ts diff --git a/packages/office-viewer/src/openxml/word/drawing/Geom.ts b/packages/ooxml-viewer/src/openxml/word/drawing/Geom.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/drawing/Geom.ts rename to packages/ooxml-viewer/src/openxml/word/drawing/Geom.ts diff --git a/packages/office-viewer/src/openxml/word/drawing/Pic.ts b/packages/ooxml-viewer/src/openxml/word/drawing/Pic.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/drawing/Pic.ts rename to packages/ooxml-viewer/src/openxml/word/drawing/Pic.ts diff --git a/packages/office-viewer/src/openxml/word/drawing/ShapeProperties.ts b/packages/ooxml-viewer/src/openxml/word/drawing/ShapeProperties.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/drawing/ShapeProperties.ts rename to packages/ooxml-viewer/src/openxml/word/drawing/ShapeProperties.ts diff --git a/packages/office-viewer/src/openxml/word/drawing/Transform.ts b/packages/ooxml-viewer/src/openxml/word/drawing/Transform.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/drawing/Transform.ts rename to packages/ooxml-viewer/src/openxml/word/drawing/Transform.ts diff --git a/packages/office-viewer/src/openxml/word/numbering/AbstractNum.ts b/packages/ooxml-viewer/src/openxml/word/numbering/AbstractNum.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/numbering/AbstractNum.ts rename to packages/ooxml-viewer/src/openxml/word/numbering/AbstractNum.ts diff --git a/packages/office-viewer/src/openxml/word/numbering/Lvl.ts b/packages/ooxml-viewer/src/openxml/word/numbering/Lvl.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/numbering/Lvl.ts rename to packages/ooxml-viewer/src/openxml/word/numbering/Lvl.ts diff --git a/packages/office-viewer/src/openxml/word/numbering/Num.ts b/packages/ooxml-viewer/src/openxml/word/numbering/Num.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/numbering/Num.ts rename to packages/ooxml-viewer/src/openxml/word/numbering/Num.ts diff --git a/packages/office-viewer/src/openxml/word/numbering/NumberProperties.ts b/packages/ooxml-viewer/src/openxml/word/numbering/NumberProperties.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/numbering/NumberProperties.ts rename to packages/ooxml-viewer/src/openxml/word/numbering/NumberProperties.ts diff --git a/packages/office-viewer/src/openxml/word/numbering/Numbering.ts b/packages/ooxml-viewer/src/openxml/word/numbering/Numbering.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/numbering/Numbering.ts rename to packages/ooxml-viewer/src/openxml/word/numbering/Numbering.ts diff --git a/packages/office-viewer/src/openxml/word/properties/Properties.ts b/packages/ooxml-viewer/src/openxml/word/properties/Properties.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/properties/Properties.ts rename to packages/ooxml-viewer/src/openxml/word/properties/Properties.ts diff --git a/packages/office-viewer/src/openxml/word/table/Tc.ts b/packages/ooxml-viewer/src/openxml/word/table/Tc.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/table/Tc.ts rename to packages/ooxml-viewer/src/openxml/word/table/Tc.ts diff --git a/packages/office-viewer/src/openxml/word/table/Tr.ts b/packages/ooxml-viewer/src/openxml/word/table/Tr.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/table/Tr.ts rename to packages/ooxml-viewer/src/openxml/word/table/Tr.ts diff --git a/packages/office-viewer/src/openxml/word/wps/WPG.ts b/packages/ooxml-viewer/src/openxml/word/wps/WPG.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/wps/WPG.ts rename to packages/ooxml-viewer/src/openxml/word/wps/WPG.ts diff --git a/packages/office-viewer/src/openxml/word/wps/WPS.ts b/packages/ooxml-viewer/src/openxml/word/wps/WPS.ts similarity index 100% rename from packages/office-viewer/src/openxml/word/wps/WPS.ts rename to packages/ooxml-viewer/src/openxml/word/wps/WPS.ts diff --git a/packages/office-viewer/src/package/PackageParser.ts b/packages/ooxml-viewer/src/package/PackageParser.ts similarity index 100% rename from packages/office-viewer/src/package/PackageParser.ts rename to packages/ooxml-viewer/src/package/PackageParser.ts diff --git a/packages/office-viewer/src/package/XMLPackageParser.ts b/packages/ooxml-viewer/src/package/XMLPackageParser.ts similarity index 100% rename from packages/office-viewer/src/package/XMLPackageParser.ts rename to packages/ooxml-viewer/src/package/XMLPackageParser.ts diff --git a/packages/office-viewer/src/package/ZipPackageParser.ts b/packages/ooxml-viewer/src/package/ZipPackageParser.ts similarity index 100% rename from packages/office-viewer/src/package/ZipPackageParser.ts rename to packages/ooxml-viewer/src/package/ZipPackageParser.ts diff --git a/packages/ooxml-viewer/src/parse/Footnotes.ts b/packages/ooxml-viewer/src/parse/Footnotes.ts new file mode 100644 index 000000000..dd5766bd4 --- /dev/null +++ b/packages/ooxml-viewer/src/parse/Footnotes.ts @@ -0,0 +1,19 @@ +import Word from '../Word'; +import {Note} from '../openxml/word/Note'; + +export function parseFootnotes( + word: Word, + doc: Document +): Record { + const footnotes: Record = {}; + const footnotesElement = [].slice.call( + doc.getElementsByTagName('w:footnote') + ); + + for (const footnoteElement of footnotesElement) { + const footnote = Note.fromXML(word, footnoteElement); + footnotes[footnoteElement.getAttribute('w:id')] = footnote; + } + + return footnotes; +} diff --git a/packages/office-viewer/src/parse/jcToTextAlign.ts b/packages/ooxml-viewer/src/parse/jcToTextAlign.ts similarity index 100% rename from packages/office-viewer/src/parse/jcToTextAlign.ts rename to packages/ooxml-viewer/src/parse/jcToTextAlign.ts diff --git a/packages/ooxml-viewer/src/parse/mergeSdt.ts b/packages/ooxml-viewer/src/parse/mergeSdt.ts new file mode 100644 index 000000000..4d6b473ca --- /dev/null +++ b/packages/ooxml-viewer/src/parse/mergeSdt.ts @@ -0,0 +1,47 @@ +/** + * 将 sdt 内容合并到上层节点,返回合并后的数组 + */ + +function flattenSdtArray(arr: Element[]): Element[] { + const returnArray = arr.slice(); + let index = 0; + // 如果 sdt 里还有 sdt 就需要递归 + let needRecursion = false; + for (const child of arr) { + const tagName = child.tagName; + switch (tagName) { + case 'w:smartTag': + case 'w:customXml': + const customXMLChildren = [].slice.call(child.children); + returnArray.splice(index, 1, ...customXMLChildren); + index = index + customXMLChildren.length; + continue; + + case 'w:sdt': + const sdtContent = child.getElementsByTagName('w:sdtContent').item(0); + const childSdt = child.getElementsByTagName('w:sdt').item(0); + if (childSdt) { + needRecursion = true; + } + if (sdtContent) { + const sdtContentChildren = [].slice.call(sdtContent.children); + returnArray.splice(index, 1, ...sdtContentChildren); + index = index + sdtContentChildren.length; + continue; + } + + break; + } + index = index + 1; + } + if (needRecursion) { + return flattenSdtArray(returnArray); + } + + return returnArray; +} + +export function mergeSdt(element: Element) { + const arr = [].slice.call(element.children); + return flattenSdtArray(arr); +} diff --git a/packages/office-viewer/src/parse/parseBorder.ts b/packages/ooxml-viewer/src/parse/parseBorder.ts similarity index 100% rename from packages/office-viewer/src/parse/parseBorder.ts rename to packages/ooxml-viewer/src/parse/parseBorder.ts diff --git a/packages/office-viewer/src/parse/parseCellMargin.ts b/packages/ooxml-viewer/src/parse/parseCellMargin.ts similarity index 100% rename from packages/office-viewer/src/parse/parseCellMargin.ts rename to packages/ooxml-viewer/src/parse/parseCellMargin.ts diff --git a/packages/office-viewer/src/parse/parseChildColor.ts b/packages/ooxml-viewer/src/parse/parseChildColor.ts similarity index 100% rename from packages/office-viewer/src/parse/parseChildColor.ts rename to packages/ooxml-viewer/src/parse/parseChildColor.ts diff --git a/packages/office-viewer/src/parse/parseColor.ts b/packages/ooxml-viewer/src/parse/parseColor.ts similarity index 99% rename from packages/office-viewer/src/parse/parseColor.ts rename to packages/ooxml-viewer/src/parse/parseColor.ts index e2f26e5fc..33cc070f6 100644 --- a/packages/office-viewer/src/parse/parseColor.ts +++ b/packages/ooxml-viewer/src/parse/parseColor.ts @@ -74,7 +74,7 @@ export function parseShdColor(word: Word, element: Element) { const val = getVal(element) as ST_Shd; if (color === 'auto') { - color = 'inherit'; + color = '000000'; } if (color.length === 6) { diff --git a/packages/ooxml-viewer/src/parse/parseEndnotes.ts b/packages/ooxml-viewer/src/parse/parseEndnotes.ts new file mode 100644 index 000000000..e7f61e677 --- /dev/null +++ b/packages/ooxml-viewer/src/parse/parseEndnotes.ts @@ -0,0 +1,14 @@ +import Word from '../Word'; +import {Note} from '../openxml/word/Note'; + +export function parseEndnotes(word: Word, doc: Document): Record { + const endnotes: Record = {}; + const endnotesElement = [].slice.call(doc.getElementsByTagName('w:endnote')); + + for (const endnoteElement of endnotesElement) { + const endnote = Note.fromXML(word, endnoteElement); + endnotes[endnoteElement.getAttribute('w:id')] = endnote; + } + + return endnotes; +} diff --git a/packages/office-viewer/src/parse/parseFont.ts b/packages/ooxml-viewer/src/parse/parseFont.ts similarity index 100% rename from packages/office-viewer/src/parse/parseFont.ts rename to packages/ooxml-viewer/src/parse/parseFont.ts diff --git a/packages/office-viewer/src/parse/parseInd.ts b/packages/ooxml-viewer/src/parse/parseInd.ts similarity index 100% rename from packages/office-viewer/src/parse/parseInd.ts rename to packages/ooxml-viewer/src/parse/parseInd.ts diff --git a/packages/office-viewer/src/parse/parseInsideBorders.ts b/packages/ooxml-viewer/src/parse/parseInsideBorders.ts similarity index 100% rename from packages/office-viewer/src/parse/parseInsideBorders.ts rename to packages/ooxml-viewer/src/parse/parseInsideBorders.ts diff --git a/packages/office-viewer/src/parse/parsePr.ts b/packages/ooxml-viewer/src/parse/parsePr.ts similarity index 100% rename from packages/office-viewer/src/parse/parsePr.ts rename to packages/ooxml-viewer/src/parse/parsePr.ts diff --git a/packages/office-viewer/src/parse/parseRelationship.ts b/packages/ooxml-viewer/src/parse/parseRelationship.ts similarity index 100% rename from packages/office-viewer/src/parse/parseRelationship.ts rename to packages/ooxml-viewer/src/parse/parseRelationship.ts diff --git a/packages/office-viewer/src/parse/parseSdt.ts b/packages/ooxml-viewer/src/parse/parseSdt.ts similarity index 62% rename from packages/office-viewer/src/parse/parseSdt.ts rename to packages/ooxml-viewer/src/parse/parseSdt.ts index 35e5c8cd6..d23c0442f 100644 --- a/packages/office-viewer/src/parse/parseSdt.ts +++ b/packages/ooxml-viewer/src/parse/parseSdt.ts @@ -3,9 +3,9 @@ * 目前 sdt 的做法就是直接忽略,将它的 stdContent 子节点融入上级节点 */ -export function parseSdt(element: Element, arr: Element[]) { +export function parseSdt(element: Element, arr: Element[], index: number) { const sdtContent = element.getElementsByTagName('w:sdtContent').item(0); if (sdtContent) { - arr.push(...[].slice.call(sdtContent.children)); + arr.splice(index, 0, ...[].slice.call(sdtContent.children)); } } diff --git a/packages/office-viewer/src/parse/parseSize.ts b/packages/ooxml-viewer/src/parse/parseSize.ts similarity index 100% rename from packages/office-viewer/src/parse/parseSize.ts rename to packages/ooxml-viewer/src/parse/parseSize.ts diff --git a/packages/office-viewer/src/parse/parseSpacing.ts b/packages/ooxml-viewer/src/parse/parseSpacing.ts similarity index 100% rename from packages/office-viewer/src/parse/parseSpacing.ts rename to packages/ooxml-viewer/src/parse/parseSpacing.ts diff --git a/packages/office-viewer/src/parse/parseTable.ts b/packages/ooxml-viewer/src/parse/parseTable.ts similarity index 80% rename from packages/office-viewer/src/parse/parseTable.ts rename to packages/ooxml-viewer/src/parse/parseTable.ts index 73a38deff..287ef038d 100644 --- a/packages/office-viewer/src/parse/parseTable.ts +++ b/packages/ooxml-viewer/src/parse/parseTable.ts @@ -4,7 +4,8 @@ import {parseTr} from './parseTr'; import {parseTablePr} from './parseTablePr'; import Word from '../Word'; import {parseSize} from './parseSize'; -import {parseSdt} from './parseSdt'; + +import {mergeSdt} from './mergeSdt'; function parseTblGrid(element: Element) { const gridCol: GridCol[] = []; @@ -22,8 +23,7 @@ export function parseTable(word: Word, element: Element) { // 用于计算列的跨行,这里记下前面的跨行情况 const rowSpanMap: {[key: string]: Tc} = {}; - const arr = [].slice.call(element.children); - for (const child of element.children) { + for (const child of mergeSdt(element)) { const tagName = child.tagName; switch (tagName) { case 'w:tblPr': @@ -38,14 +38,6 @@ export function parseTable(word: Word, element: Element) { table.tblGrid = parseTblGrid(child); break; - case 'w:customXml': - arr.push(...[].slice.call(child.children)); - break; - - case 'w:sdt': - parseSdt(child, arr); - break; - default: console.warn('Table.fromXML unknown tag', tagName, child); } diff --git a/packages/office-viewer/src/parse/parseTablePr.ts b/packages/ooxml-viewer/src/parse/parseTablePr.ts similarity index 100% rename from packages/office-viewer/src/parse/parseTablePr.ts rename to packages/ooxml-viewer/src/parse/parseTablePr.ts diff --git a/packages/office-viewer/src/parse/parseTblWidth.ts b/packages/ooxml-viewer/src/parse/parseTblWidth.ts similarity index 100% rename from packages/office-viewer/src/parse/parseTblWidth.ts rename to packages/ooxml-viewer/src/parse/parseTblWidth.ts diff --git a/packages/office-viewer/src/parse/parseTc.ts b/packages/ooxml-viewer/src/parse/parseTc.ts similarity index 100% rename from packages/office-viewer/src/parse/parseTc.ts rename to packages/ooxml-viewer/src/parse/parseTc.ts diff --git a/packages/office-viewer/src/parse/parseTcPr.ts b/packages/ooxml-viewer/src/parse/parseTcPr.ts similarity index 100% rename from packages/office-viewer/src/parse/parseTcPr.ts rename to packages/ooxml-viewer/src/parse/parseTcPr.ts diff --git a/packages/office-viewer/src/parse/parseTextDirection.ts b/packages/ooxml-viewer/src/parse/parseTextDirection.ts similarity index 100% rename from packages/office-viewer/src/parse/parseTextDirection.ts rename to packages/ooxml-viewer/src/parse/parseTextDirection.ts diff --git a/packages/office-viewer/src/parse/parseTr.ts b/packages/ooxml-viewer/src/parse/parseTr.ts similarity index 80% rename from packages/office-viewer/src/parse/parseTr.ts rename to packages/ooxml-viewer/src/parse/parseTr.ts index d1a9e7466..2ac624fc3 100644 --- a/packages/office-viewer/src/parse/parseTr.ts +++ b/packages/ooxml-viewer/src/parse/parseTr.ts @@ -4,7 +4,8 @@ import {parseTc} from './parseTc'; import {parseTablePr} from './parseTablePr'; import {Tc} from '../openxml/word/table/Tc'; import {parseTrPr} from './parseTrPr'; -import {parseSdt} from './parseSdt'; + +import {mergeSdt} from './mergeSdt'; export function parseTr( word: Word, @@ -18,8 +19,7 @@ export function parseTr( index: 0 }; - const arr = [].slice.call(element.children); - for (const child of arr) { + for (const child of mergeSdt(element)) { const tagName = child.tagName; switch (tagName) { case 'w:tc': @@ -39,14 +39,6 @@ export function parseTr( Object.assign(tr.properties.cssStyle || {}, tablePr.cssStyle); break; - case 'w:customXml': - arr.push(...[].slice.call(child.children)); - break; - - case 'w:sdt': - parseSdt(child, arr); - break; - default: console.warn(`Tr: Unknown tag `, tagName, child); } diff --git a/packages/office-viewer/src/parse/parseTrHeight.ts b/packages/ooxml-viewer/src/parse/parseTrHeight.ts similarity index 100% rename from packages/office-viewer/src/parse/parseTrHeight.ts rename to packages/ooxml-viewer/src/parse/parseTrHeight.ts diff --git a/packages/office-viewer/src/parse/parseTrPr.ts b/packages/ooxml-viewer/src/parse/parseTrPr.ts similarity index 100% rename from packages/office-viewer/src/parse/parseTrPr.ts rename to packages/ooxml-viewer/src/parse/parseTrPr.ts diff --git a/packages/office-viewer/src/render/renderBody.ts b/packages/ooxml-viewer/src/render/renderBody.ts similarity index 94% rename from packages/office-viewer/src/render/renderBody.ts rename to packages/ooxml-viewer/src/render/renderBody.ts index 52ec5a1f6..b8296b0dd 100644 --- a/packages/office-viewer/src/render/renderBody.ts +++ b/packages/ooxml-viewer/src/render/renderBody.ts @@ -26,7 +26,8 @@ export default function renderBody( appendChild(sectionEl, p); } else if (child instanceof Table) { appendChild(sectionEl, renderTable(word, child)); - } else if (child instanceof Hyperlink) { + } else { + console.warn('unknown child', child); } } appendChild(parent, sectionEl); diff --git a/packages/office-viewer/src/render/renderBookmark.ts b/packages/ooxml-viewer/src/render/renderBookmark.ts similarity index 100% rename from packages/office-viewer/src/render/renderBookmark.ts rename to packages/ooxml-viewer/src/render/renderBookmark.ts diff --git a/packages/office-viewer/src/render/renderBr.ts b/packages/ooxml-viewer/src/render/renderBr.ts similarity index 100% rename from packages/office-viewer/src/render/renderBr.ts rename to packages/ooxml-viewer/src/render/renderBr.ts diff --git a/packages/office-viewer/src/render/renderDocument.ts b/packages/ooxml-viewer/src/render/renderDocument.ts similarity index 100% rename from packages/office-viewer/src/render/renderDocument.ts rename to packages/ooxml-viewer/src/render/renderDocument.ts diff --git a/packages/office-viewer/src/render/renderDrawing.ts b/packages/ooxml-viewer/src/render/renderDrawing.ts similarity index 100% rename from packages/office-viewer/src/render/renderDrawing.ts rename to packages/ooxml-viewer/src/render/renderDrawing.ts diff --git a/packages/office-viewer/src/render/renderFont.ts b/packages/ooxml-viewer/src/render/renderFont.ts similarity index 100% rename from packages/office-viewer/src/render/renderFont.ts rename to packages/ooxml-viewer/src/render/renderFont.ts diff --git a/packages/office-viewer/src/render/renderHyperLink.ts b/packages/ooxml-viewer/src/render/renderHyperLink.ts similarity index 100% rename from packages/office-viewer/src/render/renderHyperLink.ts rename to packages/ooxml-viewer/src/render/renderHyperLink.ts diff --git a/packages/office-viewer/src/render/renderInlineText.ts b/packages/ooxml-viewer/src/render/renderInlineText.ts similarity index 100% rename from packages/office-viewer/src/render/renderInlineText.ts rename to packages/ooxml-viewer/src/render/renderInlineText.ts diff --git a/packages/office-viewer/src/render/renderInstrText.ts b/packages/ooxml-viewer/src/render/renderInstrText.ts similarity index 100% rename from packages/office-viewer/src/render/renderInstrText.ts rename to packages/ooxml-viewer/src/render/renderInstrText.ts diff --git a/packages/office-viewer/src/render/renderMath.ts b/packages/ooxml-viewer/src/render/renderMath.ts similarity index 100% rename from packages/office-viewer/src/render/renderMath.ts rename to packages/ooxml-viewer/src/render/renderMath.ts diff --git a/packages/office-viewer/src/render/renderNoBreakHyphen.ts b/packages/ooxml-viewer/src/render/renderNoBreakHyphen.ts similarity index 100% rename from packages/office-viewer/src/render/renderNoBreakHyphen.ts rename to packages/ooxml-viewer/src/render/renderNoBreakHyphen.ts diff --git a/packages/ooxml-viewer/src/render/renderNotes.ts b/packages/ooxml-viewer/src/render/renderNotes.ts new file mode 100644 index 000000000..0a02a2161 --- /dev/null +++ b/packages/ooxml-viewer/src/render/renderNotes.ts @@ -0,0 +1,56 @@ +/** + * 渲染 footnotes 和 endnotes,这个需要最后执行 + */ + +import {Note, NoteChild} from '../openxml/word/Note'; +import {Paragraph} from '../openxml/word/Paragraph'; +import {Table} from '../openxml/word/Table'; +import {appendChild, appendComment, createElement} from '../util/dom'; +import Word from '../Word'; +import renderParagraph from './renderParagraph'; +import renderTable from './renderTable'; + +function renderNote( + word: Word, + noteRoot: HTMLElement, + type: 'footnote' | 'endnote', + id: string, + note: Note +) { + const noteChild = note.children; + const noteElement = createElement('div'); + const mark = createElement('a') as HTMLAnchorElement; + const fName = type + '-' + id; + mark.name = fName; + mark.id = fName; + noteRoot.appendChild(noteElement); + + for (const child of noteChild) { + if (child instanceof Paragraph) { + const p = renderParagraph(word, child); + appendChild(noteElement, p); + } else if (child instanceof Table) { + appendChild(noteElement, renderTable(word, child)); + } else { + console.warn('unknown child', child); + } + } +} + +export function renderNotes(word: Word) { + const noteRoot = createElement('div'); + + for (const fId in word.footNotes || {}) { + renderNote(word, noteRoot, 'footnote', fId, word.footNotes[fId]); + } + + for (const fId in word.endNotes || {}) { + renderNote(word, noteRoot, 'endnote', fId, word.endNotes[fId]); + } + + if (noteRoot.children.length) { + return noteRoot; + } else { + return null; + } +} diff --git a/packages/office-viewer/src/render/renderNumbering.ts b/packages/ooxml-viewer/src/render/renderNumbering.ts similarity index 100% rename from packages/office-viewer/src/render/renderNumbering.ts rename to packages/ooxml-viewer/src/render/renderNumbering.ts diff --git a/packages/office-viewer/src/render/renderParagraph.ts b/packages/ooxml-viewer/src/render/renderParagraph.ts similarity index 100% rename from packages/office-viewer/src/render/renderParagraph.ts rename to packages/ooxml-viewer/src/render/renderParagraph.ts diff --git a/packages/office-viewer/src/render/renderPict.ts b/packages/ooxml-viewer/src/render/renderPict.ts similarity index 100% rename from packages/office-viewer/src/render/renderPict.ts rename to packages/ooxml-viewer/src/render/renderPict.ts diff --git a/packages/office-viewer/src/render/renderRuby.ts b/packages/ooxml-viewer/src/render/renderRuby.ts similarity index 100% rename from packages/office-viewer/src/render/renderRuby.ts rename to packages/ooxml-viewer/src/render/renderRuby.ts diff --git a/packages/office-viewer/src/render/renderRun.ts b/packages/ooxml-viewer/src/render/renderRun.ts similarity index 89% rename from packages/office-viewer/src/render/renderRun.ts rename to packages/ooxml-viewer/src/render/renderRun.ts index 52f60a27f..cc9e2ab25 100644 --- a/packages/office-viewer/src/render/renderRun.ts +++ b/packages/ooxml-viewer/src/render/renderRun.ts @@ -26,6 +26,8 @@ import {renderSoftHyphen} from './renderSoftHyphen'; import {SoftHyphen} from '../openxml/word/SoftHyphen'; import {NoBreakHyphen} from '../openxml/word/NoBreakHyphen'; import {renderNoBreakHyphen} from './renderNoBreakHyphen'; +import {Separator} from '../openxml/word/Separator'; +import {renderSeparator} from './renderSeparator'; const VARIABLE_CLASS_NAME = 'variable'; @@ -82,6 +84,14 @@ export default function renderRun( setElementStyle(word, span, run.properties); + // run 不好通过 class 来设置 rStyle,所以单独支持一下 + if (run.properties?.rStyle) { + const style = word.getStyle(run.properties.rStyle); + if (style?.rPr?.cssStyle) { + applyStyle(span, style.rPr.cssStyle); + } + } + if (run.children.length === 1 && run.children[0] instanceof Text) { const text = run.children[0] as Text; renderText(span, word, text.text, paragraph); @@ -110,6 +120,8 @@ export default function renderRun( appendChild(span, renderSoftHyphen()); } else if (child instanceof NoBreakHyphen) { appendChild(span, renderNoBreakHyphen()); + } else if (child instanceof Separator) { + appendChild(span, renderSeparator()); } else { console.warn('unknown child', child); } diff --git a/packages/office-viewer/src/render/renderSection.ts b/packages/ooxml-viewer/src/render/renderSection.ts similarity index 100% rename from packages/office-viewer/src/render/renderSection.ts rename to packages/ooxml-viewer/src/render/renderSection.ts diff --git a/packages/ooxml-viewer/src/render/renderSeparator.ts b/packages/ooxml-viewer/src/render/renderSeparator.ts new file mode 100644 index 000000000..6295b143e --- /dev/null +++ b/packages/ooxml-viewer/src/render/renderSeparator.ts @@ -0,0 +1,7 @@ +import {createElement} from '../util/dom'; + +export function renderSeparator() { + const sep = createElement('hr'); + sep.style.borderTop = '1px solid #bbb'; + return sep; +} diff --git a/packages/office-viewer/src/render/renderSoftHyphen.ts b/packages/ooxml-viewer/src/render/renderSoftHyphen.ts similarity index 100% rename from packages/office-viewer/src/render/renderSoftHyphen.ts rename to packages/ooxml-viewer/src/render/renderSoftHyphen.ts diff --git a/packages/office-viewer/src/render/renderStyle.ts b/packages/ooxml-viewer/src/render/renderStyle.ts similarity index 100% rename from packages/office-viewer/src/render/renderStyle.ts rename to packages/ooxml-viewer/src/render/renderStyle.ts diff --git a/packages/office-viewer/src/render/renderSym.ts b/packages/ooxml-viewer/src/render/renderSym.ts similarity index 100% rename from packages/office-viewer/src/render/renderSym.ts rename to packages/ooxml-viewer/src/render/renderSym.ts diff --git a/packages/office-viewer/src/render/renderTab.ts b/packages/ooxml-viewer/src/render/renderTab.ts similarity index 100% rename from packages/office-viewer/src/render/renderTab.ts rename to packages/ooxml-viewer/src/render/renderTab.ts diff --git a/packages/office-viewer/src/render/renderTable.ts b/packages/ooxml-viewer/src/render/renderTable.ts similarity index 100% rename from packages/office-viewer/src/render/renderTable.ts rename to packages/ooxml-viewer/src/render/renderTable.ts diff --git a/packages/office-viewer/src/render/setElementStyle.ts b/packages/ooxml-viewer/src/render/setElementStyle.ts similarity index 100% rename from packages/office-viewer/src/render/setElementStyle.ts rename to packages/ooxml-viewer/src/render/setElementStyle.ts diff --git a/packages/office-viewer/src/render/zindex.ts b/packages/ooxml-viewer/src/render/zindex.ts similarity index 100% rename from packages/office-viewer/src/render/zindex.ts rename to packages/ooxml-viewer/src/render/zindex.ts diff --git a/packages/office-viewer/src/util/autoSpace.ts b/packages/ooxml-viewer/src/util/autoSpace.ts similarity index 100% rename from packages/office-viewer/src/util/autoSpace.ts rename to packages/ooxml-viewer/src/util/autoSpace.ts diff --git a/packages/office-viewer/src/util/blob.ts b/packages/ooxml-viewer/src/util/blob.ts similarity index 100% rename from packages/office-viewer/src/util/blob.ts rename to packages/ooxml-viewer/src/util/blob.ts diff --git a/packages/office-viewer/src/util/color.ts b/packages/ooxml-viewer/src/util/color.ts similarity index 100% rename from packages/office-viewer/src/util/color.ts rename to packages/ooxml-viewer/src/util/color.ts diff --git a/packages/office-viewer/src/util/createObject.ts b/packages/ooxml-viewer/src/util/createObject.ts similarity index 100% rename from packages/office-viewer/src/util/createObject.ts rename to packages/ooxml-viewer/src/util/createObject.ts diff --git a/packages/office-viewer/src/util/dom.ts b/packages/ooxml-viewer/src/util/dom.ts similarity index 100% rename from packages/office-viewer/src/util/dom.ts rename to packages/ooxml-viewer/src/util/dom.ts diff --git a/packages/office-viewer/src/util/mergeRun.ts b/packages/ooxml-viewer/src/util/mergeRun.ts similarity index 100% rename from packages/office-viewer/src/util/mergeRun.ts rename to packages/ooxml-viewer/src/util/mergeRun.ts diff --git a/packages/office-viewer/src/util/replaceVar.ts b/packages/ooxml-viewer/src/util/replaceVar.ts similarity index 100% rename from packages/office-viewer/src/util/replaceVar.ts rename to packages/ooxml-viewer/src/util/replaceVar.ts diff --git a/packages/office-viewer/src/util/xml.ts b/packages/ooxml-viewer/src/util/xml.ts similarity index 100% rename from packages/office-viewer/src/util/xml.ts rename to packages/ooxml-viewer/src/util/xml.ts diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-chart.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-chart.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-chart.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-chart.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-chartDrawing.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-chartDrawing.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-chartDrawing.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-chartDrawing.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-diagram.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-diagram.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-diagram.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-diagram.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-lockedCanvas.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-lockedCanvas.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-lockedCanvas.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-lockedCanvas.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-main.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-main.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-main.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-main.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-picture.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-picture.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-picture.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-picture.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-spreadsheetDrawing.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-spreadsheetDrawing.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-spreadsheetDrawing.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-spreadsheetDrawing.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-wordprocessingDrawing.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-wordprocessingDrawing.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-wordprocessingDrawing.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/dml-wordprocessingDrawing.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/pml.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/pml.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/pml.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/pml.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-additionalCharacteristics.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-additionalCharacteristics.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-additionalCharacteristics.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-additionalCharacteristics.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-bibliography.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-bibliography.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-bibliography.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-bibliography.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-commonSimpleTypes.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-commonSimpleTypes.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-commonSimpleTypes.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-commonSimpleTypes.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-customXmlDataProperties.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-customXmlDataProperties.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-customXmlDataProperties.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-customXmlDataProperties.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-customXmlSchemaProperties.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-customXmlSchemaProperties.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-customXmlSchemaProperties.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-customXmlSchemaProperties.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesCustom.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesCustom.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesCustom.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesCustom.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesExtended.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesExtended.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesExtended.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesExtended.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesVariantTypes.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesVariantTypes.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesVariantTypes.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-documentPropertiesVariantTypes.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-math.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-math.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-math.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-math.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-relationshipReference.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-relationshipReference.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-relationshipReference.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/shared-relationshipReference.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/sml.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/sml.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/sml.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/sml.xsd diff --git a/packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/wml.xsd b/packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/wml.xsd similarity index 100% rename from packages/office-viewer/tools/OfficeOpenXML-XMLSchema-Strict/wml.xsd rename to packages/ooxml-viewer/tools/OfficeOpenXML-XMLSchema-Strict/wml.xsd diff --git a/packages/office-viewer/tools/README.md b/packages/ooxml-viewer/tools/README.md similarity index 100% rename from packages/office-viewer/tools/README.md rename to packages/ooxml-viewer/tools/README.md diff --git a/packages/office-viewer/tools/xsd2ts.ts b/packages/ooxml-viewer/tools/xsd2ts.ts similarity index 100% rename from packages/office-viewer/tools/xsd2ts.ts rename to packages/ooxml-viewer/tools/xsd2ts.ts diff --git a/packages/office-viewer/tsconfig-for-declaration.json b/packages/ooxml-viewer/tsconfig-for-declaration.json similarity index 100% rename from packages/office-viewer/tsconfig-for-declaration.json rename to packages/ooxml-viewer/tsconfig-for-declaration.json diff --git a/packages/office-viewer/tsconfig.json b/packages/ooxml-viewer/tsconfig.json similarity index 100% rename from packages/office-viewer/tsconfig.json rename to packages/ooxml-viewer/tsconfig.json diff --git a/tsconfig.json b/tsconfig.json index e6a6a8fd8..3b61403e9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,7 +26,7 @@ "amis-formula": ["./packages/amis-formula/src/index.ts"], "amis-ui": ["./packages/amis-ui/src/index.tsx"], "amis": ["./packages/amis/src/index.tsx"], - "office-viewer": ["./packages/office-viewer/src/index.ts"], + "ooxml-viewer": ["./packages/ooxml-viewer/src/index.ts"], "amis-editor-core": ["./packages/amis-editor-core/src/index.ts"], "amis-editor": ["./packages/amis-editor/src/index.tsx"] } diff --git a/vite.config.ts b/vite.config.ts index 33c46b3a6..9ecbc7927 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -84,8 +84,8 @@ export default defineConfig({ replacement: path.resolve(__dirname, './packages/amis-editor-core/src') }, { - find: 'office-viewer', - replacement: path.resolve(__dirname, './packages/office-viewer/src') + find: 'ooxml-viewer', + replacement: path.resolve(__dirname, './packages/ooxml-viewer/src') } ] }