devexpress-richedit 24.2.1-alpha-24260-0102 → 24.2.2-beta

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.
Files changed (98) hide show
  1. package/bin/gulpfile.js +1 -1
  2. package/bin/index-custom.js +1 -1
  3. package/bin/localization-builder.js +1 -1
  4. package/bin/nspell-index.js +1 -1
  5. package/bin/nspell.webpack.config.js +1 -1
  6. package/bin/webpack-externals.js +1 -1
  7. package/bin/webpack.config.js +1 -1
  8. package/dist/dx.richedit.d.ts +12 -1
  9. package/dist/dx.richedit.js +528 -226
  10. package/dist/dx.richedit.min.js +2 -2
  11. package/index.d.ts +1 -1
  12. package/index.js +1 -1
  13. package/lib/client/bars/rich-edit-ribbon/ribbon-items-data.js +2 -1
  14. package/lib/client/client-rich-edit.js +6 -6
  15. package/lib/client/commands/commands.js +3 -0
  16. package/lib/client/commands/new-document-command.js +2 -1
  17. package/lib/client/default-localization.js +2 -0
  18. package/lib/client/dialogs/hyperlink-dialog.js +13 -6
  19. package/lib/client/formats/docx/import/color/open-xml-color-import-helper.js +2 -2
  20. package/lib/client/formats/docx/import/importers/styles-importer.js +2 -1
  21. package/lib/client/i-rich-constructor-settings.d.ts +1 -2
  22. package/lib/client/model-api/collections/drawing-object-collection.js +1 -1
  23. package/lib/client/model-api/collections/hyperlink-collection.js +1 -1
  24. package/lib/client/public/commands/enum.d.ts +1 -0
  25. package/lib/client/public/commands/enum.js +1 -0
  26. package/lib/client/public/options.d.ts +1 -2
  27. package/lib/client/public/ribbon/item-ids.d.ts +1 -0
  28. package/lib/client/public/ribbon/item-ids.js +1 -0
  29. package/lib/client/public/rich-edit.js +1 -1
  30. package/lib/client/settings.js +2 -4
  31. package/lib/common/commands/client-command.d.ts +2 -1
  32. package/lib/common/commands/client-command.js +1 -0
  33. package/lib/common/commands/command-manager.js +2 -1
  34. package/lib/common/commands/dialogs/dialog-hyperlink-command.js +10 -4
  35. package/lib/common/commands/fields/create-field-command.d.ts +4 -0
  36. package/lib/common/commands/fields/create-field-command.js +8 -0
  37. package/lib/common/commands/fields/open-hyperlink-command.js +9 -6
  38. package/lib/common/commands/floating-objects/floating-object-drag-drop-change-position-command.js +1 -1
  39. package/lib/common/commands/floating-objects/insert-anchored-text-box-command.js +1 -1
  40. package/lib/common/formats/html/export/html-export.d.ts +7 -1
  41. package/lib/common/formats/html/export/html-export.js +35 -35
  42. package/lib/common/formats/html/import/html-importer.js +1 -1
  43. package/lib/common/formats/html/import/importers/list-base.js +4 -4
  44. package/lib/common/input-controller.d.ts +14 -1
  45. package/lib/common/input-controller.js +58 -20
  46. package/lib/common/layout/document-layout.js +1 -1
  47. package/lib/common/layout/main-structures/layout-boxes/layout-space-box.js +1 -1
  48. package/lib/common/model/color/color-model-info.d.ts +1 -1
  49. package/lib/common/model/color/color-model-info.js +2 -1
  50. package/lib/common/model/fields/field.d.ts +4 -1
  51. package/lib/common/model/fields/field.js +18 -2
  52. package/lib/common/model/fields/names.d.ts +2 -1
  53. package/lib/common/model/fields/names.js +1 -0
  54. package/lib/common/model/fields/parsers/field-code-parser-client-updating-base.js +1 -1
  55. package/lib/common/model/fields/parsers/field-code-parser-doc-variable.js +1 -1
  56. package/lib/common/model/fields/parsers/field-code-parser-hyperlink.js +32 -38
  57. package/lib/common/model/fields/parsers/field-code-parser-if.d.ts +39 -0
  58. package/lib/common/model/fields/parsers/field-code-parser-if.js +138 -0
  59. package/lib/common/model/fields/parsers/field-code-parser-merge-field.js +1 -1
  60. package/lib/common/model/fields/parsers/field-code-parser.d.ts +3 -2
  61. package/lib/common/model/fields/parsers/field-code-parser.js +6 -12
  62. package/lib/common/model/fields/tree-creator.js +2 -0
  63. package/lib/common/model/history/items/floating-objects/insert-anchored-picture-history-item.js +1 -0
  64. package/lib/common/model/history/items/switch-text-box-sub-documents-state-history-item.js +0 -1
  65. package/lib/common/model/manipulators/document/sub-document-inserter.d.ts +1 -0
  66. package/lib/common/model/manipulators/document/sub-document-inserter.js +4 -0
  67. package/lib/common/model/manipulators/range/remove-interval-operation.d.ts +2 -0
  68. package/lib/common/model/manipulators/range/remove-interval-operation.js +10 -2
  69. package/lib/common/model/manipulators/range-permission-manipulator.d.ts +4 -0
  70. package/lib/common/model/manipulators/range-permission-manipulator.js +35 -0
  71. package/lib/common/model/manipulators/text-box-manipulator.d.ts +1 -1
  72. package/lib/common/model/manipulators/text-box-manipulator.js +2 -1
  73. package/lib/common/model/manipulators/text-manipulator/text-manipulator.js +1 -1
  74. package/lib/common/model/options/fields.d.ts +1 -2
  75. package/lib/common/model/options/fields.js +2 -5
  76. package/lib/common/model/styles-manager.js +1 -0
  77. package/lib/common/selection/selection.js +2 -1
  78. package/lib/common/ui/ruler/controls/indent/first-line.js +5 -5
  79. package/lib/common/ui/ruler/controls/indent/left.js +6 -6
  80. package/lib/common/ui/ruler/controls/indent/right.js +4 -4
  81. package/lib/common/ui/ruler/controls/margin/left.js +1 -1
  82. package/lib/common/ui/ruler/controls/margin/right.js +1 -1
  83. package/lib/common/ui/ruler/controls/ruler.js +2 -2
  84. package/lib/common/ui/ruler/controls/tab/tab-type.js +3 -3
  85. package/lib/common/ui/ruler/controls/tab/tab.js +7 -7
  86. package/lib/common/ui/ruler/controls/tab/utils.d.ts +2 -2
  87. package/lib/common/ui/ruler/controls/tab/utils.js +5 -5
  88. package/lib/common/ui/ruler/controls/table.js +1 -1
  89. package/lib/common/ui/ruler/controls/vertical-line.d.ts +1 -2
  90. package/lib/common/ui/ruler/controls/vertical-line.js +2 -2
  91. package/lib/common/ui/ruler/controls/wrapper.js +1 -1
  92. package/lib/common/ui/ruler/manager.js +1 -1
  93. package/lib/common/ui/ruler/model-data.d.ts +8 -2
  94. package/lib/common/ui/ruler/model-data.js +6 -0
  95. package/lib/common/ui/ruler/ruler.js +2 -1
  96. package/lib/common/utils/utils.d.ts +10 -5
  97. package/lib/common/utils/utils.js +46 -18
  98. package/package.json +3 -3
