devexpress-richedit 25.1.1-alpha → 25.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 +1 -1
- package/bin/webpack.config.js +1 -1
- package/dist/dx.richedit.css +1 -1
- package/dist/dx.richedit.d.ts +1 -2
- package/dist/dx.richedit.js +1732 -1362
- 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 +3 -3
- package/lib/client/commands/commands.js +0 -3
- 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/character-properties.js +13 -17
- package/lib/client/model-api/document.js +2 -0
- package/lib/client/model-api/formats/exporter.js +2 -2
- package/lib/client/model-api/images/images.js +1 -1
- package/lib/client/model-api/sub-document.js +1 -1
- package/lib/client/public/commands/enum.d.ts +1 -2
- package/lib/client/public/commands/enum.js +0 -1
- package/lib/client/public/options.d.ts +1 -0
- package/lib/client/public/rich-edit.js +2 -2
- package/lib/client/utils/focus-helper.js +22 -5
- package/lib/common/canvas/canvas-manager.js +38 -24
- package/lib/common/canvas/canvas-scroll-info.d.ts +6 -3
- package/lib/common/canvas/canvas-scroll-info.js +9 -4
- package/lib/common/canvas/canvas-scroll-manager.d.ts +4 -1
- package/lib/common/canvas/canvas-scroll-manager.js +28 -20
- package/lib/common/canvas/canvas-size-info.d.ts +4 -2
- package/lib/common/canvas/canvas-size-info.js +3 -5
- package/lib/common/canvas/renderes/canvas-listener/print-layout-view-canvas-listener.js +2 -2
- package/lib/common/canvas/renderes/common/document-renderer.d.ts +4 -1
- package/lib/common/canvas/renderes/common/document-renderer.js +15 -12
- package/lib/common/canvas/renderes/view-manager.d.ts +5 -1
- package/lib/common/canvas/renderes/view-manager.js +16 -7
- package/lib/common/commands/client-command.d.ts +1 -2
- package/lib/common/commands/client-command.js +0 -1
- package/lib/common/commands/command-manager.js +0 -2
- package/lib/common/commands/document/print-document-on-client-command.d.ts +2 -0
- package/lib/common/commands/document/print-document-on-client-command.js +46 -18
- 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/import/table/normalization/apply-use-values.d.ts +6 -0
- package/lib/common/formats/rtf/import/table/normalization/apply-use-values.js +90 -0
- package/lib/common/formats/rtf/import/table/table-converter.js +7 -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/input-controller.d.ts +5 -5
- package/lib/common/input-controller.js +16 -12
- package/lib/common/layout/document-layout.d.ts +5 -0
- package/lib/common/layout/document-layout.js +13 -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/row/word-holder.js +1 -1
- 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/caches/images.d.ts +4 -1
- package/lib/common/model/caches/images.js +6 -2
- package/lib/common/model/changes/change.d.ts +2 -1
- package/lib/common/model/changes/enums.d.ts +2 -1
- package/lib/common/model/changes/enums.js +1 -0
- package/lib/common/model/changes/model/zoom-level.d.ts +8 -0
- package/lib/common/model/changes/model/zoom-level.js +8 -0
- 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/creator/creator.js +6 -0
- package/lib/common/model/fields/field.d.ts +1 -1
- package/lib/common/model/fields/field.js +4 -3
- package/lib/common/model/fields/tree-creator.js +1 -1
- 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/manipulators/model-manipulator.d.ts +2 -1
- package/lib/common/model/manipulators/model-manipulator.js +4 -0
- package/lib/common/model/manipulators/picture-manipulator/picture-manipulator.js +2 -2
- package/lib/common/model/options/fonts.d.ts +1 -1
- package/lib/common/model/paragraph/paragraph-style.d.ts +2 -1
- package/lib/common/model/paragraph/paragraph-style.js +2 -1
- 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/mouse-handler/mouse-handler/mouse-handler-default-state.d.ts +1 -1
- package/lib/common/mouse-handler/mouse-handler/mouse-handler-default-state.js +22 -25
- package/lib/common/rich-edit-core.js +18 -18
- package/lib/common/ui/ruler/controls/ruler.js +3 -7
- package/lib/common/ui/ruler/controls/vertical-line.js +2 -1
- package/lib/common/ui/ruler/ruler.js +2 -0
- package/lib/common/utils/mixed-size.d.ts +27 -0
- package/lib/common/utils/mixed-size.js +91 -0
- package/lib/common/utils/size-utils.d.ts +14 -7
- package/lib/common/utils/size-utils.js +43 -18
- package/package.json +3 -3
- package/lib/common/commands/layout/toggle-allow-zoom-command.d.ts +0 -7
- package/lib/common/commands/layout/toggle-allow-zoom-command.js +0 -17
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -62,8 +62,8 @@ export class ClientRichEdit {
|
|
62
62
|
this.rawDataSource = settings.rawDataSource;
|
63
63
|
this.contextMenuSettings = settings.contextMenuSettings;
|
64
64
|
this.fullScreenHelper = new FullScreenHelper(element);
|
65
|
-
if ("
|
66
|
-
config(JSON.parse(atob("
|
65
|
+
if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaVZqSlJjRkZ0U2xaWVYzazJUbVY0YTNFNVdHczVieUlLZlE9PS5EMTNKeDFkWmJlWFE0bGVWQ05XZnk5U2FLeWFHbmxMOE1xYkF2YzloQ3FVZTlBajJWYzJUS2RaU01RR05xVkVkSjMrTWZQKzQrQTBqMFhCSGxEczdEV2xpWFlNK01EMEVCaEJVQ0JTVzVmeWRGSzhyOGpEMDRzV2ZKYS9CTDRFTGdLOWZpZz09In0=")
|
66
|
+
config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaVZqSlJjRkZ0U2xaWVYzazJUbVY0YTNFNVdHczVieUlLZlE9PS5EMTNKeDFkWmJlWFE0bGVWQ05XZnk5U2FLeWFHbmxMOE1xYkF2YzloQ3FVZTlBajJWYzJUS2RaU01RR05xVkVkSjMrTWZQKzQrQTBqMFhCSGxEczdEV2xpWFlNK01EMEVCaEJVQ0JTVzVmeWRGSzhyOGpEMDRzV2ZKYS9CTDRFTGdLOWZpZz09In0=")));
|
67
67
|
this.prepareElement(element, settings);
|
68
68
|
this.initDefaultFontsAndStyles();
|
69
69
|
this.initBars(settings.ribbon, settings.fonts);
|
@@ -247,7 +247,7 @@ export class ClientRichEdit {
|
|
247
247
|
const ribbonBar = new ClientRibbonBar(this, this.element, ribbon, fonts);
|
248
248
|
this.barHolder.ribbon = ribbonBar;
|
249
249
|
if (this.core) {
|
250
|
-
this.core.modelManager.modelManipulator.
|
250
|
+
this.core.modelManager.modelManipulator.addModelListener(this.barHolder.ribbon);
|
251
251
|
this.core.selection.onChanged.add(this.barHolder.ribbon);
|
252
252
|
ribbonBar.initialize(this.core);
|
253
253
|
}
|
@@ -441,9 +441,6 @@ export function executeApiCommandCore(commandManager, commandId, parameter) {
|
|
441
441
|
break;
|
442
442
|
}
|
443
443
|
;
|
444
|
-
case ViewTabCommandId.ToggleAllowZoom:
|
445
|
-
parameter = undefined;
|
446
|
-
break;
|
447
444
|
case HeaderAndFooterTabCommandId.GoToPageHeader:
|
448
445
|
parameter = undefined;
|
449
446
|
break;
|
@@ -44,7 +44,8 @@ export class MailMergeCommand extends CommandBase {
|
|
44
44
|
return true;
|
45
45
|
}
|
46
46
|
executeCore(_state, options) {
|
47
|
-
const
|
47
|
+
const exportModelOptions = this.control.getExportModelOptions();
|
48
|
+
const docxExporter = new DocxExporter(exportModelOptions, new DocxExportOptions());
|
48
49
|
docxExporter.exportToBlob((blob) => {
|
49
50
|
const docxImporter = new Importer(new ImporterOptions());
|
50
51
|
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;
|
@@ -23,11 +23,12 @@ export class Data {
|
|
23
23
|
get subDocumentExporter() { return this.subDocumentExporterStack.last; }
|
24
24
|
get relationExporter() { return ListUtils.last(this.relationExporters); }
|
25
25
|
get mainSubDocumentRelations() { return this.relationExporters[0]; }
|
26
|
-
constructor(
|
26
|
+
constructor(exportModelOptions, options) {
|
27
27
|
this.drawingElementId = 1;
|
28
28
|
this.exportSubDocumentsList = [];
|
29
29
|
this.relationExporters = [];
|
30
|
-
this.model = model;
|
30
|
+
this.model = exportModelOptions.modelManager.model;
|
31
|
+
this.grids = exportModelOptions.grids;
|
31
32
|
this.options = options;
|
32
33
|
this.constants = new DocxConstants();
|
33
34
|
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');
|
@@ -40,7 +40,7 @@ export function convertToCharacterPropertiesApi(properties, colorProvider) {
|
|
40
40
|
return value;
|
41
41
|
}
|
42
42
|
export function convertFromCharacterPropertiesApi(properties, fontInfoCache, parameterIndex, setRestAsUndefined, propsCoreTemplate) {
|
43
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
43
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
44
44
|
properties = ApiParametersChecker.check(properties, parameterIndex, false, [
|
45
45
|
ApiParametersChecker.objectDescriptor('properties', 'CharacterProperties', (val) => val)
|
46
46
|
]);
|
@@ -60,31 +60,27 @@ export function convertFromCharacterPropertiesApi(properties, fontInfoCache, par
|
|
60
60
|
propsCoreTemplate.fontItalic = (_d = ApiParametersChecker.check(properties.italic, parameterIndex, true, [
|
61
61
|
ApiParametersChecker.booleanDescriptor('properties.italic', (val) => val)
|
62
62
|
])) !== null && _d !== void 0 ? _d : propsCoreTemplate.fontItalic;
|
63
|
-
|
64
|
-
ApiParametersChecker.stringDescriptor('properties.fontName', (
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
return fontInfo;
|
69
|
-
}, false)
|
70
|
-
])) !== null && _e !== void 0 ? _e : propsCoreTemplate.fontInfo;
|
71
|
-
propsCoreTemplate.fontSize = (_f = ApiParametersChecker.check(properties.size, parameterIndex, true, [
|
63
|
+
const fontInfo = ApiParametersChecker.check(properties.fontName, parameterIndex, true, [
|
64
|
+
ApiParametersChecker.stringDescriptor('properties.fontName', (value) => fontInfoCache.getItemByName(value), false)
|
65
|
+
]);
|
66
|
+
propsCoreTemplate.fontInfo = fontInfo === undefined ? propsCoreTemplate.fontInfo : fontInfo !== null && fontInfo !== void 0 ? fontInfo : fontInfoCache.addFont(properties.fontName, properties.fontName);
|
67
|
+
propsCoreTemplate.fontSize = (_e = ApiParametersChecker.check(properties.size, parameterIndex, true, [
|
72
68
|
ApiParametersChecker.numberDescriptor('properties.size', (val) => val, 0, 601)
|
73
|
-
])) !== null &&
|
74
|
-
propsCoreTemplate.hidden = (
|
69
|
+
])) !== null && _e !== void 0 ? _e : propsCoreTemplate.fontSize;
|
70
|
+
propsCoreTemplate.hidden = (_f = ApiParametersChecker.check(properties.hidden, parameterIndex, true, [
|
75
71
|
ApiParametersChecker.booleanDescriptor('properties.hidden', (val) => val)
|
76
|
-
])) !== null &&
|
72
|
+
])) !== null && _f !== void 0 ? _f : propsCoreTemplate.hidden;
|
77
73
|
const shadigInfoColor = ApiParametersChecker.check(properties.backColor, parameterIndex, true, ModelParametersChecker.colorDescriptors('properties.backColor'));
|
78
74
|
propsCoreTemplate.shadingInfo = shadigInfoColor === undefined ? propsCoreTemplate.shadingInfo :
|
79
75
|
ShadingInfo.createByColor(ColorModelInfo.makeByColor(shadigInfoColor));
|
80
|
-
propsCoreTemplate.script = (
|
76
|
+
propsCoreTemplate.script = (_g = ApiParametersChecker.check(properties.script, parameterIndex, true, [
|
81
77
|
ApiParametersChecker.enumDescriptor('properties.script', (val) => val, CharacterPropertiesScriptApi, 'CharacterPropertiesScript')
|
82
|
-
])) !== null &&
|
78
|
+
])) !== null && _g !== void 0 ? _g : propsCoreTemplate.script;
|
83
79
|
const underlineColor = ApiParametersChecker.check(properties.underlineColor, parameterIndex, true, ModelParametersChecker.colorDescriptors('properties.underlineColor'));
|
84
80
|
propsCoreTemplate.underlineColor = underlineColor === undefined ? propsCoreTemplate.underlineColor : ColorModelInfo.makeByColor(underlineColor);
|
85
|
-
propsCoreTemplate.underlineWordsOnly = (
|
81
|
+
propsCoreTemplate.underlineWordsOnly = (_h = ApiParametersChecker.check(properties.underlineWordsOnly, parameterIndex, true, [
|
86
82
|
ApiParametersChecker.booleanDescriptor('properties.underlineWordsOnly', (val) => val)
|
87
|
-
])) !== null &&
|
83
|
+
])) !== null && _h !== void 0 ? _h : propsCoreTemplate.underlineWordsOnly;
|
88
84
|
const strikeout = ApiParametersChecker.check(properties.strikeout, parameterIndex, true, [
|
89
85
|
ApiParametersChecker.booleanDescriptor('properties.strikeout', (val) => val)
|
90
86
|
]);
|
@@ -7,6 +7,7 @@ import { HyperlinkCollection } from './collections/hyperlink-collection';
|
|
7
7
|
import { ListCollection } from './collections/numbered-list-collection';
|
8
8
|
import { SectionCollection } from './collections/section-collection';
|
9
9
|
import { SubDocumentCollection as SubDocumentCollection } from './collections/sub-documents-collection';
|
10
|
+
import { FontCorrector } from '../../common/model/creator/font-corrector';
|
10
11
|
export class RichEditDocumentApi {
|
11
12
|
constructor(processor) {
|
12
13
|
this._processor = processor;
|
@@ -105,6 +106,7 @@ export class RichEditDocumentApi {
|
|
105
106
|
this._processor.modelManager.model.defaultCharacterProperties =
|
106
107
|
this._processor.modelManager.model.cache.maskedCharacterPropertiesCache.getItem(propertiesCore);
|
107
108
|
NumberMapUtils.forEach(this._processor.modelManager.model.subDocuments, (sd) => sd.resetMergedFormattingCache(ResetFormattingCacheType.All));
|
109
|
+
new FontCorrector(this._processor.modelManager.modelManipulator, this._processor.modelManager.model, this._processor.modelManager.richOptions.fonts).correct();
|
108
110
|
this._processor.layoutFormatterManager.restartManager.restartAllLayout();
|
109
111
|
this._processor.endUpdate();
|
110
112
|
}
|
@@ -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:
|
@@ -197,7 +197,7 @@ export class ImagesApi {
|
|
197
197
|
applyVerticalPosition(verticalPosition, anchorInfo);
|
198
198
|
const anchorPictureInfo = new AnchorPictureInfo(new PictureSize(true, 0, cacheInfo, new Size(100, 100)), shape, anchorInfo, new NonVisualDrawingObjectInfo(), new NonVisualDrawingObjectInfo());
|
199
199
|
anchorPictureInfo.containerProperties.description = options.description;
|
200
|
-
this._processor.modelManager.modelManipulator.picture.insertAnchoredPictureViaHistory(new SubDocumentPosition(this._subDocument, position), inputPos.charPropsBundle, anchorPictureInfo,
|
200
|
+
this._processor.modelManager.modelManipulator.picture.insertAnchoredPictureViaHistory(new SubDocumentPosition(this._subDocument, position), inputPos.charPropsBundle, anchorPictureInfo, ImageLoadingOptions.initByActualSize(size ? new Size(size.width, size.height) : undefined, (_picInterval, _cacheInfo) => setTimeout(() => {
|
201
201
|
callback(getFloatingImageApiFromRun(this._processor, this._subDocument, this._subDocument.getRunAndIndexesByPosition(position)));
|
202
202
|
}, 0)));
|
203
203
|
this._processor.endUpdate();
|
@@ -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, [
|
@@ -150,8 +150,7 @@ export declare enum ViewTabCommandId {
|
|
150
150
|
SwitchToPrintLayout = 406,
|
151
151
|
ToggleShowHorizontalRuler = 94,
|
152
152
|
ToggleFullScreen = 98,
|
153
|
-
ChangeZoomLevel = 460
|
154
|
-
ToggleAllowZoom = 461
|
153
|
+
ChangeZoomLevel = 460
|
155
154
|
}
|
156
155
|
export declare enum HeaderAndFooterTabCommandId {
|
157
156
|
GoToPageHeader = 227,
|
@@ -158,7 +158,6 @@ export var ViewTabCommandId;
|
|
158
158
|
ViewTabCommandId[ViewTabCommandId["ToggleShowHorizontalRuler"] = 94] = "ToggleShowHorizontalRuler";
|
159
159
|
ViewTabCommandId[ViewTabCommandId["ToggleFullScreen"] = 98] = "ToggleFullScreen";
|
160
160
|
ViewTabCommandId[ViewTabCommandId["ChangeZoomLevel"] = 460] = "ChangeZoomLevel";
|
161
|
-
ViewTabCommandId[ViewTabCommandId["ToggleAllowZoom"] = 461] = "ToggleAllowZoom";
|
162
161
|
})(ViewTabCommandId || (ViewTabCommandId = {}));
|
163
162
|
export var HeaderAndFooterTabCommandId;
|
164
163
|
(function (HeaderAndFooterTabCommandId) {
|
@@ -160,11 +160,11 @@ class RichEditPublic {
|
|
160
160
|
command.execute(true, type);
|
161
161
|
}
|
162
162
|
get readOnly() {
|
163
|
-
return this._native.core.readOnly
|
163
|
+
return this._native.core.readOnly === ReadOnlyMode.Persistent;
|
164
164
|
}
|
165
165
|
set readOnly(value) {
|
166
166
|
if (this.readOnly != value) {
|
167
|
-
this._native.core.
|
167
|
+
this._native.core.setPersistentReadOnly(value);
|
168
168
|
this._native.core.barHolder.updateItemsState();
|
169
169
|
this._native.core.horizontalRulerControl.update();
|
170
170
|
this._native.core.beginUpdate();
|
@@ -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(',');
|
@@ -13,6 +13,7 @@ import { CursorPointer } from '../mouse-handler/mouse-handler/mouse-handler';
|
|
13
13
|
import { ResizeBoxListener } from './listeners/resize-box-listener';
|
14
14
|
import { SimpleViewCanvasSizeManager } from './renderes/common/document-renderer';
|
15
15
|
import { SizeUtils } from '../utils/size-utils';
|
16
|
+
import { MixedSize } from '../utils/mixed-size';
|
16
17
|
const SCROLL_INTERVAL_MS = 50;
|
17
18
|
const CSSCLASS_FOCUSED = "dxreInFocus";
|
18
19
|
const AUTOSCROLL_AREA_SIZE = 10;
|
@@ -248,35 +249,40 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
248
249
|
const clientRect = canvas.getBoundingClientRect();
|
249
250
|
const scaleX = this.getScale(clientRect.width, canvas.offsetWidth);
|
250
251
|
const scaleY = this.getScale(clientRect.height, canvas.offsetHeight);
|
251
|
-
const clientX = EvtUtils.getEventX(evt)
|
252
|
-
const clientY = EvtUtils.getEventY(evt)
|
253
|
-
const canvasX = DomUtils.getAbsolutePositionX(canvas)
|
254
|
-
const canvasY = DomUtils.getAbsolutePositionY(canvas)
|
255
|
-
const offsetY = canvas.scrollTop
|
256
|
-
const pageIndex = this.
|
257
|
-
const visibleAreaWidth = this.sizes.getVisibleAreaWidth(false)
|
258
|
-
const visibleAreaHeight = this.sizes.getVisibleAreaHeight(false)
|
252
|
+
const clientX = MixedSize.fromUI(EvtUtils.getEventX(evt));
|
253
|
+
const clientY = MixedSize.fromUI(EvtUtils.getEventY(evt));
|
254
|
+
const canvasX = MixedSize.fromUI(DomUtils.getAbsolutePositionX(canvas));
|
255
|
+
const canvasY = MixedSize.fromUI(DomUtils.getAbsolutePositionY(canvas));
|
256
|
+
const offsetY = MixedSize.fromUI(canvas.scrollTop).addSize(clientY).subtractSize(canvasY).useScale(scaleY);
|
257
|
+
const pageIndex = this.viewManager.layout.findPageIndexByOffsetY(offsetY.LayoutSize * scaleY, this.sizes);
|
258
|
+
const visibleAreaWidth = MixedSize.fromUI(this.sizes.getVisibleAreaWidth(false));
|
259
|
+
const visibleAreaHeight = MixedSize.fromUI(this.sizes.getVisibleAreaHeight(false));
|
259
260
|
if (checkScroll) {
|
260
|
-
|
261
|
+
const relativeX = new MixedSize().useScale(scaleX).addSize(canvasX).addSize(visibleAreaWidth).subtractSize(clientX);
|
262
|
+
if (this.sizes.scrollYVisible && relativeX.LayoutSize < 0)
|
261
263
|
return LayoutPoint.Empty();
|
262
|
-
|
264
|
+
const relativeY = new MixedSize().useScale(scaleY).addSize(canvasY).addSize(visibleAreaHeight).subtractSize(clientY);
|
265
|
+
if (this.sizes.scrollXVisible && relativeY.LayoutSize < 0)
|
263
266
|
return LayoutPoint.Empty();
|
264
267
|
}
|
265
268
|
const layoutPage = this.viewManager.layout.pages[pageIndex];
|
266
269
|
const renderPageCacheElem = this.viewManager.cache[pageIndex];
|
267
270
|
if (!layoutPage || !renderPageCacheElem)
|
268
271
|
return LayoutPoint.Empty();
|
269
|
-
|
272
|
+
const pageX = new MixedSize().useScale(scaleX).addUISize(canvas.scrollLeft).addSize(clientX).subtractSize(canvasX).subtractLayoutSize(renderPageCacheElem.page.offsetLeft).LayoutSize;
|
273
|
+
const pageY = new MixedSize().useScale(scaleY).addSize(offsetY).subtractLayoutSize(this.sizes.getPageOffsetY(layoutPage)).LayoutSize;
|
274
|
+
return new LayoutPoint(pageIndex, pageX, pageY);
|
270
275
|
}
|
271
276
|
isVisiblePosition(layoutPoint) {
|
272
|
-
const
|
273
|
-
this.
|
277
|
+
const layout = this.viewManager.layout;
|
278
|
+
const zoomLevel = this.viewManager.zoomLevel;
|
279
|
+
this.scroll.updatePageIndexesInfo(layout);
|
274
280
|
if (layoutPoint.pageIndex < this.scroll.startVisiblePageIndex || layoutPoint.pageIndex > this.scroll.endVisiblePageIndex)
|
275
281
|
return false;
|
276
|
-
const pageY = this.sizes.getPageOffsetY(pages[layoutPoint.pageIndex]);
|
277
|
-
const pageX = this.viewManager.cache[layoutPoint.pageIndex].page.offsetLeft;
|
278
|
-
const x = pageX
|
279
|
-
const y = pageY
|
282
|
+
const pageY = MixedSize.fromLayout(this.sizes.getPageOffsetY(layout.pages[layoutPoint.pageIndex])).useScale(zoomLevel);
|
283
|
+
const pageX = MixedSize.fromLayout(this.viewManager.cache[layoutPoint.pageIndex].page.offsetLeft).useScale(zoomLevel);
|
284
|
+
const x = pageX.addLayoutSize(layoutPoint.x).UISize;
|
285
|
+
const y = pageY.addLayoutSize(layoutPoint.y).UISize;
|
280
286
|
return x >= this.scroll.lastScrollLeft && x <= this.sizes.getVisibleAreaWidth(false) + this.scroll.lastScrollLeft &&
|
281
287
|
y >= this.scroll.lastScrollTop && y <= this.sizes.getVisibleAreaHeight(false) + this.scroll.lastScrollTop;
|
282
288
|
}
|
@@ -324,17 +330,23 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
324
330
|
onScrollIntervalTick() {
|
325
331
|
const evtX = this.lastMousePosition.x;
|
326
332
|
const evtY = this.lastMousePosition.y;
|
327
|
-
const inHorizontalArea = evtX >= this.canvasPosition.x && evtX <= this.canvasPosition.x + this.sizes.getVisibleAreaWidth(
|
328
|
-
const inVerticalArea = evtY >= this.canvasPosition.y && evtY <= this.canvasPosition.y + this.sizes.getVisibleAreaHeight(
|
333
|
+
const inHorizontalArea = evtX >= this.canvasPosition.x && evtX <= this.canvasPosition.x + this.sizes.getVisibleAreaWidth(false);
|
334
|
+
const inVerticalArea = evtY >= this.canvasPosition.y && evtY <= this.canvasPosition.y + this.sizes.getVisibleAreaHeight(false);
|
329
335
|
if (!inHorizontalArea && !inVerticalArea)
|
330
336
|
return;
|
337
|
+
const yOffsetWithoutScrollbar = this.canvasPosition.y + this.sizes.getVisibleAreaHeight(false) - evtY;
|
338
|
+
const yOffsetWithScrollbar = this.canvasPosition.y + this.sizes.getVisibleAreaHeight(true) - evtY;
|
339
|
+
const outsideHorizontalScrollbar = yOffsetWithoutScrollbar > 0 || yOffsetWithScrollbar < 0;
|
331
340
|
if (inHorizontalArea && evtY - this.canvasPosition.y <= AUTOSCROLL_AREA_SIZE)
|
332
341
|
this.viewManager.canvas.scrollTop -= AUTOSCROLL_STEP;
|
333
|
-
else if (inHorizontalArea &&
|
342
|
+
else if (inHorizontalArea && yOffsetWithoutScrollbar <= AUTOSCROLL_AREA_SIZE && outsideHorizontalScrollbar)
|
334
343
|
this.viewManager.canvas.scrollTop += AUTOSCROLL_STEP;
|
344
|
+
const xOffsetWithoutScrollbar = this.canvasPosition.x + this.sizes.getVisibleAreaWidth(false) - evtX;
|
345
|
+
const xOffsetWithScrollbar = this.canvasPosition.x + this.sizes.getVisibleAreaWidth(true) - evtX;
|
346
|
+
const outsideVerticalScrollbar = xOffsetWithoutScrollbar > 0 || xOffsetWithScrollbar < 0;
|
335
347
|
if (inVerticalArea && evtX - this.canvasPosition.x <= AUTOSCROLL_AREA_SIZE)
|
336
348
|
this.viewManager.canvas.scrollLeft -= AUTOSCROLL_STEP;
|
337
|
-
else if (inVerticalArea &&
|
349
|
+
else if (inVerticalArea && xOffsetWithoutScrollbar <= AUTOSCROLL_AREA_SIZE && outsideVerticalScrollbar)
|
338
350
|
this.viewManager.canvas.scrollLeft += AUTOSCROLL_STEP;
|
339
351
|
}
|
340
352
|
static getCursorClassName(pointer) {
|
@@ -378,10 +390,12 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
378
390
|
return ResizeBoxListener.directionToSource[className.substr(ind + cornerPrefix.length, 2).trim()];
|
379
391
|
}
|
380
392
|
getScrollTopInfo() {
|
381
|
-
const pages = this.viewManager.layout.pages;
|
382
393
|
const scrollTop = this.viewManager.canvas.scrollTop;
|
383
|
-
const pageIndex = this.
|
384
|
-
|
394
|
+
const pageIndex = this.viewManager.layout.findPageIndexByOffsetY(scrollTop, this.sizes);
|
395
|
+
const pages = this.viewManager.layout.pages;
|
396
|
+
const zoomLevel = this.viewManager.zoomLevel;
|
397
|
+
const pageOffsetY = this.sizes.getPageOffsetY(pages[pageIndex]);
|
398
|
+
return new ScrollTopInfo(pageIndex, new MixedSize().useScale(zoomLevel).addUISize(scrollTop).subtractLayoutSize(pageOffsetY).LayoutSize);
|
385
399
|
}
|
386
400
|
}
|
387
401
|
export class ScrollTopInfo {
|
@@ -1,9 +1,11 @@
|
|
1
|
-
import { LayoutPage } from '../layout/main-structures/layout-page';
|
2
1
|
import { BoundaryInterval } from '@devexpress/utils/lib/intervals/boundary';
|
3
2
|
import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
|
4
3
|
import { IInternalApi } from '../internal-api';
|
5
4
|
import { CanvasSizeInfo } from './canvas-size-info';
|
6
|
-
|
5
|
+
import { DocumentLayout } from '../layout/document-layout';
|
6
|
+
import { IModelChangesListener } from '../interfaces/model-changes-listener';
|
7
|
+
import { ModelChange } from '../model/changes/change';
|
8
|
+
export declare class CanvasScrollInfo implements IModelChangesListener {
|
7
9
|
protected static VISIBLE_PAGES_RANGE: number;
|
8
10
|
protected static VISIBLE_PAGES_RANGE_TOUCH: number;
|
9
11
|
protected static VISIBLE_AREA_HEIGHT_MULTIPLIER: number;
|
@@ -17,11 +19,12 @@ export declare class CanvasScrollInfo {
|
|
17
19
|
readonly internalApi: IInternalApi;
|
18
20
|
private _needUpdatePageIndexes;
|
19
21
|
constructor(canvas: HTMLDivElement, sizes: CanvasSizeInfo, internalApi: IInternalApi);
|
22
|
+
modelChanged(change: ModelChange): void;
|
20
23
|
init(canvas: HTMLDivElement, sizes: CanvasSizeInfo): void;
|
21
24
|
getStartRenderPageIndex(): number;
|
22
25
|
getEndRenderPageIndex(): number;
|
23
26
|
renderPageIndexInterval(): FixedInterval;
|
24
|
-
updatePageIndexesInfo(
|
27
|
+
updatePageIndexesInfo(layout: DocumentLayout): void;
|
25
28
|
getVisibleInterval(): BoundaryInterval;
|
26
29
|
private getScrollTop;
|
27
30
|
private getVisibleHeight;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Browser } from '@devexpress/utils/lib/browser';
|
2
2
|
import { BoundaryInterval } from '@devexpress/utils/lib/intervals/boundary';
|
3
3
|
import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
|
4
|
+
import { ModelChangeType } from '../model/changes/enums';
|
4
5
|
export class CanvasScrollInfo {
|
5
6
|
constructor(canvas, sizes, internalApi) {
|
6
7
|
this.lastScrollTop = -1;
|
@@ -11,6 +12,10 @@ export class CanvasScrollInfo {
|
|
11
12
|
this.internalApi = internalApi;
|
12
13
|
this.init(canvas, sizes);
|
13
14
|
}
|
15
|
+
modelChanged(change) {
|
16
|
+
if (change.type == ModelChangeType.ZoomLevelChanged)
|
17
|
+
this.onCanvasSizeChanged();
|
18
|
+
}
|
14
19
|
init(canvas, sizes) {
|
15
20
|
this.canvas = canvas;
|
16
21
|
this.sizes = sizes;
|
@@ -25,16 +30,16 @@ export class CanvasScrollInfo {
|
|
25
30
|
renderPageIndexInterval() {
|
26
31
|
return FixedInterval.fromPositions(this.getStartRenderPageIndex(), this.getEndRenderPageIndex() + 1);
|
27
32
|
}
|
28
|
-
updatePageIndexesInfo(
|
29
|
-
if (!pages.length)
|
33
|
+
updatePageIndexesInfo(layout) {
|
34
|
+
if (!layout.pages.length)
|
30
35
|
return;
|
31
36
|
const scrollTop = this.getScrollTop();
|
32
37
|
this.lastScrollLeft = this.canvas.scrollLeft;
|
33
38
|
if (this.startVisiblePageIndex >= 0 && scrollTop == this.lastScrollTop && !this._needUpdatePageIndexes)
|
34
39
|
return;
|
35
40
|
this._needUpdatePageIndexes = false;
|
36
|
-
this.startVisiblePageIndex =
|
37
|
-
this.endVisiblePageIndex =
|
41
|
+
this.startVisiblePageIndex = layout.findPageIndexByOffsetY(scrollTop, this.sizes);
|
42
|
+
this.endVisiblePageIndex = layout.findPageIndexByOffsetY(scrollTop + this.getVisibleHeight(), this.sizes);
|
38
43
|
this.lastScrollTop = scrollTop;
|
39
44
|
}
|
40
45
|
getVisibleInterval() {
|