devexpress-richedit 24.1.12-build-25107-0103 → 24.1.13-build-25142-0103
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 +1 -1
- package/bin/webpack.config.js +1 -1
- package/dist/dx.richedit.css +1 -1
- package/dist/dx.richedit.d.ts +1 -1
- package/dist/dx.richedit.js +915 -833
- package/dist/dx.richedit.min.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/client/client-rich-edit.js +2 -2
- package/lib/client/commands/mail-merge-command.js +2 -1
- package/lib/client/formats/docx/export/data.d.ts +5 -1
- package/lib/client/formats/docx/export/data.js +3 -2
- package/lib/client/formats/docx/export/exporter.d.ts +2 -3
- package/lib/client/formats/docx/export/exporter.js +3 -3
- package/lib/client/formats/docx/export/exporters/base/sections.d.ts +0 -1
- package/lib/client/formats/docx/export/exporters/base/sections.js +2 -10
- package/lib/client/formats/docx/export/exporters/base/table/table.d.ts +1 -1
- package/lib/client/formats/docx/export/exporters/base/table/table.js +4 -4
- package/lib/client/formats/docx/import/destination/paragraph-properties/properties/paragraph-spacing-destination.js +6 -4
- package/lib/client/model-api/formats/exporter.js +2 -2
- package/lib/client/model-api/sub-document.js +1 -1
- package/lib/client/utils/focus-helper.js +22 -5
- package/lib/common/commands/layout/apply-style-command.d.ts +2 -2
- package/lib/common/commands/layout/apply-style-command.js +3 -4
- package/lib/common/commands/toc/set-paragraph-level-command.js +1 -1
- package/lib/common/formats/i-document-exporter.d.ts +3 -0
- package/lib/common/formats/rtf/export/exporter.d.ts +2 -3
- package/lib/common/formats/rtf/export/exporter.js +3 -3
- package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.d.ts +4 -2
- package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.js +13 -9
- package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.d.ts +3 -2
- package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.js +4 -4
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.d.ts +2 -1
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.js +2 -2
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.d.ts +4 -2
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.js +16 -9
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.d.ts +2 -1
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.js +2 -2
- package/lib/common/formats/rtf/importer-in-subdocument.d.ts +1 -2
- package/lib/common/formats/rtf/importer-in-subdocument.js +4 -3
- package/lib/common/layout/document-layout.d.ts +3 -0
- package/lib/common/layout/document-layout.js +6 -0
- package/lib/common/layout/main-structures/layout-page-area.d.ts +3 -0
- package/lib/common/layout/main-structures/layout-page-area.js +6 -0
- package/lib/common/layout/main-structures/layout-page.d.ts +3 -0
- package/lib/common/layout/main-structures/layout-page.js +8 -0
- package/lib/common/layout/main-structures/layout-row.js +1 -2
- package/lib/common/layout-formatter/floating/position-calculators/horizontal.d.ts +1 -0
- package/lib/common/layout-formatter/floating/position-calculators/horizontal.js +16 -12
- package/lib/common/layout-formatter/row/size-engine/row-formatting-info.d.ts +4 -1
- package/lib/common/layout-formatter/row/size-engine/row-formatting-info.js +36 -2
- package/lib/common/layout-formatter/row/states.js +0 -2
- package/lib/common/layout-formatter/row/tab-info.js +5 -4
- package/lib/common/layout-formatter/table/info/table-info.d.ts +0 -1
- package/lib/common/layout-formatter/table/info/table-info.js +2 -18
- package/lib/common/layout-formatter/table/size-compressor.js +9 -2
- package/lib/common/layout-formatter/table/table-alignment-applier.js +0 -2
- package/lib/common/model/borders/border-info.js +1 -1
- package/lib/common/model/character/character-properties.d.ts +1 -1
- package/lib/common/model/character/character-properties.js +14 -2
- package/lib/common/model/history/items/character-properties-history-items.d.ts +2 -1
- package/lib/common/model/history/items/character-properties-history-items.js +3 -2
- package/lib/common/model/manipulators/character-properties-manipulator.js +2 -2
- package/lib/common/model/manipulators/i-properties-manipulator.d.ts +1 -1
- package/lib/common/model/paragraph/paragraph-style.d.ts +2 -1
- package/lib/common/model/paragraph/paragraph-style.js +5 -3
- package/lib/common/model/tables/secondary-structures/table-base-structures.d.ts +2 -1
- package/lib/common/model/tables/secondary-structures/table-base-structures.js +1 -0
- package/lib/common/rich-edit-core.js +1 -0
- package/lib/common/ui/ruler/controls/ruler.js +3 -7
- package/package.json +3 -3
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -53,8 +53,8 @@ export class ClientRichEdit {
|
|
53
53
|
this.rawDataSource = settings.rawDataSource;
|
54
54
|
this.contextMenuSettings = settings.contextMenuSettings;
|
55
55
|
this.fullScreenHelper = new FullScreenHelper(element);
|
56
|
-
if ("
|
57
|
-
config(JSON.parse(atob("
|
56
|
+
if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaVREZzBkbWxZYUZOS1MyWnRRams0U0VOTVkxTTRNaUlLZlE9PS53SkN1UVJhY3dIaU9DMEdWZFBPVlNacDJsRThrcTdTbUZTTWpIMXgvamxEMnowbzQvYWFkVm9zK1g2ZzlwSDZaYjdUUXdOdlZvQkduRUNwblB2M0ZaOUV4eWlkK3pybUxITE8yZnIyVzFTOEJOWE1YaE1mSlNPdjJ3aCs5SDBSd2lMejJxUT09In0=")
|
57
|
+
config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaVREZzBkbWxZYUZOS1MyWnRRams0U0VOTVkxTTRNaUlLZlE9PS53SkN1UVJhY3dIaU9DMEdWZFBPVlNacDJsRThrcTdTbUZTTWpIMXgvamxEMnowbzQvYWFkVm9zK1g2ZzlwSDZaYjdUUXdOdlZvQkduRUNwblB2M0ZaOUV4eWlkK3pybUxITE8yZnIyVzFTOEJOWE1YaE1mSlNPdjJ3aCs5SDBSd2lMejJxUT09In0=")));
|
58
58
|
this.prepareElement(element, settings);
|
59
59
|
this.initDefaultFontsAndStyles();
|
60
60
|
this.initBars(settings.ribbon, settings.fonts);
|
@@ -41,7 +41,8 @@ export class MailMergeCommand extends CommandBase {
|
|
41
41
|
return true;
|
42
42
|
}
|
43
43
|
executeCore(_state, options) {
|
44
|
-
const
|
44
|
+
const exportModelOptions = this.control.getExportModelOptions();
|
45
|
+
const docxExporter = new DocxExporter(exportModelOptions, new DocxExportOptions());
|
45
46
|
docxExporter.exportToBlob((blob) => {
|
46
47
|
const docxImporter = new Importer(new ImporterOptions());
|
47
48
|
docxImporter.importFromFile(blob, this.control.modelManager.richOptions, (documentModel, formatImagesImporter) => {
|
@@ -23,6 +23,9 @@ import { BaseSubDocumentExporter } from './exporters/sub-document/base-sub-docum
|
|
23
23
|
import { TextBoxSubDocumentExporter } from './exporters/sub-document/text-box-content-exporter';
|
24
24
|
import { IdGenerator } from './utils/id-generator';
|
25
25
|
import { WriterHelper } from './utils/writer-helper';
|
26
|
+
import { Grid } from '../../../../common/layout-formatter/table/grid-engine/grid';
|
27
|
+
import { IExportModelOptions } from '../../../../common/formats/i-document-exporter';
|
28
|
+
import { Table } from '../../../../common/model/tables/main-structures/table';
|
26
29
|
export declare class Data {
|
27
30
|
get writer(): XmlWriter;
|
28
31
|
set writer(val: XmlWriter);
|
@@ -30,6 +33,7 @@ export declare class Data {
|
|
30
33
|
get relationExporter(): RelationCollectionExporter;
|
31
34
|
get mainSubDocumentRelations(): DocumentRelationsExporter;
|
32
35
|
model: DocumentModel;
|
36
|
+
grids: Map<Table, Grid>;
|
33
37
|
options: DocxExportOptions;
|
34
38
|
headerCounter: number;
|
35
39
|
footerCounter: number;
|
@@ -58,7 +62,7 @@ export declare class Data {
|
|
58
62
|
endNotes: Map<SubDocument, number>;
|
59
63
|
private writerStack;
|
60
64
|
private relationExporters;
|
61
|
-
constructor(
|
65
|
+
constructor(exportModelOptions: IExportModelOptions, options: DocxExportOptions);
|
62
66
|
popWriter(): void;
|
63
67
|
pushRelationExporter(exporter: RelationCollectionExporter): void;
|
64
68
|
popRelationExporter(): void;
|
@@ -18,11 +18,12 @@ import { TextBoxSubDocumentExporter } from './exporters/sub-document/text-box-co
|
|
18
18
|
import { IdGenerator } from './utils/id-generator';
|
19
19
|
import { WriterHelper } from './utils/writer-helper';
|
20
20
|
export class Data {
|
21
|
-
constructor(
|
21
|
+
constructor(exportModelOptions, options) {
|
22
22
|
this.drawingElementId = 1;
|
23
23
|
this.exportSubDocumentsList = [];
|
24
24
|
this.relationExporters = [];
|
25
|
-
this.model = model;
|
25
|
+
this.model = exportModelOptions.modelManager.model;
|
26
|
+
this.grids = exportModelOptions.grids;
|
26
27
|
this.options = options;
|
27
28
|
this.constants = new DocxConstants();
|
28
29
|
this.writerStack = new Stack();
|
@@ -1,11 +1,10 @@
|
|
1
|
-
import { IDocumentExporter } from '../../../../common/formats/i-document-exporter';
|
2
|
-
import { ModelManipulator } from '../../../../common/model/manipulators/model-manipulator';
|
1
|
+
import { IDocumentExporter, IExportModelOptions } from '../../../../common/formats/i-document-exporter';
|
3
2
|
import { DocxExportOptions } from './docx-export-options';
|
4
3
|
export declare class DocxExporter implements IDocumentExporter {
|
5
4
|
private data;
|
6
5
|
private modelManipulator;
|
7
6
|
private options;
|
8
|
-
constructor(
|
7
|
+
constructor(exportModelOptions: IExportModelOptions, options: DocxExportOptions);
|
9
8
|
exportToBlob(callback: (blob: Blob) => void): void;
|
10
9
|
exportToBase64(callback: (base64: string) => void): void;
|
11
10
|
private exportInner;
|
@@ -9,10 +9,10 @@ import { MainSubDocumentExporter } from './exporters/sub-document/main-sub-docum
|
|
9
9
|
import { ThemeExporter } from './exporters/theme';
|
10
10
|
import { EndNoteExporter, FootNoteExporter } from './exporters/sub-document/note-sub-document-exporter';
|
11
11
|
export class DocxExporter {
|
12
|
-
constructor(
|
13
|
-
this.modelManipulator = modelManipulator;
|
12
|
+
constructor(exportModelOptions, options) {
|
13
|
+
this.modelManipulator = exportModelOptions.modelManager.modelManipulator;
|
14
14
|
this.options = options;
|
15
|
-
this.data = new Data(
|
15
|
+
this.data = new Data(exportModelOptions, options);
|
16
16
|
}
|
17
17
|
exportToBlob(callback) {
|
18
18
|
this.modelManipulator.picture.loader.ensureAllPicturesLoaded(this.options.ensurePictureLoadedTimeout, (_loaded) => {
|
@@ -11,7 +11,6 @@ export declare class SectionExporter extends BaseExporter {
|
|
11
11
|
private exportSectionHeadersFootersCore;
|
12
12
|
private exportSectionPropertiesCore;
|
13
13
|
private exportSectionPage;
|
14
|
-
private shouldExportSectionPage;
|
15
14
|
private exportSectionMargins;
|
16
15
|
private exportSectionLineNumbering;
|
17
16
|
private exportSectionPageNumbering;
|
@@ -75,21 +75,13 @@ export class SectionExporter extends BaseExporter {
|
|
75
75
|
this.exportSectionGeneralSettings(props);
|
76
76
|
}
|
77
77
|
exportSectionPage(props) {
|
78
|
-
if (!this.shouldExportSectionPage(props))
|
79
|
-
return;
|
80
78
|
this.writer.writeWpStartElement('pgSz');
|
81
|
-
|
82
|
-
|
83
|
-
if (props.pageSize.height != SectionExporter.defaultProps.pageSize.height)
|
84
|
-
this.writer.writeWpIntAttr('h', props.pageSize.height);
|
79
|
+
this.writer.writeWpIntAttr('w', props.pageSize.width);
|
80
|
+
this.writer.writeWpIntAttr('h', props.pageSize.height);
|
85
81
|
if (props.landscape)
|
86
82
|
this.writer.writeWpStringAttr('orient', props.landscape ? 'landscape' : 'portrait');
|
87
83
|
this.writer.endElement();
|
88
84
|
}
|
89
|
-
shouldExportSectionPage(props) {
|
90
|
-
return !props.pageSize.equals(SectionExporter.defaultProps.pageSize) ||
|
91
|
-
props.landscape != SectionExporter.defaultProps.landscape;
|
92
|
-
}
|
93
85
|
exportSectionMargins(props) {
|
94
86
|
this.writer.writeWpStartElement('pgMar');
|
95
87
|
this.writer.writeWpIntAttr('left', props.marginLeft);
|
@@ -8,7 +8,7 @@ export declare class TableExporter extends BaseExporter {
|
|
8
8
|
private initTableDeferred;
|
9
9
|
init(): void;
|
10
10
|
checkTable(pos: number, allowInitNextTable: boolean): void;
|
11
|
-
getTableGrid
|
11
|
+
private getTableGrid;
|
12
12
|
private initNewTables;
|
13
13
|
private closeTables;
|
14
14
|
private handleNextCell;
|
@@ -6,6 +6,7 @@ import { ListUtils } from '@devexpress/utils/lib/utils/list';
|
|
6
6
|
import { BaseExporter } from '../../base';
|
7
7
|
import { TableCellPropertiesExporter } from './table-cell-properties';
|
8
8
|
import { TableRowPropertiesExporter } from './table-row-properties';
|
9
|
+
import { UnitConverter } from '@devexpress/utils/lib/class/unit-converter';
|
9
10
|
export class TableExporter extends BaseExporter {
|
10
11
|
constructor() {
|
11
12
|
super(...arguments);
|
@@ -35,10 +36,9 @@ export class TableExporter extends BaseExporter {
|
|
35
36
|
}
|
36
37
|
}
|
37
38
|
getTableGrid(table) {
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
return colGrid;
|
39
|
+
var _a, _b;
|
40
|
+
const grid = this.data.grids.get(table);
|
41
|
+
return ((_b = (_a = grid === null || grid === void 0 ? void 0 : grid.columns) === null || _a === void 0 ? void 0 : _a.width) === null || _b === void 0 ? void 0 : _b.map(UnitConverter.pixelsToTwips)) || [];
|
42
42
|
}
|
43
43
|
initNewTables(newIndexes, allowInitNextTable) {
|
44
44
|
for (let levelIndex = this.tableIndexes.length; levelIndex < newIndexes.length; levelIndex++) {
|
@@ -12,10 +12,12 @@ export class ParagraphSpacingDestination extends ParagraphFormattingLeafElementD
|
|
12
12
|
const spacingBefore = this.data.readerHelper.getWpSTIntegerValue(reader, 'before', Constants.MIN_SAFE_INTEGER);
|
13
13
|
if (spacingBefore >= 0)
|
14
14
|
this.paragraphProperties.setValue(ParagraphPropertyDescriptor.spacingBefore, spacingBefore);
|
15
|
-
this.
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
const beforeAutoSpacing = this.data.readerHelper.getWpSTOnOffValue(reader, 'beforeAutospacing', null);
|
16
|
+
if (spacingBefore == -1 || beforeAutoSpacing != null)
|
17
|
+
this.paragraphProperties.setValue(ParagraphPropertyDescriptor.beforeAutoSpacing, spacingBefore == -1 || beforeAutoSpacing);
|
18
|
+
const afterAutoSpacing = this.data.readerHelper.getWpSTOnOffValue(reader, 'afterAutospacing', null);
|
19
|
+
if (spacingAfter == -1 || afterAutoSpacing != null)
|
20
|
+
this.paragraphProperties.setValue(ParagraphPropertyDescriptor.afterAutoSpacing, spacingAfter == -1 || afterAutoSpacing);
|
19
21
|
const lineSpacing = this.data.readerHelper.getWpSTIntegerValue(reader, 'line', Constants.MIN_SAFE_INTEGER);
|
20
22
|
if (lineSpacing != Constants.MIN_SAFE_INTEGER && lineSpacing > 0) {
|
21
23
|
const attribute = new WordProcessingMLValue('lineRule', 'line-rule');
|
@@ -15,8 +15,8 @@ export function exportModelToBlob(exportModelOptions, callback) {
|
|
15
15
|
function getExporter(exportModelOptions) {
|
16
16
|
const { modelManipulator } = exportModelOptions.modelManager;
|
17
17
|
switch (exportModelOptions.documentFormat) {
|
18
|
-
case DocumentFormat.OpenXml: return new DocxExporter(
|
19
|
-
case DocumentFormat.Rtf: return new RtfExporter(
|
18
|
+
case DocumentFormat.OpenXml: return new DocxExporter(exportModelOptions, new DocxExportOptions());
|
19
|
+
case DocumentFormat.Rtf: return new RtfExporter(exportModelOptions, new RtfDocumentExporterOptions());
|
20
20
|
case DocumentFormat.PlainText: return new TxtExporter(modelManipulator, new DocumentExporterOptions());
|
21
21
|
case DocumentFormat.Html: return new HtmlDocumentExporter(exportModelOptions, new DocumentExporterOptions());
|
22
22
|
default:
|
@@ -211,7 +211,7 @@ export class SubDocumentApi {
|
|
211
211
|
}
|
212
212
|
getRtf(interval) {
|
213
213
|
const coreInterval = this._checkInterval(interval);
|
214
|
-
return getRtfFromSubDocumentPublic(this._processor
|
214
|
+
return getRtfFromSubDocumentPublic(this._processor, this._subDocument, coreInterval);
|
215
215
|
}
|
216
216
|
insertContent(position, content, documentFormat, callback) {
|
217
217
|
position = ApiParametersChecker.check(position, 1, false, [
|
@@ -1,3 +1,4 @@
|
|
1
|
+
var _a;
|
1
2
|
export class FocusHelper {
|
2
3
|
static preventFocusOnClick(element) {
|
3
4
|
return new FocusBlocker(element);
|
@@ -10,23 +11,24 @@ class FocusBlocker {
|
|
10
11
|
this.addEventListeners(target);
|
11
12
|
}
|
12
13
|
addEventListeners(element) {
|
13
|
-
element.addEventListener("
|
14
|
+
element.addEventListener("mousedown", this.onPointerDownBinded);
|
14
15
|
}
|
15
16
|
removeEventListeners(element) {
|
16
|
-
element.removeEventListener("
|
17
|
+
element.removeEventListener("mousedown", this.onPointerDownBinded);
|
17
18
|
}
|
18
19
|
onPointerDown(event) {
|
19
20
|
for (const element of event.composedPath()) {
|
20
|
-
if (!(element instanceof HTMLElement))
|
21
|
-
continue;
|
22
21
|
if (element === this.target) {
|
23
22
|
event.preventDefault();
|
24
23
|
break;
|
25
24
|
}
|
26
|
-
if (
|
25
|
+
if (element instanceof Element && this.isFocusableElement(element))
|
27
26
|
break;
|
28
27
|
}
|
29
28
|
}
|
29
|
+
isFocusableElement(element) {
|
30
|
+
return element.matches(FocusBlocker.focusableSelector);
|
31
|
+
}
|
30
32
|
dispose() {
|
31
33
|
if (this.target) {
|
32
34
|
this.removeEventListeners(this.target);
|
@@ -34,3 +36,18 @@ class FocusBlocker {
|
|
34
36
|
}
|
35
37
|
}
|
36
38
|
}
|
39
|
+
_a = FocusBlocker;
|
40
|
+
FocusBlocker.focusableSelectors = [
|
41
|
+
'a[href]',
|
42
|
+
'area[href]',
|
43
|
+
'input',
|
44
|
+
'select',
|
45
|
+
'textarea',
|
46
|
+
'button',
|
47
|
+
'iframe',
|
48
|
+
'object',
|
49
|
+
'embed',
|
50
|
+
'[tabindex]:not([tabindex="-1"])',
|
51
|
+
'[contenteditable]:not([contenteditable="false"])'
|
52
|
+
];
|
53
|
+
FocusBlocker.focusableSelector = _a.focusableSelectors.join(',');
|
@@ -6,7 +6,7 @@ import { CommandBase, CommandSimpleOptions } from '../command-base';
|
|
6
6
|
import { ApplyStyleCommandState } from '../command-states';
|
7
7
|
export interface IApplyStyleCommandParams {
|
8
8
|
styleName: string;
|
9
|
-
|
9
|
+
keepCustomFormatting?: boolean;
|
10
10
|
}
|
11
11
|
export declare class ApplyStyleCommand extends CommandBase<ApplyStyleCommandState> {
|
12
12
|
getState(): ApplyStyleCommandState;
|
@@ -14,7 +14,7 @@ export declare class ApplyStyleCommand extends CommandBase<ApplyStyleCommandStat
|
|
14
14
|
DEPRECATEDConvertOptionsParameter(parameter: string | IApplyStyleCommandParams): IApplyStyleCommandParams;
|
15
15
|
executeCore(state: ApplyStyleCommandState, options: CommandSimpleOptions<IApplyStyleCommandParams>): boolean;
|
16
16
|
applyCharacterStyle(subDocumentInterval: SubDocumentInterval, style: CharacterStyle, isPresetStyle: boolean): void;
|
17
|
-
applyParagraphStyle(subDocumentInterval: SubDocumentInterval, style: ParagraphStyle, isPresetStyle: boolean,
|
17
|
+
applyParagraphStyle(subDocumentInterval: SubDocumentInterval, style: ParagraphStyle, isPresetStyle: boolean, keepCustomFormatting?: boolean): void;
|
18
18
|
applyParagraphLinkedStyle(subDocumentInterval: SubDocumentInterval, style: ParagraphStyle, isPresetStyle: boolean): void;
|
19
19
|
private addLinkedCharacterStyle;
|
20
20
|
calculateAffectedParagraphCount(subDocumentInterval: SubDocumentInterval): number;
|
@@ -70,7 +70,7 @@ export class ApplyStyleCommand extends CommandBase {
|
|
70
70
|
paragraphStyle = StylesManager.getPresetParagraphStyleByName(styleName).clone();
|
71
71
|
isPresetStyle = true;
|
72
72
|
}
|
73
|
-
this.applyParagraphStyle(subDocumentInterval, paragraphStyle, isPresetStyle, parameter.
|
73
|
+
this.applyParagraphStyle(subDocumentInterval, paragraphStyle, isPresetStyle, parameter.keepCustomFormatting);
|
74
74
|
}
|
75
75
|
else if (!StylesManager.isParagraphStyle(parameter.styleName) && state.characterStyleChangeEnabled) {
|
76
76
|
const styleName = StylesManager.getStyleNameWithoutPrefix(parameter.styleName);
|
@@ -105,7 +105,7 @@ export class ApplyStyleCommand extends CommandBase {
|
|
105
105
|
this.modelManipulator.style.applyCharacterStyle(subDocumentInterval, characterStyle, false);
|
106
106
|
}
|
107
107
|
}
|
108
|
-
applyParagraphStyle(subDocumentInterval, style, isPresetStyle,
|
108
|
+
applyParagraphStyle(subDocumentInterval, style, isPresetStyle, keepCustomFormatting = false) {
|
109
109
|
const count = this.calculateAffectedParagraphCount(subDocumentInterval);
|
110
110
|
if (count > 0 && ControlOptions.isEnabled(this.control.modelManager.richOptions.control.paragraphStyle)) {
|
111
111
|
const { interval, subDocument } = subDocumentInterval;
|
@@ -118,8 +118,7 @@ export class ApplyStyleCommand extends CommandBase {
|
|
118
118
|
style = isPresetStyle ? modelManipulator.model.stylesManager.addParagraphStyle(style) : style;
|
119
119
|
this.history.addAndRedo(new ApplyParagraphStyleHistoryItem(modelManipulator, paragraphSubDocumentInterval, style));
|
120
120
|
this.history.addAndRedo(new ParagraphUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0));
|
121
|
-
|
122
|
-
this.history.addAndRedo(new FontUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0));
|
121
|
+
this.history.addAndRedo(new FontUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0, keepCustomFormatting));
|
123
122
|
this.history.addAndRedo(new AddParagraphToListHistoryItem(modelManipulator, subDocument, paragraphIndex, NumberingList.NumberingListNotSettedIndex, -1));
|
124
123
|
}
|
125
124
|
}
|
@@ -22,7 +22,7 @@ export class SetParagraphLevelCommandBase extends CommandBase {
|
|
22
22
|
if (!paragraphStyle)
|
23
23
|
paragraphStyle = StylesManager.getPresetParagraphStyleByName(styleName);
|
24
24
|
if (paragraphStyle) {
|
25
|
-
const commandOptions = new CommandSimpleOptions(this.control, { styleName: StylesManager.paragraphPrefix + styleName,
|
25
|
+
const commandOptions = new CommandSimpleOptions(this.control, { styleName: StylesManager.paragraphPrefix + styleName, keepCustomFormatting: true });
|
26
26
|
this.commandManager.getCommand(RichEditClientCommand.ChangeStyle).execute(this.commandManager.isPublicApiCall, commandOptions);
|
27
27
|
}
|
28
28
|
else {
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { IPictureRenderer } from "../canvas/picture-renderer";
|
2
2
|
import { DocumentFormat } from "../document-format";
|
3
|
+
import { Grid } from "../layout-formatter/table/grid-engine/grid";
|
3
4
|
import { IModelManager } from "../model-manager";
|
5
|
+
import { Table } from "../model/tables/main-structures/table";
|
4
6
|
import { IRichEditUnitConverter } from "../utils/unit-converter";
|
5
7
|
export interface IDocumentExporter {
|
6
8
|
exportToBlob(callback: (blob: Blob) => void): any;
|
@@ -14,5 +16,6 @@ export interface IExportModelOptions {
|
|
14
16
|
sessionGuid: string;
|
15
17
|
clientGuid: string;
|
16
18
|
lastMaxNumPages?: number;
|
19
|
+
grids?: Map<Table, Grid>;
|
17
20
|
pageIndex?: number;
|
18
21
|
}
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import { IDocumentExporter } from '../../i-document-exporter';
|
1
|
+
import { IDocumentExporter, IExportModelOptions } from '../../i-document-exporter';
|
2
2
|
import { ColorModelInfo } from '../../../model/color/color-model-info';
|
3
3
|
import { DocumentModel } from '../../../model/document-model';
|
4
|
-
import { ModelManipulator } from '../../../model/manipulators/model-manipulator';
|
5
4
|
import { RtfContentExporter } from './exporters/rtf-content-exporter';
|
6
5
|
import { RtfExportHelper } from './helpers/rtf-export-helper';
|
7
6
|
import { RtfBuilder } from './rtf-builder';
|
@@ -13,7 +12,7 @@ export declare class RtfExporter implements IDocumentExporter {
|
|
13
12
|
contentExporter: RtfContentExporter;
|
14
13
|
private modelManipulator;
|
15
14
|
get documentModel(): DocumentModel;
|
16
|
-
constructor(
|
15
|
+
constructor(exportModelOptions: IExportModelOptions, options: RtfDocumentExporterOptions);
|
17
16
|
exportToBlob(callback: (blob: Blob) => void): void;
|
18
17
|
exportToBase64(callback: (base64: string) => void): void;
|
19
18
|
exportAsString(): string;
|
@@ -10,11 +10,11 @@ import { RtfExportSR } from '../translation-table/rtf-export-sr';
|
|
10
10
|
import { RtfContentExporter } from './exporters/rtf-content-exporter';
|
11
11
|
import { RtfExportHelper } from './helpers/rtf-export-helper';
|
12
12
|
export class RtfExporter {
|
13
|
-
constructor(
|
14
|
-
this.modelManipulator = modelManipulator;
|
13
|
+
constructor(exportModelOptions, options) {
|
14
|
+
this.modelManipulator = exportModelOptions.modelManager.modelManipulator;
|
15
15
|
this.options = options;
|
16
16
|
this.rtfExportHelper = new RtfExportHelper();
|
17
|
-
this.contentExporter = new RtfContentExporter(
|
17
|
+
this.contentExporter = new RtfContentExporter(exportModelOptions, options, this.rtfExportHelper);
|
18
18
|
this.rtfBuilder = this.contentExporter.createRtfBuilder();
|
19
19
|
}
|
20
20
|
get documentModel() { return this.modelManipulator.model; }
|
@@ -8,6 +8,7 @@ import { Section } from '../../../../model/section/section';
|
|
8
8
|
import { SubDocument } from '../../../../model/sub-document';
|
9
9
|
import { FooterSubDocumentInfo, HeaderSubDocumentInfo } from '../../../../model/sub-document-infos';
|
10
10
|
import { ConditionalTableStyleFormatting } from '../../../../model/tables/secondary-structures/table-base-structures';
|
11
|
+
import { IExportModelOptions } from '../../../../formats/i-document-exporter';
|
11
12
|
import { RtfExportHelper } from '../helpers/rtf-export-helper';
|
12
13
|
import { PieceTableNumberingListCountersManager } from '../piece-table-numbering-list-counters-manager';
|
13
14
|
import { RtfBuilder } from '../rtf-builder';
|
@@ -17,7 +18,7 @@ import { RtfParagraphPropertiesExporter } from './rtf-paragraph-properties-expor
|
|
17
18
|
import { RtfSectionPropertiesExporter } from './rtf-section-properties-exporter';
|
18
19
|
export declare type RunHandler = (run: RunBase, runText: string, absolutePosition: number) => void;
|
19
20
|
export declare class RtfContentExporter {
|
20
|
-
|
21
|
+
exportModelOptions: IExportModelOptions;
|
21
22
|
subDocument: SubDocument;
|
22
23
|
currentSection: Section;
|
23
24
|
static readonly verticalAlignmentTypes: Record<number, string>;
|
@@ -44,9 +45,10 @@ export declare class RtfContentExporter {
|
|
44
45
|
private bookmarksIterator;
|
45
46
|
private permissionsIterator;
|
46
47
|
tableIterator: TableIterator;
|
48
|
+
get documentModel(): DocumentModel;
|
47
49
|
private startSectionParagraphIndex;
|
48
50
|
private shouldFourceUpdateIterators;
|
49
|
-
constructor(
|
51
|
+
constructor(exportModelOptions: IExportModelOptions, options: RtfDocumentExporterOptions, rtfExportHelper: RtfExportHelper);
|
50
52
|
createRtfBuilder(): RtfBuilder;
|
51
53
|
export(): void;
|
52
54
|
shouldSplitRuns(): boolean;
|
@@ -35,17 +35,17 @@ import { RtfSectionPropertiesExporter } from './rtf-section-properties-exporter'
|
|
35
35
|
import { RtfStyleExporter } from './rtf-style-exporter';
|
36
36
|
import { RtfTableExporter } from './table/rtf-table-exporter';
|
37
37
|
export class RtfContentExporter {
|
38
|
-
constructor(
|
38
|
+
constructor(exportModelOptions, options, rtfExportHelper) {
|
39
39
|
this.shouldFourceUpdateIterators = false;
|
40
|
-
this.
|
40
|
+
this.exportModelOptions = exportModelOptions;
|
41
41
|
this.subDocument = this.documentModel.mainSubDocument;
|
42
42
|
this.pieceTableNumberingListCounters = new PieceTableNumberingListCountersManager();
|
43
43
|
this.rtfExportHelper = rtfExportHelper;
|
44
44
|
this.options = options;
|
45
45
|
this.rtfBuilder = this.createRtfBuilder();
|
46
|
-
this.paragraphPropertiesExporter = new RtfParagraphPropertiesExporter(documentModel, rtfExportHelper, this.rtfBuilder);
|
47
|
-
this.characterPropertiesExporter = new RtfCharacterPropertiesExporter(documentModel, rtfExportHelper, this.rtfBuilder, options);
|
48
|
-
this.sectionPropertiesExporter = new RtfSectionPropertiesExporter(documentModel, rtfExportHelper, this.rtfBuilder);
|
46
|
+
this.paragraphPropertiesExporter = new RtfParagraphPropertiesExporter(this.documentModel, rtfExportHelper, this.rtfBuilder);
|
47
|
+
this.characterPropertiesExporter = new RtfCharacterPropertiesExporter(this.documentModel, rtfExportHelper, this.rtfBuilder, options);
|
48
|
+
this.sectionPropertiesExporter = new RtfSectionPropertiesExporter(this.documentModel, rtfExportHelper, this.rtfBuilder);
|
49
49
|
this.runHandlerMap = new MapCreator()
|
50
50
|
.add(RunType.TextRun, this.exportTextRun)
|
51
51
|
.add(RunType.FieldCodeStartRun, this.fieldCodeStartRunHandler)
|
@@ -59,6 +59,7 @@ export class RtfContentExporter {
|
|
59
59
|
}
|
60
60
|
get shouldExportHiddenText() { return true; }
|
61
61
|
;
|
62
|
+
get documentModel() { return this.exportModelOptions.modelManager.modelManipulator.model; }
|
62
63
|
createRtfBuilder() {
|
63
64
|
return new RtfBuilder();
|
64
65
|
}
|
@@ -257,7 +258,7 @@ export class RtfContentExporter {
|
|
257
258
|
value = "00000000";
|
258
259
|
}
|
259
260
|
else {
|
260
|
-
const view = new DataView(hash, 0);
|
261
|
+
const view = new DataView(hash.buffer, 0);
|
261
262
|
const hashValue = view.getInt32(0);
|
262
263
|
value = this.documentModel.simpleFormattersManager.formatString("{0:x8}", hashValue);
|
263
264
|
}
|
@@ -433,11 +434,14 @@ export class RtfContentExporter {
|
|
433
434
|
this.exportSingleParagraph(paragraph);
|
434
435
|
return paragraphIndex;
|
435
436
|
}
|
436
|
-
else
|
437
|
-
|
437
|
+
else {
|
438
|
+
const table = tablesInfo[0].table.getTopLevelParent();
|
439
|
+
const grid = this.exportModelOptions.grids.get(table);
|
440
|
+
return RtfTableExporter.exportTable(this, table, grid) - this.startSectionParagraphIndex;
|
441
|
+
}
|
438
442
|
}
|
439
443
|
exportSingleParagraph(paragraph) {
|
440
|
-
this.exportParagraphCore(paragraph, 0,
|
444
|
+
this.exportParagraphCore(paragraph, 0, ConditionalTableStyleFormatting.None, -1);
|
441
445
|
this.finishParagraph(paragraph);
|
442
446
|
}
|
443
447
|
finishParagraph(paragraph) {
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import { Grid } from '../../../../../layout-formatter/table/grid-engine/grid';
|
1
2
|
import { Table } from '../../../../../model/tables/main-structures/table';
|
2
3
|
import { RtfContentExporter } from '../rtf-content-exporter';
|
3
4
|
export declare class RtfTableExporter {
|
4
|
-
static exportTable(rtfContentExporter: RtfContentExporter, table: Table): number;
|
5
|
-
static exportNestedTable(rtfContentExporter: RtfContentExporter, table: Table, nestingLevel: number): number;
|
5
|
+
static exportTable(rtfContentExporter: RtfContentExporter, table: Table, grid: Grid): number;
|
6
|
+
static exportNestedTable(rtfContentExporter: RtfContentExporter, table: Table, grid: Grid, nestingLevel: number): number;
|
6
7
|
}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { RtfNestedTableExporterState } from './states/rtf-nested-table-exporter-state';
|
2
2
|
import { RtfTableExporterState } from './states/rtf-table-exporter-state';
|
3
3
|
export class RtfTableExporter {
|
4
|
-
static exportTable(rtfContentExporter, table) {
|
5
|
-
new RtfTableExporterState(rtfContentExporter, table).export();
|
4
|
+
static exportTable(rtfContentExporter, table, grid) {
|
5
|
+
new RtfTableExporterState(rtfContentExporter, table, grid).export();
|
6
6
|
rtfContentExporter.tableIterator.update(table.getEndPosition());
|
7
7
|
return rtfContentExporter.subDocument.getParagraphIndexByPosition(table.getEndPosition() - 1);
|
8
8
|
}
|
9
|
-
static exportNestedTable(rtfContentExporter, table, nestingLevel) {
|
10
|
-
new RtfNestedTableExporterState(rtfContentExporter, table, nestingLevel).export();
|
9
|
+
static exportNestedTable(rtfContentExporter, table, grid, nestingLevel) {
|
10
|
+
new RtfNestedTableExporterState(rtfContentExporter, table, grid, nestingLevel).export();
|
11
11
|
rtfContentExporter.tableIterator.update(table.getEndPosition());
|
12
12
|
return rtfContentExporter.subDocument.getParagraphIndexByPosition(table.getEndPosition() - 1);
|
13
13
|
}
|
package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.d.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
import { Grid } from '../../../../../../layout-formatter/table/grid-engine/grid';
|
1
2
|
import { Table } from '../../../../../../model/tables/main-structures/table';
|
2
3
|
import { TableRow } from '../../../../../../model/tables/main-structures/table-row';
|
3
4
|
import { RtfContentExporter } from '../../rtf-content-exporter';
|
4
5
|
import { RtfTableExporterStateBase } from './rtf-table-exporter-state-base';
|
5
6
|
export declare class RtfNestedTableExporterState extends RtfTableExporterStateBase {
|
6
|
-
constructor(rtfExporter: RtfContentExporter, table: Table, nestingLevel: number);
|
7
|
+
constructor(rtfExporter: RtfContentExporter, table: Table, grid: Grid, nestingLevel: number);
|
7
8
|
export(): void;
|
8
9
|
protected writeParagraphEndMark(): void;
|
9
10
|
protected exportRow(row: TableRow, rowIndex: number): void;
|
package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { RtfExportSR } from '../../../../translation-table/rtf-export-sr';
|
2
2
|
import { RtfTableExporterStateBase } from './rtf-table-exporter-state-base';
|
3
3
|
export class RtfNestedTableExporterState extends RtfTableExporterStateBase {
|
4
|
-
constructor(rtfExporter, table, nestingLevel) {
|
5
|
-
super(rtfExporter, table, nestingLevel);
|
4
|
+
constructor(rtfExporter, table, grid, nestingLevel) {
|
5
|
+
super(rtfExporter, table, grid, nestingLevel);
|
6
6
|
}
|
7
7
|
export() {
|
8
8
|
super.exportBase();
|
package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.d.ts
CHANGED
@@ -6,6 +6,7 @@ import { TableCell } from '../../../../../../model/tables/main-structures/table-
|
|
6
6
|
import { TableRow } from '../../../../../../model/tables/main-structures/table-row';
|
7
7
|
import { ConditionalTableStyleFormatting } from '../../../../../../model/tables/secondary-structures/table-base-structures';
|
8
8
|
import { TableWidthUnit } from '../../../../../../model/tables/secondary-structures/table-units';
|
9
|
+
import { Grid } from '../../../../../../layout-formatter/table/grid-engine/grid';
|
9
10
|
import { RtfBuilder } from '../../../rtf-builder';
|
10
11
|
import { RtfContentExporter } from '../../rtf-content-exporter';
|
11
12
|
import { RtfTableCellPropertiesExporter } from '../rtf-table-cell-properties-exporter';
|
@@ -17,10 +18,11 @@ export declare abstract class RtfTableExporterStateBase {
|
|
17
18
|
tableStyleIndex: number;
|
18
19
|
rowLeftOffset: number;
|
19
20
|
readonly table: Table;
|
21
|
+
readonly grid: Grid;
|
20
22
|
readonly tableRowPropertiesExporter: RtfTableRowPropertiesExporter;
|
21
23
|
readonly tableCellPropertiesExporter: RtfTableCellPropertiesExporter;
|
22
24
|
readonly tablePropertiesExporter: RtfTablePropertiesExporter;
|
23
|
-
protected constructor(rtfExporter: RtfContentExporter, table: Table, nestingLevel: number);
|
25
|
+
protected constructor(rtfExporter: RtfContentExporter, table: Table, grid: Grid, nestingLevel: number);
|
24
26
|
protected get rtfBuilder(): RtfBuilder;
|
25
27
|
protected get documentModel(): DocumentModel;
|
26
28
|
protected get subDocument(): SubDocument;
|
@@ -36,7 +38,7 @@ export declare abstract class RtfTableExporterStateBase {
|
|
36
38
|
protected abstract exportRow(row: TableRow, rowIndex: number): void;
|
37
39
|
protected abstract writeParagraphEndMark(): void;
|
38
40
|
exportRowProperties(row: TableRow, rowIndex: number): void;
|
39
|
-
getCellWidth(
|
41
|
+
getCellWidth(leftSideIndex: number, columnSpan: number): number;
|
40
42
|
calculateRowLeft(row: TableRow, indent: TableWidthUnit): number;
|
41
43
|
protected calculateRowLeftOffset(row: TableRow): number;
|
42
44
|
getActualWidth(unit: TableWidthUnit): number;
|