Skip to content

Commit

Permalink
Demo site: Fix insert link button in Content Model ribbon (#2018)
Browse files Browse the repository at this point in the history
  • Loading branch information
JiuqingSong authored Aug 10, 2023
1 parent 72f0c87 commit a1a7b81
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import showInputDialog from 'roosterjs-react/lib/inputDialog/utils/showInputDialog';
import { InsertLinkButtonStringKey, RibbonButton } from 'roosterjs-react';
import { showInputDialog } from 'roosterjs-react/lib/inputDialog';
import {
adjustLinkSelection,
insertLink,
Expand Down
1 change: 1 addition & 0 deletions packages-ui/roosterjs-react/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './contextMenu/index';
export * from './pasteOptions/index';
export * from './colorPicker/index';
export * from './emoji/index';
export * from './inputDialog/index';
2 changes: 2 additions & 0 deletions packages-ui/roosterjs-react/lib/inputDialog/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as showInputDialog } from './utils/showInputDialog';
export { default as DialogItem } from './type/DialogItem';
17 changes: 16 additions & 1 deletion packages-ui/roosterjs-react/lib/inputDialog/type/DialogItem.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
/**
* @internal
* Item of input dialog
*/
export default interface DialogItem<Strings extends string> {
/**
* Localized string key of the input item name
*/
labelKey: Strings | null;

/**
* Unlocalized string for the label text. This will be used when a valid localized string is not found using the given string key
*/
unlocalizedLabel: string | null;

/**
* Initial value of this item
*/
initValue: string;

/**
* Whether focus should be put into this item automatically
*/
autoFocus?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ import {
} from '../../common/index';

/**
* @internal
* Show a dialog with input items
* @param uiUtilities UI utilities to help render the dialog
* @param dialogTitleKey Localized string key for title of this dialog
* @param unlocalizedTitle Unlocalized title string of this dialog. It will be used if a valid localized string is not found using dialogTitleKey
* @param items Input items in this dialog
* @param strings Localized strings
* @param onChange An optional callback that will be invoked when input item value is changed
*/
export default function showInputDialog<Strings extends string, ItemNames extends string>(
uiUtilities: UIUtilities,
Expand Down

0 comments on commit a1a7b81

Please sign in to comment.