devexpress-richedit 24.2.7-build-25100-0108 → 24.2.7
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/dist/dx.richedit.js +259 -210
- package/dist/dx.richedit.min.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/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 +1 -1
- package/lib/client/public/rich-edit.js +2 -2
- package/lib/common/canvas/renderes/common/document-renderer.js +10 -12
- package/lib/common/formats/i-document-exporter.d.ts +3 -0
- package/lib/common/input-controller.d.ts +5 -5
- package/lib/common/input-controller.js +12 -12
- 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-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/states.js +0 -2
- package/lib/common/layout-formatter/row/tab-info.js +1 -1
- 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 +3 -2
- package/lib/common/utils/size-utils.d.ts +7 -0
- package/lib/common/utils/size-utils.js +31 -4
- package/package.json +3 -3
@@ -61,8 +61,8 @@ export class ClientRichEdit {
|
|
61
61
|
this.rawDataSource = settings.rawDataSource;
|
62
62
|
this.contextMenuSettings = settings.contextMenuSettings;
|
63
63
|
this.fullScreenHelper = new FullScreenHelper(element);
|
64
|
-
if ("
|
65
|
-
config(JSON.parse(atob("
|
64
|
+
if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaVVUTmhiM0ZJYzFKRU0zWllaVlZOVUdSWVNEZHhOU0lLZlE9PS5rMTA4KzRjbVFYSU96S1F1bUlqUE5oQkw0ejc5N0VSNlByVkkxcTB3V1QwbnkwUTVNZnkzRkJONlV5Zk9PV2p1eUJwaDR1ZllMM0llb0g4UHhNUU5wQUhUb3VUTTFFOHZaM01CM0lac2c1L1ZoOXhUNkg4TFJQSGZoQk00Rk5HUE5zNkY0dz09In0=")
|
65
|
+
config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaVVUTmhiM0ZJYzFKRU0zWllaVlZOVUdSWVNEZHhOU0lLZlE9PS5rMTA4KzRjbVFYSU96S1F1bUlqUE5oQkw0ejc5N0VSNlByVkkxcTB3V1QwbnkwUTVNZnkzRkJONlV5Zk9PV2p1eUJwaDR1ZllMM0llb0g4UHhNUU5wQUhUb3VUTTFFOHZaM01CM0lac2c1L1ZoOXhUNkg4TFJQSGZoQk00Rk5HUE5zNkY0dz09In0=")));
|
66
66
|
this.prepareElement(element, settings);
|
67
67
|
this.initDefaultFontsAndStyles();
|
68
68
|
this.initBars(settings.ribbon, settings.fonts);
|
@@ -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) => {
|
@@ -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,7 +15,7 @@ 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(
|
18
|
+
case DocumentFormat.OpenXml: return new DocxExporter(exportModelOptions, new DocxExportOptions());
|
19
19
|
case DocumentFormat.Rtf: return new RtfExporter(modelManipulator, new RtfDocumentExporterOptions());
|
20
20
|
case DocumentFormat.PlainText: return new TxtExporter(modelManipulator, new DocumentExporterOptions());
|
21
21
|
case DocumentFormat.Html: return new HtmlDocumentExporter(exportModelOptions, new DocumentExporterOptions());
|
@@ -158,11 +158,11 @@ class RichEditPublic {
|
|
158
158
|
command.execute(true, type);
|
159
159
|
}
|
160
160
|
get readOnly() {
|
161
|
-
return this._native.core.readOnly
|
161
|
+
return this._native.core.readOnly === ReadOnlyMode.Persistent;
|
162
162
|
}
|
163
163
|
set readOnly(value) {
|
164
164
|
if (this.readOnly != value) {
|
165
|
-
this._native.core.
|
165
|
+
this._native.core.setPersistentReadOnly(value);
|
166
166
|
this._native.core.barHolder.updateItemsState();
|
167
167
|
this._native.core.horizontalRulerControl.update();
|
168
168
|
this._native.core.beginUpdate();
|
@@ -77,18 +77,16 @@ export class SimpleViewCanvasSizeManager {
|
|
77
77
|
this.sizeUpdated = true;
|
78
78
|
}
|
79
79
|
changeSizeCore() {
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
this.control.selection.
|
87
|
-
.setModelPosition(this.control.selection.lastSelectedInterval.start).useStdRelativePosition().useStdOffset());
|
88
|
-
}
|
89
|
-
this.control.owner.adjustControl();
|
90
|
-
this.control.horizontalRulerControl.update();
|
80
|
+
ListUtils.forEach(this.control.viewManager.cache, (_val) => this.control.viewManager.renderer.removePage(1), 1);
|
81
|
+
this.control.viewManager.ensureFirstPageIsRendered();
|
82
|
+
this.control.innerClientProperties.viewsSettings.widthOfPage = this.canvasManager.getCanvasWidth();
|
83
|
+
if (this.control.layoutFormatterManager) {
|
84
|
+
this.control.layoutFormatterManager.invalidator.onChangedAllLayout();
|
85
|
+
this.control.selection.scrollManager.setScroll(new ScrollState().byModelPosition(this.control.selection)
|
86
|
+
.setModelPosition(this.control.selection.lastSelectedInterval.start).useStdRelativePosition().useStdOffset());
|
91
87
|
}
|
88
|
+
this.control.owner.adjustControl();
|
89
|
+
this.control.horizontalRulerControl.update();
|
92
90
|
}
|
93
91
|
}
|
94
92
|
export class DocumentRenderer {
|
@@ -272,7 +270,7 @@ export class DocumentRenderer {
|
|
272
270
|
}
|
273
271
|
}
|
274
272
|
updatePageSize(page, pageElement) {
|
275
|
-
if (pageElement.offsetHeight != page.height || pageElement.offsetWidth != page.width)
|
273
|
+
if (pageElement.offsetHeight != Math.round(page.height) || pageElement.offsetWidth != Math.round(page.width))
|
276
274
|
DomUtils.setStyleSize(pageElement.style, page);
|
277
275
|
}
|
278
276
|
updatePageClasses(pageElement) {
|
@@ -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
|
}
|
@@ -17,7 +17,7 @@ export declare abstract class InputEditorBase<TInpElement extends HTMLElement> {
|
|
17
17
|
previousText: string;
|
18
18
|
canInsertTextOnInputEvent: boolean;
|
19
19
|
needProcessShortcut: boolean;
|
20
|
-
|
20
|
+
editableStateInitialized: boolean;
|
21
21
|
prevKeyCode: number;
|
22
22
|
IMEState: IMEState;
|
23
23
|
private inputWithAlt;
|
@@ -31,8 +31,8 @@ export declare abstract class InputEditorBase<TInpElement extends HTMLElement> {
|
|
31
31
|
constructor(control: IRichEditControl, eventManager: IEventManager, parent: HTMLElement);
|
32
32
|
dispose(): void;
|
33
33
|
initialize(): void;
|
34
|
-
|
35
|
-
|
34
|
+
initializeEditableState(): void;
|
35
|
+
initializeEditableStateCore(): void;
|
36
36
|
initEvents(): void;
|
37
37
|
createHierarchy(parent: HTMLElement): void;
|
38
38
|
createHierarchyCore(): void;
|
@@ -78,7 +78,7 @@ export declare class DivInputEditor extends InputEditorBase<HTMLElement> {
|
|
78
78
|
private onTextInputTimerId;
|
79
79
|
constructor(control: IRichEditControl, eventManager: IEventManager, parent: HTMLElement);
|
80
80
|
dispose(): void;
|
81
|
-
|
81
|
+
initializeEditableStateCore(): void;
|
82
82
|
setPosition(left: number, top: number): void;
|
83
83
|
createInputElement(): HTMLElement;
|
84
84
|
initEvents(): void;
|
@@ -114,7 +114,7 @@ export declare class IFrameInputEditor extends InputEditorBase<HTMLIFrameElement
|
|
114
114
|
constructor(control: IRichEditControl, eventManager: IEventManager, parent: HTMLElement);
|
115
115
|
dispose(): void;
|
116
116
|
createHierarchyCore(): void;
|
117
|
-
|
117
|
+
initializeEditableStateCore(): void;
|
118
118
|
createInputElement(): HTMLIFrameElement;
|
119
119
|
initEvents(): void;
|
120
120
|
private isModifyEnabled;
|
@@ -51,17 +51,17 @@ export class InputEditorBase {
|
|
51
51
|
clearTimeout(this.onKeyUpTimerId);
|
52
52
|
}
|
53
53
|
initialize() {
|
54
|
-
this.
|
54
|
+
this.initializeEditableState();
|
55
55
|
this.initEvents();
|
56
56
|
this.prevKeyCode = EMPTY_KEYCODE;
|
57
57
|
}
|
58
|
-
|
59
|
-
if (
|
60
|
-
this.
|
61
|
-
this.
|
58
|
+
initializeEditableState() {
|
59
|
+
if (!this.editableStateInitialized) {
|
60
|
+
this.editableStateInitialized = true;
|
61
|
+
this.initializeEditableStateCore();
|
62
62
|
}
|
63
63
|
}
|
64
|
-
|
64
|
+
initializeEditableStateCore() {
|
65
65
|
}
|
66
66
|
initEvents() {
|
67
67
|
this.evtHandlersHolder.addListener(this.getEditableDocument(), "keydown", this.onKeyDown.bind(this));
|
@@ -281,8 +281,8 @@ export class DivInputEditor extends InputEditorBase {
|
|
281
281
|
clearTimeout(this.composEndTimerId);
|
282
282
|
clearTimeout(this.onTextInputTimerId);
|
283
283
|
}
|
284
|
-
|
285
|
-
this.inputElement.contentEditable =
|
284
|
+
initializeEditableStateCore() {
|
285
|
+
this.inputElement.contentEditable = String(!this.control.isReadOnlyPersistent);
|
286
286
|
this.clearInputElement();
|
287
287
|
}
|
288
288
|
setPosition(left, top) {
|
@@ -530,11 +530,11 @@ export class IFrameInputEditor extends InputEditorBase {
|
|
530
530
|
body.style.margin = "0px";
|
531
531
|
body.style.overflow = "hidden";
|
532
532
|
}
|
533
|
-
|
533
|
+
initializeEditableStateCore() {
|
534
534
|
if (Browser.WebKitFamily)
|
535
|
-
this.editableDocument.body.setAttribute("contenteditable",
|
535
|
+
this.editableDocument.body.setAttribute("contenteditable", String(!this.control.isReadOnlyPersistent));
|
536
536
|
else
|
537
|
-
this.editableDocument.designMode = "on";
|
537
|
+
this.editableDocument.designMode = this.control.isReadOnlyPersistent ? "off" : "on";
|
538
538
|
}
|
539
539
|
createInputElement() {
|
540
540
|
const element = document.createElement("IFRAME");
|
@@ -673,7 +673,7 @@ export class IFrameInputEditor extends InputEditorBase {
|
|
673
673
|
recreateIfNeeded() {
|
674
674
|
const iframeDocument = this.inputElement.contentDocument || this.inputElement.contentWindow.document;
|
675
675
|
if (!iframeDocument.body.hasAttribute("loaded")) {
|
676
|
-
this.
|
676
|
+
this.editableStateInitialized = false;
|
677
677
|
this.createHierarchyCore();
|
678
678
|
this.initialize();
|
679
679
|
}
|
@@ -2,6 +2,8 @@ import { DocumentModel } from '../model/document-model';
|
|
2
2
|
import { PositionManager } from '../model/position/position-manager';
|
3
3
|
import { LayoutAnchoredObjectBox } from './main-structures/layout-boxes/layout-anchored-object-box';
|
4
4
|
import { LayoutPage } from './main-structures/layout-page';
|
5
|
+
import { Grid } from '../layout-formatter/table/grid-engine/grid';
|
6
|
+
import { Table } from '../model/tables/main-structures/table';
|
5
7
|
export declare class ModelPositionHolder {
|
6
8
|
private pos;
|
7
9
|
private posManager;
|
@@ -25,6 +27,7 @@ export declare class DocumentLayout {
|
|
25
27
|
isFullyFormatted: boolean;
|
26
28
|
anchorObjectsPositionInfo: AnchorObjectsPositionInfo;
|
27
29
|
pageColor: number;
|
30
|
+
get grids(): Map<Table, Grid>;
|
28
31
|
constructor(anchorObjectsPositionInfo: AnchorObjectsPositionInfo);
|
29
32
|
setEmptyLayout(pageColor: number): void;
|
30
33
|
getLastValidPage(): LayoutPage;
|
@@ -37,6 +37,12 @@ export class AnchorObjectsPositionInfo {
|
|
37
37
|
}
|
38
38
|
}
|
39
39
|
export class DocumentLayout {
|
40
|
+
get grids() {
|
41
|
+
return this.pages.reduce((res, page) => {
|
42
|
+
page.grids.forEach((grid, table) => res.set(table, grid));
|
43
|
+
return res;
|
44
|
+
}, new Map());
|
45
|
+
}
|
40
46
|
constructor(anchorObjectsPositionInfo) {
|
41
47
|
this.anchorObjectsPositionInfo = anchorObjectsPositionInfo;
|
42
48
|
this.setEmptyLayout(ColorHelper.NO_COLOR);
|
@@ -1,10 +1,13 @@
|
|
1
1
|
import { Rectangle } from '@devexpress/utils/lib/geometry/rectangle';
|
2
2
|
import { SubDocument } from '../../model/sub-document';
|
3
3
|
import { LayoutColumn } from './layout-column';
|
4
|
+
import { Grid } from '../../layout-formatter/table/grid-engine/grid';
|
5
|
+
import { Table } from '../../model/tables/main-structures/table';
|
4
6
|
export declare class LayoutPageArea extends Rectangle {
|
5
7
|
subDocument: SubDocument;
|
6
8
|
columns: LayoutColumn[];
|
7
9
|
pageOffset: number;
|
10
|
+
get grids(): Map<Table, Grid>;
|
8
11
|
constructor(subDocument: SubDocument);
|
9
12
|
getEndPosition(): number;
|
10
13
|
getLastColumn(): LayoutColumn;
|
@@ -1,6 +1,12 @@
|
|
1
1
|
import { Rectangle } from '@devexpress/utils/lib/geometry/rectangle';
|
2
2
|
import { ListUtils } from '@devexpress/utils/lib/utils/list';
|
3
3
|
export class LayoutPageArea extends Rectangle {
|
4
|
+
get grids() {
|
5
|
+
return this.columns.reduce((res, column) => {
|
6
|
+
column.tablesInfo.forEach(tableInfo => res.set(tableInfo.logicInfo.grid.table, tableInfo.logicInfo.grid));
|
7
|
+
return res;
|
8
|
+
}, new Map());
|
9
|
+
}
|
4
10
|
constructor(subDocument) {
|
5
11
|
super(0, 0, 0, 0);
|
6
12
|
this.columns = [];
|
@@ -8,6 +8,8 @@ import { AnchorObjectsPositionInfo } from '../document-layout';
|
|
8
8
|
import { LayoutAnchoredObjectBox } from './layout-boxes/layout-anchored-object-box';
|
9
9
|
import { LayoutPageArea } from './layout-page-area';
|
10
10
|
import { TableAnchoredObjectsHolder } from '../../layout-formatter/table/utils/table-anchored-objects-holder';
|
11
|
+
import { Grid } from '../../layout-formatter/table/grid-engine/grid';
|
12
|
+
import { Table } from '../../model/tables/main-structures/table';
|
11
13
|
export declare enum LayoutPageFlags {
|
12
14
|
MustBeRendered = 1,
|
13
15
|
ContentRendered = 2,
|
@@ -42,6 +44,7 @@ export declare class LayoutPage extends Rectangle {
|
|
42
44
|
tableAnchoredObjectsHolder: TableAnchoredObjectsHolder;
|
43
45
|
renderLevelCalculator: RenderLevelCalculator;
|
44
46
|
private contentIntervals;
|
47
|
+
get grids(): Map<Table, Grid>;
|
45
48
|
constructor();
|
46
49
|
setRenderLevelCalculator(anchorObjectsPositionInfo: AnchorObjectsPositionInfo, compatibilityMode: CompatibilityMode): void;
|
47
50
|
setAbsolutePosition(pos: number): void;
|
@@ -38,6 +38,14 @@ export class LayoutOtherPageAreasInfo {
|
|
38
38
|
}
|
39
39
|
}
|
40
40
|
export class LayoutPage extends Rectangle {
|
41
|
+
get grids() {
|
42
|
+
const result = new Map();
|
43
|
+
for (let pageArea of this.mainSubDocumentPageAreas)
|
44
|
+
pageArea.grids.forEach((grid, table) => result.set(table, grid));
|
45
|
+
for (let pageArea of Object.values(this.otherPageAreas))
|
46
|
+
pageArea.grids.forEach((grid, table) => result.set(table, grid));
|
47
|
+
return result;
|
48
|
+
}
|
41
49
|
constructor() {
|
42
50
|
super(0, 0, 0, 0);
|
43
51
|
this.mainSubDocumentPageAreas = [];
|
@@ -41,7 +41,7 @@ export class AnchorObjectHorizontalPositionCalculator extends AnchorObjectPositi
|
|
41
41
|
alignment(type, alignment) {
|
42
42
|
switch (type) {
|
43
43
|
case AnchorObjectHorizontalPositionType.Character:
|
44
|
-
return this.getAlignPosition(alignment, 0);
|
44
|
+
return this.getAnchorXPosition() + this.getAlignPosition(alignment, 0);
|
45
45
|
case AnchorObjectHorizontalPositionType.Column:
|
46
46
|
return this.isRelativeCell ?
|
47
47
|
this.relativeColumnPos() + this.lp.row.tableCellInfo.x +
|
@@ -90,17 +90,8 @@ export class AnchorObjectHorizontalPositionCalculator extends AnchorObjectPositi
|
|
90
90
|
return this.isRelativeCell ? this.relativeColumnPos() + this.lp.row.tableCellInfo.x : 0;
|
91
91
|
case AnchorObjectHorizontalPositionType.Column:
|
92
92
|
return this.isRelativeCell ? this.relativeColumnPos() + this.lp.row.tableCellInfo.x + this.leftCellMargin : this.relativeColumnPos();
|
93
|
-
case AnchorObjectHorizontalPositionType.Character:
|
94
|
-
|
95
|
-
const ancBoxAbsPos = this.obj.rowOffset;
|
96
|
-
const boxIndex = SearchUtils.normedInterpolationIndexOf(this.lp.row.boxes, (box) => rowAbsPos + box.rowOffset, ancBoxAbsPos);
|
97
|
-
const box = this.lp.row.boxes[boxIndex];
|
98
|
-
if (!box)
|
99
|
-
return this.lp.getLayoutX(null, DocumentLayoutDetailsLevel.Row);
|
100
|
-
const symbolCount = Math.max(0, ancBoxAbsPos - rowAbsPos - box.rowOffset);
|
101
|
-
return this.lp.getLayoutX(null, DocumentLayoutDetailsLevel.Row) + box.x +
|
102
|
-
box.getCharOffsetXInPixels(this.manager.measurer, symbolCount);
|
103
|
-
}
|
93
|
+
case AnchorObjectHorizontalPositionType.Character:
|
94
|
+
return this.getAnchorXPosition();
|
104
95
|
case AnchorObjectHorizontalPositionType.Margin:
|
105
96
|
return this.isRelativeCell ? this.relativeColumnPos() + this.lp.row.tableCellInfo.x + this.leftCellMargin :
|
106
97
|
this.manager.boundsCalculator.marginLeft;
|
@@ -117,6 +108,19 @@ export class AnchorObjectHorizontalPositionCalculator extends AnchorObjectPositi
|
|
117
108
|
throw new Error(Errors.InternalException);
|
118
109
|
}
|
119
110
|
}
|
111
|
+
getAnchorXPosition() {
|
112
|
+
const rowAbsPos = this.lp.getLogPosition(DocumentLayoutDetailsLevel.Row);
|
113
|
+
const ancBoxAbsPos = this.obj.rowOffset;
|
114
|
+
let boxIndex = SearchUtils.normedInterpolationIndexOf(this.lp.row.boxes, (box) => rowAbsPos + box.rowOffset, ancBoxAbsPos);
|
115
|
+
if (boxIndex < 0)
|
116
|
+
boxIndex = 0;
|
117
|
+
const box = this.lp.row.boxes[boxIndex];
|
118
|
+
if (!box)
|
119
|
+
return this.lp.getLayoutX(null, DocumentLayoutDetailsLevel.Row);
|
120
|
+
const symbolCount = Math.max(0, ancBoxAbsPos - rowAbsPos - box.rowOffset);
|
121
|
+
return this.lp.getLayoutX(null, DocumentLayoutDetailsLevel.Row) + box.x +
|
122
|
+
box.getCharOffsetXInPixels(this.manager.measurer, symbolCount);
|
123
|
+
}
|
120
124
|
bookLayout() {
|
121
125
|
return this.alignment(this.anchorInfo.horizontalPositionType, AnchorObjectHorizontalPositionCalculator.mapBookLayoutALignmentType[this.anchorInfo.horizontalPositionAlignment]);
|
122
126
|
}
|
@@ -85,7 +85,7 @@ export class RowTabInfo {
|
|
85
85
|
const lastInterval = ListUtils.last(this.rowFormatter.rowSizesManager.rowFormattingInfo.intervals);
|
86
86
|
if (tabXPosRelativePage > lastInterval.end) {
|
87
87
|
if (lastInterval.end < this.rowFormatter.paragraphHorizontalBounds.end) {
|
88
|
-
if (this.rowFormatter.manager.model.compatibilitySettings.compatibilityMode < CompatibilityMode.Word2013) {
|
88
|
+
if (this.rowFormatter.manager.model.compatibilitySettings.compatibilityMode < CompatibilityMode.Word2013 && tabPosition !== null) {
|
89
89
|
this.currInterval.avaliableWidth = Number.MAX_SAFE_INTEGER - this.currInterval.busyWidth;
|
90
90
|
this.currInterval.length = Number.MAX_SAFE_INTEGER;
|
91
91
|
this.row.width = Number.MAX_SAFE_INTEGER;
|
@@ -32,7 +32,7 @@ export declare class MouseHandlerDefaultState extends MouseHandlerStateBase {
|
|
32
32
|
private shouldBeginDragExistingSelection;
|
33
33
|
private selectImage;
|
34
34
|
private beginDragExistingSelection;
|
35
|
-
selectFloatingObject(box: LayoutAnchoredObjectBox):
|
35
|
+
selectFloatingObject(box: LayoutAnchoredObjectBox): boolean;
|
36
36
|
}
|
37
37
|
export declare class MouseHandlerHelper {
|
38
38
|
static selectParentsTextBox(control: IRichEditControl): void;
|
@@ -168,40 +168,31 @@ export class MouseHandlerDefaultState extends MouseHandlerStateBase {
|
|
168
168
|
this.processMouseDownOnMaxDetailsLevel(evt, htr, activeSubDocument);
|
169
169
|
}
|
170
170
|
processMouseDownOnMaxDetailsLevel(evt, htr, activeSubDocument) {
|
171
|
+
const selection = this.handler.control.selection;
|
171
172
|
if (htr.floatingObject) {
|
172
|
-
if (htr.floatingObject.belongsToSubDocId != this.handler.control.selection.activeSubDocument.id)
|
173
|
-
MouseHandlerHelper.changeActiveSubDocumentToParent(this.handler.control);
|
174
173
|
const box = htr.floatingObject;
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
if (
|
179
|
-
HitTestManager.isPointInTexBoxArea(evt.layoutPoint, box, activeSubDocument.isTextBox() ? 0 : box.rotationInRadians)) {
|
174
|
+
const rotationAngle = activeSubDocument.isTextBox() ? 0 : box.rotationInRadians;
|
175
|
+
if (box.getType() == LayoutBoxType.AnchorTextBox && HitTestManager.isPointInTexBoxArea(evt.layoutPoint, box, rotationAngle)) {
|
176
|
+
const textbox = box;
|
177
|
+
if (textbox.internalSubDocId !== selection.activeSubDocument.id && this.selectFloatingObject(box)) {
|
180
178
|
this.handler.control.commandManager.getCommand(RichEditClientCommand.ChangeActiveSubDocumentToTextBox).execute(this.handler.control.commandManager.isPublicApiCall);
|
181
179
|
this.handler.boxVisualizerManager.resizeBoxVisualizer.show(htr.pageIndex, null, null, null, box);
|
182
|
-
htr = this.handler.control.hitTestManager.calculate(evt.layoutPoint, DocumentLayoutDetailsLevel.Max,
|
183
|
-
}
|
184
|
-
else {
|
185
|
-
if (this.resizeRotationChecker(() => {
|
186
|
-
const dragFloatingObjectState = new MouseHandlerDragFloatingObjectState(this.handler, evt);
|
187
|
-
this.handler.switchState(new MouseHandlerBeginDragHelperState(evt.layoutPoint, this.handler, dragFloatingObjectState));
|
188
|
-
}))
|
189
|
-
return;
|
190
|
-
else {
|
191
|
-
if (specRunInfo.isPictureSelected()) {
|
192
|
-
this.handler.control.selection.setSelection(new SetSelectionParams()
|
193
|
-
.setInterval(new FixedInterval(specRunInfo.getPicturePosition(), 1)));
|
194
|
-
return;
|
195
|
-
}
|
196
|
-
}
|
180
|
+
htr = this.handler.control.hitTestManager.calculate(evt.layoutPoint, DocumentLayoutDetailsLevel.Max, selection.activeSubDocument);
|
197
181
|
}
|
198
182
|
}
|
183
|
+
else {
|
184
|
+
if (this.selectFloatingObject(box) && this.resizeRotationChecker(() => {
|
185
|
+
const dragFloatingObjectState = new MouseHandlerDragFloatingObjectState(this.handler, evt);
|
186
|
+
this.handler.switchState(new MouseHandlerBeginDragHelperState(evt.layoutPoint, this.handler, dragFloatingObjectState));
|
187
|
+
}))
|
188
|
+
return;
|
189
|
+
}
|
199
190
|
}
|
200
191
|
if (Browser.TouchUI && htr.subDocument.isMain() && htr.exactlyDetailLevel < DocumentLayoutDetailsLevel.PageArea) {
|
201
192
|
if (htr.deviations[DocumentLayoutDetailsLevel.PageArea] & HitTestDeviation.Top || htr.deviations[DocumentLayoutDetailsLevel.PageArea] & HitTestDeviation.Bottom)
|
202
193
|
this.handler.control.viewManager.canvasScrollManager.waitForDblClick();
|
203
194
|
}
|
204
|
-
if (evt.button === MouseButton.Right &&
|
195
|
+
if (evt.button === MouseButton.Right && selection.lastSelectedInterval.contains(htr.getPosition()))
|
205
196
|
return;
|
206
197
|
if (this.shouldSelectEntireTableColumn(htr))
|
207
198
|
this.beginSelectEntireTableColumn(htr, evt);
|
@@ -216,7 +207,7 @@ export class MouseHandlerDefaultState extends MouseHandlerStateBase {
|
|
216
207
|
this.beginSelectEntireTableCell(htr, evt);
|
217
208
|
}
|
218
209
|
else if (this.isLeftArea(htr, evt)) {
|
219
|
-
if (evt.modifiers & ModifierKey.Ctrl &&
|
210
|
+
if (evt.modifiers & ModifierKey.Ctrl && selection.isCollapsed())
|
220
211
|
this.handler.control.commandManager.getCommand(RichEditClientCommand.SelectAll).execute(this.handler.control.commandManager.isPublicApiCall, htr.getPosition());
|
221
212
|
else if (this.isLeftAreaOffset(htr, evt))
|
222
213
|
this.beginLineSelection(htr, evt);
|
@@ -424,8 +415,14 @@ export class MouseHandlerDefaultState extends MouseHandlerStateBase {
|
|
424
415
|
this.handler.switchState(state);
|
425
416
|
}
|
426
417
|
selectFloatingObject(box) {
|
418
|
+
const selection = this.handler.control.selection;
|
419
|
+
if (box.belongsToSubDocId !== selection.activeSubDocument.id)
|
420
|
+
MouseHandlerHelper.changeActiveSubDocumentToParent(this.handler.control);
|
421
|
+
if (box.belongsToSubDocId !== selection.activeSubDocument.id)
|
422
|
+
return false;
|
427
423
|
const pos = this.handler.control.layout.anchorObjectsPositionInfo.getPosition(box.objectId);
|
428
|
-
|
424
|
+
selection.setSelection(new SetSelectionParams().setInterval(new FixedInterval(pos, 1)));
|
425
|
+
return selection.specialRunInfo.isSelectedAnchorObject;
|
429
426
|
}
|
430
427
|
}
|
431
428
|
export class MouseHandlerHelper {
|
@@ -45,7 +45,7 @@ import { HorizontalRulerControl } from './ui/ruler/ruler';
|
|
45
45
|
import { SearchManager } from './ui/search-manager';
|
46
46
|
import { isDefined } from '@devexpress/utils/lib/utils/common';
|
47
47
|
export class RichEditCore {
|
48
|
-
get isReadOnlyPersistent() { return this.readOnly
|
48
|
+
get isReadOnlyPersistent() { return this.readOnly === ReadOnlyMode.Persistent; }
|
49
49
|
get model() { return this.modelManager.model; }
|
50
50
|
get isDisposed() {
|
51
51
|
return this._isDisposed;
|
@@ -257,8 +257,8 @@ export class RichEditCore {
|
|
257
257
|
this.readOnly = ReadOnlyMode.Persistent;
|
258
258
|
else if (!readOnly && this.readOnly === ReadOnlyMode.Persistent) {
|
259
259
|
this.readOnly = ReadOnlyMode.None;
|
260
|
-
this.inputController.inputEditor.initializeIfNotReadOnly();
|
261
260
|
}
|
261
|
+
this.inputController.inputEditor.initializeEditableStateCore();
|
262
262
|
}
|
263
263
|
setWorkSession(sessionGuid, documentInfo) {
|
264
264
|
this.sessionGuid = sessionGuid;
|
@@ -384,6 +384,7 @@ export class RichEditCore {
|
|
384
384
|
pictureRenderer: this.viewManager.renderer,
|
385
385
|
uiUnitConverter: this.uiUnitConverter,
|
386
386
|
lastMaxNumPages: this.layout.lastMaxNumPages,
|
387
|
+
grids: this.layout.grids,
|
387
388
|
pageIndex: this.selection.pageIndex,
|
388
389
|
sessionGuid: this.sessionGuid,
|
389
390
|
clientGuid: this.clientGuid,
|