@harbour-enterprises/superdoc 0.6.10 → 0.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/chunks/{super-editor.es-BDSHdpjP.js → super-editor.es-n8lS5QnA.js} +679 -5
  2. package/dist/chunks/{super-editor.es-BDSHdpjP.js.map → super-editor.es-n8lS5QnA.js.map} +1 -1
  3. package/dist/super-editor/chunks/{converter-6mfBech5.js → converter-BA8jbeZU.js} +674 -3
  4. package/dist/super-editor/chunks/{converter-6mfBech5.js.map → converter-BA8jbeZU.js.map} +1 -1
  5. package/dist/super-editor/chunks/{docx-zipper-Dnp61dGQ.js → docx-zipper-Crq6kHku.js} +2 -2
  6. package/dist/super-editor/chunks/{docx-zipper-Dnp61dGQ.js.map → docx-zipper-Crq6kHku.js.map} +1 -1
  7. package/dist/super-editor/chunks/{editor-B-egQeTe.js → editor-S_v8wD_U.js} +8 -5
  8. package/dist/super-editor/chunks/editor-S_v8wD_U.js.map +1 -0
  9. package/dist/super-editor/chunks/{toolbar-DBqSp9Eo.js → toolbar-BBp1B1nW.js} +3 -3
  10. package/dist/super-editor/chunks/{toolbar-DBqSp9Eo.js.map → toolbar-BBp1B1nW.js.map} +1 -1
  11. package/dist/super-editor/converter.es.js +1 -1
  12. package/dist/super-editor/core/Editor.d.ts.map +1 -1
  13. package/dist/super-editor/core/super-converter/SuperConverter.d.ts.map +1 -1
  14. package/dist/super-editor/core/super-converter/exporter-docx-defs.d.ts +447 -0
  15. package/dist/super-editor/core/super-converter/v2/importer/docxImporter.d.ts +10 -0
  16. package/dist/super-editor/core/super-converter/v2/importer/docxImporter.d.ts.map +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/super-editor.es.js +6 -6
  21. package/dist/super-editor/tests/import/docxImporter.test.d.ts +2 -0
  22. package/dist/super-editor/tests/import/docxImporter.test.d.ts.map +1 -0
  23. package/dist/super-editor/toolbar.es.js +2 -2
  24. package/dist/super-editor.es.js +1 -1
  25. package/dist/superdoc.es.js +3 -3
  26. package/package.json +1 -1
  27. package/dist/super-editor/chunks/editor-B-egQeTe.js.map +0 -1
@@ -49729,6 +49729,661 @@ const COMMENT_REF = {
49729
49729
  }
49730
49730
  ]
49731
49731
  };
