devexpress-richedit 24.1.7-build-24288-0102 → 24.1.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 +94 -62
- package/dist/dx.richedit.min.js +1 -1
- package/lib/client/client-rich-edit.js +6 -6
- package/lib/client/dialogs/hyperlink-dialog.js +13 -6
- package/lib/client/model-api/collections/hyperlink-collection.js +1 -1
- package/lib/common/commands/dialogs/dialog-hyperlink-command.js +10 -4
- package/lib/common/commands/fields/open-hyperlink-command.js +7 -4
- package/lib/common/model/fields/field.d.ts +4 -1
- package/lib/common/model/fields/field.js +18 -2
- package/lib/common/model/fields/parsers/field-code-parser-hyperlink.js +31 -37
- package/lib/common/utils/utils.d.ts +1 -0
- package/lib/common/utils/utils.js +6 -0
- package/package.json +3 -3
@@ -53,8 +53,8 @@ export class ClientRichEdit {
|
|
53
53
|
this.rawDataSource = settings.rawDataSource;
|
54
54
|
this.contextMenuSettings = settings.contextMenuSettings;
|
55
55
|
this.fullScreenHelper = new FullScreenHelper(element);
|
56
|
-
if ("
|
57
|
-
config(JSON.parse(atob("
|
56
|
+
if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWNsQXpXRVkxYm5aUmEyRjVjRTk1UWt4d2RXTlVRU0lLZlE9PS5mRVhyTm1adGMwdWRsdzlOa3hheDBPejFzTEdNU0RwUHBXWGhVdEllc0xvU21lMVhxTC9jZWw2QUtMVVFjVFJERURuN0dRM1k0ZzVMRTlVSGJsK0lUM09zbmpOZnBxYS9nTFY2bmpHbWt2NytLQnVvWWtyTE9LbGtyQjRWQ00rVVZYdDNKZz09In0=")
|
57
|
+
config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWNsQXpXRVkxYm5aUmEyRjVjRTk1UWt4d2RXTlVRU0lLZlE9PS5mRVhyTm1adGMwdWRsdzlOa3hheDBPejFzTEdNU0RwUHBXWGhVdEllc0xvU21lMVhxTC9jZWw2QUtMVVFjVFJERURuN0dRM1k0ZzVMRTlVSGJsK0lUM09zbmpOZnBxYS9nTFY2bmpHbWt2NytLQnVvWWtyTE9LbGtyQjRWQ00rVVZYdDNKZz09In0=")));
|
58
58
|
this.prepareElement(element, settings);
|
59
59
|
this.initDefaultFontsAndStyles();
|
60
60
|
this.initBars(settings.ribbon, settings.fonts);
|
@@ -585,11 +585,11 @@ export class ClientRichEdit {
|
|
585
585
|
return this.barHolder.ribbon;
|
586
586
|
}
|
587
587
|
getLinkType(hyperlinkInfo) {
|
588
|
-
if (hyperlinkInfo.
|
589
|
-
return DocumentLinkType.Bookmark;
|
590
|
-
if (hyperlinkInfo.uri && hyperlinkInfo.uri.substr(0, 7) === "mailto:")
|
588
|
+
if (hyperlinkInfo.isMail())
|
591
589
|
return DocumentLinkType.EmailAddress;
|
592
|
-
|
590
|
+
if (hyperlinkInfo.isUri())
|
591
|
+
return DocumentLinkType.Hyperlink;
|
592
|
+
return DocumentLinkType.Bookmark;
|
593
593
|
}
|
594
594
|
setFullScreenMode() {
|
595
595
|
this.fullScreenHelper.prepareFullScreenMode();
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { formatMessage } from 'devextreme/localization';
|
2
2
|
import { DialogBase } from './dialog-base';
|
3
|
+
import { UrlUtils } from '../../common/utils/utils';
|
3
4
|
export class HyperlinkDialog extends DialogBase {
|
4
5
|
constructor() {
|
5
6
|
super(...arguments);
|
@@ -146,13 +147,19 @@ export class HyperlinkDialog extends DialogBase {
|
|
146
147
|
parameters.text = data.text;
|
147
148
|
parameters.tooltip = data.tooltip;
|
148
149
|
const tabPanelSelectedIndex = this.tabPanel.option('selectedIndex');
|
149
|
-
if (tabPanelSelectedIndex == 0)
|
150
|
-
parameters.url = data.url;
|
151
|
-
|
152
|
-
parameters.anchor = data.anchor;
|
150
|
+
if (tabPanelSelectedIndex == 0) {
|
151
|
+
[parameters.url, parameters.anchor] = UrlUtils.splitUrlByAnchor(data.url);
|
152
|
+
}
|
153
153
|
else {
|
154
|
-
|
155
|
-
|
154
|
+
if (tabPanelSelectedIndex == 1) {
|
155
|
+
parameters.url = "";
|
156
|
+
parameters.anchor = data.anchor;
|
157
|
+
}
|
158
|
+
else {
|
159
|
+
const subject = data.subject ? this.subjectPrefix + data.subject : '';
|
160
|
+
parameters.url = this.mailtoPrefix + data.email + subject;
|
161
|
+
parameters.anchor = "";
|
162
|
+
}
|
156
163
|
}
|
157
164
|
}
|
158
165
|
}
|
@@ -60,7 +60,7 @@ export class HyperlinkCollection extends Collection {
|
|
60
60
|
subDocument.insertText(field.getCodeInterval().start, HyperlinkInfo.getNewCodeText(info));
|
61
61
|
if (canChangeHyperlinkDisplayText && hyperlinkInfo.text || field.getResultInterval().length == 0) {
|
62
62
|
subDocument.deleteText(convertToIntervalApi(field.getResultInterval()));
|
63
|
-
subDocument.insertText(field.getResultInterval().start, !hyperlinkInfo.text || hyperlinkInfo.text == "" ? info.
|
63
|
+
subDocument.insertText(field.getResultInterval().start, !hyperlinkInfo.text || hyperlinkInfo.text == "" ? info.getUriWithAnchor() : hyperlinkInfo.text);
|
64
64
|
}
|
65
65
|
this._processor.modelManager.history.addAndRedo(new ApplyFieldHyperlinkStyleHistoryItem(this._processor.modelManager.modelManipulator, new SubDocumentInterval(this._subDocument, field.getResultInterval())));
|
66
66
|
this._processor.modelManager.history.endTransaction();
|
@@ -36,8 +36,14 @@ export class DialogHyperlinkCommandBase extends ShowDialogCommandBase {
|
|
36
36
|
var field = this.getState().value;
|
37
37
|
if (field) {
|
38
38
|
var hyperlinkInfo = field.getHyperlinkInfo();
|
39
|
-
|
40
|
-
|
39
|
+
if (hyperlinkInfo.isUri()) {
|
40
|
+
parameters.url = hyperlinkInfo.getUriWithAnchor();
|
41
|
+
parameters.anchor = "";
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
parameters.url = "";
|
45
|
+
parameters.anchor = hyperlinkInfo.anchor;
|
46
|
+
}
|
41
47
|
parameters.tooltip = hyperlinkInfo.tip;
|
42
48
|
parameters.text = FieldContextMenuHelper.getHyperlinkResultText(options.subDocument, field);
|
43
49
|
}
|
@@ -50,7 +56,7 @@ export class DialogHyperlinkCommandBase extends ShowDialogCommandBase {
|
|
50
56
|
if (newParams.tooltip == initParams.tooltip && newParams.url == initParams.url && newParams.anchor == initParams.anchor && newParams.text == initParams.text)
|
51
57
|
return false;
|
52
58
|
var hyperlinkInfo = new HyperlinkInfo(newParams.url, newParams.anchor, newParams.tooltip, false);
|
53
|
-
if (hyperlinkInfo.
|
59
|
+
if (!hyperlinkInfo.isValid())
|
54
60
|
return false;
|
55
61
|
var modelManipulator = this.modelManipulator;
|
56
62
|
var selection = this.selection;
|
@@ -72,7 +78,7 @@ export class DialogHyperlinkCommandBase extends ShowDialogCommandBase {
|
|
72
78
|
}
|
73
79
|
if (initParams.canChangeDisplayText && newParams.text != initParams.text || field.getResultInterval().length == 0) {
|
74
80
|
selection.deprecatedSetSelection(field.getResultStartPosition(), field.getResultEndPosition(), false, selection.keepX, false, false);
|
75
|
-
this.control.commandManager.getCommand(RichEditClientCommand.InsertText).execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, !newParams.text || newParams.text == "" ? hyperlinkInfo.
|
81
|
+
this.control.commandManager.getCommand(RichEditClientCommand.InsertText).execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, !newParams.text || newParams.text == "" ? hyperlinkInfo.getUriWithAnchor() : newParams.text));
|
76
82
|
}
|
77
83
|
history.addAndRedo(new ApplyFieldHyperlinkStyleHistoryItem(modelManipulator, new SubDocumentInterval(this.selection.activeSubDocument, field.getResultInterval())));
|
78
84
|
selection.deprecatedSetSelection(field.getFieldEndPosition(), field.getFieldEndPosition(), false, selection.keepX, false, false);
|
@@ -25,12 +25,15 @@ export class OpenHyperlinkCommand extends HyperlinkCommandBase {
|
|
25
25
|
this.history.endTransaction();
|
26
26
|
this.aspxForceSendingRequest();
|
27
27
|
}
|
28
|
-
if (hyperlinkInfo.
|
28
|
+
if (hyperlinkInfo.isUri()) {
|
29
|
+
let uri = hyperlinkInfo.getUriWithAnchor();
|
30
|
+
if (!UrlUtils.isValid(uri))
|
31
|
+
uri = UrlUtils.EmptyPage;
|
32
|
+
Url.navigate(uri, "_blank");
|
33
|
+
}
|
34
|
+
else {
|
29
35
|
this.control.commandManager.getCommand(RichEditClientCommand.GoToBookmark)
|
30
36
|
.execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, hyperlinkInfo.anchor));
|
31
|
-
else {
|
32
|
-
const url = UrlUtils.isValid(hyperlinkInfo.uri) ? hyperlinkInfo.uri : UrlUtils.EmptyPage;
|
33
|
-
Url.navigate(url, "_blank");
|
34
37
|
}
|
35
38
|
return true;
|
36
39
|
}
|
@@ -29,8 +29,11 @@ export declare class HyperlinkInfo implements ICloneable<HyperlinkInfo> {
|
|
29
29
|
visited: boolean;
|
30
30
|
constructor(uri: string, anchor: string, tip: string, visited: boolean);
|
31
31
|
clone(): HyperlinkInfo;
|
32
|
-
|
32
|
+
getUriWithAnchor(): string;
|
33
33
|
static getNewCodeText(hyperlinkInfo: HyperlinkInfo): string;
|
34
|
+
isUri(): boolean;
|
35
|
+
isMail(): boolean;
|
36
|
+
isValid(): boolean;
|
34
37
|
}
|
35
38
|
export declare class SequenceInfo {
|
36
39
|
identifier: string;
|
@@ -4,6 +4,7 @@ import { ListUtils } from '@devexpress/utils/lib/utils/list';
|
|
4
4
|
import { SearchUtils } from '@devexpress/utils/lib/utils/search';
|
5
5
|
import { FieldDeletedSubDocumentChange } from '../changes/sub-document/field/deleted';
|
6
6
|
import { RunType } from '../runs/run-type';
|
7
|
+
import { UrlUtils } from '../../utils/utils';
|
7
8
|
export var FieldNameType;
|
8
9
|
(function (FieldNameType) {
|
9
10
|
FieldNameType[FieldNameType["None"] = 0] = "None";
|
@@ -33,8 +34,8 @@ export class HyperlinkInfo {
|
|
33
34
|
clone() {
|
34
35
|
return new HyperlinkInfo(this.uri, this.anchor, this.tip, this.visited);
|
35
36
|
}
|
36
|
-
|
37
|
-
return this.uri + (this.anchor
|
37
|
+
getUriWithAnchor() {
|
38
|
+
return this.uri + (this.anchor.length > 0 ? "#" + this.anchor : "");
|
38
39
|
}
|
39
40
|
static getNewCodeText(hyperlinkInfo) {
|
40
41
|
return [
|
@@ -45,6 +46,21 @@ export class HyperlinkInfo {
|
|
45
46
|
hyperlinkInfo.anchor == "" ? "" : " \\l \"" + hyperlinkInfo.anchor + "\""
|
46
47
|
].join("");
|
47
48
|
}
|
49
|
+
isUri() {
|
50
|
+
if (this.uri.length === 0)
|
51
|
+
return false;
|
52
|
+
if (this.uri.startsWith("#"))
|
53
|
+
return false;
|
54
|
+
if (this.isMail())
|
55
|
+
return false;
|
56
|
+
return UrlUtils.isValid(this.uri);
|
57
|
+
}
|
58
|
+
isMail() {
|
59
|
+
return this.uri.startsWith("mailto:");
|
60
|
+
}
|
61
|
+
isValid() {
|
62
|
+
return !!(this.uri || this.anchor);
|
63
|
+
}
|
48
64
|
}
|
49
65
|
export class SequenceInfo {
|
50
66
|
constructor(identifier, repeats, hidesResult, resets, resetsWith) {
|
@@ -6,6 +6,7 @@ import { HyperlinkInfo } from '../field';
|
|
6
6
|
import { FieldName } from '../names';
|
7
7
|
import { FieldCodeParserState, FieldSwitchType } from './field-code-parser';
|
8
8
|
import { FieldCodeParserClientUpdatingBase } from './field-code-parser-client-updating-base';
|
9
|
+
import { UrlUtils } from '../../../utils/utils';
|
9
10
|
export class FieldCodeParserHyperlink extends FieldCodeParserClientUpdatingBase {
|
10
11
|
get name() { return FieldName.Hyperlink; }
|
11
12
|
parseCodeCurrentFieldInternal(_responce) {
|
@@ -17,54 +18,47 @@ export class FieldCodeParserHyperlink extends FieldCodeParserClientUpdatingBase
|
|
17
18
|
return true;
|
18
19
|
}
|
19
20
|
fillResult() {
|
20
|
-
var
|
21
|
-
|
22
|
-
|
21
|
+
var _a, _b;
|
22
|
+
const field = this.getTopField();
|
23
|
+
const text = (_b = (_a = this.parameterInfoList[0]) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : "";
|
24
|
+
const newHyperlinkInfo = this.updateHyperlinkInfo(text);
|
23
25
|
if (!newHyperlinkInfo) {
|
24
|
-
if (!this.modelManager.richOptions.fields.keepHyperlinkResultForInvalidReference)
|
26
|
+
if (!this.modelManager.richOptions.fields.keepHyperlinkResultForInvalidReference) {
|
25
27
|
this.removeInterval(this.getTopField().getResultInterval());
|
28
|
+
}
|
26
29
|
return true;
|
27
30
|
}
|
28
|
-
|
29
|
-
|
30
|
-
if (resultInterval.length
|
31
|
-
|
32
|
-
|
31
|
+
const modelManipulator = this.modelManager.modelManipulator;
|
32
|
+
const resultInterval = field.getResultInterval();
|
33
|
+
if (resultInterval.length === 0) {
|
34
|
+
const resultText = text !== null && text !== void 0 ? text : "#" + newHyperlinkInfo.anchor;
|
35
|
+
const newResultInterval = new FixedInterval(resultInterval.start, resultText.length);
|
33
36
|
this.setInputPositionState();
|
34
37
|
this.replaceTextByInterval(resultInterval, resultText);
|
35
|
-
|
38
|
+
const subDocumentInterval = new SubDocumentInterval(this.subDocument, newResultInterval);
|
39
|
+
const historyItem = new ApplyFieldHyperlinkStyleHistoryItem(modelManipulator, subDocumentInterval);
|
40
|
+
this.modelManager.history.addAndRedo(historyItem);
|
36
41
|
}
|
37
|
-
|
42
|
+
const historyItem = new ChangeFieldHyperlinkInfoHistoryItem(modelManipulator, this.subDocument, field.index, newHyperlinkInfo);
|
43
|
+
this.modelManager.history.addAndRedo(historyItem);
|
38
44
|
return true;
|
39
45
|
}
|
40
|
-
updateHyperlinkInfo(
|
41
|
-
|
46
|
+
updateHyperlinkInfo(text) {
|
47
|
+
const newHyperlinkInfo = new HyperlinkInfo("", "", "", false);
|
48
|
+
[newHyperlinkInfo.uri, newHyperlinkInfo.anchor] = UrlUtils.splitUrlByAnchor(text);
|
42
49
|
newHyperlinkInfo.visited = false;
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
break;
|
54
|
-
}
|
50
|
+
for (const switchInfo of this.switchInfoList) {
|
51
|
+
if (switchInfo.type != FieldSwitchType.FieldSpecific)
|
52
|
+
continue;
|
53
|
+
switch (switchInfo.name.toLocaleUpperCase()) {
|
54
|
+
case "O":
|
55
|
+
newHyperlinkInfo.tip = switchInfo.arg;
|
56
|
+
break;
|
57
|
+
case "L":
|
58
|
+
newHyperlinkInfo.anchor = switchInfo.arg;
|
59
|
+
break;
|
55
60
|
}
|
56
|
-
newHyperlinkInfo.tip = tipSwitch ? tipSwitch.arg : "";
|
57
|
-
var splitted = text.split("#");
|
58
|
-
if (splitted.length == 1) {
|
59
|
-
newHyperlinkInfo.uri = splitted[0];
|
60
|
-
newHyperlinkInfo.anchor = bookmarkSwitch ? bookmarkSwitch.arg : "";
|
61
|
-
if (newHyperlinkInfo.uri == "" && newHyperlinkInfo.anchor == "")
|
62
|
-
return null;
|
63
|
-
}
|
64
|
-
else {
|
65
|
-
newHyperlinkInfo.uri = splitted[0];
|
66
|
-
newHyperlinkInfo.anchor = splitted[1];
|
67
61
|
}
|
68
|
-
return newHyperlinkInfo;
|
62
|
+
return newHyperlinkInfo.isValid() ? newHyperlinkInfo : null;
|
69
63
|
}
|
70
64
|
}
|
@@ -71,5 +71,11 @@ export class UrlUtils {
|
|
71
71
|
catch (_a) { }
|
72
72
|
return false;
|
73
73
|
}
|
74
|
+
static splitUrlByAnchor(url) {
|
75
|
+
const hashTagPosition = url.indexOf("#");
|
76
|
+
if (hashTagPosition < 0)
|
77
|
+
return [url, ""];
|
78
|
+
return [url.substring(0, hashTagPosition), url.substring(hashTagPosition + 1)];
|
79
|
+
}
|
74
80
|
}
|
75
81
|
UrlUtils.EmptyPage = "about:blank";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "devexpress-richedit",
|
3
|
-
"version": "24.1.7
|
3
|
+
"version": "24.1.7",
|
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.7
|
18
|
-
"devextreme-dist": "24.1.7
|
17
|
+
"devextreme": "24.1.7",
|
18
|
+
"devextreme-dist": "24.1.7"
|
19
19
|
},
|
20
20
|
"dependencies": {
|
21
21
|
"jszip": "~3.10.1",
|