roosterjs 8.22.0 → 8.22.1

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.
@@ -1,4 +1,4 @@
1
- // Type definitions for roosterjs (Version 8.22.0)
1
+ // Type definitions for roosterjs (Version 8.22.1)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -2098,10 +2098,11 @@ export function clearFormat(editor: IEditor, formatType?: ClearFormatMode | Comp
2098
2098
  * When protocol is not specified, a best matched protocol will be predicted.
2099
2099
  * @param altText Optional alt text of the link, will be shown when hover on the link
2100
2100
  * @param displayText Optional display text for the link.
2101
+ * @param target Optional display target for the link ("_blank"|"_self"|"_parent"|"_top"|"{framename}")
2101
2102
  * If specified, the display text of link will be replaced with this text.
2102
2103
  * If not specified and there wasn't a link, the link url will be used as display text.
2103
2104
  */
2104
- export function createLink(editor: IEditor, link: string, altText?: string, displayText?: string): void;
2105
+ export function createLink(editor: IEditor, link: string, altText?: string, displayText?: string, target?: string): void;
2105
2106
 
2106
2107
  /**
2107
2108
  * Get format state at cursor
@@ -2954,6 +2955,8 @@ export const enum Keys {
2954
2955
  TAB = 9,
2955
2956
  ENTER = 13,
2956
2957
  SHIFT = 16,
2958
+ CTRL_LEFT = 17,
2959
+ ALT = 18,
2957
2960
  ESCAPE = 27,
2958
2961
  SPACE = 32,
2959
2962
  PAGEUP = 33,
@@ -2961,6 +2964,7 @@ export const enum Keys {
2961
2964
  UP = 38,
2962
2965
  RIGHT = 39,
2963
2966
  DOWN = 40,
2967
+ PRINT_SCREEN = 44,
2964
2968
  DELETE = 46,
2965
2969
  /**
2966
2970
  * @deprecated Just for backward compatibility
@@ -2972,6 +2976,7 @@ export const enum Keys {
2972
2976
  U = 85,
2973
2977
  Y = 89,
2974
2978
  Z = 90,
2979
+ META_LEFT = 91,
2975
2980
  COMMA = 188,
2976
2981
  DASH_UNDERSCORE = 189,
2977
2982
  PERIOD = 190,
@@ -7917,6 +7922,8 @@ export enum CompatibleKeys {
7917
7922
  TAB = 9,
7918
7923
  ENTER = 13,
7919
7924
  SHIFT = 16,
7925
+ CTRL_LEFT = 17,
7926
+ ALT = 18,
7920
7927
  ESCAPE = 27,
7921
7928
  SPACE = 32,
7922
7929
  PAGEUP = 33,
@@ -7924,6 +7931,7 @@ export enum CompatibleKeys {
7924
7931
  UP = 38,
7925
7932
  RIGHT = 39,
7926
7933
  DOWN = 40,
7934
+ PRINT_SCREEN = 44,
7927
7935
  DELETE = 46,
7928
7936
  /**
7929
7937
  * @deprecated Just for backward compatibility
@@ -7935,6 +7943,7 @@ export enum CompatibleKeys {
7935
7943
  U = 85,
7936
7944
  Y = 89,
7937
7945
  Z = 90,
7946
+ META_LEFT = 91,
7938
7947
  COMMA = 188,
7939
7948
  DASH_UNDERSCORE = 189,
7940
7949
  PERIOD = 190,
@@ -2684,10 +2684,11 @@ function applyLinkPrefix(url) {
2684
2684
  * When protocol is not specified, a best matched protocol will be predicted.
2685
2685
  * @param altText Optional alt text of the link, will be shown when hover on the link
2686
2686
  * @param displayText Optional display text for the link.
2687
+ * @param target Optional display target for the link ("_blank"|"_self"|"_parent"|"_top"|"{framename}")
2687
2688
  * If specified, the display text of link will be replaced with this text.
2688
2689
  * If not specified and there wasn't a link, the link url will be used as display text.
2689
2690
  */
2690
- function createLink(editor, link, altText, displayText) {
2691
+ function createLink(editor, link, altText, displayText, target) {
2691
2692
  editor.focus();
2692
2693
  var url = (checkXss(link) || '').trim();
2693
2694
  if (url) {
@@ -2733,6 +2734,9 @@ function createLink(editor, link, altText, displayText) {
2733
2734
  if (altText && anchor) {
2734
2735
  anchor.title = altText;
2735
2736
  }
2737
+ if (anchor) {
2738
+ updateAnchorTarget(anchor, target);
2739
+ }
2736
2740
  return anchor;
2737
2741
  }, "CreateLink" /* CreateLink */);
2738
2742
  }
@@ -2746,6 +2750,14 @@ function updateAnchorDisplayText(anchor, displayText) {
2746
2750
  anchor.textContent = displayText;
2747
2751
  }
2748
2752
  }