49732
+ const DEFAULT_LINKED_STYLES = {
49733
+ Normal: {
49734
+ type: "element",
49735
+ name: "w:style",
49736
+ attributes: {
49737
+ "w:type": "paragraph",
49738
+ "w:default": "1",
49739
+ "w:styleId": "Normal"
49740
+ },
49741
+ elements: [
49742
+ {
49743
+ type: "element",
49744
+ name: "w:name",
49745
+ attributes: {
49746
+ "w:val": "Normal"
49747
+ }
49748
+ },
49749
+ {
49750
+ type: "element",
49751
+ name: "w:qFormat"
49752
+ }
49753
+ ]
49754
+ },
49755
+ Title: {
49756
+ type: "element",
49757
+ name: "w:style",
49758
+ attributes: {
49759
+ "w:type": "paragraph",
49760
+ "w:styleId": "Title"
49761
+ },
49762
+ elements: [
49763
+ {
49764
+ type: "element",
49765
+ name: "w:name",
49766
+ attributes: {
49767
+ "w:val": "Title"
49768
+ }
49769
+ },
49770
+ {
49771
+ type: "element",
49772
+ name: "w:basedOn",
49773
+ attributes: {
49774
+ "w:val": "Normal"
49775
+ }
49776
+ },
49777
+ {
49778
+ type: "element",
49779
+ name: "w:next",
49780
+ attributes: {
49781
+ "w:val": "Normal"
49782
+ }
49783
+ },
49784
+ {
49785
+ type: "element",
49786
+ name: "w:link",
49787
+ attributes: {
49788
+ "w:val": "TitleChar"
49789
+ }
49790
+ },
49791
+ {
49792
+ type: "element",
49793
+ name: "w:uiPriority",
49794
+ attributes: {
49795
+ "w:val": "10"
49796
+ }
49797
+ },
49798
+ {
49799
+ type: "element",
49800
+ name: "w:qFormat"
49801
+ },
49802
+ {
49803
+ type: "element",
49804
+ name: "w:rsid",
49805
+ attributes: {
49806
+ "w:val": "00B72667"
49807
+ }
49808
+ },
49809
+ {
49810
+ type: "element",
49811
+ name: "w:pPr",
49812
+ elements: [
49813
+ {
49814
+ type: "element",
49815
+ name: "w:spacing",
49816
+ attributes: {
49817
+ "w:after": "80"
49818
+ }
49819
+ },
49820
+ {
49821
+ type: "element",
49822
+ name: "w:contextualSpacing"
49823
+ }
49824
+ ]
49825
+ },
49826
+ {
49827
+ type: "element",
49828
+ name: "w:rPr",
49829
+ elements: [
49830
+ {
49831
+ type: "element",
49832
+ name: "w:rFonts",
49833
+ attributes: {
49834
+ "w:asciiTheme": "majorHAnsi",
49835
+ "w:eastAsiaTheme": "majorEastAsia",
49836
+ "w:hAnsiTheme": "majorHAnsi",
49837
+ "w:cstheme": "majorBidi"
49838
+ }
49839
+ },
49840
+ {
49841
+ type: "element",
49842
+ name: "w:spacing",
49843
+ attributes: {
49844
+ "w:val": "-10"
49845
+ }
49846
+ },
49847
+ {
49848
+ type: "element",
49849
+ name: "w:kern",
49850
+ attributes: {
49851
+ "w:val": "28"
49852
+ }
49853
+ },
49854
+ {
49855
+ type: "element",
49856
+ name: "w:sz",
49857
+ attributes: {
49858
+ "w:val": "56"
49859
+ }
49860
+ },
49861
+ {
49862
+ type: "element",
49863
+ name: "w:szCs",
49864
+ attributes: {
49865
+ "w:val": "56"
49866
+ }
49867
+ }
49868
+ ]
49869
+ }
49870
+ ]
49871
+ },
49872
+ Subtitle: {
49873
+ type: "element",
49874
+ name: "w:style",
49875
+ attributes: {
49876
+ "w:type": "paragraph",
49877
+ "w:styleId": "Subtitle"
49878
+ },
49879
+ elements: [
49880
+ {
49881
+ type: "element",
49882
+ name: "w:name",
49883
+ attributes: {
49884
+ "w:val": "Subtitle"
49885
+ }
49886
+ },
49887
+ {
49888
+ type: "element",
49889
+ name: "w:basedOn",
49890
+ attributes: {
49891
+ "w:val": "Normal"
49892
+ }
49893
+ },
49894
+ {
49895
+ type: "element",
49896
+ name: "w:next",
49897
+ attributes: {
49898
+ "w:val": "Normal"
49899
+ }
49900
+ },
49901
+ {
49902
+ type: "element",
49903
+ name: "w:link",
49904
+ attributes: {
49905
+ "w:val": "SubtitleChar"
49906
+ }
49907
+ },
49908
+ {
49909
+ type: "element",
49910
+ name: "w:uiPriority",
49911
+ attributes: {
49912
+ "w:val": "11"
49913
+ }
49914
+ },
49915
+ {
49916
+ type: "element",
49917
+ name: "w:qFormat"
49918
+ },
49919
+ {
49920
+ type: "element",
49921
+ name: "w:rsid",
49922
+ attributes: {
49923
+ "w:val": "00B72667"
49924
+ }
49925
+ },
49926
+ {
49927
+ type: "element",
49928
+ name: "w:pPr",
49929
+ elements: [
49930
+ {
49931
+ type: "element",
49932
+ name: "w:numPr",
49933
+ elements: [
49934
+ {
49935
+ type: "element",
49936
+ name: "w:ilvl",
49937
+ attributes: {
49938
+ "w:val": "1"
49939
+ }
49940
+ }
49941
+ ]
49942
+ },
49943
+ {
49944
+ type: "element",
49945
+ name: "w:spacing",
49946
+ attributes: {
49947
+ "w:after": "160"
49948
+ }
49949
+ }
49950
+ ]
49951
+ },
49952
+ {
49953
+ type: "element",
49954
+ name: "w:rPr",
49955
+ elements: [
49956
+ {
49957
+ type: "element",
49958
+ name: "w:rFonts",
49959
+ attributes: {
49960
+ "w:asciiTheme": "minorHAnsi",
49961
+ "w:eastAsiaTheme": "majorEastAsia",
49962
+ "w:hAnsiTheme": "minorHAnsi",
49963
+ "w:cstheme": "majorBidi"
49964
+ }
49965
+ },
49966
+ {
49967
+ type: "element",
49968
+ name: "w:color",
49969
+ attributes: {
49970
+ "w:val": "595959",
49971
+ "w:themeColor": "text1",
49972
+ "w:themeTint": "A6"
49973
+ }
49974
+ },
49975
+ {
49976
+ type: "element",
49977
+ name: "w:spacing",
49978
+ attributes: {
49979
+ "w:val": "15"
49980
+ }
49981
+ },
49982
+ {
49983
+ type: "element",
49984
+ name: "w:sz",
49985
+ attributes: {
49986
+ "w:val": "28"
49987
+ }
49988
+ },
49989
+ {
49990
+ type: "element",
49991
+ name: "w:szCs",
49992
+ attributes: {
49993
+ "w:val": "28"
49994
+ }
49995
+ }
49996
+ ]
49997
+ }
49998
+ ]
49999
+ },
50000
+ Heading1: {
50001
+ type: "element",
50002
+ name: "w:style",
50003
+ attributes: {
50004
+ "w:type": "paragraph",
50005
+ "w:styleId": "Heading1"
50006
+ },
50007
+ elements: [
50008
+ {
50009
+ type: "element",
50010
+ name: "w:name",
50011
+ attributes: {
50012
+ "w:val": "heading 1"
50013
+ }
50014
+ },
50015
+ {
50016
+ type: "element",
50017
+ name: "w:basedOn",
50018
+ attributes: {
50019
+ "w:val": "Normal"
50020
+ }
50021
+ },
50022
+ {
50023
+ type: "element",
50024
+ name: "w:next",
50025
+ attributes: {
50026
+ "w:val": "Normal"
50027
+ }
50028
+ },
50029
+ {
50030
+ type: "element",
50031
+ name: "w:link",
50032
+ attributes: {
50033
+ "w:val": "Heading1Char"
50034
+ }
50035
+ },
50036
+ {
50037
+ type: "element",
50038
+ name: "w:uiPriority",
50039
+ attributes: {
50040
+ "w:val": "9"
50041
+ }
50042
+ },
50043
+ {
50044
+ type: "element",
50045
+ name: "w:qFormat"
50046
+ },
50047
+ {
50048
+ type: "element",
50049
+ name: "w:rsid",
50050
+ attributes: {
50051
+ "w:val": "00233D7B"
50052
+ }
50053
+ },
50054
+ {
50055
+ type: "element",
50056
+ name: "w:pPr",
50057
+ elements: [
50058
+ {
50059
+ type: "element",
50060
+ name: "w:keepNext"
50061
+ },
50062
+ {
50063
+ type: "element",
50064
+ name: "w:keepLines"
50065
+ },
50066
+ {
50067
+ type: "element",
50068
+ name: "w:spacing",
50069
+ attributes: {
50070
+ "w:before": "360",
50071
+ "w:after": "80"
50072
+ }
50073
+ },
50074
+ {
50075
+ type: "element",
50076
+ name: "w:outlineLvl",
50077
+ attributes: {
50078
+ "w:val": "0"
50079
+ }
50080
+ }
50081
+ ]
50082
+ },
50083
+ {
50084
+ type: "element",
50085
+ name: "w:rPr",
50086
+ elements: [
50087
+ {
50088
+ type: "element",
50089
+ name: "w:rFonts",
50090
+ attributes: {
50091
+ "w:asciiTheme": "majorHAnsi",
50092
+ "w:eastAsiaTheme": "majorEastAsia",
50093
+ "w:hAnsiTheme": "majorHAnsi",
50094
+ "w:cstheme": "majorBidi"
50095
+ }
50096
+ },
50097
+ {
50098
+ type: "element",
50099
+ name: "w:color",
50100
+ attributes: {
50101
+ "w:val": "0F4761",
50102
+ "w:themeColor": "accent1",
50103
+ "w:themeShade": "BF"
50104
+ }
50105
+ },
50106
+ {
50107
+ type: "element",
50108
+ name: "w:sz",
50109
+ attributes: {
50110
+ "w:val": "40"
50111
+ }
50112
+ },
50113
+ {
50114
+ type: "element",
50115
+ name: "w:szCs",
50116
+ attributes: {
50117
+ "w:val": "40"
50118
+ }
50119
+ }
50120
+ ]
50121
+ }
50122
+ ]
50123
+ },
50124
+ Heading2: {
50125
+ type: "element",
50126
+ name: "w:style",
50127
+ attributes: {
50128
+ "w:type": "paragraph",
50129
+ "w:styleId": "Heading2"
50130
+ },
50131
+ elements: [
50132
+ {
50133
+ type: "element",
50134
+ name: "w:name",
50135
+ attributes: {
50136
+ "w:val": "heading 2"
50137
+ }
50138
+ },
50139
+ {
50140
+ type: "element",
50141
+ name: "w:basedOn",
50142
+ attributes: {
50143
+ "w:val": "Normal"
50144
+ }
50145
+ },
50146
+ {
50147
+ type: "element",
50148
+ name: "w:next",
50149
+ attributes: {
50150
+ "w:val": "Normal"
50151
+ }
50152
+ },
50153
+ {
50154
+ type: "element",
50155
+ name: "w:link",
50156
+ attributes: {
50157
+ "w:val": "Heading2Char"
50158
+ }
50159
+ },
50160
+ {
50161
+ type: "element",
50162
+ name: "w:uiPriority",
50163
+ attributes: {
50164
+ "w:val": "9"
50165
+ }
50166
+ },
50167
+ {
50168
+ type: "element",
50169
+ name: "w:semiHidden"
50170
+ },
50171
+ {
50172
+ type: "element",
50173
+ name: "w:unhideWhenUsed"
50174
+ },
50175
+ {
50176
+ type: "element",
50177
+ name: "w:qFormat"
50178
+ },
50179
+ {
50180
+ type: "element",
50181
+ name: "w:rsid",
50182
+ attributes: {
50183
+ "w:val": "00233D7B"
50184
+ }
50185
+ },
50186
+ {
50187
+ type: "element",
50188
+ name: "w:pPr",
50189
+ elements: [
50190
+ {
50191
+ type: "element",
50192
+ name: "w:keepNext"
50193
+ },
50194
+ {
50195
+ type: "element",
50196
+ name: "w:keepLines"
50197
+ },
50198
+ {
50199
+ type: "element",
50200
+ name: "w:spacing",
50201
+ attributes: {
50202
+ "w:before": "160",
50203
+ "w:after": "80"
50204
+ }
50205
+ },
50206
+ {
50207
+ type: "element",
50208
+ name: "w:outlineLvl",
50209
+ attributes: {
50210
+ "w:val": "1"
50211
+ }
50212
+ }
50213
+ ]
50214
+ },
50215
+ {
50216
+ type: "element",
50217
+ name: "w:rPr",
50218
+ elements: [
50219
+ {
50220
+ type: "element",
50221
+ name: "w:rFonts",
50222
+ attributes: {
50223
+ "w:asciiTheme": "majorHAnsi",
50224
+ "w:eastAsiaTheme": "majorEastAsia",
50225
+ "w:hAnsiTheme": "majorHAnsi",
50226
+ "w:cstheme": "majorBidi"
50227
+ }
50228
+ },
50229
+ {
50230
+ type: "element",
50231
+ name: "w:color",
50232
+ attributes: {
50233
+ "w:val": "0F4761",
50234
+ "w:themeColor": "accent1",
50235
+ "w:themeShade": "BF"
50236
+ }
50237
+ },
50238
+ {
50239
+ type: "element",
50240
+ name: "w:sz",
50241
+ attributes: {
50242
+ "w:val": "32"
50243
+ }
50244
+ },
50245
+ {
50246
+ type: "element",
50247
+ name: "w:szCs",
50248
+ attributes: {
50249
+ "w:val": "32"
50250
+ }
50251
+ }
50252
+ ]
50253
+ }
50254
+ ]
50255
+ },
50256
+ Heading3: {
50257
+ type: "element",
50258
+ name: "w:style",
50259
+ attributes: {
50260
+ "w:type": "paragraph",
50261
+ "w:styleId": "Heading3"
50262
+ },
50263
+ elements: [
50264
+ {
50265
+ type: "element",
50266
+ name: "w:name",
50267
+ attributes: {
50268
+ "w:val": "heading 3"
50269
+ }
50270
+ },
50271
+ {
50272
+ type: "element",
50273
+ name: "w:basedOn",
50274
+ attributes: {
50275
+ "w:val": "Normal"
50276
+ }
50277
+ },
50278
+ {
50279
+ type: "element",
50280
+ name: "w:next",
50281
+ attributes: {
50282
+ "w:val": "Normal"
50283
+ }
50284
+ },
50285
+ {
50286
+ type: "element",
50287
+ name: "w:link",
50288
+ attributes: {
50289
+ "w:val": "Heading3Char"
50290
+ }
50291
+ },
50292
+ {
50293
+ type: "element",
50294
+ name: "w:uiPriority",
50295
+ attributes: {
50296
+ "w:val": "9"
50297
+ }
50298
+ },
50299
+ {
50300
+ type: "element",
50301
+ name: "w:semiHidden"
50302
+ },
50303
+ {
50304
+ type: "element",
50305
+ name: "w:unhideWhenUsed"
50306
+ },
50307
+ {
50308
+ type: "element",
50309
+ name: "w:qFormat"
50310
+ },
50311
+ {
50312
+ type: "element",
50313
+ name: "w:rsid",
50314
+ attributes: {
50315
+ "w:val": "00233D7B"
50316
+ }
50317
+ },
50318
+ {
50319
+ type: "element",
50320
+ name: "w:pPr",
50321
+ elements: [
50322
+ {
50323
+ type: "element",
50324
+ name: "w:keepNext"
50325
+ },
50326
+ {
50327
+ type: "element",
50328
+ name: "w:keepLines"
50329
+ },
50330
+ {
50331
+ type: "element",
50332
+ name: "w:spacing",
50333
+ attributes: {
50334
+ "w:before": "160",
50335
+ "w:after": "80"
50336
+ }
50337
+ },
50338
+ {
50339
+ type: "element",
50340
+ name: "w:outlineLvl",
50341
+ attributes: {
50342
+ "w:val": "2"
50343
+ }
50344
+ }
50345
+ ]
50346
+ },
50347
+ {
50348
+ type: "element",
50349
+ name: "w:rPr",
50350
+ elements: [
50351
+ {
50352
+ type: "element",
50353
+ name: "w:rFonts",
50354
+ attributes: {
50355
+ "w:eastAsiaTheme": "majorEastAsia",
50356
+ "w:cstheme": "majorBidi"
50357
+ }
50358
+ },
50359
+ {
50360
+ type: "element",
50361
+ name: "w:color",
50362
+ attributes: {
50363
+ "w:val": "0F4761",
50364
+ "w:themeColor": "accent1",
50365
+ "w:themeShade": "BF"
50366
+ }
50367
+ },
50368
+ {
50369
+ type: "element",
50370
+ name: "w:sz",
50371
+ attributes: {
50372
+ "w:val": "28"
50373
+ }
50374
+ },
50375
+ {
50376
+ type: "element",
50377
+ name: "w:szCs",
50378
+ attributes: {
50379
+ "w:val": "28"
50380
+ }
50381
+ }
50382
+ ]
50383
+ }
50384
+ ]
50385
+ }
50386
+ };
49732
50387
  const TrackInsertMarkName = "trackInsert";