@@ -59,7 +59,7 @@ export class RulerControls {
59
59
  this.tabs = new RulerTabsControl(modelData, this);
60
60
  this.ruler.init();
61
61
  this.tabTypeBox.init();
62
- this.lineControl = new RulerVerticalLineControl(this.canvas, modelData.settings, this.ruler.rootElement);
62
+ this.lineControl = new RulerVerticalLineControl(this.canvas, modelData.styles.line.className, this.ruler.rootElement);
63
63
  this.mouseHandler = new RulerMouseHandler(modelData, this);
64
64
  this.mouseEventsManager.addListener(this.mouseHandler);
65
65
  this.viewElementScrollManager.addListener(this.ruler, this.canvas);
@@ -4,10 +4,16 @@ import { CommandManager } from '../../commands/command-manager';
4
4
  import { RichEditCore } from '../../rich-edit-core';
5
5
  import { InputPosition } from '../../selection/input-position';
6
6
  import { Selection } from '../../selection/selection';
7
- import { RulerSettings } from './settings';
7
+ import { RulerSettings, RulerStyles, RulerTitles, RulerVisibility } from './settings';
8
8
  export declare class RulerModelData {
9
9
  private core;
10
- readonly settings: RulerSettings;
10
+ private readonly settings;
11
+ visibility: RulerVisibility;
12
+ showTabs: boolean;
13
+ get showLeftIndent(): boolean;
14
+ get showRightIndent(): boolean;
15
+ get titles(): RulerTitles;
16
+ get styles(): RulerStyles;
11
17
  get inputPosition(): InputPosition;
12
18
  get commandManager(): CommandManager;
13
19
  get isClosed(): boolean;
@@ -1,6 +1,10 @@
1
1
  import { ReadOnlyMode } from '../../interfaces/i-rich-edit-core';
2
2
  import { RulerStyleInfo } from './settings';
3
3
  export class RulerModelData {
4
+ get showLeftIndent() { return this.settings.showLeftIndent; }
5
+ get showRightIndent() { return this.settings.showRightIndent; }
6
+ get titles() { return this.settings.titles; }
7
+ get styles() { return this.settings.styles; }
4
8
  get inputPosition() { return this.core.inputPosition; }
5
9
  ;
6
10
  get commandManager() { return this.core.commandManager; }
@@ -12,6 +16,8 @@ export class RulerModelData {
12
16
  constructor(core, settings) {
13
17
  this.core = core;
14
18
  this.settings = this.fixSettings(settings);
19
+ this.visibility = this.settings.visibility;
20
+ this.showTabs = this.settings.showTabs;
15
21
  }
16
22
  fixSettings(settings) {
17
23
  if (!settings.styles.firstLineIndent)
@@ -175,6 +175,7 @@ export class HorizontalRulerControl extends BatchUpdatableObject {
175
175
  }
176
176
  setVisible(visible) {
177
177
  if (visible != this._innerVisible || visible != this._visible) {
178
+ this.modelData.visibility = visible ? RulerVisibility.Visible : RulerVisibility.Hidden;
178
179
  this._visible = visible;
179
180
  this.innerSetVisible(visible);
180
181
  }
@@ -201,7 +202,7 @@ export class HorizontalRulerControl extends BatchUpdatableObject {
201
202
  return;
202
203
  if (!this.initialized && this.canvas.offsetWidth)
203
204
  this.controls = new RulerControls(this.canvas, this.modelData);
204
- this.setVisible(this.modelData.settings.visibility != RulerVisibility.Hidden);
205
+ this.setVisible(this.modelData.visibility != RulerVisibility.Hidden);
205
206
  this.onViewTypeChanged();
206
207
  }
207
208
  }
@@ -1,5 +1,5 @@
1
1
  import { Point } from '@devexpress/utils/lib/geometry/point';
2
- import { IRichEditControl } from '../interfaces/i-rich-edit-core';
2
+ import { IModelManager } from '../model-manager';
3
3
  export declare function rotatePoint(point: Point, angle: number, center: Point): Point;
4
4
  export declare class SearchTreeItemResult<T> {
5
5
  readonly parentList: T[];
@@ -13,8 +13,13 @@ export declare function searchTreeItem<T extends {
13
13
  export declare function convertToFunction(func: any): any | null;
14
14
  export declare function splitByLines(text: string): string[];
15
15
  export interface IUrlValidationOptions {
16
- allowRelativeUrl?: boolean;
17
- allowedProtocols?: string[];
16
+ allowedSchemes?: string[];
17
+ }
18
+ export declare function createUrlValidationOptions(modelManager: IModelManager): IUrlValidationOptions;
19
+ export declare class UrlUtils {
20
+ static EmptyPage: string;
21
+ static isValid(url: string, options?: IUrlValidationOptions): boolean;
22
+ static isRelative(url: string): boolean;
23
+ static convertToAbsolute(url: string): URL | null;
24
+ static splitUrlByAnchor(url: string): [url: string, anchor: string];
18
25
  }
19
- export declare function createUrlValidationOptions(control: IRichEditControl): IUrlValidationOptions;
20
- export declare function isUrlValid(url: string, options?: IUrlValidationOptions): boolean;
@@ -56,29 +56,57 @@ 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;
59
+ export function createUrlValidationOptions(modelManager) {
60
+ const fieldSettings = modelManager.richOptions.fields;
61
61
  return {
62
- allowRelativeUrl: !fieldSettings.disableRelativeHyperlinkUri,
63
- allowedProtocols: fieldSettings.allowedHyperlinkUriProtocols
62
+ allowedSchemes: fieldSettings.allowedHyperlinkUriSchemes
64
63
  };
65
64
  }
65
+ const defaultAllowedProtocols = [
66
+ 'http',
67
+ 'https',
68
+ 'mailto',
69
+ 'tel'
70
+ ];
66
71
  const disallowedProtocols = [
67
- 'data',
68
- 'javascript'
72
+ 'javascript',
73
+ 'data'
69
74
  ];
70
- export function isUrlValid(url, options) {
71
- let currentLocation;
72
- if (options === null || options === void 0 ? void 0 : options.allowRelativeUrl)
73
- currentLocation = window.location.href;
74
- try {
75
- const resultUrl = new URL(url, currentLocation);
75
+ export class UrlUtils {
76
+ static isValid(url, options) {
77
+ var _a;
78
+ const resultUrl = this.convertToAbsolute(url);
79
+ if (!resultUrl)
80
+ return false;
76
81
  const protocol = resultUrl.protocol.slice(0, -1);
77
- const allowedProtocols = options === null || options === void 0 ? void 0 : options.allowedProtocols;
78
- if (allowedProtocols)
79
- return allowedProtocols.includes(protocol);
80
- return !disallowedProtocols.includes(protocol);
82
+ if (disallowedProtocols.includes(protocol))
83
+ return false;
84
+ const allowedProtocols = (_a = options === null || options === void 0 ? void 0 : options.allowedSchemes) !== null && _a !== void 0 ? _a : defaultAllowedProtocols;
85
+ return allowedProtocols.includes(protocol);
86
+ }
87
+ static isRelative(url) {
88
+ try {
89
+ new URL(url);
90
+ return false;
91
+ }
92
+ catch (_a) {
93
+ return true;
94
+ }
95
+ }
96
+ static convertToAbsolute(url) {
97
+ const currentLocation = window.location.href;
98
+ try {
99
+ return new URL(url, currentLocation);
100
+ }
101
+ catch (_a) {
102
+ return null;
103
+ }
104
+ }
105
+ static splitUrlByAnchor(url) {
106
+ const hashTagPosition = url.indexOf("#");
107
+ if (hashTagPosition < 0)
108
+ return [url, ""];
109
+ return [url.substring(0, hashTagPosition), url.substring(hashTagPosition + 1)];
81
110
  }
82
- catch (_a) { }
83
- return false;
84
111
  }
112
+ UrlUtils.EmptyPage = "about:blank";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devexpress-richedit",
3
- "version": "24.2.1-alpha-24260-0102",
3
+ "version": "24.2.2-beta",
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.2.1-alpha-24256-1935",
18
- "devextreme-dist": "24.2.1-alpha-24256-1935"
17
+ "devextreme": "24.2.2-beta",
18
+ "devextreme-dist": "24.2.2-beta"
19
19
  },
20
20
  "dependencies": {
21
21
  "jszip": "~3.10.1",