roosterjs 9.26.0 → 9.27.0

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/rooster.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for roosterjs (Version 9.26.0)
1
+ // Type definitions for roosterjs (Version 9.27.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -76,7 +76,7 @@ type ShallowMutableContentModelWithDataset<T> = ShallowMutableMark & {
76
76
  /**
77
77
  * The format object for a paragraph in Content Model
78
78
  */
79
- type ContentModelBlockFormat = BackgroundColorFormat & DirectionFormat & TextAlignFormat & HtmlAlignFormat & MarginFormat & PaddingFormat & LineHeightFormat & WhiteSpaceFormat & BorderFormat & TextIndentFormat;
79
+ type ContentModelBlockFormat = BackgroundColorFormat & DirectionFormat & TextAlignFormat & HtmlAlignFormat & MarginFormat & PaddingFormat & LineHeightFormat & WhiteSpaceFormat & BorderFormat & TextIndentFormat & IdFormat;
80
80
 
81
81
  /**
82
82
  * Format of table cell
@@ -236,7 +236,7 @@ interface ContentModelFormatMap {
236
236
  /**
237
237
  * The format object for an image in Content Model
238
238
  */
239
- type ContentModelImageFormat = ContentModelSegmentFormat & IdFormat & SizeFormat & MarginFormat & PaddingFormat & BorderFormat & BoxShadowFormat & DisplayFormat & FloatFormat & VerticalAlignFormat;
239
+ type ContentModelImageFormat = ContentModelSegmentFormat & IdFormat & SizeFormat & MarginFormat & PaddingFormat & BorderFormat & BoxShadowFormat & DisplayFormat & FloatFormat & VerticalAlignFormat & ImageStateFormat;
240
240
 
241
241
  /**
242
242
  * The format object for an entity in Content Model
@@ -307,6 +307,10 @@ interface FormatHandlerTypeMap {
307
307
  * Format for IdFormat
308
308
  */
309
309
  id: IdFormat;
310
+ /**
311
+ * Format of ImageStateFormat
312
+ */
313
+ imageState: ImageStateFormat;
310
314
  /**
311
315
  * Format for ItalicFormat
312
316
  */
@@ -891,6 +895,16 @@ type UndeletableFormat = {
891
895
  undeletable?: boolean;
892
896
  };
893
897
 
898
+ /**
899
+ * The hidden property of an image
900
+ */
901
+ type ImageStateFormat = {
902
+ /**
903
+ * A hidden marker for the image state
904
+ */
905
+ imageState?: string;
906
+ };
907
+
894
908
  /**
895
909
  * Represents dataset format of Content Model
896
910
  */
@@ -3590,9 +3604,15 @@ type ExperimentalFeature = /**
3590
3604
  */
3591
3605
  | 'LegacyImageSelection'
3592
3606
  /**
3607
+ * @deprecated Please use the shouldHandleEnterKey option of the EditPlugin Options
3593
3608
  * Use Content Model handle ENTER key
3594
3609
  */
3595
- | 'HandleEnterKey';
3610
+ | 'HandleEnterKey'
3611
+ /**
3612
+ * Prevent default browser behavior for copy/cut event,
3613
+ * and set the clipboard data with custom implementation.
3614
+ */
3615
+ | 'CustomCopyCut';
3596
3616
 
3597
3617
  /**
3598
3618
  * Options for editor
@@ -4855,9 +4875,13 @@ interface ContentModelFormatState {
4855
4875
  */
4856
4876
  fontWeight?: string;
4857
4877
  /**
4858
- * Format of image, if there is table at cursor position
4878
+ * Format of image, if there is image at cursor position
4859
4879
  */
4860
4880
  imageFormat?: ImageFormatState;
4881
+ /**
4882
+ * Editing metadata of image, if there is image at cursor position
4883
+ */
4884
+ imageEditingMetadata?: ImageMetadataFormat | null;
4861
4885
  /**
4862
4886
  * Letter spacing
4863
4887
  */
@@ -5306,7 +5330,15 @@ type TrustedHTMLHandler = DOMCreator | LegacyTrustedHTMLHandler;
5306
5330
  * A handler type to convert HTML string to a DOM object
5307
5331
  */
