devexpress-richedit 24.1.1-alpha-24085-0102 → 24.1.3
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.
- package/bin/gulpfile.js +1 -1
- package/bin/index-custom.js +1 -1
- package/bin/localization-builder.js +1 -1
- package/bin/nspell-index.js +1 -1
- package/bin/nspell.webpack.config.js +1 -1
- package/bin/webpack-externals.js +3 -1
- package/bin/webpack.config.js +1 -1
- package/dist/dx.richedit.css +1 -0
- package/dist/dx.richedit.d.ts +17 -10
- package/dist/dx.richedit.js +53229 -51846
- package/dist/dx.richedit.min.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/client/bars/ribbon.js +2 -1
- package/lib/client/bars/rich-edit-ribbon/ribbon-items-data.js +2 -1
- package/lib/client/client-rich-edit.js +4 -3
- package/lib/client/commands/client-command-manager.js +2 -1
- package/lib/client/commands/commands.js +3 -0
- package/lib/client/commands/download-document-command.d.ts +3 -0
- package/lib/client/commands/download-document-command.js +13 -2
- package/lib/client/commands/export-document-command.js +4 -4
- package/lib/client/commands/mail-merge-command.js +7 -4
- package/lib/client/commands/open-document-command.d.ts +2 -1
- package/lib/client/commands/open-document-command.js +17 -12
- package/lib/client/default-localization.js +2 -1
- package/lib/client/dialogs/finish-and-merge-dialog.js +1 -0
- package/lib/client/document-processor/processor.d.ts +9 -2
- package/lib/client/document-processor/processor.js +18 -6
- package/lib/client/formats/docx/export/data.d.ts +4 -0
- package/lib/client/formats/docx/export/data.js +12 -0
- package/lib/client/formats/docx/export/exporter.d.ts +2 -0
- package/lib/client/formats/docx/export/exporter.js +15 -0
- package/lib/client/formats/docx/export/exporters/base/sections.js +5 -0
- package/lib/client/formats/docx/export/exporters/note-properties.d.ts +18 -0
- package/lib/client/formats/docx/export/exporters/note-properties.js +83 -0
- package/lib/client/formats/docx/export/exporters/settings.d.ts +2 -0
- package/lib/client/formats/docx/export/exporters/settings.js +11 -0
- package/lib/client/formats/docx/export/exporters/sub-document/base-sub-document.d.ts +15 -1
- package/lib/client/formats/docx/export/exporters/sub-document/base-sub-document.js +85 -3
- package/lib/client/formats/docx/export/exporters/sub-document/header-footer-sub-document-exporter.d.ts +2 -2
- package/lib/client/formats/docx/export/exporters/sub-document/header-footer-sub-document-exporter.js +2 -2
- package/lib/client/formats/docx/export/exporters/sub-document/main-sub-document.d.ts +2 -2
- package/lib/client/formats/docx/export/exporters/sub-document/main-sub-document.js +2 -2
- package/lib/client/formats/docx/export/exporters/sub-document/note-sub-document-exporter.d.ts +37 -0
- package/lib/client/formats/docx/export/exporters/sub-document/note-sub-document-exporter.js +71 -0
- package/lib/client/formats/docx/export/exporters/sub-document/text-box-content-exporter.d.ts +2 -2
- package/lib/client/formats/docx/export/exporters/sub-document/text-box-content-exporter.js +2 -2
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-properties-destination.d.ts +16 -0
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-properties-destination.js +48 -0
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-reference-destination.d.ts +5 -0
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-reference-destination.js +9 -0
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnotes-destination.d.ts +5 -0
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnotes-destination.js +39 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-properties-destination.d.ts +18 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-properties-destination.js +49 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-reference-destination.d.ts +5 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-reference-destination.js +9 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnotes-destination.d.ts +5 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnotes-destination.js +39 -0
- package/lib/client/formats/docx/import/destination/notes/note-destination.d.ts +18 -0
- package/lib/client/formats/docx/import/destination/notes/note-destination.js +45 -0
- package/lib/client/formats/docx/import/destination/notes/note-properties-destination.d.ts +32 -0
- package/lib/client/formats/docx/import/destination/notes/note-properties-destination.js +81 -0
- package/lib/client/formats/docx/import/destination/notes/note-reference-destination.d.ts +8 -0
- package/lib/client/formats/docx/import/destination/notes/note-reference-destination.js +21 -0
- package/lib/client/formats/docx/import/destination/notes/note-self-reference-destination.d.ts +5 -0
- package/lib/client/formats/docx/import/destination/notes/note-self-reference-destination.js +12 -0
- package/lib/client/formats/docx/import/destination/notes/note-separator-destination.d.ts +8 -0
- package/lib/client/formats/docx/import/destination/notes/note-separator-destination.js +20 -0
- package/lib/client/formats/docx/import/destination/paragraph-properties/paragraph-numbering-reference-destination.js +1 -1
- package/lib/client/formats/docx/import/destination/runs/run-destination.js +11 -5
- package/lib/client/formats/docx/import/destination/section/section-destination.js +5 -2
- package/lib/client/formats/docx/import/destination/settings/settings.js +4 -0
- package/lib/client/formats/docx/import/importer.d.ts +2 -0
- package/lib/client/formats/docx/import/importer.js +26 -0
- package/lib/client/formats/docx/import/importers/character-importer.d.ts +3 -0
- package/lib/client/formats/docx/import/importers/character-importer.js +12 -1
- package/lib/client/formats/docx/import/importers/end-notes-importer.d.ts +3 -4
- package/lib/client/formats/docx/import/importers/end-notes-importer.js +8 -3
- package/lib/client/formats/docx/import/importers/foot-notes-importer.d.ts +3 -5
- package/lib/client/formats/docx/import/importers/foot-notes-importer.js +8 -5
- package/lib/client/formats/docx/import/importers/notes-importer.d.ts +8 -0
- package/lib/client/formats/docx/import/importers/notes-importer.js +7 -0
- package/lib/client/formats/docx/translation-table/translation-tables.d.ts +7 -0
- package/lib/client/formats/docx/translation-table/translation-tables.js +27 -0
- package/lib/client/formats/docx/utils/constants.d.ts +2 -0
- package/lib/client/formats/docx/utils/constants.js +2 -0
- package/lib/client/model-api/formats/enum.d.ts +1 -0
- package/lib/client/model-api/formats/enum.js +1 -0
- package/lib/client/model-api/formats/exporter.d.ts +3 -4
- package/lib/client/model-api/formats/exporter.js +9 -6
- package/lib/client/model-api/formats/importer.js +2 -0
- package/lib/client/model-api/sub-document.d.ts +6 -2
- package/lib/client/model-api/sub-document.js +37 -35
- package/lib/client/model-api/table/table-borders.d.ts +1 -1
- package/lib/client/public/commands/enum.d.ts +1 -0
- package/lib/client/public/commands/enum.js +1 -0
- package/lib/client/public/document-processor.d.ts +3 -1
- package/lib/client/public/document-processor.js +2 -2
- package/lib/client/public/ribbon/creator.js +1 -0
- package/lib/client/public/ribbon/item-ids.d.ts +1 -0
- package/lib/client/public/ribbon/item-ids.js +1 -0
- package/lib/client/public/ribbon/items/select-box.d.ts +2 -0
- package/lib/client/public/ribbon/items/select-box.js +7 -0
- package/lib/client/public/rich-edit.d.ts +2 -1
- package/lib/client/public/rich-edit.js +16 -9
- package/lib/client/public/utils.d.ts +4 -0
- package/lib/client/public/utils.js +15 -0
- package/lib/client/ribbon/i-toolbar-item-options.d.ts +1 -0
- package/lib/common/canvas/canvas-manager.js +1 -0
- package/lib/common/canvas/picture-renderer.d.ts +1 -1
- package/lib/common/canvas/renderes/common/document-renderer.d.ts +1 -1
- package/lib/common/canvas/renderes/common/document-renderer.js +6 -2
- package/lib/common/canvas/renderes/view-manager.js +3 -1
- package/lib/common/clipboard-content-inserter.js +2 -1
- package/lib/common/commands/client-command.d.ts +3 -1
- package/lib/common/commands/client-command.js +2 -0
- package/lib/common/commands/document/print-document-on-client-command.js +1 -1
- package/lib/common/commands/text/clipboard-commands.js +7 -5
- package/lib/common/document-format.d.ts +2 -0
- package/lib/common/document-format.js +2 -0
- package/lib/common/formats/document-importer-errors.d.ts +3 -1
- package/lib/common/formats/document-importer-errors.js +2 -0
- package/lib/common/formats/file-name-helper.d.ts +1 -0
- package/lib/common/formats/file-name-helper.js +7 -1
- package/lib/common/formats/html/export/get-html.d.ts +4 -0
- package/lib/common/formats/html/export/get-html.js +12 -0
- package/lib/common/formats/html/export/html-builder.d.ts +16 -0
- package/lib/common/formats/html/export/html-builder.js +102 -0
- package/lib/common/formats/html/export/html-document-exporter.d.ts +13 -0
- package/lib/common/formats/html/export/html-document-exporter.js +29 -0
- package/lib/common/formats/html/export/html-export.d.ts +37 -0
- package/lib/common/{html-export.js → formats/html/export/html-export.js} +226 -289
- package/lib/common/formats/html/import/html-document-importer.d.ts +15 -0
- package/lib/common/formats/html/import/html-document-importer.js +84 -0
- package/lib/common/formats/html/import/html-importer.d.ts +1 -0
- package/lib/common/formats/html/import/html-importer.js +34 -9
- package/lib/common/formats/html/import/insert-html.d.ts +4 -0
- package/lib/common/formats/html/import/insert-html.js +5 -0
- package/lib/common/formats/html/import/utils/paragraph-properties-utils.d.ts +1 -0
- package/lib/common/formats/html/import/utils/paragraph-properties-utils.js +17 -4
- package/lib/common/formats/i-document-exporter.d.ts +14 -0
- package/lib/common/formats/rtf/export/exporter.d.ts +1 -1
- package/lib/common/formats/rtf/export/exporter.js +1 -1
- package/lib/common/formats/rtf/importer-in-subdocument.d.ts +1 -1
- package/lib/common/formats/rtf/importer-in-subdocument.js +1 -1
- package/lib/common/formats/txt/txt-exporter.js +2 -1
- package/lib/common/input-controller.d.ts +2 -1
- package/lib/common/input-controller.js +5 -2
- package/lib/common/interfaces/i-rich-edit-core.d.ts +2 -0
- package/lib/common/layout/main-structures/layout-boxes/layout-anchored-picture-box.d.ts +2 -1
- package/lib/common/layout/main-structures/layout-boxes/layout-anchored-picture-box.js +4 -3
- package/lib/common/layout/main-structures/layout-boxes/layout-picture-box.d.ts +2 -1
- package/lib/common/layout/main-structures/layout-boxes/layout-picture-box.js +5 -4
- package/lib/common/layout/main-structures/layout-page.d.ts +1 -0
- package/lib/common/layout/main-structures/layout-page.js +5 -2
- package/lib/common/layout-formatter/box/generator/box-infos-generator.d.ts +1 -0
- package/lib/common/layout-formatter/box/generator/box-infos-generator.js +12 -2
- package/lib/common/layout-formatter/floating/page-anchored-object-holder.d.ts +5 -3
- package/lib/common/layout-formatter/floating/page-anchored-object-holder.js +7 -4
- package/lib/common/layout-formatter/formatter/base-formatter.js +0 -1
- package/lib/common/layout-formatter/formatter/main-formatter.js +1 -0
- package/lib/common/layout-formatter/managers/formatter-manager.d.ts +6 -2
- package/lib/common/layout-formatter/managers/formatter-manager.js +3 -1
- package/lib/common/layout-formatter/row/size-engine/row-sizes-manager.js +20 -4
- package/lib/common/measurer/measurer.js +2 -1
- package/lib/common/model/chunk.d.ts +1 -0
- package/lib/common/model/chunk.js +27 -2
- package/lib/common/model/document-model.d.ts +4 -0
- package/lib/common/model/document-model.js +4 -1
- package/lib/common/model/enums.d.ts +3 -1
- package/lib/common/model/enums.js +2 -0
- package/lib/common/model/footnotes/footnote.d.ts +46 -0
- package/lib/common/model/footnotes/footnote.js +100 -0
- package/lib/common/model/json/importers/sub-document/json-sub-document-importer.js +3 -3
- package/lib/common/model/json/importers/sub-document/run-importers.d.ts +6 -0
- package/lib/common/model/json/importers/sub-document/run-importers.js +9 -0
- package/lib/common/model/model-checks/position.d.ts +2 -1
- package/lib/common/model/model-checks/position.js +11 -2
- package/lib/common/model/numbering-lists/numbering-helper.d.ts +2 -1
- package/lib/common/model/numbering-lists/numbering-helper.js +3 -0
- package/lib/common/model/paragraph/paragraph-style.d.ts +1 -0
- package/lib/common/model/paragraph/paragraph-style.js +6 -2
- package/lib/common/model/properties-merger/paragraph-properties-merger.js +1 -1
- package/lib/common/model/runs/run-base.d.ts +1 -0
- package/lib/common/model/runs/simple-runs.d.ts +8 -2
- package/lib/common/model/runs/simple-runs.js +12 -6
- package/lib/common/model/section/section-properties.d.ts +3 -0
- package/lib/common/model/special-characters.d.ts +3 -0
- package/lib/common/model/special-characters.js +3 -0
- package/lib/common/model/sub-document-infos.d.ts +18 -0
- package/lib/common/model/sub-document-infos.js +39 -0
- package/lib/common/model/sub-document.d.ts +2 -0
- package/lib/common/model/sub-document.js +18 -16
- package/lib/common/mouse-handler/touch-handler/touch-handler-state-base.d.ts +1 -0
- package/lib/common/mouse-handler/touch-handler/touch-handler-state-base.js +21 -13
- package/lib/common/processor.d.ts +2 -0
- package/lib/common/rich-edit-core.d.ts +6 -2
- package/lib/common/rich-edit-core.js +20 -1
- package/lib/common/selection/selection-intervals-info.js +1 -1
- package/lib/common/ui/ruler/controls/divisions.js +2 -1
- package/lib/common/ui/ruler/controls/indent/first-line.js +4 -3
- package/lib/common/ui/ruler/controls/indent/left.js +5 -4
- package/lib/common/ui/ruler/ruler.js +2 -1
- package/lib/common/utils/_license.d.ts +1 -0
- package/lib/common/utils/_license.js +2 -0
- package/lib/common/utils/size-utils.d.ts +3 -0
- package/lib/common/utils/size-utils.js +17 -4
- package/package.json +4 -4
- package/lib/common/html-export.d.ts +0 -32
@@ -390,6 +390,7 @@ export var RichEditClientCommand;
|
|
390
390
|
RichEditClientCommand[RichEditClientCommand["DownloadDocx"] = 418] = "DownloadDocx";
|
391
391
|
RichEditClientCommand[RichEditClientCommand["DownloadRtf"] = 419] = "DownloadRtf";
|
392
392
|
RichEditClientCommand[RichEditClientCommand["DownloadTxt"] = 420] = "DownloadTxt";
|
393
|
+
RichEditClientCommand[RichEditClientCommand["DownloadHtml"] = 421] = "DownloadHtml";
|
393
394
|
RichEditClientCommand[RichEditClientCommand["PdfExported"] = 430] = "PdfExported";
|
394
395
|
RichEditClientCommand[RichEditClientCommand["ChangeCaseMenu"] = 431] = "ChangeCaseMenu";
|
395
396
|
RichEditClientCommand[RichEditClientCommand["AlignParagraphMenu"] = 432] = "AlignParagraphMenu";
|
@@ -418,4 +419,5 @@ export var RichEditClientCommand;
|
|
418
419
|
RichEditClientCommand[RichEditClientCommand["FloatingObjectBringForwardMenu"] = 455] = "FloatingObjectBringForwardMenu";
|
419
420
|
RichEditClientCommand[RichEditClientCommand["FloatingObjectSendBackwardMenu"] = 456] = "FloatingObjectSendBackwardMenu";
|
420
421
|
RichEditClientCommand[RichEditClientCommand["NoSpellingSuggestions"] = 457] = "NoSpellingSuggestions";
|
422
|
+
RichEditClientCommand[RichEditClientCommand["GetHtml"] = 458] = "GetHtml";
|
421
423
|
})(RichEditClientCommand || (RichEditClientCommand = {}));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { HtmlBuilder } from '../../html-
|
1
|
+
import { HtmlBuilder } from '../../formats/html/export/html-builder';
|
2
2
|
import { RendererClassNames } from '../../canvas/renderer-class-names';
|
3
3
|
import { UpdateFieldsOptions } from '../../model/fields/tree-creator';
|
4
4
|
import { ControlOptions } from '../../model/options/control';
|
@@ -17,6 +17,7 @@ import { SelectionHistoryItem } from '../../model/history/selection/selection-hi
|
|
17
17
|
import { RichEditClientCommand } from '../client-command';
|
18
18
|
import { CommandBase, CommandSimpleOptions } from '../command-base';
|
19
19
|
import { SimpleCommandState } from '../command-states';
|
20
|
+
import { HtmlMimeType, PlainTextMimeType } from '@devexpress/utils/lib/utils/mime-type';
|
20
21
|
export class ClipboardCommand extends CommandBase {
|
21
22
|
constructor(control, queryCommandId) {
|
22
23
|
super(control);
|
@@ -303,10 +304,10 @@ export class ClipboardHelper {
|
|
303
304
|
}
|
304
305
|
insertClipboardItems(items) {
|
305
306
|
for (let item of items) {
|
306
|
-
if (ListUtils.anyOf(item.types, type => type ===
|
307
|
-
return this.insertClipboardItem(item,
|
308
|
-
if (ListUtils.anyOf(item.types, type => type ===
|
309
|
-
return this.insertClipboardItem(item,
|
307
|
+
if (ListUtils.anyOf(item.types, type => type === HtmlMimeType))
|
308
|
+
return this.insertClipboardItem(item, HtmlMimeType, html => this.insertHtml(html));
|
309
|
+
if (ListUtils.anyOf(item.types, type => type === PlainTextMimeType))
|
310
|
+
return this.insertClipboardItem(item, PlainTextMimeType, text => this.insertPlainText(text));
|
310
311
|
}
|
311
312
|
return Promise.reject(ClipboardHelper.noDataInClipboardMessage);
|
312
313
|
}
|
@@ -348,7 +349,8 @@ export class ClipboardHelper {
|
|
348
349
|
writeToClipboard(clipboardData) {
|
349
350
|
ClipboardHelper.lastWritenTextHash = -1;
|
350
351
|
return new Promise((resolve, reject) => {
|
351
|
-
const
|
352
|
+
const modelManager = this.createModelManager(clipboardData.model);
|
353
|
+
const exporter = new TxtExporter(modelManager.modelManipulator, new DocumentExporterOptions());
|
352
354
|
exporter.exportToBlob((blob) => __awaiter(this, void 0, void 0, function* () {
|
353
355
|
const text = yield this.readAsText(blob);
|
354
356
|
if (this.useWithBuildInClipboard)
|
@@ -16,9 +16,11 @@ export declare const mimeTypeIntoDocumentFormat: {
|
|
16
16
|
4: DocumentFormat;
|
17
17
|
2: DocumentFormat;
|
18
18
|
3: DocumentFormat;
|
19
|
+
14: DocumentFormat;
|
19
20
|
};
|
20
21
|
export declare const documentFormatIntoMimeType: {
|
21
22
|
4: DxMimeType;
|
22
23
|
2: DxMimeType;
|
23
24
|
1: DxMimeType;
|
25
|
+
3: DxMimeType;
|
24
26
|
};
|
@@ -17,9 +17,11 @@ export const mimeTypeIntoDocumentFormat = {
|
|
17
17
|
[DxMimeType.Docm]: DocumentFormat.OpenXml,
|
18
18
|
[DxMimeType.Rtf]: DocumentFormat.Rtf,
|
19
19
|
[DxMimeType.PlainText]: DocumentFormat.PlainText,
|
20
|
+
[DxMimeType.Html]: DocumentFormat.Html,
|
20
21
|
};
|
21
22
|
export const documentFormatIntoMimeType = {
|
22
23
|
[DocumentFormat.OpenXml]: DxMimeType.OpenXml,
|
23
24
|
[DocumentFormat.Rtf]: DxMimeType.Rtf,
|
24
25
|
[DocumentFormat.PlainText]: DxMimeType.PlainText,
|
26
|
+
[DocumentFormat.Html]: DxMimeType.Html,
|
25
27
|
};
|
@@ -5,4 +5,6 @@ export var DocumentImporterErrors;
|
|
5
5
|
DocumentImporterErrors[DocumentImporterErrors["RtfFileReaderError"] = 2] = "RtfFileReaderError";
|
6
6
|
DocumentImporterErrors[DocumentImporterErrors["RtfImportError"] = 3] = "RtfImportError";
|
7
7
|
DocumentImporterErrors[DocumentImporterErrors["OpenXmlImportError"] = 4] = "OpenXmlImportError";
|
8
|
+
DocumentImporterErrors[DocumentImporterErrors["HtmlFileReaderError"] = 5] = "HtmlFileReaderError";
|
9
|
+
DocumentImporterErrors[DocumentImporterErrors["HtmlImportError"] = 6] = "HtmlImportError";
|
8
10
|
})(DocumentImporterErrors || (DocumentImporterErrors = {}));
|
@@ -11,6 +11,7 @@ export declare class FileNameHelper {
|
|
11
11
|
checkExtension(): void;
|
12
12
|
static normalizeVirtualFolderPath(folderPath: string, isNormalizePath: boolean): string;
|
13
13
|
static convertToDocumentFormat(fileName: string): DocumentFormat;
|
14
|
+
static convertToDocumentExtension(fileName: string): string;
|
14
15
|
static convertExtensionToDocumentFormat(extension: string): DocumentFormat;
|
15
16
|
static convertToString(docFormat: DocumentFormat): string;
|
16
17
|
private static testFormat;
|
@@ -49,6 +49,12 @@ export class FileNameHelper {
|
|
49
49
|
return DocumentFormat.WordML;
|
50
50
|
return DocumentFormat.Undefined;
|
51
51
|
}
|
52
|
+
static convertToDocumentExtension(fileName) {
|
53
|
+
const position = fileName.lastIndexOf('.');
|
54
|
+
const extension = fileName.slice(position);
|
55
|
+
const format = FileNameHelper.convertExtensionToDocumentFormat(extension);
|
56
|
+
return format !== DocumentFormat.Undefined ? extension : '';
|
57
|
+
}
|
52
58
|
static convertExtensionToDocumentFormat(extension) {
|
53
59
|
switch (extension.toLowerCase()) {
|
54
60
|
case "doc":
|
@@ -58,7 +64,7 @@ export class FileNameHelper {
|
|
58
64
|
case "html":
|
59
65
|
case ".html":
|
60
66
|
case "htm":
|
61
|
-
case "htm": return DocumentFormat.Html;
|
67
|
+
case ".htm": return DocumentFormat.Html;
|
62
68
|
case "mht":
|
63
69
|
case ".mht": return DocumentFormat.Mht;
|
64
70
|
case "odt":
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { FixedInterval } from "@devexpress/utils/lib/intervals/fixed";
|
2
|
+
import { SubDocument } from "../../../model/sub-document";
|
3
|
+
import { IProcessor } from "../../../processor";
|
4
|
+
export declare function getHtmlFromSubDocument(processor: IProcessor, subDocument: SubDocument, coreInterval: FixedInterval): string;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { EmptyBatchUpdatableObject } from "@devexpress/utils/lib/class/batch-updatable";
|
2
|
+
import { ClientModelManager } from "../../../model-manager";
|
3
|
+
import { RangeCopy } from "../../../model/manipulators/range/create-range-copy-operation";
|
4
|
+
import { SubDocumentIntervals } from "../../../model/sub-document";
|
5
|
+
import { HtmlDocumentExporter } from "./html-document-exporter";
|
6
|
+
import { DocumentExporterOptions } from "../../options";
|
7
|
+
export function getHtmlFromSubDocument(processor, subDocument, coreInterval) {
|
8
|
+
const rangeCopy = RangeCopy.create(new SubDocumentIntervals(subDocument, [coreInterval]));
|
9
|
+
const modelManager = new ClientModelManager(rangeCopy.model, processor.modelManager.richOptions, new EmptyBatchUpdatableObject());
|
10
|
+
const exportModelOptions = processor.getExportModelOptions({ modelManager: modelManager });
|
11
|
+
return new HtmlDocumentExporter(exportModelOptions, new DocumentExporterOptions()).exportAsString();
|
12
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export declare class HtmlBuilder {
|
2
|
+
getHtmlString(needDefaultMarkup?: boolean): string;
|
3
|
+
private _currentElement;
|
4
|
+
childElements: Array<Element | string>;
|
5
|
+
callbacks: Array<(target: HtmlBuilder) => void>;
|
6
|
+
isEmpty(): boolean;
|
7
|
+
clear(): this;
|
8
|
+
startChild(tagName: string, namespaceUri?: string): this;
|
9
|
+
configure<T extends Element = HTMLElement>(config: (element: T) => void): this;
|
10
|
+
addCallback(callback: (target: HtmlBuilder) => void): void;
|
11
|
+
assignFrom(builder: HtmlBuilder | string): this;
|
12
|
+
addElement(element: Element | string): this;
|
13
|
+
addBreak(cssText?: string): this;
|
14
|
+
endChild(tagName: string): this;
|
15
|
+
private addDefaultMarkup;
|
16
|
+
}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
export class HtmlBuilder {
|
2
|
+
constructor() {
|
3
|
+
this.childElements = [];
|
4
|
+
this.callbacks = [];
|
5
|
+
}
|
6
|
+
getHtmlString(needDefaultMarkup = false) {
|
7
|
+
const content = this.childElements.map(x => {
|
8
|
+
if (typeof x === 'string')
|
9
|
+
return x;
|
10
|
+
return x.outerHTML;
|
11
|
+
}).join('');
|
12
|
+
return needDefaultMarkup ? this.addDefaultMarkup(content) : content;
|
13
|
+
}
|
14
|
+
isEmpty() {
|
15
|
+
return this.callbacks.length === 0 && this.childElements.length === 0;
|
16
|
+
}
|
17
|
+
clear() {
|
18
|
+
this._currentElement = null;
|
19
|
+
this.callbacks = [];
|
20
|
+
this.childElements = [];
|
21
|
+
return this;
|
22
|
+
}
|
23
|
+
startChild(tagName, namespaceUri) {
|
24
|
+
const element = (namespaceUri) ? document.createElementNS(namespaceUri, tagName) : document.createElement(tagName);
|
25
|
+
if (this._currentElement)
|
26
|
+
this._currentElement.appendChild(element);
|
27
|
+
else {
|
28
|
+
this.childElements.push(element);
|
29
|
+
}
|
30
|
+
this._currentElement = element;
|
31
|
+
return this;
|
32
|
+
}
|
33
|
+
configure(config) {
|
34
|
+
config(this._currentElement);
|
35
|
+
return this;
|
36
|
+
}
|
37
|
+
addCallback(callback) {
|
38
|
+
this.callbacks.push(callback);
|
39
|
+
}
|
40
|
+
assignFrom(builder) {
|
41
|
+
if (!builder)
|
42
|
+
return this;
|
43
|
+
if (typeof builder === "string") {
|
44
|
+
this.addElement(builder);
|
45
|
+
return this;
|
46
|
+
}
|
47
|
+
builder.callbacks.forEach((callback) => {
|
48
|
+
callback(this);
|
49
|
+
});
|
50
|
+
builder.childElements.forEach((el) => {
|
51
|
+
this.addElement(el);
|
52
|
+
});
|
53
|
+
builder.clear();
|
54
|
+
return this;
|
55
|
+
}
|
56
|
+
addElement(element) {
|
57
|
+
if (!element)
|
58
|
+
return this;
|
59
|
+
if (!this._currentElement) {
|
60
|
+
this.childElements.push(element);
|
61
|
+
return this;
|
62
|
+
}
|
63
|
+
if (typeof element === 'string')
|
64
|
+
this._currentElement.innerHTML += element;
|
65
|
+
else if (this._currentElement)
|
66
|
+
this._currentElement.appendChild(element);
|
67
|
+
else
|
68
|
+
this._currentElement = element;
|
69
|
+
return this;
|
70
|
+
}
|
71
|
+
addBreak(cssText) {
|
72
|
+
this.startChild('br');
|
73
|
+
if (cssText)
|
74
|
+
this.configure((el) => el.style.cssText = cssText);
|
75
|
+
this.endChild('br');
|
76
|
+
return this;
|
77
|
+
}
|
78
|
+
endChild(tagName) {
|
79
|
+
try {
|
80
|
+
let currentElement = this._currentElement;
|
81
|
+
while (currentElement.tagName.toLowerCase() !== tagName.toLowerCase())
|
82
|
+
currentElement = currentElement.parentElement;
|
83
|
+
this._currentElement = currentElement.parentElement;
|
84
|
+
}
|
85
|
+
catch (e) {
|
86
|
+
console.warn(`The element with the ${tagName} tag is not found.`);
|
87
|
+
}
|
88
|
+
return this;
|
89
|
+
}
|
90
|
+
addDefaultMarkup(content) {
|
91
|
+
return '<!DOCTYPE html>' +
|
92
|
+
'<html lang="en">' +
|
93
|
+
'<head>' +
|
94
|
+
'<meta charset="UTF-8">' +
|
95
|
+
'<meta name="viewport" content="width=device-width, initial-scale=1.0">' +
|
96
|
+
'</head>' +
|
97
|
+
'<body>' +
|
98
|
+
content +
|
99
|
+
'</body>' +
|
100
|
+
'</html>';
|
101
|
+
}
|
102
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { IDocumentExporter, IExportModelOptions } from "../../i-document-exporter";
|
2
|
+
import { DocumentExporterOptions } from "../../options";
|
3
|
+
export declare class HtmlDocumentExporter implements IDocumentExporter {
|
4
|
+
private options;
|
5
|
+
private exportModelOptions;
|
6
|
+
private sessionGuid;
|
7
|
+
private clientGuid;
|
8
|
+
private get modelManipulator();
|
9
|
+
constructor(exportModelOptions: IExportModelOptions, options: DocumentExporterOptions);
|
10
|
+
exportToBlob(callback: (blob: Blob) => void): void;
|
11
|
+
exportToBase64(callback: (base64: string) => void): void;
|
12
|
+
exportAsString(): string;
|
13
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { FixedInterval } from "@devexpress/utils/lib/intervals/fixed";
|
2
|
+
import { HtmlMimeType } from "@devexpress/utils/lib/utils/mime-type";
|
3
|
+
import { RichUtils } from "../../../model/rich-utils";
|
4
|
+
import { HtmlExporter } from "./html-export";
|
5
|
+
export class HtmlDocumentExporter {
|
6
|
+
constructor(exportModelOptions, options) {
|
7
|
+
this.exportModelOptions = exportModelOptions;
|
8
|
+
this.options = options;
|
9
|
+
}
|
10
|
+
get modelManipulator() { return this.exportModelOptions.modelManager.modelManipulator; }
|
11
|
+
exportToBlob(callback) {
|
12
|
+
this.modelManipulator.picture.loader.ensureAllPicturesLoaded(this.options.ensurePictureLoadedTimeout, (_loaded) => {
|
13
|
+
callback(new Blob([this.exportAsString()], { type: HtmlMimeType }));
|
14
|
+
});
|
15
|
+
}
|
16
|
+
exportToBase64(callback) {
|
17
|
+
this.modelManipulator.picture.loader.ensureAllPicturesLoaded(this.options.ensurePictureLoadedTimeout, (_loaded) => {
|
18
|
+
callback(btoa(this.exportAsString()));
|
19
|
+
});
|
20
|
+
}
|
21
|
+
exportAsString() {
|
22
|
+
const model = this.modelManipulator.model;
|
23
|
+
const subDocument = model.mainSubDocument;
|
24
|
+
const interval = new FixedInterval(0, model.mainSubDocument.getDocumentEndPosition());
|
25
|
+
const guidLabel = RichUtils.getCopyPasteGuidLabel({ sguid: this.sessionGuid, cguid: this.clientGuid });
|
26
|
+
const exporter = new HtmlExporter(this.exportModelOptions);
|
27
|
+
return exporter.getHtmlElementsByInterval(model, subDocument, interval, guidLabel).getHtmlString(true);
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
|
2
|
+
import { DocumentModel } from '../../../model/document-model';
|
3
|
+
import { RangeCopy } from '../../../model/manipulators/range/create-range-copy-operation';
|
4
|
+
import { Paragraph } from '../../../model/paragraph/paragraph';
|
5
|
+
import { SubDocument } from '../../../model/sub-document';
|
6
|
+
import { HtmlBuilder } from './html-builder';
|
7
|
+
import { IExportModelOptions } from '../../i-document-exporter';
|
8
|
+
interface List {
|
9
|
+
numberingListIndex: number;
|
10
|
+
listLevelIndex: number;
|
11
|
+
start: number;
|
12
|
+
end: number;
|
13
|
+
}
|
14
|
+
export declare class HtmlExporter {
|
15
|
+
rangeCopy: RangeCopy;
|
16
|
+
private exportModelOptions;
|
17
|
+
private get modelManager();
|
18
|
+
private get colorProvider();
|
19
|
+
private get unitConverter();
|
20
|
+
private get documentRenderer();
|
21
|
+
private get lastMaxNumPages();
|
22
|
+
private get pageIndex();
|
23
|
+
constructor(exportModelOptions: IExportModelOptions);
|
24
|
+
getHtmlElementsByInterval(model: DocumentModel, subDocument: SubDocument, interval: FixedInterval, guidLabel: string): HtmlBuilder;
|
25
|
+
getParagraphsByInterval(subDocument: SubDocument, interval: FixedInterval): Paragraph[];
|
26
|
+
getListsByParagraphs(paragraphs: Paragraph[]): List[];
|
27
|
+
private addParentTableRecursively;
|
28
|
+
startList(model: DocumentModel, subDocument: SubDocument, interval: FixedInterval, builder: HtmlBuilder, lists: List[], position: number): void;
|
29
|
+
private endList;
|
30
|
+
private getHtmlText;
|
31
|
+
private getBorderCssString;
|
32
|
+
private getTableWidthUnitCssString;
|
33
|
+
private getTableStyle;
|
34
|
+
private getCellStyle;
|
35
|
+
private getTextBoxStyleString;
|
36
|
+
}
|
37
|
+
export {};
|