2753
+ function updateAnchorTarget(anchor, target) {
2754
+ if (target) {
2755
+ anchor.target = target;
2756
+ }
2757
+ else if (!target && anchor.getAttribute('target')) {
2758
+ anchor.removeAttribute('target');
2759
+ }
2760
+ }
2749
2761
  function checkXss(link) {
2750
2762
  var sanitizer = new roosterjs_editor_dom_1.HtmlSanitizer();
2751
2763
  var a = document.createElement('a');
@@ -23277,6 +23289,13 @@ var roosterjs_editor_dom_1 = __webpack_require__(/*! roosterjs-editor-dom */ "./
23277
23289
  var TABLE_CELL_SELECTOR = 'td,th';
23278
23290
  var LEFT_CLICK = 1;
23279
23291
  var RIGHT_CLICK = 3;
23292
+ var IGNORE_KEY_UP_KEYS = [
23293
+ 16 /* SHIFT */,
23294
+ 18 /* ALT */,
23295
+ 91 /* META_LEFT */,
23296
+ 17 /* CTRL_LEFT */,
23297
+ 44 /* PRINT_SCREEN */,
23298
+ ];
23280
23299
  /**
23281
23300
  * TableCellSelectionPlugin help highlight table cells
23282
23301
  */
@@ -23543,8 +23562,12 @@ var TableCellSelection = /** @class */ (function () {
23543
23562
  }
23544
23563
  };
23545
23564
  TableCellSelection.prototype.handleKeyUpEvent = function (event) {
23546
- var _a = event.rawEvent, shiftKey = _a.shiftKey, which = _a.which;
23547
- if (!shiftKey && which != 16 /* SHIFT */ && this.firstTarget && !this.preventKeyUp) {
23565
+ var _a = event.rawEvent, shiftKey = _a.shiftKey, which = _a.which, ctrlKey = _a.ctrlKey;
23566
+ if (!shiftKey &&
23567
+ !ctrlKey &&
23568
+ this.firstTarget &&
23569
+ !this.preventKeyUp &&
23570
+ IGNORE_KEY_UP_KEYS.indexOf(which) == -1) {
23548
23571
  this.clearState();
23549
23572
  }
23550
23573
  this.preventKeyUp = false;
@@ -26063,6 +26086,8 @@ var CompatibleKeys;
26063
26086
  CompatibleKeys[CompatibleKeys["TAB"] = 9] = "TAB";
26064
26087
  CompatibleKeys[CompatibleKeys["ENTER"] = 13] = "ENTER";
26065
26088
  CompatibleKeys[CompatibleKeys["SHIFT"] = 16] = "SHIFT";
26089
+ CompatibleKeys[CompatibleKeys["CTRL_LEFT"] = 17] = "CTRL_LEFT";
26090
+ CompatibleKeys[CompatibleKeys["ALT"] = 18] = "ALT";
26066
26091
  CompatibleKeys[CompatibleKeys["ESCAPE"] = 27] = "ESCAPE";
26067
26092
  CompatibleKeys[CompatibleKeys["SPACE"] = 32] = "SPACE";
26068
26093
  CompatibleKeys[CompatibleKeys["PAGEUP"] = 33] = "PAGEUP";
@@ -26070,6 +26095,7 @@ var CompatibleKeys;
26070
26095
  CompatibleKeys[CompatibleKeys["UP"] = 38] = "UP";
26071
26096
  CompatibleKeys[CompatibleKeys["RIGHT"] = 39] = "RIGHT";
26072
26097
  CompatibleKeys[CompatibleKeys["DOWN"] = 40] = "DOWN";
26098
+ CompatibleKeys[CompatibleKeys["PRINT_SCREEN"] = 44] = "PRINT_SCREEN";
26073
26099
  CompatibleKeys[CompatibleKeys["DELETE"] = 46] = "DELETE";
26074
26100
  /**
26075
26101
  * @deprecated Just for backward compatibility
@@ -26081,6 +26107,7 @@ var CompatibleKeys;
26081
26107
  CompatibleKeys[CompatibleKeys["U"] = 85] = "U";
26082
26108
  CompatibleKeys[CompatibleKeys["Y"] = 89] = "Y";
26083
26109
  CompatibleKeys[CompatibleKeys["Z"] = 90] = "Z";
26110
+ CompatibleKeys[CompatibleKeys["META_LEFT"] = 91] = "META_LEFT";
26084
26111
  CompatibleKeys[CompatibleKeys["COMMA"] = 188] = "COMMA";
26085
26112
  CompatibleKeys[CompatibleKeys["DASH_UNDERSCORE"] = 189] = "DASH_UNDERSCORE";
26086
26113
  CompatibleKeys[CompatibleKeys["PERIOD"] = 190] = "PERIOD";