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