devexpress-richedit 24.1.6 → 24.1.7-build-24274-0102
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.d.ts +1 -1
- package/dist/dx.richedit.js +17 -37
- package/dist/dx.richedit.min.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/client/i-rich-constructor-settings.d.ts +0 -2
- package/lib/client/public/options.d.ts +0 -2
- package/lib/client/settings.js +0 -4
- package/lib/common/commands/fields/open-hyperlink-command.js +3 -4
- package/lib/common/model/options/fields.d.ts +0 -2
- package/lib/common/model/options/fields.js +0 -5
- package/lib/common/utils/utils.d.ts +3 -6
- package/lib/common/utils/utils.js +11 -20
- package/package.json +3 -3
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -80,8 +80,6 @@ export interface IRichEditFieldsSettings {
|
|
80
80
|
defaultDateFormat?: string;
|
81
81
|
openHyperlinkOnClick?: boolean;
|
82
82
|
keepHyperlinkResultForInvalidReference?: boolean;
|
83
|
-
disableRelativeHyperlinkUri?: boolean;
|
84
|
-
allowedHyperlinkUriProtocols?: string[];
|
85
83
|
createHyperlinkTooltip?: (hyperlinkTooltip: string, hint: string) => string;
|
86
84
|
}
|
87
85
|
export interface IRichEditRangePermissionsSettings {
|
@@ -93,8 +93,6 @@ export interface IFieldsSettings {
|
|
93
93
|
defaultDateFormat?: string;
|
94
94
|
openHyperlinkOnClick?: boolean;
|
95
95
|
keepHyperlinkResultForInvalidReference?: boolean;
|
96
|
-
disableRelativeHyperlinkUri?: boolean;
|
97
|
-
allowedHyperlinkUriProtocols?: string[];
|
98
96
|
createHyperlinkTooltip?: (hyperlinkTooltip: string, hint: string) => string;
|
99
97
|
}
|
100
98
|
export interface IBookmarkSettings {
|
package/lib/client/settings.js
CHANGED
@@ -146,10 +146,6 @@ export class Settings {
|
|
146
146
|
result.fields.createHyperlinkTooltip = this.parseEventHandler(settings.fields.createHyperlinkTooltip);
|
147
147
|
if (isDefined(settings.fields.keepHyperlinkResultForInvalidReference))
|
148
148
|
result.fields.keepHyperlinkResultForInvalidReference = settings.fields.keepHyperlinkResultForInvalidReference;
|
149
|
-
if (isDefined(settings.fields.disableRelativeHyperlinkUri))
|
150
|
-
result.fields.disableRelativeHyperlinkUri = settings.fields.disableRelativeHyperlinkUri;
|
151
|
-
if (isDefined(settings.fields.allowedHyperlinkUriProtocols))
|
152
|
-
result.fields.allowedHyperlinkUriProtocols = settings.fields.allowedHyperlinkUriProtocols;
|
153
149
|
}
|
154
150
|
}
|
155
151
|
static parsePrintingSettings(settings, result) {
|
@@ -4,7 +4,7 @@ import { ReadOnlyMode } from '../../interfaces/i-rich-edit-core';
|
|
4
4
|
import { RichEditClientCommand } from '../client-command';
|
5
5
|
import { CommandSimpleOptions } from '../command-base';
|
6
6
|
import { HyperlinkCommandBase } from './hyperlink-command-base';
|
7
|
-
import {
|
7
|
+
import { UrlUtils } from '../../../common/utils/utils';
|
8
8
|
export class OpenHyperlinkCommand extends HyperlinkCommandBase {
|
9
9
|
executeCore(state, options) {
|
10
10
|
let field;
|
@@ -29,9 +29,8 @@ export class OpenHyperlinkCommand extends HyperlinkCommandBase {
|
|
29
29
|
this.control.commandManager.getCommand(RichEditClientCommand.GoToBookmark)
|
30
30
|
.execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, hyperlinkInfo.anchor));
|
31
31
|
else {
|
32
|
-
const
|
33
|
-
|
34
|
-
Url.navigate(hyperlinkInfo.uri, "_blank");
|
32
|
+
const url = UrlUtils.isValid(hyperlinkInfo.uri) ? hyperlinkInfo.uri : UrlUtils.EmptyPage;
|
33
|
+
Url.navigate(url, "_blank");
|
35
34
|
}
|
36
35
|
return true;
|
37
36
|
}
|
@@ -6,8 +6,6 @@ export declare class FieldsSettings {
|
|
6
6
|
defaultTimeFormat: string;
|
7
7
|
defaultDateFormat: string;
|
8
8
|
openHyperlinkOnClick: boolean;
|
9
|
-
disableRelativeHyperlinkUri: boolean;
|
10
|
-
allowedHyperlinkUriProtocols: string[];
|
11
9
|
keepHyperlinkResultForInvalidReference: boolean;
|
12
10
|
createHyperlinkTooltip: (hyperlinkTooltip: string, hint: string) => string;
|
13
11
|
constructor();
|
@@ -3,7 +3,6 @@ import { isDefined, isNonNullString } from '@devexpress/utils/lib/utils/common';
|
|
3
3
|
export class FieldsSettings {
|
4
4
|
constructor() {
|
5
5
|
this.openHyperlinkOnClick = false;
|
6
|
-
this.disableRelativeHyperlinkUri = false;
|
7
6
|
this.updateFieldsBeforePrint = true;
|
8
7
|
this.updateFieldsOnPaste = true;
|
9
8
|
this.defaultTimeFormat = FieldsSettings.DEFAULT_TIME_FORMAT;
|
@@ -30,10 +29,6 @@ export class FieldsSettings {
|
|
30
29
|
this.keepHyperlinkResultForInvalidReference = obj.keepHyperlinkResultForInvalidReference;
|
31
30
|
if (isDefined(obj.createHyperlinkTooltip) && obj.createHyperlinkTooltip !== '')
|
32
31
|
this.createHyperlinkTooltip = convertToFunction(obj.createHyperlinkTooltip);
|
33
|
-
if (isDefined(obj.disableRelativeHyperlinkUri))
|
34
|
-
this.disableRelativeHyperlinkUri = obj.disableRelativeHyperlinkUri;
|
35
|
-
if (isDefined(obj.allowedHyperlinkUriProtocols))
|
36
|
-
this.allowedHyperlinkUriProtocols = obj.allowedHyperlinkUriProtocols;
|
37
32
|
}
|
38
33
|
clone() {
|
39
34
|
const result = new FieldsSettings();
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Point } from '@devexpress/utils/lib/geometry/point';
|
2
|
-
import { IRichEditControl } from '../interfaces/i-rich-edit-core';
|
3
2
|
export declare function rotatePoint(point: Point, angle: number, center: Point): Point;
|
4
3
|
export declare class SearchTreeItemResult<T> {
|
5
4
|
readonly parentList: T[];
|
@@ -12,9 +11,7 @@ export declare function searchTreeItem<T extends {
|
|
12
11
|
}>(items: T[], comparer: (item: T) => boolean): SearchTreeItemResult<T> | null;
|
13
12
|
export declare function convertToFunction(func: any): any | null;
|
14
13
|
export declare function splitByLines(text: string): string[];
|
15
|
-
export
|
16
|
-
|
17
|
-
|
14
|
+
export declare class UrlUtils {
|
15
|
+
static EmptyPage: string;
|
16
|
+
static isValid(url: string): boolean;
|
18
17
|
}
|
19
|
-
export declare function createUrlValidationOptions(control: IRichEditControl): IUrlValidationOptions;
|
20
|
-
export declare function isUrlValid(url: string, options?: IUrlValidationOptions): boolean;
|
@@ -56,29 +56,20 @@ export function convertToFunction(func) {
|
|
56
56
|
export function splitByLines(text) {
|
57
57
|
return text ? text.split(/\r\n|\r|\n/) : [''];
|
58
58
|
}
|
59
|
-
export function createUrlValidationOptions(control) {
|
60
|
-
const fieldSettings = control.modelManager.richOptions.fields;
|
61
|
-
return {
|
62
|
-
allowRelativeUrl: !fieldSettings.disableRelativeHyperlinkUri,
|
63
|
-
allowedProtocols: fieldSettings.allowedHyperlinkUriProtocols
|
64
|
-
};
|
65
|
-
}
|
66
59
|
const disallowedProtocols = [
|
67
60
|
'data',
|
68
61
|
'javascript'
|
69
62
|
];
|
70
|
-
export
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
return !disallowedProtocols.includes(protocol);
|
63
|
+
export class UrlUtils {
|
64
|
+
static isValid(url) {
|
65
|
+
const currentLocation = window.location.href;
|
66
|
+
try {
|
67
|
+
const resultUrl = new URL(url, currentLocation);
|
68
|
+
const protocol = resultUrl.protocol.slice(0, -1);
|
69
|
+
return !disallowedProtocols.includes(protocol);
|
70
|
+
}
|
71
|
+
catch (_a) { }
|
72
|
+
return false;
|
81
73
|
}
|
82
|
-
catch (_a) { }
|
83
|
-
return false;
|
84
74
|
}
|
75
|
+
UrlUtils.EmptyPage = "about:blank";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "devexpress-richedit",
|
3
|
-
"version": "24.1.
|
3
|
+
"version": "24.1.7-build-24274-0102",
|
4
4
|
"homepage": "https://www.devexpress.com/",
|
5
5
|
"bugs": "https://www.devexpress.com/support/",
|
6
6
|
"author": "Developer Express Inc.",
|
@@ -14,8 +14,8 @@
|
|
14
14
|
"build-nspell": "webpack --mode production --config=bin/nspell.webpack.config.js"
|
15
15
|
},
|
16
16
|
"peerDependencies": {
|
17
|
-
"devextreme": "24.1.
|
18
|
-
"devextreme-dist": "24.1.
|
17
|
+
"devextreme": "24.1.7-build-24272-1937",
|
18
|
+
"devextreme-dist": "24.1.7-build-24272-1937"
|
19
19
|
},
|
20
20
|
"dependencies": {
|
21
21
|
"jszip": "~3.10.1",
|