roosterjs 9.5.0 → 9.6.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-amd-min.js +1 -1
- package/dist/rooster-amd-min.js.map +1 -1
- package/dist/rooster-amd.d.ts +17 -2
- package/dist/rooster-amd.js +280 -79
- package/dist/rooster-amd.js.map +1 -1
- package/dist/rooster-min.js +1 -1
- package/dist/rooster-min.js.map +1 -1
- package/dist/rooster-react-amd-min.js +2 -0
- package/dist/rooster-react-amd-min.js.map +1 -0
- package/dist/rooster-react-amd.d.ts +852 -0
- package/dist/rooster-react-amd.js +6762 -0
- package/dist/rooster-react-amd.js.map +1 -0
- package/dist/rooster-react-min.js +2 -0
- package/dist/rooster-react-min.js.map +1 -0
- package/dist/rooster-react.d.ts +854 -0
- package/dist/rooster-react.js +6762 -0
- package/dist/rooster-react.js.map +1 -0
- package/dist/rooster.d.ts +17 -2
- package/dist/rooster.js +280 -79
- package/dist/rooster.js.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
/// <reference path="./rooster-amd" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
|
|
4
|
+
import * as FluentUIReact from '@fluentui/react/dist/react';
|
|
5
|
+
|
|
6
|
+
// Type definitions for roosterjs (Version 9.0.0)
|
|
7
|
+
// Generated by dts tool from roosterjs
|
|
8
|
+
// Project: https://github.com/Microsoft/roosterjs
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents a localized string map from the string key to the localized string or a function returns localized string
|
|
12
|
+
*/
|
|
13
|
+
export type LocalizedStrings<T extends string, V extends string = string> = {
|
|
14
|
+
[key in T]?: V | (() => V);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Localized string key for OK button
|
|
19
|
+
*/
|
|
20
|
+
export type OkButtonStringKey = 'buttonNameOK';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Localized string key for Cancel button
|
|
24
|
+
*/
|
|
25
|
+
export type CancelButtonStringKey = 'buttonNameCancel';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Localized string key for Cancel button menu splitter.
|
|
29
|
+
* No need to localize this one as it will be replaced with a horizontal line
|
|
30
|
+
*/
|
|
31
|
+
export type MenuItemSplitterKey0 = '-';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A set of UI Utilities to help render additional UI element from a plugin
|
|
35
|
+
*/
|
|
36
|
+
export interface UIUtilities {
|
|
37
|
+
/**
|
|
38
|
+
* Render additional react component from a plugin, with correlated theme and window context of Rooster
|
|
39
|
+
* @param element The UI element (JSX object) to render
|
|
40
|
+
* @returns A disposer function to help unmount this element
|
|
41
|
+
*/
|
|
42
|
+
renderComponent(element: JSX.Element): () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Check if editor is rendered in Right-to-left mode
|
|
45
|
+
*/
|
|
46
|
+
isRightToLeft(): boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A sub interface of roosterjs.EditorPlugin to provide additional functionalities for rendering react component from the plugin
|
|
51
|
+
*/
|
|
52
|
+
export interface ReactEditorPlugin extends roosterjs.EditorPlugin {
|
|
53
|
+
/**
|
|
54
|
+
* Set the UI utilities objects to this plugin to help render additional UI elements
|
|
55
|
+
* @param uiUtilities The UI utilities object to set
|
|
56
|
+
*/
|
|
57
|
+
setUIUtilities(uiUtilities: UIUtilities): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Create the UI Utilities object for plugins to render additional react components
|
|
62
|
+
* @param container Container DIV of editor
|
|
63
|
+
* @param theme Current theme used by editor
|
|
64
|
+
* @returns A UIUtilities object
|
|
65
|
+
*/
|
|
66
|
+
export function createUIUtilities(container: HTMLDivElement, theme: FluentUIReact.PartialTheme): UIUtilities;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get a localized string
|
|
70
|
+
* @param strings The LocalizedStrings map
|
|
71
|
+
* @param key Key of the string
|
|
72
|
+
* @param defaultString Default unlocalized string, will be used if strings is not specified or the give key doesn't exist in strings
|
|
73
|
+
* @returns A localized string from the string map, or defaultString
|
|
74
|
+
*/
|
|
75
|
+
export function getLocalizedString<T extends string, R extends string | null | undefined>(strings: LocalizedStrings<T> | undefined, key: T, defaultString: R): string | R;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Properties for Rooster react component
|
|
79
|
+
*/
|
|
80
|
+
export interface RoosterProps extends roosterjs.EditorOptions, React.HTMLAttributes<HTMLDivElement> {
|
|
81
|
+
/**
|
|
82
|
+
* Creator function used for creating the instance of roosterjs editor.
|
|
83
|
+
* Use this callback when you have your own sub class of roosterjs Editor or force trigging a reset of editor
|
|
84
|
+
*/
|
|
85
|
+
editorCreator?: (div: HTMLDivElement, options: roosterjs.EditorOptions) => roosterjs.IEditor;
|
|
86
|
+
/**
|
|
87
|
+
* Whether editor should get focus once it is created
|
|
88
|
+
* Changing of this value after editor is created will not reset editor
|
|
89
|
+
*/
|
|
90
|
+
focusOnInit?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Main component of react wrapper for roosterjs
|
|
95
|
+
* @param props Properties of this component
|
|
96
|
+
* @returns The react component
|
|
97
|
+
*/
|
|
98
|
+
export function Rooster(props: RoosterProps): JSX.Element;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Represents a plugin to connect format ribbon component and the editor
|
|
102
|
+
*/
|
|
103
|
+
export interface RibbonPlugin extends ReactEditorPlugin {
|
|
104
|
+
/**
|
|
105
|
+
* Register a callback to be invoked when format state of editor is changed, returns a disposer function.
|
|
106
|
+
*/
|
|
107
|
+
registerFormatChangedCallback: (callback: (formatState: roosterjs.ContentModelFormatState) => void) => () => void;
|
|
108
|
+
/**
|
|
109
|
+
* When user clicks on a button, call this method to let the plugin to handle this click event
|
|
110
|
+
* @param button The button that is clicked
|
|
111
|
+
* @param key Key of child menu item that is clicked if any
|
|
112
|
+
* @param strings The localized string map for this button
|
|
113
|
+
*/
|
|
114
|
+
onButtonClick: <T extends string>(button: RibbonButton<T>, key: T, strings?: LocalizedStrings<T>) => void;
|
|
115
|
+
/**
|
|
116
|
+
* Enter live preview state (shadow edit) of editor if there is a non-collapsed selection
|
|
117
|
+
* @param button The button that triggered this action
|
|
118
|
+
* @param key Key of the hovered button sub item
|
|
119
|
+
* @param strings The localized string map for this button
|
|
120
|
+
*/
|
|
121
|
+
startLivePreview: <T extends string>(button: RibbonButton<T>, key: T, strings?: LocalizedStrings<T>) => void;
|
|
122
|
+
/**
|
|
123
|
+
* Leave live preview state (shadow edit) of editor
|
|
124
|
+
*/
|
|
125
|
+
stopLivePreview: () => void;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Represents a button on format ribbon
|
|
130
|
+
*/
|
|
131
|
+
export interface RibbonButton<T extends string> {
|
|
132
|
+
/**
|
|
133
|
+
* key of this button, needs to be unique
|
|
134
|
+
*/
|
|
135
|
+
key: T;
|
|
136
|
+
/**
|
|
137
|
+
* Name of button icon. See https://developer.microsoft.com/en-us/fluentui#/styles/web/icons for all icons
|
|
138
|
+
*/
|
|
139
|
+
iconName: string;
|
|
140
|
+
/**
|
|
141
|
+
* True if we need to flip the icon when render in Right-to-left page
|
|
142
|
+
*/
|
|
143
|
+
flipWhenRtl?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Text of the button. This text is not localized. To show a localized text, pass a dictionary to Ribbon component via RibbonProps.strings.
|
|
146
|
+
*/
|
|
147
|
+
unlocalizedText: string;
|
|
148
|
+
/**
|
|
149
|
+
* Click handler of this button.
|
|
150
|
+
* @param editor the editor instance
|
|
151
|
+
* @param key key of the button that is clicked
|
|
152
|
+
* @param strings localized strings used by any UI element of this click handler
|
|
153
|
+
* @param uiUtilities a utilities object to help render addition UI elements
|
|
154
|
+
*/
|
|
155
|
+
onClick: (editor: roosterjs.IEditor, key: T, strings: LocalizedStrings<T> | undefined, uiUtilities: UIUtilities) => void;
|
|
156
|
+
/**
|
|
157
|
+
* Get if the current button should be checked
|
|
158
|
+
* @param formatState The current formatState of editor
|
|
159
|
+
* @returns True to show the button in a checked state, otherwise false
|
|
160
|
+
* @default False When not specified, it is treated as always returning false
|
|
161
|
+
*/
|
|
162
|
+
isChecked?: (formatState: roosterjs.ContentModelFormatState) => boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Get if the current button should be disabled
|
|
165
|
+
* @param formatState The current formatState of editor
|
|
166
|
+
* @returns True to show the button in a disabled state, otherwise false
|
|
167
|
+
* @default False When not specified, it is treated as always returning false
|
|
168
|
+
*/
|
|
169
|
+
isDisabled?: (formatState: roosterjs.ContentModelFormatState) => boolean;
|
|
170
|
+
/**
|
|
171
|
+
* A drop down menu of this button. When set this value, the button will has a "v" icon to let user
|
|
172
|
+
* know it will open a drop down menu. And the onClick handler will only be triggered when user click
|
|
173
|
+
* a menu item of the drop down.
|
|
174
|
+
*/
|
|
175
|
+
dropDownMenu?: RibbonButtonDropDown;
|
|
176
|
+
/**
|
|
177
|
+
* Use this property to pass in Fluent UI CommandBar property directly. It will overwrite the values of other conflict properties
|
|
178
|
+
*
|
|
179
|
+
* Do not use FluentUIReact.ICommandBarItemProps.subMenuProps here since it will be overwritten.
|
|
180
|
+
* If need, specify its value using RibbonButton.dropDownMenu.commandBarSubMenuProperties.
|
|
181
|
+
*/
|
|
182
|
+
commandBarProperties?: Partial<FluentUIReact.ICommandBarItemProps>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Represent a drop down menu of a ribbon button
|
|
187
|
+
*/
|
|
188
|
+
export interface RibbonButtonDropDown {
|
|
189
|
+
/**
|
|
190
|
+
* A key-value map for child items.
|
|
191
|
+
* When click on a child item, onClick handler will be triggered with the key of the clicked child item passed in as the second parameter
|
|
192
|
+
*/
|
|
193
|
+
items: Record<string, string>;
|
|
194
|
+
/**
|
|
195
|
+
* CSS class name for drop down menu item
|
|
196
|
+
*/
|
|
197
|
+
itemClassName?: string;
|
|
198
|
+
/**
|
|
199
|
+
* Whether live preview feature is enabled for this plugin.
|
|
200
|
+
* When live preview is enabled, hovering on a sub item will show the format result immediately in editor.
|
|
201
|
+
* This option needs dropDownItems to have values
|
|
202
|
+
*/
|
|
203
|
+
allowLivePreview?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Custom render of drop down item
|
|
206
|
+
* @param item This menu item
|
|
207
|
+
* @param onClick click handler of this menu item
|
|
208
|
+
*/
|
|
209
|
+
itemRender?: (item: FluentUIReact.IContextualMenuItem, onClick: (e: React.MouseEvent<Element> | React.KeyboardEvent<Element>, item: FluentUIReact.IContextualMenuItem) => void) => React.ReactNode;
|
|
210
|
+
/**
|
|
211
|
+
* Get the key of current selected item
|
|
212
|
+
* @param formatState The current formatState of editor
|
|
213
|
+
* @returns the key of selected item, it needs to be the same with the key in dropDownItems
|
|
214
|
+
*/
|
|
215
|
+
getSelectedItemKey?: (formatState: roosterjs.ContentModelFormatState) => string | null;
|
|
216
|
+
/**
|
|
217
|
+
* Use this property to pass in Fluent UI ContextMenu property directly. It will overwrite the values of other conflict properties
|
|
218
|
+
*/ commandBarSubMenuProperties?: Partial<FluentUIReact.IContextualMenuProps>;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Properties of Ribbon component
|
|
223
|
+
*/
|
|
224
|
+
export interface RibbonProps<T extends string> extends Partial<FluentUIReact.ICommandBarProps> {
|
|
225
|
+
/**
|
|
226
|
+
* The ribbon plugin used for connect editor and the ribbon
|
|
227
|
+
*/
|
|
228
|
+
plugin: RibbonPlugin;
|
|
229
|
+
/**
|
|
230
|
+
* Buttons in this ribbon
|
|
231
|
+
*/
|
|
232
|
+
buttons: RibbonButton<T>[];
|
|
233
|
+
/**
|
|
234
|
+
* A dictionary of localized strings for all buttons.
|
|
235
|
+
* Key of the dictionary is the key of each button, value will be the string or a function to return the string
|
|
236
|
+
*/
|
|
237
|
+
strings?: LocalizedStrings<T>;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Key of localized strings of Bold button
|
|
242
|
+
*/
|
|
243
|
+
export type BoldButtonStringKey = 'buttonNameBold';
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Key of localized strings of Italic button
|
|
247
|
+
*/
|
|
248
|
+
export type ItalicButtonStringKey = 'buttonNameItalic';
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Key of localized strings of Underline button
|
|
252
|
+
*/
|
|
253
|
+
export type UnderlineButtonStringKey = 'buttonNameUnderline';
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Key of localized strings of Font button
|
|
257
|
+
*/
|
|
258
|
+
export type FontButtonStringKey = 'buttonNameFont';
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Key of localized strings of Font size button
|
|
262
|
+
*/
|
|
263
|
+
export type FontSizeButtonStringKey = 'buttonNameFontSize';
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Key of localized strings of Increase font size button
|
|
267
|
+
*/
|
|
268
|
+
export type IncreaseFontSizeButtonStringKey = 'buttonNameIncreaseFontSize';
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Key of localized strings of Decrease font size button
|
|
272
|
+
*/
|
|
273
|
+
export type DecreaseFontSizeButtonStringKey = 'buttonNameDecreaseFontSize';
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Key of localized strings of Text color button
|
|
277
|
+
*/
|
|
278
|
+
export type TextColorButtonStringKey = 'buttonNameTextColor' | TextColorKeys;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Key of localized strings of Background color button
|
|
282
|
+
*/
|
|
283
|
+
export type BackgroundColorButtonStringKey = 'buttonNameBackgroundColor' | BackgroundColorKeys;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Key of localized strings of Bulleted list button
|
|
287
|
+
*/
|
|
288
|
+
export type BulletedListButtonStringKey = 'buttonNameBulletedList';
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Key of localized strings of Numbered list button
|
|
292
|
+
*/
|
|
293
|
+
export type NumberedListButtonStringKey = 'buttonNameNumberedList';
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Key of localized strings of More commands (overflow) button
|
|
297
|
+
*/
|
|
298
|
+
export type MoreCommandsButtonStringKey = 'buttonNameMoreCommands';
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Key of localized strings of Decrease indent size button
|
|
302
|
+
*/
|
|
303
|
+
export type DecreaseIndentButtonStringKey = 'buttonNameDecreaseIndent';
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Key of localized strings of Increase indent size button
|
|
307
|
+
*/
|
|
308
|
+
export type IncreaseIndentButtonStringKey = 'buttonNameIncreaseIndent';
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Key of localized strings of Quote button
|
|
312
|
+
*/
|
|
313
|
+
export type QuoteButtonStringKey = 'buttonNameQuote';
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Key of localized strings of Align left button
|
|
317
|
+
*/
|
|
318
|
+
export type AlignLeftButtonStringKey = 'buttonNameAlignLeft';
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Key of localized strings of Align center button
|
|
322
|
+
*/
|
|
323
|
+
export type AlignCenterButtonStringKey = 'buttonNameAlignCenter';
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Key of localized strings of Align right button
|
|
327
|
+
*/
|
|
328
|
+
export type AlignRightButtonStringKey = 'buttonNameAlignRight';
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Key of localized strings of Align justify button
|
|
332
|
+
*/
|
|
333
|
+
export type AlignJustifyButtonStringKey = 'buttonNameAlignJustify';
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Key of localized strings of Insert link button
|
|
337
|
+
*/
|
|
338
|
+
export type InsertLinkButtonStringKey = 'buttonNameInsertLink' | 'insertLinkTitle' | 'insertLinkDialogUrl' | 'insertLinkDialogDisplayAs' | OkButtonStringKey | CancelButtonStringKey;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Key of localized strings of Remove link button
|
|
342
|
+
*/
|
|
343
|
+
export type RemoveLinkButtonStringKey = 'buttonNameRemoveLink';
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Key of localized strings of Insert table button
|
|
347
|
+
*/
|
|
348
|
+
export type InsertTableButtonStringKey = 'buttonNameInsertTable' | 'insertTablePane';
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Key of localized strings of Insert image button
|
|
352
|
+
*/
|
|
353
|
+
export type InsertImageButtonStringKey = 'buttonNameInsertImage';
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Key of localized strings of Superscript button
|
|
357
|
+
*/
|
|
358
|
+
export type SuperscriptButtonStringKey = 'buttonNameSuperscript';
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Key of localized strings of Subscript button
|
|
362
|
+
*/
|
|
363
|
+
export type SubscriptButtonStringKey = 'buttonNameSubscript';
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Key of localized strings of Strikethrough button
|
|
367
|
+
*/
|
|
368
|
+
export type StrikethroughButtonStringKey = 'buttonNameStrikethrough';
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Key of localized strings of Heading button
|
|
372
|
+
*/
|
|
373
|
+
export type HeadingButtonStringKey = 'buttonNameHeading' | 'buttonNameHeading1' | 'buttonNameHeading2' | 'buttonNameHeading3' | 'buttonNameHeading4' | 'buttonNameHeading5' | 'buttonNameHeading6' | 'buttonNameNoHeading' | MenuItemSplitterKey0;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* @deprecated Use HeadingButtonStringKey instead
|
|
377
|
+
*/
|
|
378
|
+
export type HeaderButtonStringKey = 'buttonNameHeader' | 'buttonNameHeader1' | 'buttonNameHeader2' | 'buttonNameHeader3' | 'buttonNameHeader4' | 'buttonNameHeader5' | 'buttonNameHeader6' | 'buttonNameNoHeader' | HeadingButtonStringKey;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Key of localized strings of Code button
|
|
382
|
+
*/
|
|
383
|
+
export type CodeButtonStringKey = 'buttonNameCode';
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Key of localized strings of Left to right button
|
|
387
|
+
*/
|
|
388
|
+
export type LtrButtonStringKey = 'buttonNameLtr';
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Key of localized strings of Right to left button
|
|
392
|
+
*/
|
|
393
|
+
export type RtlButtonStringKey = 'buttonNameRtl';
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Key of localized strings of Undo button
|
|
397
|
+
*/
|
|
398
|
+
export type UndoButtonStringKey = 'buttonNameUndo';
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Key of localized strings of Redo button
|
|
402
|
+
*/
|
|
403
|
+
export type RedoButtonStringKey = 'buttonNameRedo';
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Key of localized strings of Clear format button
|
|
407
|
+
*/
|
|
408
|
+
export type ClearFormatButtonStringKey = 'buttonNameClearFormat';
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* A public type for localized string keys of all buttons
|
|
412
|
+
*/
|
|
413
|
+
export type AllButtonStringKeys = AlignLeftButtonStringKey | AlignCenterButtonStringKey | AlignRightButtonStringKey | AlignJustifyButtonStringKey | BackgroundColorButtonStringKey | BoldButtonStringKey | BulletedListButtonStringKey | ClearFormatButtonStringKey | CodeButtonStringKey | DecreaseFontSizeButtonStringKey | DecreaseIndentButtonStringKey | FontButtonStringKey | FontSizeButtonStringKey | HeaderButtonStringKey | HeadingButtonStringKey | IncreaseFontSizeButtonStringKey | IncreaseIndentButtonStringKey | InsertImageButtonStringKey | InsertLinkButtonStringKey | InsertTableButtonStringKey | ItalicButtonStringKey | LtrButtonStringKey | MoreCommandsButtonStringKey | NumberedListButtonStringKey | QuoteButtonStringKey | RedoButtonStringKey | RemoveLinkButtonStringKey | RtlButtonStringKey | StrikethroughButtonStringKey | SubscriptButtonStringKey | SuperscriptButtonStringKey | TextColorButtonStringKey | UnderlineButtonStringKey | UndoButtonStringKey | CellShadeButtonStringKey;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* @deprecated
|
|
417
|
+
* Key of localized strings of Cell shade button
|
|
418
|
+
*/
|
|
419
|
+
export type CellShadeButtonStringKey = 'buttonNameCellShade' | BackgroundColorKeys;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* The format ribbon component of roosterjs-react
|
|
423
|
+
* @param props Properties of format ribbon component
|
|
424
|
+
* @returns The format ribbon component
|
|
425
|
+
*/
|
|
426
|
+
export function Ribbon<T extends string>(props: RibbonProps<T>): JSX.Element;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Create a new instance of RibbonPlugin object
|
|
430
|
+
* @param delayUpdateTime The time to wait before refresh the button when user do some editing operation in editor
|
|
431
|
+
*/
|
|
432
|
+
export function createRibbonPlugin(delayUpdateTime?: number): RibbonPlugin;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* "Undo" button on the format ribbon
|
|
436
|
+
*/
|
|
437
|
+
export const redoButton: RibbonButton<RedoButtonStringKey>;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* "Undo" button on the format ribbon
|
|
441
|
+
*/
|
|
442
|
+
export const undoButton: RibbonButton<UndoButtonStringKey>;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* "Align center" button on the format ribbon
|
|
446
|
+
*/
|
|
447
|
+
export const alignCenterButton: RibbonButton<AlignCenterButtonStringKey>;
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* "Align justify" button on the format ribbon
|
|
451
|
+
*/
|
|
452
|
+
export const alignJustifyButton: RibbonButton<'buttonNameAlignJustify'>;
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* "Align left" button on the format ribbon
|
|
456
|
+
*/
|
|
457
|
+
export const alignLeftButton: RibbonButton<AlignLeftButtonStringKey>;
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* "Align right" button on the format ribbon
|
|
461
|
+
*/
|
|
462
|
+
export const alignRightButton: RibbonButton<AlignRightButtonStringKey>;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* "Background color" button on the format ribbon
|
|
466
|
+
*/
|
|
467
|
+
export const backgroundColorButton: RibbonButton<BackgroundColorButtonStringKey>;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* "Block quote" button on the format ribbon
|
|
471
|
+
*/
|
|
472
|
+
export const blockQuoteButton: RibbonButton<QuoteButtonStringKey>;
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* "Bold" button on the format ribbon
|
|
476
|
+
*/
|
|
477
|
+
export const boldButton: RibbonButton<BoldButtonStringKey>;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* "Bulleted list" button on the format ribbon
|
|
481
|
+
*/
|
|
482
|
+
export const bulletedListButton: RibbonButton<BulletedListButtonStringKey>;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* "Clear format" button on the format ribbon
|
|
486
|
+
*/
|
|
487
|
+
export const clearFormatButton: RibbonButton<ClearFormatButtonStringKey>;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* "Code" button on the format ribbon
|
|
491
|
+
*/
|
|
492
|
+
export const codeButton: RibbonButton<CodeButtonStringKey>;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* "Decrease font size" button on the format ribbon
|
|
496
|
+
*/
|
|
497
|
+
export const decreaseFontSizeButton: RibbonButton<DecreaseFontSizeButtonStringKey>;
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* "Decrease indent" button on the format ribbon
|
|
501
|
+
*/
|
|
502
|
+
export const decreaseIndentButton: RibbonButton<DecreaseIndentButtonStringKey>;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* "Font" button on the format ribbon
|
|
506
|
+
*/
|
|
507
|
+
export const fontButton: RibbonButton<FontButtonStringKey>;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* "Font Size" button on the format ribbon
|
|
511
|
+
*/
|
|
512
|
+
export const fontSizeButton: RibbonButton<FontSizeButtonStringKey>;
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* "Increase font size" button on the format ribbon
|
|
516
|
+
*/
|
|
517
|
+
export const increaseFontSizeButton: RibbonButton<IncreaseFontSizeButtonStringKey>;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* "Increase indent" button on the format ribbon
|
|
521
|
+
*/
|
|
522
|
+
export const increaseIndentButton: RibbonButton<IncreaseIndentButtonStringKey>;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* "Insert image" button on the format ribbon
|
|
526
|
+
*/
|
|
527
|
+
export const insertImageButton: RibbonButton<InsertImageButtonStringKey>;
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* "Insert link" button on the format ribbon
|
|
531
|
+
*/
|
|
532
|
+
export const insertLinkButton: RibbonButton<InsertLinkButtonStringKey>;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* "Insert table" button on the format ribbon
|
|
536
|
+
*/
|
|
537
|
+
export const insertTableButton: RibbonButton<InsertTableButtonStringKey>;
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* "Italic" button on the format ribbon
|
|
541
|
+
*/
|
|
542
|
+
export const italicButton: RibbonButton<ItalicButtonStringKey>;
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* "Left to right" button on the format ribbon
|
|
546
|
+
*/
|
|
547
|
+
export const ltrButton: RibbonButton<LtrButtonStringKey>;
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* "Numbering list" button on the format ribbon
|
|
551
|
+
*/
|
|
552
|
+
export const numberedListButton: RibbonButton<NumberedListButtonStringKey>;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* "Remove link" button on the format ribbon
|
|
556
|
+
*/
|
|
557
|
+
export const removeLinkButton: RibbonButton<RemoveLinkButtonStringKey>;
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* "Right to left" button on the format ribbon
|
|
561
|
+
*/
|
|
562
|
+
export const rtlButton: RibbonButton<RtlButtonStringKey>;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* "Set header level" button on the format ribbon
|
|
566
|
+
*/
|
|
567
|
+
export const setHeadingLevelButton: RibbonButton<HeadingButtonStringKey>;
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* "Strikethrough" button on the format ribbon
|
|
571
|
+
*/
|
|
572
|
+
export const strikethroughButton: RibbonButton<StrikethroughButtonStringKey>;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* "Subscript" button on the format ribbon
|
|
576
|
+
*/
|
|
577
|
+
export const subscriptButton: RibbonButton<SubscriptButtonStringKey>;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* "Superscript" button on the format ribbon
|
|
581
|
+
*/
|
|
582
|
+
export const superscriptButton: RibbonButton<SuperscriptButtonStringKey>;
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* "Text color" button on the format ribbon
|
|
586
|
+
*/
|
|
587
|
+
export const textColorButton: RibbonButton<TextColorButtonStringKey>;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* "Underline" button on the format ribbon
|
|
591
|
+
*/
|
|
592
|
+
export const underlineButton: RibbonButton<UnderlineButtonStringKey>;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Create a new instance of ContextMenu plugin with context menu implementation based on FluentUI.
|
|
596
|
+
*/
|
|
597
|
+
export function createContextMenuPlugin(): roosterjs.ContextMenuPluginBase<FluentUIReact.IContextualMenuItem>;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Create a new instance of ContextMenuProviderImpl class
|
|
601
|
+
* @param menuName Name of this group of menus
|
|
602
|
+
* @param items Menu items that will be show
|
|
603
|
+
* @param strings Localized strings of these menu items
|
|
604
|
+
* @param shouldAddMenuItems A general checker to decide if we should add this group of menu items
|
|
605
|
+
*/
|
|
606
|
+
export function createContextMenuProvider<TString extends string, TContext>(menuName: string, items: ContextMenuItem<TString, TContext>[], strings?: LocalizedStrings<TString>, shouldAddMenuItems?: (editor: roosterjs.IEditor, node: Node) => boolean, context?: TContext): roosterjs.EditorPlugin;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Create a new instance of ContextMenuProvider to support list number editing functionalities in context menu
|
|
610
|
+
* @returns A new ContextMenuProvider
|
|
611
|
+
*/
|
|
612
|
+
export function createListEditMenuProvider(strings?: LocalizedStrings<ListNumberMenuItemStringKey>): roosterjs.EditorPlugin;
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Create a new instance of ContextMenuProvider to support image editing functionalities in context menu
|
|
616
|
+
* @returns A new ContextMenuProvider
|
|
617
|
+
*/
|
|
618
|
+
export function createImageEditMenuProvider(imageEditor?: roosterjs.ImageEditor, strings?: LocalizedStrings<ImageEditMenuItemStringKey>): roosterjs.EditorPlugin;
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Create a new instance of ContextMenuProvider to support table editing functionalities in context menu
|
|
622
|
+
* @returns A new ContextMenuProvider
|
|
623
|
+
*/
|
|
624
|
+
export function createTableEditMenuProvider(strings?: LocalizedStrings<TableEditMenuItemStringKey>): roosterjs.EditorPlugin;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Represent a context menu item
|
|
628
|
+
*/
|
|
629
|
+
export interface ContextMenuItem<TString extends string, TContext = never> {
|
|
630
|
+
/**
|
|
631
|
+
* key of this button, needs to be unique
|
|
632
|
+
*/
|
|
633
|
+
key: TString;
|
|
634
|
+
/**
|
|
635
|
+
* Text of the button. This text is not localized. To show a localized text, pass a dictionary to Ribbon component via RibbonProps.strings.
|
|
636
|
+
*/
|
|
637
|
+
unlocalizedText: string;
|
|
638
|
+
/**
|
|
639
|
+
* Click event handler
|
|
640
|
+
* @param key Key of the menu item that is clicked
|
|
641
|
+
* @param editor The editor object that triggers this event
|
|
642
|
+
* @param targetNode The node that user is clicking onto
|
|
643
|
+
* @param strings The strings object used by getLocalizedString() function
|
|
644
|
+
* @param uiUtilities UI Utilities to help render additional react component from this click event
|
|
645
|
+
* @param context A context object that passed in from context menu provider, can be anything
|
|
646
|
+
*/
|
|
647
|
+
onClick: (key: TString, editor: roosterjs.IEditor, targetNode: Node, strings: LocalizedStrings<TString> | undefined, uiUtilities: UIUtilities, context?: TContext) => void;
|
|
648
|
+
/**
|
|
649
|
+
* A callback function to check whether this menu item should show now
|
|
650
|
+
* @param editor The editor object that triggers this event
|
|
651
|
+
* @param targetNode The node that user is clicking onto
|
|
652
|
+
* @param context A context object that passed in from context menu provider, can be anything
|
|
653
|
+
*/
|
|
654
|
+
shouldShow?: (editor: roosterjs.IEditor, targetNode: Node, context?: TContext) => boolean;
|
|
655
|
+
/**
|
|
656
|
+
* A callback function to verify which subitem ID should have a checkmark
|
|
657
|
+
* @param editor The editor object that triggers this event
|
|
658
|
+
* @param targetNode The node that user is clicking onto
|
|
659
|
+
* @returns ID to be shown as selected, null for none
|
|
660
|
+
*/
|
|
661
|
+
getSelectedId?: (editor: roosterjs.IEditor, targetNode: Node) => TString | null;
|
|
662
|
+
/**
|
|
663
|
+
* A key-value map for sub menu items, key is the key of menu item, value is unlocalized string
|
|
664
|
+
* When click on a child item, onClick handler will be triggered with the key of the clicked child item passed in as the second parameter
|
|
665
|
+
*/
|
|
666
|
+
subItems?: {
|
|
667
|
+
[key in TString]?: string;
|
|
668
|
+
};
|
|
669
|
+
/**
|
|
670
|
+
* Custom render of drop down item
|
|
671
|
+
* @param item This menu item
|
|
672
|
+
* @param onClick click handler of this menu item
|
|
673
|
+
*/
|
|
674
|
+
itemRender?: (item: FluentUIReact.IContextualMenuItem, onClick: (e: React.MouseEvent<Element> | React.KeyboardEvent<Element>, item: FluentUIReact.IContextualMenuItem) => void) => React.ReactNode;
|
|
675
|
+
/**
|
|
676
|
+
* CSS class name for drop down menu item
|
|
677
|
+
*/
|
|
678
|
+
itemClassName?: string;
|
|
679
|
+
/**
|
|
680
|
+
* Icon props for the context menu item
|
|
681
|
+
*/
|
|
682
|
+
iconProps?: FluentUIReact.IIconProps;
|
|
683
|
+
/**
|
|
684
|
+
* Use this property to pass in Fluent UI ContextMenu property directly. It will overwrite the values of other conflict properties
|
|
685
|
+
*/
|
|
686
|
+
commandBarSubMenuProperties?: Partial<FluentUIReact.IContextualMenuProps>;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Key of localized strings of List Number menu items and its dialog.
|
|
691
|
+
* Including:
|
|
692
|
+
* - Menu item "Set numbering value"
|
|
693
|
+
* - Menu item "Restart at 1"
|
|
694
|
+
* - Dialog text "Set value to"
|
|
695
|
+
* - Ok button
|
|
696
|
+
* - Cancel button
|
|
697
|
+
*/
|
|
698
|
+
export type ListNumberMenuItemStringKey = 'menuNameListNumberEdit' | 'menuNameListNumberReset' | 'dialogTextSetListNumber' | OkButtonStringKey | CancelButtonStringKey;
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Key of localized strings of Image Alt Text menu item.
|
|
702
|
+
* Including:
|
|
703
|
+
* - Menu item "Add alternate text"
|
|
704
|
+
* - Menu item "Size" and sub menus"
|
|
705
|
+
* - Menu item "Crop image"
|
|
706
|
+
* - Menu item "Remove image"
|
|
707
|
+
* - Ok button
|
|
708
|
+
* - Cancel button
|
|
709
|
+
*/
|
|
710
|
+
export type ImageEditMenuItemStringKey = 'menuNameImageAltText' | 'menuNameImageResize' | 'menuNameImageCrop' | 'menuNameImageRotate' | 'menuNameImageRemove' | 'menuNameImageFlip' | 'menuNameImageSizeBestFit' | 'menuNameImageSizeSmall' | 'menuNameImageSizeMedium' | 'menuNameImageSizeOriginal' | 'menuNameImageRotateLeft' | 'menuNameImageRotateRight' | 'menuNameImageRotateFlipHorizontally' | 'menuNameImageRotateFlipVertically' | 'menuNameImageCopy' | 'menuNameImageCut' | OkButtonStringKey | CancelButtonStringKey;
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Key of localized strings of Table Edit Insert menu item.
|
|
714
|
+
*/
|
|
715
|
+
export type TableEditInsertMenuItemStringKey = 'menuNameTableInsert' | 'menuNameTableInsertAbove' | 'menuNameTableInsertBelow' | 'menuNameTableInsertLeft' | 'menuNameTableInsertRight';
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Key of localized strings of Table Edit Delete menu item.
|
|
719
|
+
*/
|
|
720
|
+
export type TableEditDeleteMenuItemStringKey = 'menuNameTableDelete' | 'menuNameTableDeleteTable' | 'menuNameTableDeleteColumn' | 'menuNameTableDeleteRow';
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Key of localized strings of Table Edit Merge menu item.
|
|
724
|
+
*/
|
|
725
|
+
export type TableEditMergeMenuItemStringKey = 'menuNameTableMerge' | 'menuNameTableMergeAbove' | 'menuNameTableMergeBelow' | 'menuNameTableMergeLeft' | 'menuNameTableMergeRight' | 'menuNameTableMergeCells' | MenuItemSplitterKey0;
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Key of localized strings of Table Edit Split menu item.
|
|
729
|
+
*/
|
|
730
|
+
export type TableEditSplitMenuItemStringKey = 'menuNameTableSplit' | 'menuNameTableSplitHorizontally' | 'menuNameTableSplitVertically';
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Key of localized strings of Table Edit Align menu item.
|
|
734
|
+
*/
|
|
735
|
+
export type TableEditAlignMenuItemStringKey = 'menuNameTableAlign' | 'menuNameTableAlignLeft' | 'menuNameTableAlignCenter' | 'menuNameTableAlignRight' | 'menuNameTableAlignTop' | 'menuNameTableAlignMiddle' | 'menuNameTableAlignBottom' | MenuItemSplitterKey0;
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Key of localized strings of Table Edit Cell Shade menu item.
|
|
739
|
+
*/
|
|
740
|
+
export type TableEditShadeMenuItemStringKey = 'menuNameTableCellShade' | BackgroundColorKeys;
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Key of localized strings of Table Edit menu item.
|
|
744
|
+
* Including:
|
|
745
|
+
* - Menu item "Insert"
|
|
746
|
+
* - Menu item "Delete"
|
|
747
|
+
* - Menu item "Merge"
|
|
748
|
+
* - Menu item "Split"
|
|
749
|
+
* - Menu item "Align cell"
|
|
750
|
+
*/
|
|
751
|
+
export type TableEditMenuItemStringKey = TableEditInsertMenuItemStringKey | TableEditDeleteMenuItemStringKey | TableEditMergeMenuItemStringKey | TableEditSplitMenuItemStringKey | TableEditAlignMenuItemStringKey | TableEditShadeMenuItemStringKey | TableEditAlignTableMenuItemStringKey;
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Key of localized strings of Table Edit Align table menu item.
|
|
755
|
+
*/
|
|
756
|
+
export type TableEditAlignTableMenuItemStringKey = 'menuNameTableAlignTable' | 'menuNameTableAlignTableLeft' | 'menuNameTableAlignTableCenter' | 'menuNameTableAlignTableRight';
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* keys for Paste Option buttons
|
|
760
|
+
*/
|
|
761
|
+
export type PasteOptionButtonKeys = 'pasteOptionPasteAsIs' | 'pasteOptionPasteText' | 'pasteOptionMergeFormat' | 'pasteOptionPasteAsImage';
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Localized string keys for Paste Option buttons and its UI component
|
|
765
|
+
*/
|
|
766
|
+
export type PasteOptionStringKeys = PasteOptionButtonKeys | 'pasteOptionPaneText';
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Create a new instance of PasteOption plugin to show an option pane when paste, so that user can choose
|
|
770
|
+
* an option to change the paste result, including:
|
|
771
|
+
* - Paste as is
|
|
772
|
+
* - Paste as text
|
|
773
|
+
* - Paste and merge format
|
|
774
|
+
* @param strings Localized string for this plugin
|
|
775
|
+
* @returns A paste option plugin
|
|
776
|
+
*/
|
|
777
|
+
export function createPasteOptionPlugin(strings?: LocalizedStrings<PasteOptionStringKeys>): ReactEditorPlugin;
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Localized string keys for background colors
|
|
781
|
+
*/
|
|
782
|
+
export type BackgroundColorKeys = 'backgroundColorCyan' | 'backgroundColorGreen' | 'backgroundColorYellow' | 'backgroundColorOrange' | 'backgroundColorRed' | 'backgroundColorMagenta' | 'backgroundColorLightCyan' | 'backgroundColorLightGreen' | 'backgroundColorLightYellow' | 'backgroundColorLightOrange' | 'backgroundColorLightRed' | 'backgroundColorLightMagenta' | 'backgroundColorWhite' | 'backgroundColorLightGray' | 'backgroundColorGray' | 'backgroundColorDarkGray' | 'backgroundColorDarkerGray' | 'backgroundColorBlack';
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Localized string keys for text colors
|
|
786
|
+
*/
|
|
787
|
+
export type TextColorKeys = 'textColorLightBlue' | 'textColorLightGreen' | 'textColorLightYellow' | 'textColorLightOrange' | 'textColorLightRed' | 'textColorLightPurple' | 'textColorBlue' | 'textColorGreen' | 'textColorYellow' | 'textColorOrange' | 'textColorRed' | 'textColorPurple' | 'textColorDarkBlue' | 'textColorDarkGreen' | 'textColorDarkYellow' | 'textColorDarkOrange' | 'textColorDarkRed' | 'textColorDarkPurple' | 'textColorDarkerBlue' | 'textColorDarkerGreen' | 'textColorDarkerYellow' | 'textColorDarkerOrange' | 'textColorDarkerRed' | 'textColorDarkerPurple' | 'textColorWhite' | 'textColorLightGray' | 'textColorGray' | 'textColorDarkGray' | 'textColorDarkerGray' | 'textColorBlack';
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Get mode independent color value of background color from the given color key
|
|
791
|
+
* @param key The key to get color from
|
|
792
|
+
* @returns A model independent color value of the given key
|
|
793
|
+
*/
|
|
794
|
+
export function getBackgroundColorValue(key: BackgroundColorKeys): roosterjs.Colors;
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Get mode independent color value of text color from the given color key
|
|
798
|
+
* @param key The key to get color from
|
|
799
|
+
* @returns A model independent color value of the given key
|
|
800
|
+
*/
|
|
801
|
+
export function getTextColorValue(key: TextColorKeys): roosterjs.Colors;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Get a drop down data object of color picker used by drop down button
|
|
805
|
+
* @param colorSet The set of color, text or background
|
|
806
|
+
* @returns The color picker drop down for ribbon button
|
|
807
|
+
*/
|
|
808
|
+
export function getColorPickerDropDown(colorSet: 'text' | 'background'): RibbonButtonDropDown;
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Create a new instance of Emoji plugin with FluentUI components.
|
|
812
|
+
*/
|
|
813
|
+
export function createEmojiPlugin(searchBoxStrings?: LocalizedStrings<EmojiStringKeys>): ReactEditorPlugin;
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Localized string keys for Emoji UI component
|
|
817
|
+
*/
|
|
818
|
+
export type EmojiStringKeys = 'emojiSearchPlaceholder' | 'emojiSearchInputAriaLabel';
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Show a dialog with input items
|
|
822
|
+
* @param uiUtilities UI utilities to help render the dialog
|
|
823
|
+
* @param dialogTitleKey Localized string key for title of this dialog
|
|
824
|
+
* @param unlocalizedTitle Unlocalized title string of this dialog. It will be used if a valid localized string is not found using dialogTitleKey
|
|
825
|
+
* @param items Input items in this dialog
|
|
826
|
+
* @param strings Localized strings
|
|
827
|
+
* @param onChange An optional callback that will be invoked when input item value is changed
|
|
828
|
+
*/
|
|
829
|
+
export function showInputDialog<Strings extends string, ItemNames extends string>(uiUtilities: UIUtilities, dialogTitleKey: Strings, unlocalizedTitle: string, items: Record<ItemNames, DialogItem<Strings>>, strings?: LocalizedStrings<Strings | OkButtonStringKey | CancelButtonStringKey>, onChange?: (changedItemName: ItemNames, newValue: string, currentValues: Record<ItemNames, string>) => Record<ItemNames, string> | null, rows?: number): Promise<Record<ItemNames, string> | null>;
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Item of input dialog
|
|
833
|
+
*/
|
|
834
|
+
export interface DialogItem<Strings extends string> {
|
|
835
|
+
/**
|
|
836
|
+
* Localized string key of the input item name
|
|
837
|
+
*/
|
|
838
|
+
labelKey: Strings | null;
|
|
839
|
+
/**
|
|
840
|
+
* Unlocalized string for the label text. This will be used when a valid localized string is not found using the given string key
|
|
841
|
+
*/
|
|
842
|
+
unlocalizedLabel: string | null;
|
|
843
|
+
/**
|
|
844
|
+
* Initial value of this item
|
|
845
|
+
*/
|
|
846
|
+
initValue: string;
|
|
847
|
+
/**
|
|
848
|
+
* Whether focus should be put into this item automatically
|
|
849
|
+
*/
|
|
850
|
+
autoFocus?: boolean;
|
|
851
|
+
}
|
|
852
|
+
|