5308
5332
  interface DOMCreator {
5333
+ /**
5334
+ * Callback to convert HTML string to a DOM object
5335
+ */
5309
5336
  htmlToDOM: (html: string) => Document;
5337
+ /**
5338
+ * Flag to indicate if this handler is bypassed or not.
5339
+ * If this is true, it means that when converting HTML string to DOM object, we don't need to do any conversion.
5340
+ */
5341
+ isBypassed?: boolean;
5310
5342
  }
5311
5343
 
5312
5344
  /**
@@ -6964,6 +6996,14 @@ function normalizeSingleSegment(paragraph: ReadonlyContentModelParagraph, segmen
6964
6996
  */
6965
6997
  function mergeTextSegments(block: ShallowMutableContentModelParagraph): void;
6966
6998
 
6999
+ /**
7000
+ * Some format values can be changed when apply to DOM, such as font family.
7001
+ * This function will normalize the format and return the same string after DOM modification.
7002
+ * @param format The format to be normalized
7003
+ * @return Normalized format
7004
+ */
7005
+ function normalizeSegmentFormat(format: ContentModelSegmentFormat, environment: EditorEnvironment): ContentModelSegmentFormat;
7006
+
6967
7007
  /**
6968
7008
  * For a given block, if it is a paragraph, set it to be not-implicit
6969
7009
  * @param block The block to check
@@ -7215,6 +7255,16 @@ function setParagraphMarker(element: HTMLElement, marker: string): void;
7215
7255
  */
7216
7256
  function getParagraphMarker(element: HTMLElement): string | undefined;
7217
7257
 
7258
+ /**
7259
+ * Set image state to element. This is used to store a image state.
7260
+ */
7261
+ function setImageState(element: HTMLElement, marker: string): void;
7262
+
7263
+ /**
7264
+ * Get image state from element. This is used to store a image state.
7265
+ */
7266
+ function getImageState(element: HTMLElement): string | undefined;
7267
+
7218
7268
  /**
7219
7269
  * Check if the given content model block or block group is of the expected block group type
7220
7270
  * @param input The object to check
@@ -7693,6 +7743,18 @@ const BulletListType: {
7693
7743
  * Bullet type circle
7694
7744
  */
7695
7745
  Circle: number;
7746
+ /**
7747
+ * Box Shadow bullet type
7748
+ */
7749
+ BoxShadow: number;
7750
+ /**
7751
+ * Rhombus with a cross inside
7752
+ */
7753
+ Xrhombus: number;
7754
+ /**
7755
+ * Check mark bullet type
7756
+ */
7757
+ CheckMark: number;
7696
7758
  /**
7697
7759
  * Maximum value of the enum
7698
7760
  */
@@ -8764,6 +8826,8 @@ class EditPlugin implements EditorPlugin {
8764
8826
  * handleTabKey: A boolean that enables or disables Tab key handling. Defaults to true.
8765
8827
  */
8766
8828
  constructor(options?: EditOptions);
8829
+ private createNormalEnterChecker;
8830
+ private getHandleNormalEnter;
8767
8831
  /**
8768
8832
  * Get name of this plugin
8769
8833
  */
@@ -8814,6 +8878,13 @@ type EditOptions = {
8814
8878
  * @default true
8815
8879
  */
8816
8880
  handleExpandedSelectionOnDelete?: boolean;
8881
+ /**
8882
+ * Callback function to determine whether the Rooster should handle the Enter key press.
8883
+ * If the function returns true, the Rooster will handle the Enter key press instead of the browser.
8884
+ * @param editor - The editor instance.
8885
+ * @returns A boolean
8886
+ */
8887
+ shouldHandleEnterKey?: ((editor: IEditor) => boolean) | boolean;
8817
8888
  };
8818
8889
 
8819
8890
  /**
@@ -8862,10 +8933,13 @@ class AutoFormatPlugin implements EditorPlugin {
8862
8933
  * @param event The event to handle:
8863
8934
  */
8864
8935
  onPluginEvent(event: PluginEvent): void;
8936
+ private autoLink;
8937
+ private tabFeatures;
8865
8938
  private features;
8939
+ private enterFeatures;
8940
+ private handleKeyboardEvents;
8866
8941
  private handleEditorInputEvent;
8867
8942
  private handleKeyDownEvent;
8868
- private handleEnterKey;
8869
8943
  private handleContentChangedEvent;
8870
8944
  }
8871
8945