49733
50388
  const TrackDeleteMarkName = "trackDelete";
49734
50389
  const TrackFormatMarkName = "trackFormat";
@@ -52842,6 +53497,19 @@ function getStyleDefinitions(docx) {
52842
53497
  });
52843
53498
  return allParsedStyles;
52844
53499
  }
53500
+ function addDefaultStylesIfMissing(styles) {
53501
+ if (!styles) return null;
53502
+ const updatedStyles = carbonCopy(styles);
53503
+ const { elements } = updatedStyles.elements[0];
53504
+ Object.keys(DEFAULT_LINKED_STYLES).forEach((styleId) => {
53505
+ const existsOnDoc = elements.some((el) => el.attributes?.["w:styleId"] === styleId);
53506
+ if (!existsOnDoc) {
53507
+ const missingStyle = DEFAULT_LINKED_STYLES[styleId];
53508
+ updatedStyles.elements[0].elements.push(missingStyle);
53509
+ }
53510
+ });
53511
+ return updatedStyles;
53512
+ }
52845
53513
  function getHeaderFooter(el, elementType, docx, converter, editor) {
52846
53514
  const rels = docx["word/_rels/document.xml.rels"];
52847
53515
  const relationships = rels.elements.find((el2) => el2.name === "Relationships");
@@ -52909,6 +53577,9 @@ const _SuperConverter = class _SuperConverter {
52909
53577
  if (file.name === "word/document.xml") {
52910
53578
  this.documentAttributes = this.convertedXml[file.name].elements[0]?.attributes;
52911
53579
  }
53580
+ if (file.name === "word/styles.xml") {
53581
+ this.convertedXml[file.name] = addDefaultStylesIfMissing(this.convertedXml[file.name]);
53582
+ }
52912
53583
  });
