devexpress-richedit 24.2.7-build-25079-0118 → 25.1.1-alpha
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 +11 -3
- package/dist/dx.richedit.js +1555 -1230
- package/dist/dx.richedit.min.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/client/_constants.d.ts +1 -0
- package/lib/client/_constants.js +3 -0
- package/lib/client/bars/ribbon.d.ts +1 -0
- package/lib/client/bars/ribbon.js +3 -1
- package/lib/client/bars/rich-edit-ribbon/ribbon-items-data.js +11 -0
- package/lib/client/client-rich-edit.js +4 -2
- package/lib/client/commands/commands.js +12 -0
- package/lib/client/i-rich-constructor-settings.d.ts +2 -0
- package/lib/client/model-api/api-utils/parameter-checker.d.ts +1 -1
- package/lib/client/model-api/api-utils/parameter-checker.js +2 -2
- package/lib/client/public/commands/enum.d.ts +3 -1
- package/lib/client/public/commands/enum.js +2 -0
- package/lib/client/public/options.d.ts +2 -0
- package/lib/client/public/options.js +2 -0
- package/lib/client/public/rich-edit.d.ts +4 -0
- package/lib/client/public/rich-edit.js +21 -0
- package/lib/client/ribbon/i-toolbar-item-options.d.ts +1 -1
- package/lib/client/settings.js +4 -0
- package/lib/client/utils/focus-helper.d.ts +4 -0
- package/lib/client/utils/focus-helper.js +36 -0
- package/lib/common/canvas/canvas-manager.d.ts +2 -0
- package/lib/common/canvas/canvas-manager.js +11 -5
- package/lib/common/canvas/renderes/common/document-renderer.d.ts +1 -1
- package/lib/common/canvas/renderes/view-manager.d.ts +4 -0
- package/lib/common/canvas/renderes/view-manager.js +17 -0
- package/lib/common/commands/client-command.d.ts +3 -1
- package/lib/common/commands/client-command.js +2 -0
- package/lib/common/commands/command-manager.js +4 -0
- package/lib/common/commands/layout/apply-style-command.d.ts +12 -7
- package/lib/common/commands/layout/apply-style-command.js +44 -36
- package/lib/common/commands/layout/change-zoom-level-command.d.ts +10 -0
- package/lib/common/commands/layout/change-zoom-level-command.js +30 -0
- package/lib/common/commands/layout/toggle-allow-zoom-command.d.ts +7 -0
- package/lib/common/commands/layout/toggle-allow-zoom-command.js +17 -0
- package/lib/common/commands/ruler/ruler-table-column-separators-command.d.ts +9 -2
- package/lib/common/commands/ruler/ruler-table-column-separators-command.js +24 -15
- package/lib/common/commands/toc/set-paragraph-level-command.d.ts +2 -0
- package/lib/common/commands/toc/set-paragraph-level-command.js +13 -7
- package/lib/common/interfaces/i-zoom-level-holder.d.ts +3 -0
- package/lib/common/interfaces/i-zoom-level-holder.js +1 -0
- package/lib/common/layout/main-structures/layout-row.d.ts +2 -1
- package/lib/common/layout/main-structures/layout-row.js +3 -1
- package/lib/common/layout-formatter/formatter/base-formatter.js +2 -1
- package/lib/common/layout-formatter/row/result.js +2 -1
- package/lib/common/layout-formatter/row/tab-info.js +3 -1
- package/lib/common/model/json/enums/json-control-enums.d.ts +2 -1
- package/lib/common/model/json/enums/json-control-enums.js +1 -0
- package/lib/common/model/json/exporters/json-control-options-converter.js +2 -0
- package/lib/common/model/json/importers/json-importer.js +2 -0
- package/lib/common/model/options/control.d.ts +1 -0
- package/lib/common/model/options/control.js +1 -0
- package/lib/common/model/paragraph/paragraph-style.d.ts +9 -4
- package/lib/common/model/paragraph/paragraph-style.js +20 -13
- package/lib/common/model/rich-utils.d.ts +2 -0
- package/lib/common/model/rich-utils.js +2 -0
- package/lib/common/mouse-handler/resize-box-helper.js +2 -2
- package/lib/common/rich-edit-core.d.ts +0 -1
- package/lib/common/rich-edit-core.js +2 -6
- package/lib/common/ui/ruler/controls/base.d.ts +7 -2
- package/lib/common/ui/ruler/controls/base.js +11 -3
- package/lib/common/ui/ruler/controls/column.d.ts +17 -5
- package/lib/common/ui/ruler/controls/column.js +37 -21
- package/lib/common/ui/ruler/controls/divisions.d.ts +18 -5
- package/lib/common/ui/ruler/controls/divisions.js +41 -13
- package/lib/common/ui/ruler/controls/indent/first-line.js +2 -2
- package/lib/common/ui/ruler/controls/indent/left.js +2 -2
- package/lib/common/ui/ruler/controls/indent/right.js +2 -2
- package/lib/common/ui/ruler/controls/margin/base.js +3 -3
- package/lib/common/ui/ruler/controls/owner.d.ts +2 -0
- package/lib/common/ui/ruler/controls/owner.js +4 -0
- package/lib/common/ui/ruler/controls/ruler.js +2 -2
- package/lib/common/ui/ruler/controls/tab/tab-info.d.ts +15 -0
- package/lib/common/ui/ruler/controls/tab/tab-info.js +19 -0
- package/lib/common/ui/ruler/controls/tab/tab.d.ts +3 -3
- package/lib/common/ui/ruler/controls/tab/tab.js +10 -11
- package/lib/common/ui/ruler/controls/table.js +5 -4
- package/lib/common/ui/ruler/controls/zoomable-value.d.ts +8 -0
- package/lib/common/ui/ruler/controls/zoomable-value.js +15 -0
- package/lib/common/ui/ruler/manager.d.ts +6 -2
- package/lib/common/ui/ruler/manager.js +13 -4
- package/lib/common/ui/ruler/model-data.d.ts +1 -0
- package/lib/common/ui/ruler/model-data.js +1 -0
- package/lib/common/view-settings/views-settings.d.ts +2 -0
- package/lib/common/view-settings/views-settings.js +3 -0
- package/package.json +7 -7
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -74,6 +74,7 @@ export declare class Constants {
|
|
74
74
|
"4": number;
|
75
75
|
}[];
|
76
76
|
static getFontSizesList(): number[];
|
77
|
+
static getZoomLevelsList(): number[];
|
77
78
|
static getParagraphStylesList(): string[];
|
78
79
|
static getTableStylesList(): string[];
|
79
80
|
private static localizedDefaultPresetStyles;
|
package/lib/client/_constants.js
CHANGED
@@ -6,6 +6,9 @@ export class Constants {
|
|
6
6
|
static getFontSizesList() {
|
7
7
|
return [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72];
|
8
8
|
}
|
9
|
+
static getZoomLevelsList() {
|
10
|
+
return [0.5, 0.75, 1.0, 1.25, 1.5, 2.0];
|
11
|
+
}
|
9
12
|
static getParagraphStylesList() {
|
10
13
|
const styles = Constants.getLocalizedDefaultPresetStyles();
|
11
14
|
return styles['1'].filter(f => f['4'] == 0).map(f => {
|
@@ -13,6 +13,7 @@ export declare class ClientRibbonBar extends RibbonBarBase implements IRibbonBar
|
|
13
13
|
private _toolbarItemsCache;
|
14
14
|
private ownerElement;
|
15
15
|
private activeItem;
|
16
|
+
private focusHandler;
|
16
17
|
constructor(ownerControl: IControlOwner, ownerElement: HTMLElement, apiRibbon: ApiRibbon, fonts: FontsSettings);
|
17
18
|
protected updateContextItem(_commandKey: RichEditClientCommand): void;
|
18
19
|
onCanvasMouseDown(): void;
|
@@ -6,6 +6,7 @@ import { ListUtils } from '@devexpress/utils/lib/utils/list';
|
|
6
6
|
import { StringMapUtils } from '@devexpress/utils/lib/utils/map/string';
|
7
7
|
import { createInnerTab } from '../public/ribbon/creator';
|
8
8
|
import { SizeUtils } from '../../common/utils/size-utils';
|
9
|
+
import { FocusHelper } from '../utils/focus-helper';
|
9
10
|
export class ClientRibbonBar extends RibbonBarBase {
|
10
11
|
constructor(ownerControl, ownerElement, apiRibbon, fonts) {
|
11
12
|
var _a;
|
@@ -14,6 +15,7 @@ export class ClientRibbonBar extends RibbonBarBase {
|
|
14
15
|
this.ownerElement = ownerElement;
|
15
16
|
this.init(apiRibbon, fonts);
|
16
17
|
this.createControl((_a = apiRibbon.activeTabIndex) !== null && _a !== void 0 ? _a : 1);
|
18
|
+
this.focusHandler = FocusHelper.preventFocusOnClick(this.ribbon.element);
|
17
19
|
}
|
18
20
|
updateContextItem(_commandKey) {
|
19
21
|
}
|
@@ -39,13 +41,13 @@ export class ClientRibbonBar extends RibbonBarBase {
|
|
39
41
|
}
|
40
42
|
dispose() {
|
41
43
|
this.ribbon.dispose();
|
44
|
+
this.focusHandler.dispose();
|
42
45
|
}
|
43
46
|
checkActivateHeaderFooter(_selection) {
|
44
47
|
return false;
|
45
48
|
}
|
46
49
|
createControl(activeTabIndex) {
|
47
50
|
const element = document.createElement('div');
|
48
|
-
element.tabIndex = 0;
|
49
51
|
const firstChild = this.ownerElement.firstChild;
|
50
52
|
if (firstChild)
|
51
53
|
this.ownerElement.insertBefore(element, firstChild);
|
@@ -16,6 +16,7 @@ export class RibbonItemsData {
|
|
16
16
|
const fontSizes = Constants.getFontSizesList().map(s => {
|
17
17
|
return { text: s.toString(), value: s };
|
18
18
|
});
|
19
|
+
const zoomLevels = Constants.getZoomLevelsList();
|
19
20
|
function getTrimmedMessage(id) {
|
20
21
|
const message = formatMessage(id);
|
21
22
|
const trimmedFromEnd = StringUtils.trimEnd(message, ['\\.']);
|
@@ -276,6 +277,16 @@ export class RibbonItemsData {
|
|
276
277
|
{ type: 'Button', text: formatMessage('XtraRichEditStringId.MenuCmd_SwitchToPrintLayoutView'), icon: 'dxre-icon-PrintLayoutView', alwaysShowText: true, name: Command.SwitchToPrintLayoutView, isToggleMode: true },
|
277
278
|
{ type: 'Button', text: formatMessage('XtraRichEditStringId.MenuCmd_ToggleShowHorizontalRuler'), icon: 'dxre-icon-RulerHorizontal', alwaysShowText: true, name: Command.ToggleShowHorizontalRuler, isToggleMode: true, beginGroup: true },
|
278
279
|
{ type: 'Button', text: formatMessage('ASPxRichEditStringId.MenuCmd_ToggleFullScreen'), icon: 'dxre-icon-FullScreen', alwaysShowText: true, name: Command.FullScreen, isToggleMode: true, beginGroup: true },
|
280
|
+
{ type: 'SelectBox', dataSource: zoomLevels, width: 90, name: Command.ChangeZoomLevel, beginGroup: true, acceptCustomValue: true, valueExpr: "this",
|
281
|
+
onCustomItemCreating: function (e) {
|
282
|
+
const parsed = parseFloat(e.text);
|
283
|
+
e.customItem = isNaN(parsed) ? e.text : parsed / 100;
|
284
|
+
},
|
285
|
+
displayExpr: function (item) {
|
286
|
+
const parsed = parseFloat(item);
|
287
|
+
return isNaN(parsed) ? item : Math.round(parsed * 100) + '%';
|
288
|
+
}
|
289
|
+
},
|
279
290
|
];
|
280
291
|
return [
|
281
292
|
{ title: formatMessage('ASPxRichEditStringId.PageFile'), items: fileToolBarItems, id: RibbonTabType.File },
|
@@ -32,6 +32,7 @@ import { RulerVisibility } from '../common/ui/ruler/settings';
|
|
32
32
|
import { FullScreenHelper } from './ui/full-screen-helper';
|
33
33
|
import config from 'devextreme/core/config';
|
34
34
|
import { SizeUtils } from '../common/utils/size-utils';
|
35
|
+
import { DocumentCapability } from '../common/model/options/control';
|
35
36
|
export class ClientRichEdit {
|
36
37
|
get clientQuickSearchPanel() {
|
37
38
|
if (!this._clientQuickSearchPanel)
|
@@ -61,8 +62,8 @@ export class ClientRichEdit {
|
|
61
62
|
this.rawDataSource = settings.rawDataSource;
|
62
63
|
this.contextMenuSettings = settings.contextMenuSettings;
|
63
64
|
this.fullScreenHelper = new FullScreenHelper(element);
|
64
|
-
if ("
|
65
|
-
config(JSON.parse(atob("
|
65
|
+
if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaVJWTTBSVlk0YmxKaVpYVk9OVGRWVEdSbFlVeHhZeUlLZlE9PS5MN1o0YXlNMTRnUWtScExSaEt6MGZSMDU5d1E5cWhhMi9ESThnRG83SEJxbFM2L1BMNVRtTmRrTVRzMmdUL3oyUFVQZDgyZGRMM0dsbjZiQUM0aXB4cUI0Y1ozT1FkZjhVc1pmMm9TOCs5SnliZGdCS1diYnFseXdEMUVFbkwwNmV0eWdtQT09In0=")
|
66
|
+
config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaVJWTTBSVlk0YmxKaVpYVk9OVGRWVEdSbFlVeHhZeUlLZlE9PS5MN1o0YXlNMTRnUWtScExSaEt6MGZSMDU5d1E5cWhhMi9ESThnRG83SEJxbFM2L1BMNVRtTmRrTVRzMmdUL3oyUFVQZDgyZGRMM0dsbjZiQUM0aXB4cUI0Y1ozT1FkZjhVc1pmMm9TOCs5SnliZGdCS1diYnFseXdEMUVFbkwwNmV0eWdtQT09In0=")));
|
66
67
|
this.prepareElement(element, settings);
|
67
68
|
this.initDefaultFontsAndStyles();
|
68
69
|
this.initBars(settings.ribbon, settings.fonts);
|
@@ -166,6 +167,7 @@ export class ClientRichEdit {
|
|
166
167
|
options.fonts = settings.fonts;
|
167
168
|
options.spellChecker = settings.spellCheck;
|
168
169
|
options.nonce = settings.nonce;
|
170
|
+
options.control.allowZoom = settings.view.allowZoom ? DocumentCapability.Enabled : DocumentCapability.Disabled;
|
169
171
|
this.core = new ClientRichEditCore(this, this.name, this.element, Math.random().toString(), settings.readOnly, this.barHolder, settings.unit, this.rulerSettings, options, settings.view, this.getStringResources());
|
170
172
|
}
|
171
173
|
initCore() {
|
@@ -432,6 +432,18 @@ export function executeApiCommandCore(commandManager, commandId, parameter) {
|
|
432
432
|
case ViewTabCommandId.ToggleFullScreen:
|
433
433
|
parameter = undefined;
|
434
434
|
break;
|
435
|
+
case ViewTabCommandId.ChangeZoomLevel:
|
436
|
+
{
|
437
|
+
const zoomLevel = ApiParametersChecker.check(parameter, 2, false, [
|
438
|
+
ApiParametersChecker.numberDescriptor('parameter', val => val)
|
439
|
+
]);
|
440
|
+
parameter = zoomLevel;
|
441
|
+
break;
|
442
|
+
}
|
443
|
+
;
|
444
|
+
case ViewTabCommandId.ToggleAllowZoom:
|
445
|
+
parameter = undefined;
|
446
|
+
break;
|
435
447
|
case HeaderAndFooterTabCommandId.GoToPageHeader:
|
436
448
|
parameter = undefined;
|
437
449
|
break;
|
@@ -52,6 +52,8 @@ export interface IRichEditConfirmOnLosingChangesSettings {
|
|
52
52
|
message?: string;
|
53
53
|
}
|
54
54
|
export interface IRichEditViewSettings {
|
55
|
+
zoomLevel?: number;
|
56
|
+
allowZoom?: boolean;
|
55
57
|
viewType?: ViewType;
|
56
58
|
simpleViewSettings?: IRichEditSimpleViewSettings;
|
57
59
|
printLayoutViewSettings?: IRichEditPrintLayoutViewSettings;
|
@@ -11,7 +11,7 @@ export declare class ApiParametersChecker {
|
|
11
11
|
static check<TResult>(value: any, parameterIndex: ArgsCheckerParameterIndex, canBeUndefined: boolean, pairs: Array<ApiParameterDescriptor<any, TResult>>): TResult;
|
12
12
|
static showErrorString<TResult>(parameterIndex: number, canBeUndefined: boolean, pairs: Array<ApiParameterDescriptor<any, TResult>>): string;
|
13
13
|
static defaultDescriptor<TResult>(getResult: () => TResult): ApiParameterDescriptor<any, TResult>;
|
14
|
-
static numberDescriptor<TResult>(parameterName: string, getResult: (value: number) => TResult, minBound?: number, maxBound?: number): ApiParameterDescriptor<number, TResult>;
|
14
|
+
static numberDescriptor<TResult>(parameterName: string, getResult: (value: number) => TResult, minBound?: number, maxBound?: number, closedMaxBound?: boolean): ApiParameterDescriptor<number, TResult>;
|
15
15
|
static booleanDescriptor<TResult>(parameterName: string, getResult: (value: boolean) => TResult): ApiParameterDescriptor<boolean, TResult>;
|
16
16
|
static arrayDescriptor<TResult, ArrayContentType>(parameterName: string, getResult: (value: ArrayContentType[]) => TResult): ApiParameterDescriptor<ArrayContentType[], TResult>;
|
17
17
|
static functionDescriptor<TResult>(parameterName: string, getResult: (value: any) => TResult): ApiParameterDescriptor<() => void, TResult>;
|
@@ -66,8 +66,8 @@ export class ApiParametersChecker {
|
|
66
66
|
static defaultDescriptor(getResult) {
|
67
67
|
return new ApiParameterDescriptor('', '', () => true, getResult);
|
68
68
|
}
|
69
|
-
static numberDescriptor(parameterName, getResult, minBound = Constants.MIN_SAFE_INTEGER, maxBound = Constants.MAX_SAFE_INTEGER) {
|
70
|
-
return new ApiParameterDescriptor(parameterName, `number on interval [${minBound}, ${maxBound}]`, (value) => isNumber(value) && (value >= minBound && value < maxBound), getResult);
|
69
|
+
static numberDescriptor(parameterName, getResult, minBound = Constants.MIN_SAFE_INTEGER, maxBound = Constants.MAX_SAFE_INTEGER, closedMaxBound = false) {
|
70
|
+
return new ApiParameterDescriptor(parameterName, `number on interval [${minBound}, ${maxBound}]`, (value) => isNumber(value) && (value >= minBound && (closedMaxBound ? value <= maxBound : value < maxBound)), getResult);
|
71
71
|
}
|
72
72
|
static booleanDescriptor(parameterName, getResult) {
|
73
73
|
return new ApiParameterDescriptor(parameterName, 'boolean', (value) => typeof value === 'boolean', getResult);
|
@@ -149,7 +149,9 @@ export declare enum ViewTabCommandId {
|
|
149
149
|
SwitchToSimpleView = 405,
|
150
150
|
SwitchToPrintLayout = 406,
|
151
151
|
ToggleShowHorizontalRuler = 94,
|
152
|
-
ToggleFullScreen = 98
|
152
|
+
ToggleFullScreen = 98,
|
153
|
+
ChangeZoomLevel = 460,
|
154
|
+
ToggleAllowZoom = 461
|
153
155
|
}
|
154
156
|
export declare enum HeaderAndFooterTabCommandId {
|
155
157
|
GoToPageHeader = 227,
|
@@ -157,6 +157,8 @@ export var ViewTabCommandId;
|
|
157
157
|
ViewTabCommandId[ViewTabCommandId["SwitchToPrintLayout"] = 406] = "SwitchToPrintLayout";
|
158
158
|
ViewTabCommandId[ViewTabCommandId["ToggleShowHorizontalRuler"] = 94] = "ToggleShowHorizontalRuler";
|
159
159
|
ViewTabCommandId[ViewTabCommandId["ToggleFullScreen"] = 98] = "ToggleFullScreen";
|
160
|
+
ViewTabCommandId[ViewTabCommandId["ChangeZoomLevel"] = 460] = "ChangeZoomLevel";
|
161
|
+
ViewTabCommandId[ViewTabCommandId["ToggleAllowZoom"] = 461] = "ToggleAllowZoom";
|
160
162
|
})(ViewTabCommandId || (ViewTabCommandId = {}));
|
161
163
|
export var HeaderAndFooterTabCommandId;
|
162
164
|
(function (HeaderAndFooterTabCommandId) {
|
@@ -75,6 +75,8 @@ export interface IConfirmOnLosingChangesSettings {
|
|
75
75
|
message?: string;
|
76
76
|
}
|
77
77
|
export interface IViewSettings {
|
78
|
+
zoomLevel?: number;
|
79
|
+
allowZoom?: boolean;
|
78
80
|
viewType?: ViewType;
|
79
81
|
simpleViewSettings?: ISimpleViewSettings;
|
80
82
|
printLayoutViewSettings?: IPrintLayoutViewSettings;
|
@@ -80,6 +80,10 @@ declare class RichEditPublic {
|
|
80
80
|
set documentExtension(filePath: string);
|
81
81
|
get hasUnsavedChanges(): boolean;
|
82
82
|
set hasUnsavedChanges(value: boolean);
|
83
|
+
get zoomLevel(): number;
|
84
|
+
set zoomLevel(value: number);
|
85
|
+
get allowZoom(): boolean;
|
86
|
+
set allowZoom(value: boolean);
|
83
87
|
newDocument(): void;
|
84
88
|
openDocument(fileContent?: File | Blob | ArrayBuffer | string, documentName?: string, documentFormat?: DocumentFormatApi, callback?: (importSuccess: boolean) => void): void;
|
85
89
|
saveDocument(documentFormat?: DocumentFormatApi, reason?: string, documentName?: string): void;
|
@@ -42,6 +42,8 @@ import { DocumentProcessorApi } from './document-processor';
|
|
42
42
|
import { NusaSettings } from './nusa/settings';
|
43
43
|
import { Utils } from './utils';
|
44
44
|
import '../../common/utils/_license';
|
45
|
+
import { ApiParametersChecker } from '../model-api/api-utils/parameter-checker';
|
46
|
+
import { RichUtils } from '../../common/model/rich-utils';
|
45
47
|
class RichEditPublic {
|
46
48
|
get events() { return this._native.events; }
|
47
49
|
constructor(htmlElement, options) {
|
@@ -222,6 +224,25 @@ class RichEditPublic {
|
|
222
224
|
}
|
223
225
|
get hasUnsavedChanges() { return !this._native.documentSaved; }
|
224
226
|
set hasUnsavedChanges(value) { this._native.documentSaved = !value; }
|
227
|
+
get zoomLevel() {
|
228
|
+
return this._native.core.viewManager.zoomLevel;
|
229
|
+
}
|
230
|
+
set zoomLevel(value) {
|
231
|
+
const zoomLevelValue = ApiParametersChecker.check(value, 1, false, [
|
232
|
+
ApiParametersChecker.numberDescriptor('value', val => val, RichUtils.minZoomLevel, RichUtils.maxZoomLevel, true)
|
233
|
+
]);
|
234
|
+
this._native.core.viewManager.zoomLevel = zoomLevelValue;
|
235
|
+
this._native.core.barHolder.forceUpdate({ [RichEditClientCommand.ChangeZoomLevel]: true });
|
236
|
+
}
|
237
|
+
get allowZoom() {
|
238
|
+
return this._native.core.viewManager.allowZoom;
|
239
|
+
}
|
240
|
+
set allowZoom(value) {
|
241
|
+
const allowZoomValue = ApiParametersChecker.check(value, 1, false, [
|
242
|
+
ApiParametersChecker.booleanDescriptor('value', val => val)
|
243
|
+
]);
|
244
|
+
this._native.core.viewManager.allowZoom = allowZoomValue;
|
245
|
+
}
|
225
246
|
newDocument() {
|
226
247
|
this._native.core.commandManager.getCommand(RichEditClientCommand.CreateNewDocumentLocally)
|
227
248
|
.execute(true);
|
package/lib/client/settings.js
CHANGED
@@ -183,6 +183,10 @@ export class Settings {
|
|
183
183
|
if (isDefined(settings.view)) {
|
184
184
|
if (isDefined(settings.view.viewType))
|
185
185
|
result.view.viewType = settings.view.viewType;
|
186
|
+
if (isDefined(settings.view.zoomLevel))
|
187
|
+
result.view.zoomLevel = settings.view.zoomLevel;
|
188
|
+
if (isDefined(settings.view.allowZoom))
|
189
|
+
result.view.allowZoom = settings.view.allowZoom;
|
186
190
|
if (isDefined(settings.view.simpleViewSettings)) {
|
187
191
|
const paddings = settings.view.simpleViewSettings.paddings;
|
188
192
|
if (isDefined(paddings)) {
|
@@ -0,0 +1,36 @@
|
|
1
|
+
export class FocusHelper {
|
2
|
+
static preventFocusOnClick(element) {
|
3
|
+
return new FocusBlocker(element);
|
4
|
+
}
|
5
|
+
}
|
6
|
+
class FocusBlocker {
|
7
|
+
constructor(target) {
|
8
|
+
this.target = target;
|
9
|
+
this.onPointerDownBinded = this.onPointerDown.bind(this);
|
10
|
+
this.addEventListeners(target);
|
11
|
+
}
|
12
|
+
addEventListeners(element) {
|
13
|
+
element.addEventListener("pointerdown", this.onPointerDownBinded);
|
14
|
+
}
|
15
|
+
removeEventListeners(element) {
|
16
|
+
element.removeEventListener("pointerdown", this.onPointerDownBinded);
|
17
|
+
}
|
18
|
+
onPointerDown(event) {
|
19
|
+
for (const element of event.composedPath()) {
|
20
|
+
if (!(element instanceof HTMLElement))
|
21
|
+
continue;
|
22
|
+
if (element === this.target) {
|
23
|
+
event.preventDefault();
|
24
|
+
break;
|
25
|
+
}
|
26
|
+
if (!this.target.contains(element) || element.tabIndex > -1)
|
27
|
+
break;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
dispose() {
|
31
|
+
if (this.target) {
|
32
|
+
this.removeEventListeners(this.target);
|
33
|
+
this.target = null;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
@@ -3,8 +3,10 @@ import { LayoutPoint } from '../layout/layout-point';
|
|
3
3
|
import { BatchUpdatableObject } from '@devexpress/utils/lib/class/batch-updatable';
|
4
4
|
import { IEventManager } from '../interfaces/i-event-manager';
|
5
5
|
import { CursorPointer } from '../mouse-handler/mouse-handler/mouse-handler';
|
6
|
+
import { SimpleViewCanvasSizeManager } from './renderes/common/document-renderer';
|
6
7
|
import { ViewManager } from './renderes/view-manager';
|
7
8
|
export declare class CanvasManager extends BatchUpdatableObject {
|
9
|
+
simpleViewCanvasSizeManager: SimpleViewCanvasSizeManager;
|
8
10
|
private viewManager;
|
9
11
|
private eventManager;
|
10
12
|
private scrollIntervalID;
|
@@ -11,6 +11,7 @@ import { RichMouseEvent } from '../event-manager';
|
|
11
11
|
import { MouseEventSource } from '../mouse-handler/mouse-event-source';
|
12
12
|
import { CursorPointer } from '../mouse-handler/mouse-handler/mouse-handler';
|
13
13
|
import { ResizeBoxListener } from './listeners/resize-box-listener';
|
14
|
+
import { SimpleViewCanvasSizeManager } from './renderes/common/document-renderer';
|
14
15
|
import { SizeUtils } from '../utils/size-utils';
|
15
16
|
const SCROLL_INTERVAL_MS = 50;
|
16
17
|
const CSSCLASS_FOCUSED = "dxreInFocus";
|
@@ -29,6 +30,7 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
29
30
|
this.blockNotPointerEvents = false;
|
30
31
|
this.lastPointerPosition = { x: -1, y: -1 };
|
31
32
|
this.evtHandlersHolder = new DomEventHandlersHolder();
|
33
|
+
this.simpleViewCanvasSizeManager = new SimpleViewCanvasSizeManager(this, viewManager.control);
|
32
34
|
this.viewManager = viewManager;
|
33
35
|
this.eventManager = eventManager;
|
34
36
|
this.initCommonEvents();
|
@@ -47,6 +49,8 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
47
49
|
}
|
48
50
|
dispose() {
|
49
51
|
this.evtHandlersHolder.removeAllListeners();
|
52
|
+
this.simpleViewCanvasSizeManager.dispose();
|
53
|
+
this.simpleViewCanvasSizeManager = null;
|
50
54
|
}
|
51
55
|
onUpdateUnlocked(_occurredEvents) {
|
52
56
|
this.viewManager.canvasListener.updateVisibleParts();
|
@@ -73,7 +77,7 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
73
77
|
DomUtils.removeClassName(this.viewManager.canvas, CSSCLASS_FOCUSED);
|
74
78
|
}
|
75
79
|
getCanvasWidth() {
|
76
|
-
return SizeUtils.getClientWidth(this.viewManager.canvas);
|
80
|
+
return SizeUtils.getClientWidth(this.viewManager.canvas) / this.viewManager.zoomLevel;
|
77
81
|
}
|
78
82
|
onCanvasMouseWheel(evt) {
|
79
83
|
if (!this.viewManager.layout)
|
@@ -235,7 +239,7 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
235
239
|
this.saveMousePosition(evt);
|
236
240
|
}
|
237
241
|
getScale(actualSize, originalSize) {
|
238
|
-
return actualSize != 0 && originalSize != 0 ? actualSize / originalSize : 1;
|
242
|
+
return (actualSize != 0 && originalSize != 0 ? actualSize / originalSize : 1) * this.viewManager.zoomLevel;
|
239
243
|
}
|
240
244
|
getLayoutPoint(evt, checkScroll) {
|
241
245
|
if (!this.viewManager.layout)
|
@@ -248,12 +252,14 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
248
252
|
const clientY = EvtUtils.getEventY(evt) / scaleY;
|
249
253
|
const canvasX = DomUtils.getAbsolutePositionX(canvas) / scaleX;
|
250
254
|
const canvasY = DomUtils.getAbsolutePositionY(canvas) / scaleY;
|
251
|
-
const offsetY = canvas.scrollTop + clientY - canvasY;
|
255
|
+
const offsetY = canvas.scrollTop / scaleY + clientY - canvasY;
|
252
256
|
const pageIndex = this.sizes.findPageIndexByOffsetY(this.viewManager.layout.pages, offsetY);
|
257
|
+
const visibleAreaWidth = this.sizes.getVisibleAreaWidth(false) / scaleX;
|
258
|
+
const visibleAreaHeight = this.sizes.getVisibleAreaHeight(false) / scaleY;
|
253
259
|
if (checkScroll) {
|
254
|
-
if (this.sizes.scrollYVisible && canvasX +
|
260
|
+
if (this.sizes.scrollYVisible && canvasX + visibleAreaWidth - clientX < 0)
|
255
261
|
return LayoutPoint.Empty();
|
256
|
-
if (this.sizes.scrollXVisible && canvasY +
|
262
|
+
if (this.sizes.scrollXVisible && canvasY + visibleAreaHeight - clientY < 0)
|
257
263
|
return LayoutPoint.Empty();
|
258
264
|
}
|
259
265
|
const layoutPage = this.viewManager.layout.pages[pageIndex];
|
@@ -36,7 +36,7 @@ export declare class SimpleViewCanvasSizeManager {
|
|
36
36
|
private resizeFrameId;
|
37
37
|
constructor(canvasManager: CanvasManager, control: IRichEditControl);
|
38
38
|
dispose(): void;
|
39
|
-
|
39
|
+
changeSize(force: boolean): void;
|
40
40
|
setViewMode(val: boolean): void;
|
41
41
|
private changeSizeCore;
|
42
42
|
}
|
@@ -67,4 +67,8 @@ export declare class ViewManager implements ILayoutChangesListener {
|
|
67
67
|
setWorkSession(layout: DocumentLayout, layoutSelection: LayoutSelection, imageCache: ImageCache): void;
|
68
68
|
closeDocument(): void;
|
69
69
|
ensureFirstPageIsRendered(): void;
|
70
|
+
get zoomLevel(): number;
|
71
|
+
set zoomLevel(value: number);
|
72
|
+
get allowZoom(): boolean;
|
73
|
+
set allowZoom(value: boolean);
|
70
74
|
}
|
@@ -24,6 +24,8 @@ import { MisspelledSelectionRenderer } from './selection-renderers/misspelled-se
|
|
24
24
|
import { RangePermissionRenderer } from './selection-renderers/range-permission-renderer';
|
25
25
|
import { SearchSelectionRenderer } from './selection-renderers/search-selection-renderer';
|
26
26
|
import { SelectionRenderer } from './selection-renderers/selection-renderer';
|
27
|
+
import { ControlOptions, DocumentCapability } from '../../model/options/control';
|
28
|
+
import { RichEditClientCommand } from '../../commands/client-command';
|
27
29
|
export class ViewManager {
|
28
30
|
get renderer() { return this.renderers[this.innerClientProperties.viewsSettings.viewType]; }
|
29
31
|
get printLayoutRenderer() { return this.renderers[ViewType.PrintLayout]; }
|
@@ -128,6 +130,7 @@ export class ViewManager {
|
|
128
130
|
}
|
129
131
|
addTopLevelContainers() {
|
130
132
|
this.pagesContainer = DocumentRenderer.renderContainer(RendererClassNames.PAGES);
|
133
|
+
this.pagesContainer.style.zoom = this.zoomLevel.toString();
|
131
134
|
this.serviceContainer = DocumentRenderer.renderContainer(RendererClassNames.TOP_LEVEL_SERVICE_CONTAINER);
|
132
135
|
DocumentRenderer.insertInContainer(this.canvas, 0, this.pagesContainer, (node) => node);
|
133
136
|
this.canvas.appendChild(this.serviceContainer);
|
@@ -164,4 +167,18 @@ export class ViewManager {
|
|
164
167
|
firstPage.flags.set(LayoutPageFlags.ContentRendered, true);
|
165
168
|
}
|
166
169
|
}
|
170
|
+
get zoomLevel() { return this.innerClientProperties.viewsSettings.zoomLevel; }
|
171
|
+
set zoomLevel(value) {
|
172
|
+
this.pagesContainer.style.zoom = value.toString();
|
173
|
+
this.innerClientProperties.viewsSettings.zoomLevel = value;
|
174
|
+
if (this.control.innerClientProperties.viewsSettings.isSimpleView) {
|
175
|
+
this.canvasManager.simpleViewCanvasSizeManager.changeSize(true);
|
176
|
+
}
|
177
|
+
this.control.horizontalRulerControl.update();
|
178
|
+
}
|
179
|
+
get allowZoom() { return ControlOptions.isEnabled(this.control.modelManager.richOptions.control.allowZoom); }
|
180
|
+
set allowZoom(value) {
|
181
|
+
this.control.modelManager.richOptions.control.allowZoom = value ? DocumentCapability.Enabled : DocumentCapability.Hidden;
|
182
|
+
this.control.barHolder.forceUpdate({ [RichEditClientCommand.ChangeZoomLevel]: true });
|
183
|
+
}
|
167
184
|
}
|
@@ -421,4 +421,6 @@ export var RichEditClientCommand;
|
|
421
421
|
RichEditClientCommand[RichEditClientCommand["NoSpellingSuggestions"] = 457] = "NoSpellingSuggestions";
|
422
422
|
RichEditClientCommand[RichEditClientCommand["GetHtml"] = 458] = "GetHtml";
|
423
423
|
RichEditClientCommand[RichEditClientCommand["CreateEmptyIfField"] = 459] = "CreateEmptyIfField";
|
424
|
+
RichEditClientCommand[RichEditClientCommand["ChangeZoomLevel"] = 460] = "ChangeZoomLevel";
|
425
|
+
RichEditClientCommand[RichEditClientCommand["ToggleAllowZoom"] = 461] = "ToggleAllowZoom";
|
424
426
|
})(RichEditClientCommand || (RichEditClientCommand = {}));
|
@@ -67,6 +67,8 @@ import { GoToNextHeaderFooterCommand, GoToPreviousHeaderFooterCommand } from './
|
|
67
67
|
import { InsertFooterCommand, InsertHeaderCommand } from './header-footer/insert-header-footer-commands';
|
68
68
|
import { LinkHeaderFooterToPreviousCommand } from './header-footer/link-header-footer-commands';
|
69
69
|
import { ApplyStyleCommand } from './layout/apply-style-command';
|
70
|
+
import { ToggleAllowZoomCommand } from './layout/toggle-allow-zoom-command';
|
71
|
+
import { ChangeZoomLevelCommand } from './layout/change-zoom-level-command';
|
70
72
|
import { ClearFormattingCommand } from './layout/clear-formatting-command';
|
71
73
|
import { ChangeViewTypeCommand, SwitchToPrintLayoutViewCommand, SwitchToSimpleViewCommand } from './layout/switch-view-command';
|
72
74
|
import { ToggleFullScreenCommand } from './layout/toggle-full-screen-command';
|
@@ -555,6 +557,8 @@ export class CommandManager {
|
|
555
557
|
this.createCommand(control, RichEditClientCommand.ChangeViewType, ChangeViewTypeCommand);
|
556
558
|
this.createCommand(control, RichEditClientCommand.SwitchToSimpleView, SwitchToSimpleViewCommand);
|
557
559
|
this.createCommand(control, RichEditClientCommand.SwitchToPrintLayoutView, SwitchToPrintLayoutViewCommand);
|
560
|
+
this.createCommand(control, RichEditClientCommand.ChangeZoomLevel, ChangeZoomLevelCommand);
|
561
|
+
this.createCommand(control, RichEditClientCommand.ToggleAllowZoom, ToggleAllowZoomCommand);
|
558
562
|
this.createCommand(control, RichEditClientCommand.ShowErrorLoadPictureMessage, ShowLoadPictureErrorDialogCommand);
|
559
563
|
this.assingCommand(RichEditClientCommand.PrintDocumentOnClient, new PrintDocumentOnClient(control, printNonce));
|
560
564
|
}
|
@@ -1,18 +1,23 @@
|
|
1
1
|
import { CharacterStyle } from '../../model/character/character-style';
|
2
2
|
import { ParagraphStyle } from '../../model/paragraph/paragraph-style';
|
3
|
-
import {
|
3
|
+
import { SubDocumentInterval } from '../../model/sub-document';
|
4
4
|
import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
|
5
5
|
import { CommandBase, CommandSimpleOptions } from '../command-base';
|
6
6
|
import { ApplyStyleCommandState } from '../command-states';
|
7
|
+
export interface IApplyStyleCommandParams {
|
8
|
+
styleName: string;
|
9
|
+
keepDirectFormatting?: boolean;
|
10
|
+
}
|
7
11
|
export declare class ApplyStyleCommand extends CommandBase<ApplyStyleCommandState> {
|
8
12
|
getState(): ApplyStyleCommandState;
|
9
13
|
private getStyleName;
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
DEPRECATEDConvertOptionsParameter(parameter: string | IApplyStyleCommandParams): IApplyStyleCommandParams;
|
15
|
+
executeCore(state: ApplyStyleCommandState, options: CommandSimpleOptions<IApplyStyleCommandParams>): boolean;
|
16
|
+
applyCharacterStyle(subDocumentInterval: SubDocumentInterval, style: CharacterStyle, isPresetStyle: boolean): void;
|
17
|
+
applyParagraphStyle(subDocumentInterval: SubDocumentInterval, style: ParagraphStyle, isPresetStyle: boolean, keepDirectFormatting?: boolean): void;
|
18
|
+
applyParagraphLinkedStyle(subDocumentInterval: SubDocumentInterval, style: ParagraphStyle, isPresetStyle: boolean): void;
|
19
|
+
private addLinkedCharacterStyle;
|
20
|
+
calculateAffectedParagraphCount(subDocumentInterval: SubDocumentInterval): number;
|
16
21
|
isEnabled(): boolean;
|
17
22
|
protected canModify(): boolean;
|
18
23
|
protected getIntervalsForModifying(): FixedInterval[];
|