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