52913
53584
  this.initialJSON = this.convertedXml["word/document.xml"];
52914
53585
  if (!this.initialJSON) this.initialJSON = this.parseXmlToJson(this.xml);
@@ -52935,7 +53606,7 @@ const _SuperConverter = class _SuperConverter {
52935
53606
  return;
52936
53607
  }
52937
53608
  }
52938
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.10") {
53609
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.11") {
52939
53610
  const customLocation = "docProps/custom.xml";
52940
53611
  if (!docx[customLocation]) {
52941
53612
  docx[customLocation] = generateCustomXml();
@@ -53183,7 +53854,7 @@ function storeSuperdocVersion(docx) {
53183
53854
  function generateCustomXml() {
53184
53855
  return DEFAULT_CUSTOM_XML;
53185
53856
  }
53186
- function generateSuperdocVersion(version2 = "0.6.10") {
53857
+ function generateSuperdocVersion(version2 = "0.6.11") {
53187
53858
  return {
53188
53859
  type: "element",
53189
53860
  name: "property",
@@ -53255,4 +53926,4 @@ export {
53255
53926
  twipsToLines as y,
53256
53927
  pixelsToTwips as z
53257
53928
  };
53258
- //# sourceMappingURL=converter-6mfBech5.js.map
53929
+ //# sourceMappingURL=converter-BA8jbeZU.js.map