@azure/communication-react 1.22.0-alpha-202412100018 → 1.22.0-alpha-202412120017

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.
Files changed (58) hide show
  1. package/dist/communication-react.d.ts +41 -39
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-Bpez2mhK.js → ChatMessageComponentAsRichTextEditBox-BBGCXfci.js} +2 -2
  3. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-Bpez2mhK.js.map → ChatMessageComponentAsRichTextEditBox-BBGCXfci.js.map} +1 -1
  4. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CrmMCuXY.js → RichTextSendBoxWrapper-CG_xsEdn.js} +2 -2
  5. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CrmMCuXY.js.map → RichTextSendBoxWrapper-CG_xsEdn.js.map} +1 -1
  6. package/dist/dist-cjs/communication-react/{index-DIxf34Zj.js → index-BryVG9gm.js} +95 -50
  7. package/dist/dist-cjs/communication-react/index-BryVG9gm.js.map +1 -0
  8. package/dist/dist-cjs/communication-react/index.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  10. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  11. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +3 -3
  12. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +5 -5
  13. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
  14. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.d.ts +2 -33
  15. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js +8 -15
  16. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js.map +1 -1
  17. package/dist/dist-esm/communication-react/src/index.d.ts +1 -1
  18. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  19. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.d.ts +9 -2
  20. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.js +20 -2
  21. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.js.map +1 -1
  22. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.d.ts +2 -0
  23. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js +14 -0
  24. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js.map +1 -1
  25. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.d.ts +1 -0
  26. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js +11 -1
  27. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js.map +1 -1
  28. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.d.ts +1 -0
  29. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +5 -1
  30. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -1
  31. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +4 -1
  32. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +1 -1
  33. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.d.ts +2 -1
  34. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js +1 -0
  35. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js.map +1 -1
  36. package/dist/dist-esm/react-components/src/components/utils.js +5 -3
  37. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  38. package/dist/dist-esm/react-components/src/index.d.ts +1 -1
  39. package/dist/dist-esm/react-components/src/index.js.map +1 -1
  40. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +29 -1
  41. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +2 -2
  42. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +5 -5
  43. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  44. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +3 -3
  45. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  46. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +3 -3
  47. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
  48. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +2 -2
  49. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +4 -4
  50. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  51. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +3 -3
  52. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  53. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.d.ts +2 -2
  54. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js +2 -2
  55. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
  56. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +25 -1
  57. package/package.json +3 -3
  58. package/dist/dist-cjs/communication-react/index-DIxf34Zj.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextEditor.js","sourceRoot":"","sources":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EF,MAAM,4BAA4B,GAAG,CAAC,KAAqC,EAAE,KAA4B,EAAQ,EAAE;;IACjH,yEAAyE;IACzE,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAA,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACzG,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAY,EAAiB,EAAE;IACrD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AACnC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport { richTextEditorWrapperStyle, richTextEditorStyle } from '../styles/RichTextEditor.styles';\nimport { useTheme } from '../../theming';\nimport { RichTextStrings } from './RichTextSendBox';\nimport { isDarkThemed } from '../../theming/themeUtils';\nimport CopyPastePlugin from './Plugins/CopyPastePlugin';\nimport type {\n ContentModelDocument,\n ContentModelParagraph,\n EditorPlugin,\n IEditor,\n ReadonlyContentModelBlockGroup,\n ShallowMutableContentModelDocument,\n KnownAnnounceStrings\n} from 'roosterjs-content-model-types';\nimport { createModelFromHtml, Editor, exportContent } from 'roosterjs-content-model-core';\nimport {\n createBr,\n createEmptyModel,\n createParagraph,\n createSelectionMarker,\n setSelection\n} from 'roosterjs-content-model-dom';\nimport { KeyboardInputPlugin } from './Plugins/KeyboardInputPlugin';\nimport {\n AutoFormatPlugin,\n EditPlugin,\n PastePlugin,\n ShortcutPlugin,\n DefaultSanitizers\n} from 'roosterjs-content-model-plugins';\nimport { UpdateContentPlugin, UpdateEvent } from './Plugins/UpdateContentPlugin';\nimport { RichTextToolbar } from './Toolbar/RichTextToolbar';\nimport { RichTextToolbarPlugin } from './Plugins/RichTextToolbarPlugin';\nimport { ContextMenuPlugin } from './Plugins/ContextMenuPlugin';\nimport { TableEditContextMenuProvider } from './Plugins/TableEditContextMenuProvider';\nimport { borderApplier, dataSetApplier } from '../utils/RichTextEditorUtils';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport {\n getPreviousInlineImages,\n getRemovedInlineImages,\n removeLocalBlobs,\n cleanAllLocalBlobs\n} from '../utils/RichTextEditorUtils';\nimport { ContextualMenu, IContextualMenuItem, IContextualMenuProps, Theme } from '@fluentui/react';\nimport { PlaceholderPlugin } from './Plugins/PlaceholderPlugin';\nimport { getFormatState, setDirection } from 'roosterjs-content-model-api';\nimport UndoRedoPlugin from './Plugins/UndoRedoPlugin';\n\n/**\n * Style props for {@link RichTextEditor}.\n *\n * @private\n */\nexport interface RichTextEditorStyleProps {\n minHeight: string;\n maxHeight: string;\n}\n\n/**\n * Props for {@link RichTextEditor}.\n *\n * @private\n */\nexport interface RichTextEditorProps {\n // the initial content of editor that is set when editor is created (e.g. when editing a message)\n initialContent?: string;\n onChange: (\n newValue?: string,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ removedInlineImages?: Record<string, string>[]\n ) => void;\n onKeyDown?: (ev: KeyboardEvent) => void;\n // update the current content of the rich text editor\n onContentModelUpdate?: (contentModel: ContentModelDocument | undefined) => void;\n contentModel?: ContentModelDocument | undefined;\n placeholderText?: string;\n strings: Partial<RichTextStrings>;\n showRichTextEditorFormatting: boolean;\n styles: RichTextEditorStyleProps;\n autoFocus?: 'sendBoxTextField';\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage?: (imageAttributes: Record<string, string>) => void;\n}\n\n/**\n * Represents a reference to the RichTextEditor component.\n */\nexport interface RichTextEditorComponentRef {\n /**\n * Sets focus on the RichTextEditor component.\n */\n focus: () => void;\n\n /**\n * Sets the content of the RichTextEditor component to an empty string.\n */\n setEmptyContent: () => void;\n\n /**\n * Retrieves the plain text content of the RichTextEditor component.\n * @returns The plain text content of the RichTextEditor component, or undefined if the editor isn't available.\n */\n getPlainContent: () => string | undefined;\n}\n\n/**\n * A component to wrap RoosterJS Rich Text Editor.\n *\n * @beta\n */\nexport const RichTextEditor = React.forwardRef<RichTextEditorComponentRef, RichTextEditorProps>((props, ref) => {\n const {\n initialContent,\n onChange,\n placeholderText,\n strings,\n showRichTextEditorFormatting,\n autoFocus,\n onKeyDown,\n onContentModelUpdate,\n contentModel,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage\n } = props;\n const editor = useRef<IEditor | null>(null);\n const editorDiv = useRef<HTMLDivElement>(null);\n const toolbarRef = useRef<HTMLDivElement>(null);\n const theme = useTheme();\n const [contextMenuProps, setContextMenuProps] = useState<IContextualMenuProps | null>(null);\n const previousThemeDirection = useRef(themeDirection(theme));\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n // This will be set when the editor is initialized and when the content is updated.\n const [previousInlineImages, setPreviousInlineImages] = useState<Record<string, string>[]>([]);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const [inlineImageLocalBlobs, setInlineImageLocalBlobs] = useState<Record<string, string>>({});\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n useEffect(() => {\n return () => {\n // Cleanup Local Blob URLs when the component is unmounted\n cleanAllLocalBlobs(inlineImageLocalBlobs);\n };\n // This effect should only run once when the component is unmounted, so we don't need to add any dependencies\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (editor.current) {\n if (showRichTextEditorFormatting) {\n toolbarRef.current?.focus();\n } else {\n editor.current?.focus();\n }\n }\n }, [showRichTextEditorFormatting]);\n\n useImperativeHandle(ref, () => {\n return {\n focus() {\n if (editor.current) {\n editor.current.focus();\n }\n },\n setEmptyContent() {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n setPreviousInlineImages([]);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n cleanAllLocalBlobs(inlineImageLocalBlobs);\n\n if (editor.current) {\n // remove all content from the editor and update the model\n // ContentChanged event will be sent by RoosterJS automatically\n editor.current.formatContentModel((model: ShallowMutableContentModelDocument): boolean => {\n // Create a new empty paragraph with selection marker\n // this is needed for correct processing of images after the content is deleted\n const newModel = createEmptyModel();\n model.blocks = newModel.blocks;\n return true;\n });\n //reset content model\n onContentModelUpdate && onContentModelUpdate(editor.current.getContentModelCopy('disconnected'));\n }\n },\n getPlainContent() {\n if (editor.current) {\n return exportContent(editor.current, 'PlainTextFast');\n } else {\n return undefined;\n }\n }\n };\n }, [/* @conditional-compile-remove(rich-text-editor-image-upload) */ inlineImageLocalBlobs, onContentModelUpdate]);\n\n const toolbarPlugin = React.useMemo(() => {\n return new RichTextToolbarPlugin();\n }, []);\n\n const placeholderPlugin = useMemo(() => {\n const textColor = theme.palette?.neutralSecondary;\n return new PlaceholderPlugin(\n '',\n textColor\n ? {\n textColor: textColor\n }\n : undefined\n );\n }, [theme]);\n\n useEffect(() => {\n if (placeholderText !== undefined) {\n placeholderPlugin.updatePlaceholder(placeholderText);\n }\n }, [placeholderPlugin, placeholderText]);\n\n const toolbar = useMemo(() => {\n return <RichTextToolbar plugin={toolbarPlugin} strings={strings} />;\n }, [strings, toolbarPlugin]);\n\n const updatePlugin = useMemo(() => {\n return new UpdateContentPlugin();\n }, []);\n\n const copyPastePlugin = useMemo(() => {\n return new CopyPastePlugin();\n }, []);\n\n const onChangeContent = useCallback(\n (/* @conditional-compile-remove(rich-text-editor-image-upload) */ shouldUpdateInlineImages?: boolean) => {\n if (editor.current === null) {\n return;\n }\n const content = exportContent(editor.current);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n let removedInlineImages: Record<string, string>[] = [];\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (shouldUpdateInlineImages) {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n removedInlineImages = getRemovedInlineImages(content, previousInlineImages);\n }\n\n onChange &&\n onChange(content, /* @conditional-compile-remove(rich-text-editor-image-upload) */ removedInlineImages);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n setPreviousInlineImages(getPreviousInlineImages(content));\n },\n [onChange, /* @conditional-compile-remove(rich-text-editor-image-upload) */ previousInlineImages]\n );\n\n useEffect(() => {\n // don't set callback in plugin constructor to update callback without plugin recreation\n updatePlugin.onUpdate = (\n event: string,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ shouldRemoveInlineImages?: boolean\n ) => {\n if (editor.current === null) {\n return;\n }\n if (event === UpdateEvent.Blur || event === UpdateEvent.Dispose) {\n onContentModelUpdate && onContentModelUpdate(editor.current.getContentModelCopy('disconnected'));\n } else {\n const content = exportContent(editor.current);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n let removedInlineImages: Record<string, string>[] = [];\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (shouldRemoveInlineImages) {\n removedInlineImages = getRemovedInlineImages(content, previousInlineImages);\n if (removedInlineImages.length > 0) {\n removeLocalBlobs(inlineImageLocalBlobs, removedInlineImages);\n }\n }\n\n onChange &&\n onChange(content, /* @conditional-compile-remove(rich-text-editor-image-upload) */ removedInlineImages);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n setPreviousInlineImages(getPreviousInlineImages(content));\n }\n };\n }, [\n onChange,\n onContentModelUpdate,\n updatePlugin,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ previousInlineImages,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ inlineImageLocalBlobs\n ]);\n\n const undoRedoPlugin = useMemo(() => {\n return new UndoRedoPlugin();\n }, []);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n useEffect(() => {\n if (onInsertInlineImage) {\n copyPastePlugin.onInsertInlineImage = (imageAttributes: Record<string, string>) => {\n const { id, src } = imageAttributes;\n setInlineImageLocalBlobs((prev) => {\n if (!id || !src) {\n return prev;\n }\n return { ...prev, [id]: src };\n });\n onInsertInlineImage(imageAttributes);\n };\n } else {\n copyPastePlugin.onInsertInlineImage = undefined;\n }\n undoRedoPlugin.onInsertInlineImage = onInsertInlineImage;\n }, [copyPastePlugin, onInsertInlineImage, undoRedoPlugin]);\n\n useEffect(() => {\n undoRedoPlugin.onUpdateContent = () => {\n onChangeContent(/* @conditional-compile-remove(rich-text-editor-image-upload) */ true);\n };\n }, [onChangeContent, undoRedoPlugin]);\n\n const keyboardInputPlugin = useMemo(() => {\n return new KeyboardInputPlugin();\n }, []);\n\n useEffect(() => {\n // don't set callback in plugin constructor to update callback without plugin recreation\n keyboardInputPlugin.onKeyDown = onKeyDown;\n }, [keyboardInputPlugin, onKeyDown]);\n\n const tableContextMenuPlugin = useMemo(() => {\n return new TableEditContextMenuProvider();\n }, []);\n\n useEffect(() => {\n tableContextMenuPlugin.updateStrings(strings);\n }, [tableContextMenuPlugin, strings]);\n\n const onContextMenuRender = useCallback(\n (container: HTMLElement, items: IContextualMenuItem[], onDismiss: () => void): void => {\n setContextMenuProps({\n items: items,\n target: container,\n onDismiss: onDismiss\n });\n },\n []\n );\n\n const onContextMenuDismiss = useCallback((): void => {\n setContextMenuProps(null);\n }, []);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n useEffect(() => {\n copyPastePlugin.onPaste = onPaste;\n }, [copyPastePlugin, onPaste]);\n\n const plugins: EditorPlugin[] = useMemo(() => {\n const contentEdit = new EditPlugin({ handleTabKey: false });\n // AutoFormatPlugin previously was a part of the edit plugin\n const autoFormatPlugin = new AutoFormatPlugin({ autoBullet: true, autoNumbering: true, autoLink: true });\n const roosterPastePlugin = new PastePlugin(false, {\n additionalDisallowedTags: ['head', '!doctype', '!cdata', '#comment'],\n additionalAllowedTags: [],\n styleSanitizers: DefaultSanitizers,\n attributeSanitizers: {}\n });\n\n const shortcutPlugin = new ShortcutPlugin();\n const contextMenuPlugin = new ContextMenuPlugin(onContextMenuRender, onContextMenuDismiss);\n return [\n placeholderPlugin,\n keyboardInputPlugin,\n contentEdit,\n autoFormatPlugin,\n updatePlugin,\n copyPastePlugin,\n roosterPastePlugin,\n toolbarPlugin,\n shortcutPlugin,\n // contextPlugin and tableEditMenuProvider allow to show insert/delete menu for the table\n contextMenuPlugin,\n tableContextMenuPlugin,\n undoRedoPlugin\n ];\n }, [\n onContextMenuRender,\n onContextMenuDismiss,\n placeholderPlugin,\n keyboardInputPlugin,\n updatePlugin,\n copyPastePlugin,\n toolbarPlugin,\n tableContextMenuPlugin,\n undoRedoPlugin\n ]);\n\n const announcerStringGetter = useCallback(\n (key: KnownAnnounceStrings): string => {\n switch (key) {\n case 'announceListItemBullet':\n return strings.richTextNewBulletedListItemAnnouncement ?? '';\n case 'announceListItemNumbering':\n return strings.richTextNewNumberedListItemAnnouncement ?? '';\n case 'announceOnFocusLastCell':\n return '';\n }\n },\n [strings.richTextNewBulletedListItemAnnouncement, strings.richTextNewNumberedListItemAnnouncement]\n );\n\n useEffect(() => {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const prevInlineImage = getPreviousInlineImages(initialContent);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n setPreviousInlineImages(prevInlineImage);\n\n const initialModel = createEditorInitialModel(initialContent, contentModel);\n if (editorDiv.current) {\n editor.current = new Editor(editorDiv.current, {\n inDarkMode: isDarkThemed(theme),\n // doNotAdjustEditorColor is used to disable default color and background color for Rooster component\n doNotAdjustEditorColor: true,\n imageSelectionBorderColor: theme.palette.themePrimary,\n tableCellSelectionBackgroundColor: theme.palette.neutralLight,\n plugins: plugins,\n initialModel: initialModel,\n defaultModelToDomOptions: {\n formatApplierOverride: {\n // apply border and dataset formats for table\n border: borderApplier,\n dataset: dataSetApplier\n }\n },\n announcerStringGetter: announcerStringGetter\n });\n }\n\n if (autoFocus === 'sendBoxTextField') {\n editor.current?.focus();\n }\n\n return () => {\n if (editor.current) {\n editor.current.dispose();\n editor.current = null;\n }\n };\n // don't update the editor on deps update as everything is handled in separate hooks or plugins\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme, plugins, announcerStringGetter]);\n\n useEffect(() => {\n const themeDirectionValue = themeDirection(theme);\n // check that editor exists and theme was actually changed\n // as format.direction will be undefined if setDirection is not called\n if (editor.current && previousThemeDirection.current !== themeDirectionValue) {\n const format = getFormatState(editor.current);\n if (format.direction !== themeDirectionValue) {\n // should be set after the hook where editor is created as the editor might be null\n // setDirection will cause the focus change back to the editor and this might not be what we want to do (autoFocus prop)\n // that's why it's not part of the create editor hook\n setDirection(editor.current, theme.rtl ? 'rtl' : 'ltr');\n }\n previousThemeDirection.current = themeDirectionValue;\n }\n }, [theme]);\n\n return (\n <div data-testid={'rich-text-editor-wrapper'}>\n <div ref={toolbarRef}>{showRichTextEditorFormatting && toolbar}</div>\n <div className={richTextEditorWrapperStyle(theme)}>\n {/* div that is used by Rooster JS as a parent of the editor */}\n <div\n id=\"richTextSendBox\"\n ref={editorDiv}\n tabIndex={0}\n role=\"textbox\"\n aria-multiline=\"true\"\n data-testid={'rooster-rich-text-editor'}\n className={richTextEditorStyle(props.styles)}\n aria-label={placeholderText}\n />\n </div>\n {contextMenuProps && <ContextualMenu {...contextMenuProps} calloutProps={{ isBeakVisible: false }} />}\n </div>\n );\n});\n\nconst createEditorInitialModel = (\n initialContent?: string,\n contentModel?: ContentModelDocument\n): ContentModelDocument | undefined => {\n if (contentModel) {\n // contentModel is the current content of the editor\n return contentModel;\n } else {\n const initialContentValue = initialContent;\n const initialModel =\n initialContentValue && initialContentValue.length > 0 ? createModelFromHtml(initialContentValue) : undefined;\n if (initialModel && initialModel.blocks.length > 0) {\n // lastBlock should have blockType = paragraph, otherwise add a new paragraph\n // to set focus to the end of the content\n const lastBlock = initialModel.blocks[initialModel.blocks.length - 1];\n if (lastBlock?.blockType === 'Paragraph') {\n // now lastBlock is paragraph\n setSelectionAfterLastSegment(initialModel, lastBlock);\n } else {\n const block = createParagraph(false);\n initialModel.blocks.push(block);\n setSelectionAfterLastSegment(initialModel, block);\n // add content to the paragraph, otherwise height might be calculated incorrectly\n block.segments.push(createBr());\n }\n }\n return initialModel;\n }\n};\n\nconst setSelectionAfterLastSegment = (model: ReadonlyContentModelBlockGroup, block: ContentModelParagraph): void => {\n //selection marker should have the same format as the last segment if any\n const format = block.segments.length > 0 ? block.segments[block.segments.length - 1]?.format : undefined;\n const marker = createSelectionMarker(format);\n block.segments.push(marker);\n setSelection(model, marker);\n};\n\nconst themeDirection = (theme: Theme): 'rtl' | 'ltr' => {\n return theme.rtl ? 'rtl' : 'ltr';\n};\n"]}
1
+ {"version":3,"file":"RichTextEditor.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/RichTextEditor/RichTextEditor.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtG,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAUxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,YAAY,EACb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAA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AC;AAC9B,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAY,EAAiB,EAAE;IACrD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AACnC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport { richTextEditorWrapperStyle, richTextEditorStyle } from '../styles/RichTextEditor.styles';\nimport { useTheme } from '../../theming';\nimport { RichTextStrings } from './RichTextSendBox';\nimport { isDarkThemed } from '../../theming/themeUtils';\nimport CopyPastePlugin from './Plugins/CopyPastePlugin';\nimport type {\n ContentModelDocument,\n ContentModelParagraph,\n EditorPlugin,\n IEditor,\n ReadonlyContentModelBlockGroup,\n ShallowMutableContentModelDocument,\n KnownAnnounceStrings\n} from 'roosterjs-content-model-types';\nimport { createModelFromHtml, Editor, exportContent } from 'roosterjs-content-model-core';\nimport {\n createBr,\n createEmptyModel,\n createParagraph,\n createSelectionMarker,\n setSelection\n} from 'roosterjs-content-model-dom';\nimport { KeyboardInputPlugin } from './Plugins/KeyboardInputPlugin';\nimport {\n AutoFormatPlugin,\n EditPlugin,\n PastePlugin,\n ShortcutPlugin,\n DefaultSanitizers\n} from 'roosterjs-content-model-plugins';\nimport { UpdateContentPlugin, UpdateEvent } from './Plugins/UpdateContentPlugin';\nimport { RichTextToolbar } from './Toolbar/RichTextToolbar';\nimport { RichTextToolbarPlugin } from './Plugins/RichTextToolbarPlugin';\nimport { ContextMenuPlugin } from './Plugins/ContextMenuPlugin';\nimport { TableEditContextMenuProvider } from './Plugins/TableEditContextMenuProvider';\nimport { borderApplier, dataSetApplier } from '../utils/RichTextEditorUtils';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport {\n getPreviousInlineImages,\n getRemovedInlineImages,\n removeLocalBlobs,\n cleanAllLocalBlobs\n} from '../utils/RichTextEditorUtils';\nimport { ContextualMenu, IContextualMenuItem, IContextualMenuProps, Theme } from '@fluentui/react';\nimport { PlaceholderPlugin } from './Plugins/PlaceholderPlugin';\nimport { getFormatState, setDirection } from 'roosterjs-content-model-api';\nimport UndoRedoPlugin from './Plugins/UndoRedoPlugin';\n\n/**\n * Style props for {@link RichTextEditor}.\n *\n * @private\n */\nexport interface RichTextEditorStyleProps {\n minHeight: string;\n maxHeight: string;\n}\n\n/**\n * Props for {@link RichTextEditor}.\n *\n * @private\n */\nexport interface RichTextEditorProps {\n // the initial content of editor that is set when editor is created (e.g. when editing a message)\n initialContent?: string;\n onChange: (\n newValue?: string,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ removedInlineImages?: Record<string, string>[]\n ) => void;\n onKeyDown?: (ev: KeyboardEvent) => void;\n // OnKeyDown aren't called for composition events, so we need to handle them separately\n onCompositionUpdate?: () => void;\n // update the current content of the rich text editor\n onContentModelUpdate?: (contentModel: ContentModelDocument | undefined) => void;\n contentModel?: ContentModelDocument | undefined;\n placeholderText?: string;\n strings: Partial<RichTextStrings>;\n showRichTextEditorFormatting: boolean;\n styles: RichTextEditorStyleProps;\n autoFocus?: 'sendBoxTextField';\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage?: (imageAttributes: Record<string, string>) => void;\n}\n\n/**\n * Represents a reference to the RichTextEditor component.\n */\nexport interface RichTextEditorComponentRef {\n /**\n * Sets focus on the RichTextEditor component.\n */\n focus: () => void;\n\n /**\n * Sets the content of the RichTextEditor component to an empty string.\n */\n setEmptyContent: () => void;\n\n /**\n * Retrieves the plain text content of the RichTextEditor component.\n * @returns The plain text content of the RichTextEditor component, or undefined if the editor isn't available.\n */\n getPlainContent: () => string | undefined;\n}\n\n/**\n * A component to wrap RoosterJS Rich Text Editor.\n *\n * @beta\n */\nexport const RichTextEditor = React.forwardRef<RichTextEditorComponentRef, RichTextEditorProps>((props, ref) => {\n const {\n initialContent,\n onChange,\n placeholderText,\n strings,\n showRichTextEditorFormatting,\n autoFocus,\n onKeyDown,\n onCompositionUpdate,\n onContentModelUpdate,\n contentModel,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage\n } = props;\n const editor = useRef<IEditor | null>(null);\n const editorDiv = useRef<HTMLDivElement>(null);\n const toolbarRef = useRef<HTMLDivElement>(null);\n const theme = useTheme();\n const [contextMenuProps, setContextMenuProps] = useState<IContextualMenuProps | null>(null);\n const previousThemeDirection = useRef(themeDirection(theme));\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n // This will be set when the editor is initialized and when the content is updated.\n const [previousInlineImages, setPreviousInlineImages] = useState<Record<string, string>[]>([]);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const [inlineImageLocalBlobs, setInlineImageLocalBlobs] = useState<Record<string, string>>({});\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n useEffect(() => {\n return () => {\n // Cleanup Local Blob URLs when the component is unmounted\n cleanAllLocalBlobs(inlineImageLocalBlobs);\n };\n // This effect should only run once when the component is unmounted, so we don't need to add any dependencies\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (editor.current) {\n if (showRichTextEditorFormatting) {\n toolbarRef.current?.focus();\n } else {\n editor.current?.focus();\n }\n }\n }, [showRichTextEditorFormatting]);\n\n useImperativeHandle(ref, () => {\n return {\n focus() {\n if (editor.current) {\n editor.current.focus();\n }\n },\n setEmptyContent() {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n setPreviousInlineImages([]);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n cleanAllLocalBlobs(inlineImageLocalBlobs);\n\n if (editor.current) {\n // remove all content from the editor and update the model\n // ContentChanged event will be sent by RoosterJS automatically\n editor.current.formatContentModel((model: ShallowMutableContentModelDocument): boolean => {\n // Create a new empty paragraph with selection marker\n // this is needed for correct processing of images after the content is deleted\n const newModel = createEmptyModel();\n model.blocks = newModel.blocks;\n return true;\n });\n //reset content model\n onContentModelUpdate && onContentModelUpdate(editor.current.getContentModelCopy('disconnected'));\n }\n },\n getPlainContent() {\n if (editor.current) {\n return exportContent(editor.current, 'PlainTextFast');\n } else {\n return undefined;\n }\n }\n };\n }, [/* @conditional-compile-remove(rich-text-editor-image-upload) */ inlineImageLocalBlobs, onContentModelUpdate]);\n\n const toolbarPlugin = React.useMemo(() => {\n return new RichTextToolbarPlugin();\n }, []);\n\n const placeholderPlugin = useMemo(() => {\n const textColor = theme.palette?.neutralSecondary;\n return new PlaceholderPlugin(\n '',\n textColor\n ? {\n textColor: textColor\n }\n : undefined\n );\n }, [theme]);\n\n useEffect(() => {\n if (placeholderText !== undefined) {\n placeholderPlugin.updatePlaceholder(placeholderText);\n }\n }, [placeholderPlugin, placeholderText]);\n\n const toolbar = useMemo(() => {\n return <RichTextToolbar plugin={toolbarPlugin} strings={strings} />;\n }, [strings, toolbarPlugin]);\n\n const updatePlugin = useMemo(() => {\n return new UpdateContentPlugin();\n }, []);\n\n const copyPastePlugin = useMemo(() => {\n return new CopyPastePlugin();\n }, []);\n\n const onChangeContent = useCallback(\n (/* @conditional-compile-remove(rich-text-editor-image-upload) */ shouldUpdateInlineImages?: boolean) => {\n if (editor.current === null) {\n return;\n }\n const content = exportContent(editor.current);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n let removedInlineImages: Record<string, string>[] = [];\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (shouldUpdateInlineImages) {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n removedInlineImages = getRemovedInlineImages(content, previousInlineImages);\n }\n\n onChange &&\n onChange(content, /* @conditional-compile-remove(rich-text-editor-image-upload) */ removedInlineImages);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n setPreviousInlineImages(getPreviousInlineImages(content));\n },\n [onChange, /* @conditional-compile-remove(rich-text-editor-image-upload) */ previousInlineImages]\n );\n\n useEffect(() => {\n // don't set callback in plugin constructor to update callback without plugin recreation\n updatePlugin.onUpdate = (\n event: string,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ shouldRemoveInlineImages?: boolean\n ) => {\n if (editor.current === null) {\n return;\n }\n if (event === UpdateEvent.Blur || event === UpdateEvent.Dispose) {\n onContentModelUpdate && onContentModelUpdate(editor.current.getContentModelCopy('disconnected'));\n } else {\n const content = exportContent(editor.current);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n let removedInlineImages: Record<string, string>[] = [];\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (shouldRemoveInlineImages) {\n removedInlineImages = getRemovedInlineImages(content, previousInlineImages);\n if (removedInlineImages.length > 0) {\n removeLocalBlobs(inlineImageLocalBlobs, removedInlineImages);\n }\n }\n\n onChange &&\n onChange(content, /* @conditional-compile-remove(rich-text-editor-image-upload) */ removedInlineImages);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n setPreviousInlineImages(getPreviousInlineImages(content));\n }\n };\n }, [\n onChange,\n onContentModelUpdate,\n updatePlugin,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ previousInlineImages,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ inlineImageLocalBlobs\n ]);\n\n const undoRedoPlugin = useMemo(() => {\n return new UndoRedoPlugin();\n }, []);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n useEffect(() => {\n if (onInsertInlineImage) {\n copyPastePlugin.onInsertInlineImage = (imageAttributes: Record<string, string>) => {\n const { id, src } = imageAttributes;\n setInlineImageLocalBlobs((prev) => {\n if (!id || !src) {\n return prev;\n }\n return { ...prev, [id]: src };\n });\n onInsertInlineImage(imageAttributes);\n };\n } else {\n copyPastePlugin.onInsertInlineImage = undefined;\n }\n undoRedoPlugin.onInsertInlineImage = onInsertInlineImage;\n }, [copyPastePlugin, onInsertInlineImage, undoRedoPlugin]);\n\n useEffect(() => {\n undoRedoPlugin.onUpdateContent = () => {\n onChangeContent(/* @conditional-compile-remove(rich-text-editor-image-upload) */ true);\n };\n }, [onChangeContent, undoRedoPlugin]);\n\n const keyboardInputPlugin = useMemo(() => {\n return new KeyboardInputPlugin();\n }, []);\n\n useEffect(() => {\n // don't set callback in plugin constructor to update callback without plugin recreation\n keyboardInputPlugin.onKeyDown = onKeyDown;\n }, [keyboardInputPlugin, onKeyDown]);\n\n useEffect(() => {\n // don't set callback in plugin constructor to update callback without plugin recreation\n keyboardInputPlugin.onCompositionUpdate = onCompositionUpdate;\n }, [keyboardInputPlugin, onCompositionUpdate]);\n\n const tableContextMenuPlugin = useMemo(() => {\n return new TableEditContextMenuProvider();\n }, []);\n\n useEffect(() => {\n tableContextMenuPlugin.updateStrings(strings);\n }, [tableContextMenuPlugin, strings]);\n\n const onContextMenuRender = useCallback(\n (container: HTMLElement, items: IContextualMenuItem[], onDismiss: () => void): void => {\n setContextMenuProps({\n items: items,\n target: container,\n onDismiss: onDismiss\n });\n },\n []\n );\n\n const onContextMenuDismiss = useCallback((): void => {\n setContextMenuProps(null);\n }, []);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n useEffect(() => {\n copyPastePlugin.onPaste = onPaste;\n }, [copyPastePlugin, onPaste]);\n\n const plugins: EditorPlugin[] = useMemo(() => {\n const contentEdit = new EditPlugin({ handleTabKey: false });\n // AutoFormatPlugin previously was a part of the edit plugin\n const autoFormatPlugin = new AutoFormatPlugin({ autoBullet: true, autoNumbering: true, autoLink: true });\n const roosterPastePlugin = new PastePlugin(false, {\n additionalDisallowedTags: ['head', '!doctype', '!cdata', '#comment'],\n additionalAllowedTags: [],\n styleSanitizers: DefaultSanitizers,\n attributeSanitizers: {}\n });\n\n const shortcutPlugin = new ShortcutPlugin();\n const contextMenuPlugin = new ContextMenuPlugin(onContextMenuRender, onContextMenuDismiss);\n return [\n placeholderPlugin,\n keyboardInputPlugin,\n contentEdit,\n autoFormatPlugin,\n updatePlugin,\n copyPastePlugin,\n roosterPastePlugin,\n toolbarPlugin,\n shortcutPlugin,\n // contextPlugin and tableEditMenuProvider allow to show insert/delete menu for the table\n contextMenuPlugin,\n tableContextMenuPlugin,\n undoRedoPlugin\n ];\n }, [\n onContextMenuRender,\n onContextMenuDismiss,\n placeholderPlugin,\n keyboardInputPlugin,\n updatePlugin,\n copyPastePlugin,\n toolbarPlugin,\n tableContextMenuPlugin,\n undoRedoPlugin\n ]);\n\n const announcerStringGetter = useCallback(\n (key: KnownAnnounceStrings): string => {\n switch (key) {\n case 'announceListItemBullet':\n return strings.richTextNewBulletedListItemAnnouncement ?? '';\n case 'announceListItemNumbering':\n return strings.richTextNewNumberedListItemAnnouncement ?? '';\n case 'announceOnFocusLastCell':\n return '';\n }\n },\n [strings.richTextNewBulletedListItemAnnouncement, strings.richTextNewNumberedListItemAnnouncement]\n );\n\n useEffect(() => {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const prevInlineImage = getPreviousInlineImages(initialContent);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n setPreviousInlineImages(prevInlineImage);\n\n const initialModel = createEditorInitialModel(initialContent, contentModel);\n if (editorDiv.current) {\n editor.current = new Editor(editorDiv.current, {\n inDarkMode: isDarkThemed(theme),\n // doNotAdjustEditorColor is used to disable default color and background color for Rooster component\n doNotAdjustEditorColor: true,\n imageSelectionBorderColor: theme.palette.themePrimary,\n tableCellSelectionBackgroundColor: theme.palette.neutralLight,\n plugins: plugins,\n initialModel: initialModel,\n defaultModelToDomOptions: {\n formatApplierOverride: {\n // apply border and dataset formats for table\n border: borderApplier,\n dataset: dataSetApplier\n }\n },\n announcerStringGetter: announcerStringGetter\n });\n }\n\n if (autoFocus === 'sendBoxTextField') {\n editor.current?.focus();\n }\n\n return () => {\n if (editor.current) {\n editor.current.dispose();\n editor.current = null;\n }\n };\n // don't update the editor on deps update as everything is handled in separate hooks or plugins\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme, plugins, announcerStringGetter]);\n\n useEffect(() => {\n const themeDirectionValue = themeDirection(theme);\n // check that editor exists and theme was actually changed\n // as format.direction will be undefined if setDirection is not called\n if (editor.current && previousThemeDirection.current !== themeDirectionValue) {\n const format = getFormatState(editor.current);\n if (format.direction !== themeDirectionValue) {\n // should be set after the hook where editor is created as the editor might be null\n // setDirection will cause the focus change back to the editor and this might not be what we want to do (autoFocus prop)\n // that's why it's not part of the create editor hook\n setDirection(editor.current, theme.rtl ? 'rtl' : 'ltr');\n }\n previousThemeDirection.current = themeDirectionValue;\n }\n }, [theme]);\n\n return (\n <div data-testid={'rich-text-editor-wrapper'}>\n <div ref={toolbarRef}>{showRichTextEditorFormatting && toolbar}</div>\n <div className={richTextEditorWrapperStyle(theme)}>\n {/* div that is used by Rooster JS as a parent of the editor */}\n <div\n id=\"richTextSendBox\"\n ref={editorDiv}\n tabIndex={0}\n role=\"textbox\"\n aria-multiline=\"true\"\n data-testid={'rooster-rich-text-editor'}\n className={richTextEditorStyle(props.styles)}\n aria-label={placeholderText}\n />\n </div>\n {contextMenuProps && <ContextualMenu {...contextMenuProps} calloutProps={{ isBeakVisible: false }} />}\n </div>\n );\n});\n\nconst createEditorInitialModel = (\n initialContent?: string,\n contentModel?: ContentModelDocument\n): ContentModelDocument | undefined => {\n if (contentModel) {\n // contentModel is the current content of the editor\n return contentModel;\n } else {\n const initialContentValue = initialContent;\n const initialModel =\n initialContentValue && initialContentValue.length > 0 ? createModelFromHtml(initialContentValue) : undefined;\n if (initialModel && initialModel.blocks.length > 0) {\n // lastBlock should have blockType = paragraph, otherwise add a new paragraph\n // to set focus to the end of the content\n const lastBlock = initialModel.blocks[initialModel.blocks.length - 1];\n if (lastBlock?.blockType === 'Paragraph') {\n // now lastBlock is paragraph\n setSelectionAfterLastSegment(initialModel, lastBlock);\n } else {\n const block = createParagraph(false);\n initialModel.blocks.push(block);\n setSelectionAfterLastSegment(initialModel, block);\n // add content to the paragraph, otherwise height might be calculated incorrectly\n block.segments.push(createBr());\n }\n }\n return initialModel;\n }\n};\n\nconst setSelectionAfterLastSegment = (model: ReadonlyContentModelBlockGroup, block: ContentModelParagraph): void => {\n //selection marker should have the same format as the last segment if any\n const format = block.segments.length > 0 ? block.segments[block.segments.length - 1]?.format : undefined;\n const marker = createSelectionMarker(format);\n block.segments.push(marker);\n setSelection(model, marker);\n};\n\nconst themeDirection = (theme: Theme): 'rtl' | 'ltr' => {\n return theme.rtl ? 'rtl' : 'ltr';\n};\n"]}
@@ -60,6 +60,9 @@ export const RichTextInputBoxComponent = (props) => {
60
60
  onTyping === null || onTyping === void 0 ? void 0 : onTyping();
61
61
  }
62
62
  }, [onEnterKeyDown, showRichTextEditorFormatting, onTyping]);
63
+ const onCompositionUpdate = useCallback(() => {
64
+ onTyping === null || onTyping === void 0 ? void 0 : onTyping();
65
+ }, [onTyping]);
63
66
  const useHorizontalLayout = useMemo(() => {
64
67
  const isRichTextEditorToolbarShown = showRichTextEditorFormatting === true;
65
68
  return (!isHorizontalLayoutDisabled &&
@@ -86,7 +89,7 @@ export const RichTextInputBoxComponent = (props) => {
86
89
  } },
87
90
  React.createElement(Stack, { grow: true, className: inputBoxRichTextStackStyle },
88
91
  React.createElement(Stack.Item, { className: inputBoxRichTextStackItemStyle },
89
- React.createElement(RichTextEditor, { contentModel: contentModel, initialContent: initialContent, placeholderText: placeholderText, onChange: onChange, onKeyDown: onKeyDown, ref: editorComponentRef, strings: strings, showRichTextEditorFormatting: showRichTextEditorFormatting === true, styles: richTextEditorStyle, autoFocus: autoFocus, onContentModelUpdate: onContentModelUpdate,
92
+ React.createElement(RichTextEditor, { contentModel: contentModel, initialContent: initialContent, placeholderText: placeholderText, onChange: onChange, onKeyDown: onKeyDown, onCompositionUpdate: onCompositionUpdate, ref: editorComponentRef, strings: strings, showRichTextEditorFormatting: showRichTextEditorFormatting === true, styles: richTextEditorStyle, autoFocus: autoFocus, onContentModelUpdate: onContentModelUpdate,
90
93
  /* @conditional-compile-remove(rich-text-editor-image-upload) */
91
94
  onPaste: props.onPaste,
92
95
  /* @conditional-compile-remove(rich-text-editor-image-upload) */
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextInputBoxComponent.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/RichTextEditor/RichTextInputBoxComponent.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAwD,MAAM,kBAAkB,CAAC;AAExG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EACL,iCAAiC,EACjC,+BAA+B,EAC/B,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,4CAA4C,CAAC;AAyCpD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,KAAqC,EAAe,EAAE;IAC9F,MAAM,EACJ,eAAe,EACf,cAAc,EACd,QAAQ,EACR,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,gBAAgB;IAChB,mDAAmD;IACnD,yBAAyB;IACzB,mDAAmD;IACnD,cAAc,EACd,wBAAwB,EACxB,0BAA0B,GAAG,KAAK,EAClC,SAAS,EACT,QAAQ;IACR,gEAAgE;IAChE,mBAAmB,EACpB,GAAG,KAAK,CAAC;IACV,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,2FAA2F;IAC3F,MAAM,CAAC,4BAA4B,EAAE,+BAA+B,CAAC,GAAG,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actNode, useCallback, useMemo, useState } from 'react';\nimport { BaseCustomStyles } from '../../types';\nimport { RichTextEditor, RichTextEditorComponentRef, RichTextEditorStyleProps } from './RichTextEditor';\nimport { RichTextSendBoxStrings } from './RichTextSendBox';\nimport { useTheme } from '../../theming';\nimport { Icon, Stack } from '@fluentui/react';\nimport { InputBoxButton } from '../InputBoxButton';\nimport { isEnterKeyEventFromCompositionSession } from '../utils';\nimport {\n richTextActionButtonsDividerStyle,\n richTextActionButtonsStackStyle,\n richTextActionButtonsStyle,\n richTextFormatButtonIconStyle\n} from '../styles/RichTextEditor.styles';\nimport {\n inputBoxContentStackStyle,\n inputBoxRichTextStackItemStyle,\n inputBoxRichTextStackStyle,\n richTextBorderBoxStyle\n} from '../styles/RichTextInputBoxComponent.styles';\nimport type { ContentModelDocument } from 'roosterjs-content-model-types';\n\n/**\n * @private\n */\nexport interface RichTextInputBoxComponentStylesProps extends BaseCustomStyles {}\n\n/**\n * @private\n */\nexport interface RichTextInputBoxComponentProps {\n placeholderText?: string;\n // the initial content of editor that is set when editor is created (e.g. when editing a message)\n initialContent?: string;\n onChange: (\n newValue?: string,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ removedInlineImages?: Record<string, string>[]\n ) => void;\n onEnterKeyDown?: () => void;\n editorComponentRef: React.RefObject<RichTextEditorComponentRef>;\n // Partial needs to be removed when the rich text editor feature goes to GA\n strings: Partial<RichTextSendBoxStrings>;\n disabled: boolean;\n actionComponents: ReactNode;\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentUploads?: () => JSX.Element;\n /* @conditional-compile-remove(file-sharing-acs) */\n hasAttachments?: boolean;\n // props for min and max height for the rich text editor\n // otherwise the editor will grow to fit the content\n richTextEditorStyleProps: (isExpanded: boolean) => RichTextEditorStyleProps;\n isHorizontalLayoutDisabled?: boolean;\n autoFocus?: 'sendBoxTextField';\n onTyping?: () => Promise<void>;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage?: (imageAttributes: Record<string, string>) => void;\n}\n\n/**\n * @private\n */\nexport const RichTextInputBoxComponent = (props: RichTextInputBoxComponentProps): JSX.Element => {\n const {\n placeholderText,\n initialContent,\n onChange,\n onEnterKeyDown,\n editorComponentRef,\n disabled,\n strings,\n actionComponents,\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentUploads,\n /* @conditional-compile-remove(file-sharing-acs) */\n hasAttachments,\n richTextEditorStyleProps,\n isHorizontalLayoutDisabled = false,\n autoFocus,\n onTyping,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage\n } = props;\n const theme = useTheme();\n // undefined is used to indicate that the rich text editor toolbar state wasn't changed yet\n const [showRichTextEditorFormatting, setShowRichTextEditorFormatting] = useState<boolean | undefined>(undefined);\n const [contentModel, setContentModel] = useState<ContentModelDocument | undefined>(undefined);\n\n const onRenderRichTextEditorIcon = useCallback(\n (isHover: boolean) => {\n const isRichTextEditorToolbarShown = showRichTextEditorFormatting === true;\n return (\n <Icon\n iconName={\n isHover || isRichTextEditorToolbarShown ? 'RichTextEditorButtonIconFilled' : 'RichTextEditorButtonIcon'\n }\n className={richTextFormatButtonIconStyle(theme, !disabled && (isHover || isRichTextEditorToolbarShown))}\n />\n );\n },\n [disabled, showRichTextEditorFormatting, theme]\n );\n\n const actionButtons = useMemo(() => {\n return (\n <Stack.Item align=\"end\" className={richTextActionButtonsStackStyle}>\n <Stack horizontal>\n <InputBoxButton\n onRenderIcon={onRenderRichTextEditorIcon}\n onClick={(e) => {\n const isRichTextEditorToolbarShown = showRichTextEditorFormatting === true;\n setShowRichTextEditorFormatting(!isRichTextEditorToolbarShown);\n e.stopPropagation(); // Prevents the click from bubbling up and triggering a focus event on the chat.\n }}\n ariaLabel={strings.richTextFormatButtonTooltip}\n tooltipContent={strings.richTextFormatButtonTooltip}\n className={richTextActionButtonsStyle}\n data-testId={'rich-text-input-box-format-button'}\n ariaExpanded={showRichTextEditorFormatting}\n />\n <Icon iconName=\"RichTextDividerIcon\" className={richTextActionButtonsDividerStyle(theme)} />\n {actionComponents}\n </Stack>\n </Stack.Item>\n );\n }, [\n actionComponents,\n onRenderRichTextEditorIcon,\n showRichTextEditorFormatting,\n strings.richTextFormatButtonTooltip,\n theme\n ]);\n\n const richTextEditorStyle = useMemo(() => {\n return richTextEditorStyleProps(showRichTextEditorFormatting === true);\n }, [richTextEditorStyleProps, showRichTextEditorFormatting]);\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n if (isEnterKeyEventFromCompositionSession(ev)) {\n return;\n }\n const isRichTextEditorToolbarShown = showRichTextEditorFormatting === true;\n if (ev.key === 'Enter' && ev.shiftKey === false && !isRichTextEditorToolbarShown) {\n ev.preventDefault();\n onEnterKeyDown && onEnterKeyDown();\n } else {\n onTyping?.();\n }\n },\n [onEnterKeyDown, showRichTextEditorFormatting, onTyping]\n );\n\n const useHorizontalLayout = useMemo(() => {\n const isRichTextEditorToolbarShown = showRichTextEditorFormatting === true;\n return (\n !isHorizontalLayoutDisabled &&\n !isRichTextEditorToolbarShown &&\n /* @conditional-compile-remove(file-sharing-acs) */ !hasAttachments\n );\n }, [\n isHorizontalLayoutDisabled,\n showRichTextEditorFormatting,\n /* @conditional-compile-remove(file-sharing-acs) */ hasAttachments\n ]);\n\n const onContentModelUpdate = useCallback((contentModel: ContentModelDocument | undefined) => {\n setContentModel(contentModel);\n }, []);\n\n return (\n <div\n className={richTextBorderBoxStyle({\n theme: theme,\n disabled: !!disabled\n })}\n >\n {/* This layout is used for the compact view when formatting options are not shown */}\n {/* We don't use a stack here as there is a bug in Fluent Stack that causes remount of children when using wrap */}\n <div\n className={inputBoxContentStackStyle}\n style={{\n display: 'flex',\n flexGrow: 1,\n flexDirection: useHorizontalLayout ? 'row' : 'column',\n justifyContent: useHorizontalLayout ? 'flex-end' : 'space-between',\n flexWrap: useHorizontalLayout ? 'wrap' : 'nowrap'\n }}\n >\n {/* Fixes the issue when flex box can grow to be bigger than parent */}\n <Stack grow className={inputBoxRichTextStackStyle}>\n <Stack.Item className={inputBoxRichTextStackItemStyle}>\n <RichTextEditor\n contentModel={contentModel}\n initialContent={initialContent}\n placeholderText={placeholderText}\n onChange={onChange}\n onKeyDown={onKeyDown}\n ref={editorComponentRef}\n strings={strings}\n showRichTextEditorFormatting={showRichTextEditorFormatting === true}\n styles={richTextEditorStyle}\n autoFocus={autoFocus}\n onContentModelUpdate={onContentModelUpdate}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={props.onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage={onInsertInlineImage}\n />\n </Stack.Item>\n {/* @conditional-compile-remove(file-sharing-acs) */ onRenderAttachmentUploads && onRenderAttachmentUploads()}\n </Stack>\n {actionButtons}\n </div>\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"RichTextInputBoxComponent.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/RichTextEditor/RichTextInputBoxComponent.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAwD,MAAM,kBAAkB,CAAC;AAExG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EACL,iCAAiC,EACjC,+BAA+B,EAC/B,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,0BAA0B,EAC1B,sBAAsB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/C,oBAAC,KAAK,CAAC,IAAI,IAAC,SAAS,EAAE,8BAA8B;oBACnD,oBAAC,cAAc,IACb,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,mBAAmB,EACxC,GAAG,EAAE,kBAAkB,EACvB,OAAO,EAAE,OAAO,EAChB,4BAA4B,EAAE,4BAA4B,KAAK,IAAI,EACnE,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,SAAS,EACpB,oBAAoB,EAAE,oBAAoB;wBAC1C,gEAAgE;wBAChE,OAAO,EAAE,KAAK,CAAC,OAAO;wBACtB,gEAAgE;wBAChE,mBAAmB,EAAE,mBAAmB,GACxC,CACS,EACZ,mDAAmD;gBAAC,yBAAyB,IAAI,yBAAyB,EAAE,CACvG;YACP,aAAa,CACV,CACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { ReactNode, useCallback, useMemo, useState } from 'react';\nimport { BaseCustomStyles } from '../../types';\nimport { RichTextEditor, RichTextEditorComponentRef, RichTextEditorStyleProps } from './RichTextEditor';\nimport { RichTextSendBoxStrings } from './RichTextSendBox';\nimport { useTheme } from '../../theming';\nimport { Icon, Stack } from '@fluentui/react';\nimport { InputBoxButton } from '../InputBoxButton';\nimport { isEnterKeyEventFromCompositionSession } from '../utils';\nimport {\n richTextActionButtonsDividerStyle,\n richTextActionButtonsStackStyle,\n richTextActionButtonsStyle,\n richTextFormatButtonIconStyle\n} from '../styles/RichTextEditor.styles';\nimport {\n inputBoxContentStackStyle,\n inputBoxRichTextStackItemStyle,\n inputBoxRichTextStackStyle,\n richTextBorderBoxStyle\n} from '../styles/RichTextInputBoxComponent.styles';\nimport type { ContentModelDocument } from 'roosterjs-content-model-types';\n\n/**\n * @private\n */\nexport interface RichTextInputBoxComponentStylesProps extends BaseCustomStyles {}\n\n/**\n * @private\n */\nexport interface RichTextInputBoxComponentProps {\n placeholderText?: string;\n // the initial content of editor that is set when editor is created (e.g. when editing a message)\n initialContent?: string;\n onChange: (\n newValue?: string,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ removedInlineImages?: Record<string, string>[]\n ) => void;\n onEnterKeyDown?: () => void;\n editorComponentRef: React.RefObject<RichTextEditorComponentRef>;\n // Partial needs to be removed when the rich text editor feature goes to GA\n strings: Partial<RichTextSendBoxStrings>;\n disabled: boolean;\n actionComponents: ReactNode;\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentUploads?: () => JSX.Element;\n /* @conditional-compile-remove(file-sharing-acs) */\n hasAttachments?: boolean;\n // props for min and max height for the rich text editor\n // otherwise the editor will grow to fit the content\n richTextEditorStyleProps: (isExpanded: boolean) => RichTextEditorStyleProps;\n isHorizontalLayoutDisabled?: boolean;\n autoFocus?: 'sendBoxTextField';\n onTyping?: () => Promise<void>;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage?: (imageAttributes: Record<string, string>) => void;\n}\n\n/**\n * @private\n */\nexport const RichTextInputBoxComponent = (props: RichTextInputBoxComponentProps): JSX.Element => {\n const {\n placeholderText,\n initialContent,\n onChange,\n onEnterKeyDown,\n editorComponentRef,\n disabled,\n strings,\n actionComponents,\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentUploads,\n /* @conditional-compile-remove(file-sharing-acs) */\n hasAttachments,\n richTextEditorStyleProps,\n isHorizontalLayoutDisabled = false,\n autoFocus,\n onTyping,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage\n } = props;\n const theme = useTheme();\n // undefined is used to indicate that the rich text editor toolbar state wasn't changed yet\n const [showRichTextEditorFormatting, setShowRichTextEditorFormatting] = useState<boolean | undefined>(undefined);\n const [contentModel, setContentModel] = useState<ContentModelDocument | undefined>(undefined);\n\n const onRenderRichTextEditorIcon = useCallback(\n (isHover: boolean) => {\n const isRichTextEditorToolbarShown = showRichTextEditorFormatting === true;\n return (\n <Icon\n iconName={\n isHover || isRichTextEditorToolbarShown ? 'RichTextEditorButtonIconFilled' : 'RichTextEditorButtonIcon'\n }\n className={richTextFormatButtonIconStyle(theme, !disabled && (isHover || isRichTextEditorToolbarShown))}\n />\n );\n },\n [disabled, showRichTextEditorFormatting, theme]\n );\n\n const actionButtons = useMemo(() => {\n return (\n <Stack.Item align=\"end\" className={richTextActionButtonsStackStyle}>\n <Stack horizontal>\n <InputBoxButton\n onRenderIcon={onRenderRichTextEditorIcon}\n onClick={(e) => {\n const isRichTextEditorToolbarShown = showRichTextEditorFormatting === true;\n setShowRichTextEditorFormatting(!isRichTextEditorToolbarShown);\n e.stopPropagation(); // Prevents the click from bubbling up and triggering a focus event on the chat.\n }}\n ariaLabel={strings.richTextFormatButtonTooltip}\n tooltipContent={strings.richTextFormatButtonTooltip}\n className={richTextActionButtonsStyle}\n data-testId={'rich-text-input-box-format-button'}\n ariaExpanded={showRichTextEditorFormatting}\n />\n <Icon iconName=\"RichTextDividerIcon\" className={richTextActionButtonsDividerStyle(theme)} />\n {actionComponents}\n </Stack>\n </Stack.Item>\n );\n }, [\n actionComponents,\n onRenderRichTextEditorIcon,\n showRichTextEditorFormatting,\n strings.richTextFormatButtonTooltip,\n theme\n ]);\n\n const richTextEditorStyle = useMemo(() => {\n return richTextEditorStyleProps(showRichTextEditorFormatting === true);\n }, [richTextEditorStyleProps, showRichTextEditorFormatting]);\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n if (isEnterKeyEventFromCompositionSession(ev)) {\n return;\n }\n const isRichTextEditorToolbarShown = showRichTextEditorFormatting === true;\n if (ev.key === 'Enter' && ev.shiftKey === false && !isRichTextEditorToolbarShown) {\n ev.preventDefault();\n onEnterKeyDown && onEnterKeyDown();\n } else {\n onTyping?.();\n }\n },\n [onEnterKeyDown, showRichTextEditorFormatting, onTyping]\n );\n\n const onCompositionUpdate = useCallback(() => {\n onTyping?.();\n }, [onTyping]);\n\n const useHorizontalLayout = useMemo(() => {\n const isRichTextEditorToolbarShown = showRichTextEditorFormatting === true;\n return (\n !isHorizontalLayoutDisabled &&\n !isRichTextEditorToolbarShown &&\n /* @conditional-compile-remove(file-sharing-acs) */ !hasAttachments\n );\n }, [\n isHorizontalLayoutDisabled,\n showRichTextEditorFormatting,\n /* @conditional-compile-remove(file-sharing-acs) */ hasAttachments\n ]);\n\n const onContentModelUpdate = useCallback((contentModel: ContentModelDocument | undefined) => {\n setContentModel(contentModel);\n }, []);\n\n return (\n <div\n className={richTextBorderBoxStyle({\n theme: theme,\n disabled: !!disabled\n })}\n >\n {/* This layout is used for the compact view when formatting options are not shown */}\n {/* We don't use a stack here as there is a bug in Fluent Stack that causes remount of children when using wrap */}\n <div\n className={inputBoxContentStackStyle}\n style={{\n display: 'flex',\n flexGrow: 1,\n flexDirection: useHorizontalLayout ? 'row' : 'column',\n justifyContent: useHorizontalLayout ? 'flex-end' : 'space-between',\n flexWrap: useHorizontalLayout ? 'wrap' : 'nowrap'\n }}\n >\n {/* Fixes the issue when flex box can grow to be bigger than parent */}\n <Stack grow className={inputBoxRichTextStackStyle}>\n <Stack.Item className={inputBoxRichTextStackItemStyle}>\n <RichTextEditor\n contentModel={contentModel}\n initialContent={initialContent}\n placeholderText={placeholderText}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onCompositionUpdate={onCompositionUpdate}\n ref={editorComponentRef}\n strings={strings}\n showRichTextEditorFormatting={showRichTextEditorFormatting === true}\n styles={richTextEditorStyle}\n autoFocus={autoFocus}\n onContentModelUpdate={onContentModelUpdate}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={props.onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage={onInsertInlineImage}\n />\n </Stack.Item>\n {/* @conditional-compile-remove(file-sharing-acs) */ onRenderAttachmentUploads && onRenderAttachmentUploads()}\n </Stack>\n {actionButtons}\n </div>\n </div>\n );\n};\n"]}
@@ -13,7 +13,8 @@ export declare enum PluginEventType {
13
13
  BeforeCutCopy = "beforeCutCopy",
14
14
  BeforePaste = "beforePaste",
15
15
  ZoomChanged = "zoomChanged",
16
- MouseUp = "mouseUp"
16
+ MouseUp = "mouseUp",
17
+ CompositionEnd = "compositionEnd"
17
18
  }
18
19
  /**
19
20
  * ContentChanged event source for RoosterJS
@@ -16,6 +16,7 @@ export var PluginEventType;
16
16
  PluginEventType["BeforePaste"] = "beforePaste";
17
17
  PluginEventType["ZoomChanged"] = "zoomChanged";
18
18
  PluginEventType["MouseUp"] = "mouseUp";
19
+ PluginEventType["CompositionEnd"] = "compositionEnd";
19
20
  })(PluginEventType || (PluginEventType = {}));
20
21
  /**
21
22
  * ContentChanged event source for RoosterJS
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextEditorUtils.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/utils/RichTextEditorUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;;GAGG;AACH,MAAM,CAAN,IAAY,eAWX;AAXD,WAAY,eAAe;IACzB,8CAA2B,CAAA;IAC3B,kDAA+B,CAAA;IAC/B,oDAAiC,CAAA;IACjC,wDAAqC,CAAA;IACrC,kCAAe,CAAA;IACf,sCAAmB,CAAA;IACnB,kDAA+B,CAAA;IAC/B,8CAA2B,CAAA;IAC3B,8CAA2B,CAAA;IAC3B,sCAAmB,CAAA;AACrB,CAAC,EAXW,eAAe,KAAf,eAAe,QAW1B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,yBAEX;AAFD,WAAY,yBAAyB;IACnC,4CAAe,CAAA;AACjB,CAAC,EAFW,yBAAyB,KAAzB,yBAAyB,QAEpC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAoB,EAAE,OAAoB,EA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AAC;QAC7B,OAAO,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { BorderFormat, DatasetFormat, ModelToDomContext } from 'roosterjs-content-model-types';\n\n/**\n * Plugin event type for RoosterJS plugins\n * @private\n */\nexport enum PluginEventType {\n EditorReady = 'editorReady',\n BeforeDispose = 'beforeDispose',\n ContentChanged = 'contentChanged',\n BeforeSetContent = 'beforeSetContent',\n Input = 'input',\n KeyDown = 'keyDown',\n BeforeCutCopy = 'beforeCutCopy',\n BeforePaste = 'beforePaste',\n ZoomChanged = 'zoomChanged',\n MouseUp = 'mouseUp'\n}\n\n/**\n * ContentChanged event source for RoosterJS\n * @private\n */\nexport enum ContentChangedEventSource {\n Paste = 'Paste'\n}\n\n/**\n * Applies the border format to the specified element.\n * If the element is an HTMLTableCellElement, it skips setting editing info\n * and to use classes instead of inline styles.\n * For all other cases, the default format applier is used.\n */\nexport const borderApplier = (format: BorderFormat, element: HTMLElement, context: ModelToDomContext): void => {\n if (element instanceof HTMLTableCellElement) {\n // don't set format for table cell\n // as it will set inline styles for them\n // we want to use classes instead\n } else if (context.defaultFormatAppliers.border) {\n // apply default formats for all other cases\n context.defaultFormatAppliers.border(format, element, context);\n }\n};\n\n/**\n * Applies the dataset format to the given HTML element.\n * If the element is an HTMLTableElement, it skips setting editing info\n * and to use classes instead of inline styles.\n * For all other cases, it applies the default formats.\n */\nexport const dataSetApplier = (format: DatasetFormat, element: HTMLElement, context: ModelToDomContext): void => {\n if (element instanceof HTMLTableElement) {\n // don't set editing info for tables\n // as it will set inline styles for them\n // we want to use classes instead\n } else if (context.defaultFormatAppliers.dataset) {\n // apply default formats for all other cases\n context.defaultFormatAppliers.dataset(format, element, context);\n }\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getPreviousInlineImages = (content?: string): Record<string, string>[] => {\n if (!content) {\n return [];\n }\n const previousInlineImages: Record<string, string>[] = [];\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n document.querySelectorAll('img').forEach((img) => {\n const imageAttributes = getInlineImageAttributes(img);\n previousInlineImages.push(imageAttributes);\n });\n return previousInlineImages;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getRemovedInlineImages = (\n content: string,\n previousInlineImages: Record<string, string>[]\n): Record<string, string>[] => {\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n const currentContentIds = Array.from(document.querySelectorAll('img')).map((img) => img.id);\n previousInlineImages = previousInlineImages?.filter((img) => !!img.id && !currentContentIds?.includes(img.id));\n\n const removedInlineImages = [...previousInlineImages];\n return removedInlineImages;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getInsertedInlineImages = (\n content: string,\n previousInlineImages: NodeListOf<HTMLImageElement>\n): HTMLImageElement[] => {\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n const currentContentInlineImages = Array.from(document.querySelectorAll('img'));\n const previousContentIds = Array.from(previousInlineImages).map((img) => img.id);\n // if check is updated, also update getRemovedInlineImages\n const insertedInlineImages = currentContentInlineImages.filter((img) => !previousContentIds.includes(img.id));\n return insertedInlineImages;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getInlineImageAttributes = (image: HTMLImageElement): Record<string, string> => {\n const imageAttributes: Record<string, string> = {};\n image.getAttributeNames().forEach((attrName) => {\n const attrValue = image.getAttribute(attrName);\n if (attrValue) {\n imageAttributes[attrName] = attrValue;\n }\n });\n return imageAttributes;\n};\n\n/* @conditional-compile-remove(rich-text-editor) */\n/**\n * @internal\n */\n/**\n * Update the scroll position of the editor to ensure the content is visible.\n */\nexport const scrollToBottomRichTextEditor = (): void => {\n // Get the current selection in the document\n const selection = document.getSelection();\n\n // Check if a selection exists and it has at least one range\n if (!selection || selection.rangeCount <= 0) {\n // If no selection or range, exit the function\n return;\n }\n\n // Get the first range of the selection\n // A user can normally only select one range at a time, so the rangeCount will usually be 1\n const range = selection.getRangeAt(0);\n\n // If the common ancestor container of the range is the document itself,\n // it might mean that the editable element is getting removed from the DOM\n // In such cases, especially in Safari, trying to modify the range might throw a HierarchyRequest error\n if (range.commonAncestorContainer === document) {\n return;\n }\n\n // Create a temporary span element to use as an anchor for scrolling\n // We can't use the anchor node directly because if it's a Text node, calling scrollIntoView() on it will throw an error\n const tempElement = document.createElement('span');\n // Collapse the range to its end point\n // This means the start and end points of the range will be the same, and it will not contain any content\n range.collapse(false);\n // Insert the temporary element at the cursor's position at the end of the range\n range.insertNode(tempElement);\n // Scroll the temporary element into view\n // the element will be aligned at the center of the scroll container, otherwise, text and images may be positioned incorrectly\n tempElement.scrollIntoView({\n block: 'center'\n });\n tempElement.remove();\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * Revoke the blob urls in the removedInlineImages and remove them from the currentLocalBlobMap\n * @internal\n */\nexport const removeLocalBlobs = (\n currentLocalBlobMap: Record<string, string>,\n removedInlineImages: Record<string, string>[]\n): void => {\n removedInlineImages.forEach((image) => {\n if (!image.id) {\n return;\n }\n removeSingleLocalBlob(currentLocalBlobMap, image.id);\n });\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * Revoke all the blob urls in the currentLocalBlobMap and clean up the currentLocalBlobMap\n * @internal\n */\nexport const cleanAllLocalBlobs = (currentLocalBlobMap: Record<string, string>): void => {\n Object.keys(currentLocalBlobMap).forEach((imageId) => {\n removeSingleLocalBlob(currentLocalBlobMap, imageId);\n });\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst removeSingleLocalBlob = (currentLocalBlobMap: Record<string, string>, imageId: string): void => {\n const blobUrl = currentLocalBlobMap[imageId];\n if (blobUrl) {\n URL.revokeObjectURL(blobUrl);\n delete currentLocalBlobMap[imageId];\n }\n};\n"]}
1
+ {"version":3,"file":"RichTextEditorUtils.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/utils/RichTextEditorUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;;GAGG;AACH,MAAM,CAAN,IAAY,eAYX;AAZD,WAAY,eAAe;IACzB,8CAA2B,CAAA;IAC3B,kDAA+B,CAAA;IAC/B,oDAAiC,CAAA;IACjC,wDAAqC,CAAA;IACrC,kCAAe,CAAA;IACf,sCAAmB,CAAA;IACnB,kDAA+B,CAAA;IAC/B,8CAA2B,CAAA;IAC3B,8CAA2B,CAAA;IAC3B,sCAAmB,CAAA;IACnB,oDAAiC,CAAA;AACnC,CAAC,EAZW,eAAe,KAAf,eAAe,QAY1B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,yBAEX;AAFD,WAAY,yBAAyB;IACnC,4CAAe,CAAA;AACjB,CAAC,EAFW,yBAAyB,KAAzB,yBAAyB,QAEpC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAoB,EAAE,OAAoB,EAAE,OAA0B,EAAQ,EAAE;IAC5G,IAAI,OAAO,YAAY,oBAAoB,EAAE,CAAC;QAC5C,kCAAkC;QAClC,wCAAwC;QACxC,iCAAiC;IACnC,CAAC;SAAM,IAAI,OAAO,CAAC,qBAAqB,CAAC,MAAM,EAAE,CAAC;QAChD,4CAA4C;QAC5C,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAqB,EAAE,OAAoB,EAAE,OAA0B,EAAQ,EAAE;IAC9G,IAAI,OAAO,YAAY,gBAAgB,EAAE,CAAC;QACxC,oCAAoC;QACpC,wCAAwC;QACxC,iCAAiC;IACnC,CAAC;SAAM,IAAI,OAAO,CAAC,qBAAqB,CAAC,OAAO,EAAE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E;QACpC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QACD,qBAAqB,CAAC,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,gEAAgE;AAChE;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,mBAA2C,EAAQ,EAAE;IACtF,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACnD,qBAAqB,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,gEAAgE;AAChE,MAAM,qBAAqB,GAAG,CAAC,mBAA2C,EAAE,OAAe,EAAQ,EAAE;IACnG,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7C,IAAI,OAAO,EAAE,CAAC;QACZ,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC7B,OAAO,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { BorderFormat, DatasetFormat, ModelToDomContext } from 'roosterjs-content-model-types';\n\n/**\n * Plugin event type for RoosterJS plugins\n * @private\n */\nexport enum PluginEventType {\n EditorReady = 'editorReady',\n BeforeDispose = 'beforeDispose',\n ContentChanged = 'contentChanged',\n BeforeSetContent = 'beforeSetContent',\n Input = 'input',\n KeyDown = 'keyDown',\n BeforeCutCopy = 'beforeCutCopy',\n BeforePaste = 'beforePaste',\n ZoomChanged = 'zoomChanged',\n MouseUp = 'mouseUp',\n CompositionEnd = 'compositionEnd'\n}\n\n/**\n * ContentChanged event source for RoosterJS\n * @private\n */\nexport enum ContentChangedEventSource {\n Paste = 'Paste'\n}\n\n/**\n * Applies the border format to the specified element.\n * If the element is an HTMLTableCellElement, it skips setting editing info\n * and to use classes instead of inline styles.\n * For all other cases, the default format applier is used.\n */\nexport const borderApplier = (format: BorderFormat, element: HTMLElement, context: ModelToDomContext): void => {\n if (element instanceof HTMLTableCellElement) {\n // don't set format for table cell\n // as it will set inline styles for them\n // we want to use classes instead\n } else if (context.defaultFormatAppliers.border) {\n // apply default formats for all other cases\n context.defaultFormatAppliers.border(format, element, context);\n }\n};\n\n/**\n * Applies the dataset format to the given HTML element.\n * If the element is an HTMLTableElement, it skips setting editing info\n * and to use classes instead of inline styles.\n * For all other cases, it applies the default formats.\n */\nexport const dataSetApplier = (format: DatasetFormat, element: HTMLElement, context: ModelToDomContext): void => {\n if (element instanceof HTMLTableElement) {\n // don't set editing info for tables\n // as it will set inline styles for them\n // we want to use classes instead\n } else if (context.defaultFormatAppliers.dataset) {\n // apply default formats for all other cases\n context.defaultFormatAppliers.dataset(format, element, context);\n }\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getPreviousInlineImages = (content?: string): Record<string, string>[] => {\n if (!content) {\n return [];\n }\n const previousInlineImages: Record<string, string>[] = [];\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n document.querySelectorAll('img').forEach((img) => {\n const imageAttributes = getInlineImageAttributes(img);\n previousInlineImages.push(imageAttributes);\n });\n return previousInlineImages;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getRemovedInlineImages = (\n content: string,\n previousInlineImages: Record<string, string>[]\n): Record<string, string>[] => {\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n const currentContentIds = Array.from(document.querySelectorAll('img')).map((img) => img.id);\n previousInlineImages = previousInlineImages?.filter((img) => !!img.id && !currentContentIds?.includes(img.id));\n\n const removedInlineImages = [...previousInlineImages];\n return removedInlineImages;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getInsertedInlineImages = (\n content: string,\n previousInlineImages: NodeListOf<HTMLImageElement>\n): HTMLImageElement[] => {\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n const currentContentInlineImages = Array.from(document.querySelectorAll('img'));\n const previousContentIds = Array.from(previousInlineImages).map((img) => img.id);\n // if check is updated, also update getRemovedInlineImages\n const insertedInlineImages = currentContentInlineImages.filter((img) => !previousContentIds.includes(img.id));\n return insertedInlineImages;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @internal\n */\nexport const getInlineImageAttributes = (image: HTMLImageElement): Record<string, string> => {\n const imageAttributes: Record<string, string> = {};\n image.getAttributeNames().forEach((attrName) => {\n const attrValue = image.getAttribute(attrName);\n if (attrValue) {\n imageAttributes[attrName] = attrValue;\n }\n });\n return imageAttributes;\n};\n\n/* @conditional-compile-remove(rich-text-editor) */\n/**\n * @internal\n */\n/**\n * Update the scroll position of the editor to ensure the content is visible.\n */\nexport const scrollToBottomRichTextEditor = (): void => {\n // Get the current selection in the document\n const selection = document.getSelection();\n\n // Check if a selection exists and it has at least one range\n if (!selection || selection.rangeCount <= 0) {\n // If no selection or range, exit the function\n return;\n }\n\n // Get the first range of the selection\n // A user can normally only select one range at a time, so the rangeCount will usually be 1\n const range = selection.getRangeAt(0);\n\n // If the common ancestor container of the range is the document itself,\n // it might mean that the editable element is getting removed from the DOM\n // In such cases, especially in Safari, trying to modify the range might throw a HierarchyRequest error\n if (range.commonAncestorContainer === document) {\n return;\n }\n\n // Create a temporary span element to use as an anchor for scrolling\n // We can't use the anchor node directly because if it's a Text node, calling scrollIntoView() on it will throw an error\n const tempElement = document.createElement('span');\n // Collapse the range to its end point\n // This means the start and end points of the range will be the same, and it will not contain any content\n range.collapse(false);\n // Insert the temporary element at the cursor's position at the end of the range\n range.insertNode(tempElement);\n // Scroll the temporary element into view\n // the element will be aligned at the center of the scroll container, otherwise, text and images may be positioned incorrectly\n tempElement.scrollIntoView({\n block: 'center'\n });\n tempElement.remove();\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * Revoke the blob urls in the removedInlineImages and remove them from the currentLocalBlobMap\n * @internal\n */\nexport const removeLocalBlobs = (\n currentLocalBlobMap: Record<string, string>,\n removedInlineImages: Record<string, string>[]\n): void => {\n removedInlineImages.forEach((image) => {\n if (!image.id) {\n return;\n }\n removeSingleLocalBlob(currentLocalBlobMap, image.id);\n });\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * Revoke all the blob urls in the currentLocalBlobMap and clean up the currentLocalBlobMap\n * @internal\n */\nexport const cleanAllLocalBlobs = (currentLocalBlobMap: Record<string, string>): void => {\n Object.keys(currentLocalBlobMap).forEach((imageId) => {\n removeSingleLocalBlob(currentLocalBlobMap, imageId);\n });\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst removeSingleLocalBlob = (currentLocalBlobMap: Record<string, string>, imageId: string): void => {\n const blobUrl = currentLocalBlobMap[imageId];\n if (blobUrl) {\n URL.revokeObjectURL(blobUrl);\n delete currentLocalBlobMap[imageId];\n }\n};\n"]}
@@ -334,9 +334,11 @@ const SAFARI_COMPOSITION_KEYCODE = 229;
334
334
  *
335
335
  * @private
336
336
  */
337
- export const isEnterKeyEventFromCompositionSession = (e) =>
338
- // Uses KeyCode 229 and which code 229 to determine if the press of the enter key is from a composition session or not (Safari only)
339
- e.isComposing || e.keyCode === SAFARI_COMPOSITION_KEYCODE || e.which === SAFARI_COMPOSITION_KEYCODE;
337
+ export const isEnterKeyEventFromCompositionSession = (e) => {
338
+ // Uses KeyCode 229 and which code 229 to determine if the press of the enter key is from a composition session or not (the code check is needed for Safari only, for everything else e.isComposing check is enough)
339
+ const isComposing = e.isComposing || e.keyCode === SAFARI_COMPOSITION_KEYCODE || e.which === SAFARI_COMPOSITION_KEYCODE;
340
+ return isComposing && e.key === 'Enter';
341
+ };
340
342
  /**
341
343
  * @private
342
344
  */
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"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AAY,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,yCAAyC,CAAC,CAAC,CAAC,SAAS,CAAC;IACtG,MAAM,eAAe,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,yCAAyC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEpG,MAAM,WAAW,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,0BAA0B;QACrD,CAAC,CAAC,aAAa,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,0BAA0B,EAAE;YACjD,WAAW,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,GAAG;YAC/B,OAAO,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,GAAG;YAC1B,YAAY,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,GAAG;YACpC,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG;YACnB,UAAU,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,GAAG;SACnC,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IIconProps, MessageBarType } from '@fluentui/react';\nimport { ActiveErrorMessage, ErrorType } from './ErrorBar';\nimport { _SupportedSpokenLanguage } from '../types';\nimport { ActiveNotification, NotificationType } from './NotificationStack';\nimport { VideoTileStrings } from './VideoTile';\nimport { _formatString } from '@internal/acs-ui-common';\n\n/**\n * @private\n *\n * @param fileName\n * @param length\n * @returns string\n */\nexport const truncatedFileName = (fileName: string, length: number): string => {\n return fileName.substring(0, length).trimEnd() + (fileName.length > length ? '... ' : '');\n};\n\n/**\n * @private\n *\n * @param fileName\n * @returns string\n */\nexport const extension = (fileName: string): string => fileName.split('.').pop() || '';\n\n/**\n * @private\n */\nexport interface DismissedError {\n type: ErrorType;\n dismissedAt: Date;\n activeSince?: Date;\n}\n\n/**\n * @private\n */\nexport interface DismissedNotification {\n type: NotificationType;\n dismissedAt: Date;\n activeSince?: Date;\n}\n\n/**\n * @private\n * @param dismissedErrors\n * @param toDismiss\n * @returns DismissedError[]\n * Always returns a new Array so that the state variable is updated, trigerring a render.\n */\nexport const dismissError = (dismissedErrors: DismissedError[], toDismiss: ActiveErrorMessage): DismissedError[] => {\n const now = new Date(Date.now());\n for (const error of dismissedErrors) {\n if (error.type === toDismiss.type) {\n // Bump the timestamp for latest dismissal of this error to now.\n error.dismissedAt = now;\n error.activeSince = toDismiss.timestamp;\n return Array.from(dismissedErrors);\n }\n }\n\n const toDismissTimestamp = toDismiss.timestamp ?? now;\n\n // Record that this error was dismissed for the first time right now.\n return [\n ...dismissedErrors,\n {\n type: toDismiss.type,\n // the error time could be sometimes later than the button click time, which cause the dismiss not working\n // so we set the dismiss time to the later one\n dismissedAt: now > toDismissTimestamp ? now : toDismissTimestamp,\n activeSince: toDismiss.timestamp\n }\n ];\n};\n\n/**\n * @private\n * @param activeErrorMessages\n * @param dismissedErrors\n * @returns DismissedError[]\n * Returns a new Array if and only if contents change, to avoid re-rendering when nothing was dropped.\n */\nexport const dropDismissalsForInactiveErrors = (\n activeErrorMessages: ActiveErrorMessage[],\n dismissedErrors: DismissedError[]\n): DismissedError[] => {\n const active = new Map();\n for (const message of activeErrorMessages) {\n active.set(message.type, message);\n }\n\n // For an error such that:\n // * It was previously active, and dismissed.\n // * It did not have a timestamp associated with it.\n // * It is no longer active.\n //\n // We remove it from dismissals. When it becomes active again next time, it will be shown again on the UI.\n const shouldDeleteDismissal = (dismissed: DismissedError): boolean =>\n dismissed.activeSince === undefined && active.get(dismissed.type) === undefined;\n\n if (dismissedErrors.some((dismissed) => shouldDeleteDismissal(dismissed))) {\n return dismissedErrors.filter((dismissed) => !shouldDeleteDismissal(dismissed));\n }\n return dismissedErrors;\n};\n\n/**\n * @private\n * @param dismissedNotifications\n * @param toDismiss\n * @returns DismissedNotification[]\n * Always returns a new Array so that the state variable is updated, trigerring a render.\n */\nexport const dismissNotification = (\n dismissedNotifications: DismissedNotification[],\n toDismiss: ActiveNotification\n): DismissedNotification[] => {\n const now = new Date(Date.now());\n for (const notification of dismissedNotifications) {\n if (notification.type === toDismiss.type) {\n // Bump the timestamp for latest dismissal of this error to now.\n notification.dismissedAt = now;\n notification.activeSince = toDismiss.timestamp;\n return Array.from(dismissedNotifications);\n }\n }\n\n const toDismissTimestamp = toDismiss.timestamp ?? now;\n\n // Record that this error was dismissed for the first time right now.\n return [\n ...dismissedNotifications,\n {\n type: toDismiss.type,\n // the error time could be sometimes later than the button click time, which cause the dismiss not working\n // so we set the dismiss time to the later one\n dismissedAt: now > toDismissTimestamp ? now : toDismissTimestamp,\n activeSince: toDismiss.timestamp\n }\n ];\n};\n\n/**\n * @private\n * @param activeNotifications\n * @param dismissedNotifications\n * @returns DismissedError[]\n * Returns a new Array if and only if contents change, to avoid re-rendering when nothing was dropped.\n */\nexport const dropDismissalsForInactiveNotifications = (\n activeNotifications: ActiveNotification[],\n dismissedNotifications: DismissedNotification[]\n): DismissedNotification[] => {\n const active = new Map();\n for (const message of activeNotifications) {\n active.set(message.type, message);\n }\n\n // For an error such that:\n // * It was previously active, and dismissed.\n // * It did not have a timestamp associated with it.\n // * It is no longer active.\n //\n // We remove it from dismissals. When it becomes active again next time, it will be shown again on the UI.\n const shouldDeleteDismissal = (dismissed: DismissedNotification): boolean =>\n dismissed.activeSince === undefined && active.get(dismissed.type) === undefined;\n\n if (dismissedNotifications.some((dismissed) => shouldDeleteDismissal(dismissed))) {\n return dismissedNotifications.filter((dismissed) => !shouldDeleteDismissal(dismissed));\n }\n return dismissedNotifications;\n};\n\n/**\n * @private\n * @param activeErrorMessages\n * @param dismissedErrors\n * @returns ActiveErrorMessage[]\n */\nexport const errorsToShow = (\n activeErrorMessages: ActiveErrorMessage[],\n dismissedErrors: DismissedError[],\n mountTimestamp?: Date\n): ActiveErrorMessage[] => {\n const dismissed: Map<ErrorType, DismissedError> = new Map();\n for (const error of dismissedErrors) {\n dismissed.set(error.type, error);\n }\n\n return activeErrorMessages.filter((error) => {\n if (mountTimestamp && error.timestamp && mountTimestamp > error.timestamp) {\n // Error has a timestamp and it is older than when the component was mounted.\n return false;\n }\n\n const dismissal = dismissed.get(error.type);\n if (!dismissal) {\n // This error was never dismissed.\n return true;\n }\n if (!error.timestamp) {\n // No timestamp associated with the error. In this case, the existence of a dismissal is enough to suppress the error.\n return false;\n }\n // Error has an associated timestamp, so compare with last dismissal.\n return error.timestamp > dismissal.dismissedAt;\n });\n};\n\n/**\n * @private\n * @param activeNotifications\n * @param dismissedNotifications\n * @returns ActiveNotification[]\n */\nexport const notificationsToShow = (\n activeNotifications: ActiveNotification[],\n dismissedNotifications: DismissedNotification[],\n mountTimestamp?: Date\n): ActiveNotification[] => {\n const dismissed: Map<NotificationType, DismissedNotification> = new Map();\n for (const notification of dismissedNotifications) {\n dismissed.set(notification.type, notification);\n }\n\n return activeNotifications.filter((notification) => {\n if (mountTimestamp && notification.timestamp && mountTimestamp > notification.timestamp) {\n // Notification has a timestamp and it is older than when the component was mounted.\n return false;\n }\n\n const dismissal = dismissed.get(notification.type);\n if (!dismissal) {\n // This error was never dismissed.\n return true;\n }\n if (!notification.timestamp) {\n // No timestamp associated with the error. In this case, the existence of a dismissal is enough to suppress the error.\n return false;\n }\n // Error has an associated timestamp, so compare with last dismissal.\n return notification.timestamp > dismissal.dismissedAt;\n });\n};\n\n/**\n * @private\n * @param errorType\n * @returns MessageBarType\n */\nexport const messageBarType = (errorType: ErrorType): MessageBarType => {\n switch (errorType) {\n case 'callNetworkQualityLow':\n case 'callNoSpeakerFound':\n case 'callNoMicrophoneFound':\n case 'callMicrophoneAccessDenied':\n case 'callMicrophoneAccessDeniedSafari':\n case 'callMicrophoneMutedBySystem':\n case 'callMicrophoneUnmutedBySystem':\n case 'callMacOsMicrophoneAccessDenied':\n case 'callLocalVideoFreeze':\n case 'callCameraAccessDenied':\n case 'callCameraAccessDeniedSafari':\n case 'callCameraAlreadyInUse':\n case 'callVideoStoppedBySystem':\n case 'callVideoRecoveredBySystem':\n case 'callMacOsCameraAccessDenied':\n case 'callMacOsScreenShareAccessDenied':\n case 'startScreenShareGeneric':\n case 'cameraFrozenForRemoteParticipants':\n return MessageBarType.warning;\n default:\n return MessageBarType.error;\n }\n};\n\n/**\n * @private\n * @param errorType\n * @returns IIconProps | undefined\n */\nexport const messageBarIconProps = (errorType: ErrorType): IIconProps | undefined => {\n const iconName = customIconName[errorType];\n return iconName ? { iconName } : undefined;\n};\n\n/**\n * @private\n */\nexport const customIconName: Partial<{ [key in ErrorType]: string }> = {\n callNetworkQualityLow: 'ErrorBarCallNetworkQualityLow',\n callNoSpeakerFound: 'ErrorBarCallNoSpeakerFound',\n callNoMicrophoneFound: 'ErrorBarCallNoMicrophoneFound',\n callMicrophoneAccessDenied: 'ErrorBarCallMicrophoneAccessDenied',\n callMicrophoneAccessDeniedSafari: 'ErrorBarCallMicrophoneAccessDenied',\n callMicrophoneMutedBySystem: 'ErrorBarCallMicrophoneMutedBySystem',\n callMicrophoneUnmutedBySystem: 'ErrorBarCallMicrophoneUnmutedBySystem',\n callMacOsMicrophoneAccessDenied: 'ErrorBarCallMacOsMicrophoneAccessDenied',\n callLocalVideoFreeze: 'ErrorBarCallLocalVideoFreeze',\n callCameraAccessDenied: 'ErrorBarCallCameraAccessDenied',\n callCameraAccessDeniedSafari: 'ErrorBarCallCameraAccessDenied',\n callCameraAlreadyInUse: 'ErrorBarCallCameraAlreadyInUse',\n callVideoStoppedBySystem: 'ErrorBarCallVideoStoppedBySystem',\n callVideoRecoveredBySystem: 'ErrorBarCallVideoRecoveredBySystem',\n callMacOsCameraAccessDenied: 'ErrorBarCallMacOsCameraAccessDenied'\n};\n\n/**\n * @private\n * @param NotificationType\n * @returns IIconProps | undefined\n */\nexport const NotificationIconProps = (notificationType: NotificationType): IIconProps | undefined => {\n const iconName = customNotificationIconName[notificationType];\n return iconName ? { iconName } : undefined;\n};\n\n/**\n * @private\n */\nexport const customNotificationIconName: Partial<{ [key in NotificationType]: string }> = {\n callNetworkQualityLow: 'ErrorBarCallNetworkQualityLow',\n teamsMeetingCallNetworkQualityLow: 'ErrorBarCallNetworkQualityLow',\n callNoSpeakerFound: 'ErrorBarCallNoSpeakerFound',\n callNoMicrophoneFound: 'ErrorBarCallNoMicrophoneFound',\n callMicrophoneAccessDenied: 'ErrorBarCallMicrophoneAccessDenied',\n callMicrophoneAccessDeniedSafari: 'ErrorBarCallMicrophoneAccessDenied',\n callMicrophoneMutedBySystem: 'ErrorBarCallMicrophoneMutedBySystem',\n callMicrophoneUnmutedBySystem: 'ErrorBarCallMicrophoneUnmutedBySystem',\n callMacOsMicrophoneAccessDenied: 'ErrorBarCallMacOsMicrophoneAccessDenied',\n callLocalVideoFreeze: 'ErrorBarCallLocalVideoFreeze',\n callCameraAccessDenied: 'ErrorBarCallCameraAccessDenied',\n callCameraAccessDeniedSafari: 'ErrorBarCallCameraAccessDenied',\n callCameraAlreadyInUse: 'ErrorBarCallCameraAlreadyInUse',\n callVideoStoppedBySystem: 'ErrorBarCallVideoStoppedBySystem',\n callVideoRecoveredBySystem: 'ErrorBarCallVideoRecoveredBySystem',\n callMacOsCameraAccessDenied: 'ErrorBarCallMacOsCameraAccessDenied',\n mutedByRemoteParticipant: 'ErrorBarMutedByRemoteParticipant',\n speakingWhileMuted: 'ErrorBarCallMicrophoneMutedBySystem',\n recordingStarted: 'NotificationBarRecording',\n transcriptionStarted: 'NotificationBarRecording',\n recordingStopped: 'NotificationBarRecording',\n transcriptionStopped: 'NotificationBarRecording',\n recordingAndTranscriptionStarted: 'NotificationBarRecording',\n recordingAndTranscriptionStopped: 'NotificationBarRecording',\n recordingStoppedStillTranscribing: 'NotificationBarRecording',\n transcriptionStoppedStillRecording: 'NotificationBarRecording',\n /* @conditional-compile-remove(breakout-rooms) */\n assignedBreakoutRoomOpened: 'NotificationBarBreakoutRoomOpened',\n /* @conditional-compile-remove(breakout-rooms) */\n assignedBreakoutRoomOpenedPromptJoin: 'NotificationBarBreakoutRoomPromptJoin',\n /* @conditional-compile-remove(breakout-rooms) */\n assignedBreakoutRoomChanged: 'NotificationBarBreakoutRoomChanged',\n /* @conditional-compile-remove(breakout-rooms) */\n breakoutRoomJoined: 'NotificationBarBreakoutRoomJoined',\n /* @conditional-compile-remove(breakout-rooms) */\n breakoutRoomClosingSoon: 'NotificationBarBreakoutRoomClosingSoon'\n};\n\n/**\n * @private\n */\nexport const isValidString = (string: string | undefined): string is string => {\n return !!string && string.length > 0;\n};\n\n/**\n * Chunk an array into rows of a given size.\n * @private\n */\nexport function chunk<T>(options: T[], itemsPerRow: number): T[][] {\n const rows: T[][] = [];\n let currentRow: T[] = [];\n for (const option of options) {\n currentRow.push(option);\n if (currentRow.length === itemsPerRow) {\n rows.push(currentRow);\n currentRow = [];\n }\n }\n if (currentRow.length > 0) {\n rows.push(currentRow);\n }\n return rows;\n}\n\n/**\n * @private\n */\nexport const defaultSpokenLanguage: _SupportedSpokenLanguage = 'en-us';\n\n/**\n * @private\n */\nconst SAFARI_COMPOSITION_KEYCODE = 229;\n/**\n * Determine if the press of the enter key is from a composition session or not (Safari only)\n *\n * @private\n */\nexport const isEnterKeyEventFromCompositionSession = (e: KeyboardEvent): boolean =>\n // Uses KeyCode 229 and which code 229 to determine if the press of the enter key is from a composition session or not (Safari only)\n e.isComposing || e.keyCode === SAFARI_COMPOSITION_KEYCODE || e.which === SAFARI_COMPOSITION_KEYCODE;\n\n/**\n * @private\n */\nexport const nullToUndefined = <T>(value: T | null): T | undefined => (value === null ? undefined : value);\n\n/**\n * @private\n */\nexport const formatMoreButtonAriaDescription = (\n displayName?: string,\n isMuted?: boolean,\n isHandRaised?: boolean,\n state?: string,\n isSpeaking?: boolean,\n strings?: VideoTileStrings\n): string => {\n const mutedState = isMuted\n ? strings?.moreOptionsParticipantMutedStateMutedAriaLabel\n : strings?.moreOptionsParticipantMutedStateUnmutedAriaLabel;\n const handRaisedState = isHandRaised ? strings?.moreOptionsParticipantHandRaisedAriaLabel : undefined;\n const isSpeakingState = isSpeaking ? strings?.moreOptionsParticipantIsSpeakingAriaLabel : undefined;\n\n const description = strings?.moreOptionsButtonAriaLabel\n ? _formatString(strings?.moreOptionsButtonAriaLabel, {\n displayName: displayName ?? ' ',\n isMuted: mutedState ?? ' ',\n isHandRaised: handRaisedState ?? ' ',\n state: state ?? ' ',\n isSpeaking: isSpeakingState ?? ' '\n })\n : '';\n\n return description;\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAc,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAK7D,OAAO,EAAE,aAAa,EAAE,mCAAgC;AAExD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAE,MAAc,EAAU,EAAE;IAC5E,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAC5F,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAU,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;AAoBvF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,eAAiC,EAAE,SAA6B,EAAoB,EAAE;;IACjH,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACjC,KAAK,MAAM,KAAK,IAAI,eAAe,EAAE,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,WAAW,CAAC;AACrB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IIconProps, MessageBarType } from '@fluentui/react';\nimport { ActiveErrorMessage, ErrorType } from './ErrorBar';\nimport { _SupportedSpokenLanguage } from '../types';\nimport { ActiveNotification, NotificationType } from './NotificationStack';\nimport { VideoTileStrings } from './VideoTile';\nimport { _formatString } from '@internal/acs-ui-common';\n\n/**\n * @private\n *\n * @param fileName\n * @param length\n * @returns string\n */\nexport const truncatedFileName = (fileName: string, length: number): string => {\n return fileName.substring(0, length).trimEnd() + (fileName.length > length ? '... ' : '');\n};\n\n/**\n * @private\n *\n * @param fileName\n * @returns string\n */\nexport const extension = (fileName: string): string => fileName.split('.').pop() || '';\n\n/**\n * @private\n */\nexport interface DismissedError {\n type: ErrorType;\n dismissedAt: Date;\n activeSince?: Date;\n}\n\n/**\n * @private\n */\nexport interface DismissedNotification {\n type: NotificationType;\n dismissedAt: Date;\n activeSince?: Date;\n}\n\n/**\n * @private\n * @param dismissedErrors\n * @param toDismiss\n * @returns DismissedError[]\n * Always returns a new Array so that the state variable is updated, trigerring a render.\n */\nexport const dismissError = (dismissedErrors: DismissedError[], toDismiss: ActiveErrorMessage): DismissedError[] => {\n const now = new Date(Date.now());\n for (const error of dismissedErrors) {\n if (error.type === toDismiss.type) {\n // Bump the timestamp for latest dismissal of this error to now.\n error.dismissedAt = now;\n error.activeSince = toDismiss.timestamp;\n return Array.from(dismissedErrors);\n }\n }\n\n const toDismissTimestamp = toDismiss.timestamp ?? now;\n\n // Record that this error was dismissed for the first time right now.\n return [\n ...dismissedErrors,\n {\n type: toDismiss.type,\n // the error time could be sometimes later than the button click time, which cause the dismiss not working\n // so we set the dismiss time to the later one\n dismissedAt: now > toDismissTimestamp ? now : toDismissTimestamp,\n activeSince: toDismiss.timestamp\n }\n ];\n};\n\n/**\n * @private\n * @param activeErrorMessages\n * @param dismissedErrors\n * @returns DismissedError[]\n * Returns a new Array if and only if contents change, to avoid re-rendering when nothing was dropped.\n */\nexport const dropDismissalsForInactiveErrors = (\n activeErrorMessages: ActiveErrorMessage[],\n dismissedErrors: DismissedError[]\n): DismissedError[] => {\n const active = new Map();\n for (const message of activeErrorMessages) {\n active.set(message.type, message);\n }\n\n // For an error such that:\n // * It was previously active, and dismissed.\n // * It did not have a timestamp associated with it.\n // * It is no longer active.\n //\n // We remove it from dismissals. When it becomes active again next time, it will be shown again on the UI.\n const shouldDeleteDismissal = (dismissed: DismissedError): boolean =>\n dismissed.activeSince === undefined && active.get(dismissed.type) === undefined;\n\n if (dismissedErrors.some((dismissed) => shouldDeleteDismissal(dismissed))) {\n return dismissedErrors.filter((dismissed) => !shouldDeleteDismissal(dismissed));\n }\n return dismissedErrors;\n};\n\n/**\n * @private\n * @param dismissedNotifications\n * @param toDismiss\n * @returns DismissedNotification[]\n * Always returns a new Array so that the state variable is updated, trigerring a render.\n */\nexport const dismissNotification = (\n dismissedNotifications: DismissedNotification[],\n toDismiss: ActiveNotification\n): DismissedNotification[] => {\n const now = new Date(Date.now());\n for (const notification of dismissedNotifications) {\n if (notification.type === toDismiss.type) {\n // Bump the timestamp for latest dismissal of this error to now.\n notification.dismissedAt = now;\n notification.activeSince = toDismiss.timestamp;\n return Array.from(dismissedNotifications);\n }\n }\n\n const toDismissTimestamp = toDismiss.timestamp ?? now;\n\n // Record that this error was dismissed for the first time right now.\n return [\n ...dismissedNotifications,\n {\n type: toDismiss.type,\n // the error time could be sometimes later than the button click time, which cause the dismiss not working\n // so we set the dismiss time to the later one\n dismissedAt: now > toDismissTimestamp ? now : toDismissTimestamp,\n activeSince: toDismiss.timestamp\n }\n ];\n};\n\n/**\n * @private\n * @param activeNotifications\n * @param dismissedNotifications\n * @returns DismissedError[]\n * Returns a new Array if and only if contents change, to avoid re-rendering when nothing was dropped.\n */\nexport const dropDismissalsForInactiveNotifications = (\n activeNotifications: ActiveNotification[],\n dismissedNotifications: DismissedNotification[]\n): DismissedNotification[] => {\n const active = new Map();\n for (const message of activeNotifications) {\n active.set(message.type, message);\n }\n\n // For an error such that:\n // * It was previously active, and dismissed.\n // * It did not have a timestamp associated with it.\n // * It is no longer active.\n //\n // We remove it from dismissals. When it becomes active again next time, it will be shown again on the UI.\n const shouldDeleteDismissal = (dismissed: DismissedNotification): boolean =>\n dismissed.activeSince === undefined && active.get(dismissed.type) === undefined;\n\n if (dismissedNotifications.some((dismissed) => shouldDeleteDismissal(dismissed))) {\n return dismissedNotifications.filter((dismissed) => !shouldDeleteDismissal(dismissed));\n }\n return dismissedNotifications;\n};\n\n/**\n * @private\n * @param activeErrorMessages\n * @param dismissedErrors\n * @returns ActiveErrorMessage[]\n */\nexport const errorsToShow = (\n activeErrorMessages: ActiveErrorMessage[],\n dismissedErrors: DismissedError[],\n mountTimestamp?: Date\n): ActiveErrorMessage[] => {\n const dismissed: Map<ErrorType, DismissedError> = new Map();\n for (const error of dismissedErrors) {\n dismissed.set(error.type, error);\n }\n\n return activeErrorMessages.filter((error) => {\n if (mountTimestamp && error.timestamp && mountTimestamp > error.timestamp) {\n // Error has a timestamp and it is older than when the component was mounted.\n return false;\n }\n\n const dismissal = dismissed.get(error.type);\n if (!dismissal) {\n // This error was never dismissed.\n return true;\n }\n if (!error.timestamp) {\n // No timestamp associated with the error. In this case, the existence of a dismissal is enough to suppress the error.\n return false;\n }\n // Error has an associated timestamp, so compare with last dismissal.\n return error.timestamp > dismissal.dismissedAt;\n });\n};\n\n/**\n * @private\n * @param activeNotifications\n * @param dismissedNotifications\n * @returns ActiveNotification[]\n */\nexport const notificationsToShow = (\n activeNotifications: ActiveNotification[],\n dismissedNotifications: DismissedNotification[],\n mountTimestamp?: Date\n): ActiveNotification[] => {\n const dismissed: Map<NotificationType, DismissedNotification> = new Map();\n for (const notification of dismissedNotifications) {\n dismissed.set(notification.type, notification);\n }\n\n return activeNotifications.filter((notification) => {\n if (mountTimestamp && notification.timestamp && mountTimestamp > notification.timestamp) {\n // Notification has a timestamp and it is older than when the component was mounted.\n return false;\n }\n\n const dismissal = dismissed.get(notification.type);\n if (!dismissal) {\n // This error was never dismissed.\n return true;\n }\n if (!notification.timestamp) {\n // No timestamp associated with the error. In this case, the existence of a dismissal is enough to suppress the error.\n return false;\n }\n // Error has an associated timestamp, so compare with last dismissal.\n return notification.timestamp > dismissal.dismissedAt;\n });\n};\n\n/**\n * @private\n * @param errorType\n * @returns MessageBarType\n */\nexport const messageBarType = (errorType: ErrorType): MessageBarType => {\n switch (errorType) {\n case 'callNetworkQualityLow':\n case 'callNoSpeakerFound':\n case 'callNoMicrophoneFound':\n case 'callMicrophoneAccessDenied':\n case 'callMicrophoneAccessDeniedSafari':\n case 'callMicrophoneMutedBySystem':\n case 'callMicrophoneUnmutedBySystem':\n case 'callMacOsMicrophoneAccessDenied':\n case 'callLocalVideoFreeze':\n case 'callCameraAccessDenied':\n case 'callCameraAccessDeniedSafari':\n case 'callCameraAlreadyInUse':\n case 'callVideoStoppedBySystem':\n case 'callVideoRecoveredBySystem':\n case 'callMacOsCameraAccessDenied':\n case 'callMacOsScreenShareAccessDenied':\n case 'startScreenShareGeneric':\n case 'cameraFrozenForRemoteParticipants':\n return MessageBarType.warning;\n default:\n return MessageBarType.error;\n }\n};\n\n/**\n * @private\n * @param errorType\n * @returns IIconProps | undefined\n */\nexport const messageBarIconProps = (errorType: ErrorType): IIconProps | undefined => {\n const iconName = customIconName[errorType];\n return iconName ? { iconName } : undefined;\n};\n\n/**\n * @private\n */\nexport const customIconName: Partial<{ [key in ErrorType]: string }> = {\n callNetworkQualityLow: 'ErrorBarCallNetworkQualityLow',\n callNoSpeakerFound: 'ErrorBarCallNoSpeakerFound',\n callNoMicrophoneFound: 'ErrorBarCallNoMicrophoneFound',\n callMicrophoneAccessDenied: 'ErrorBarCallMicrophoneAccessDenied',\n callMicrophoneAccessDeniedSafari: 'ErrorBarCallMicrophoneAccessDenied',\n callMicrophoneMutedBySystem: 'ErrorBarCallMicrophoneMutedBySystem',\n callMicrophoneUnmutedBySystem: 'ErrorBarCallMicrophoneUnmutedBySystem',\n callMacOsMicrophoneAccessDenied: 'ErrorBarCallMacOsMicrophoneAccessDenied',\n callLocalVideoFreeze: 'ErrorBarCallLocalVideoFreeze',\n callCameraAccessDenied: 'ErrorBarCallCameraAccessDenied',\n callCameraAccessDeniedSafari: 'ErrorBarCallCameraAccessDenied',\n callCameraAlreadyInUse: 'ErrorBarCallCameraAlreadyInUse',\n callVideoStoppedBySystem: 'ErrorBarCallVideoStoppedBySystem',\n callVideoRecoveredBySystem: 'ErrorBarCallVideoRecoveredBySystem',\n callMacOsCameraAccessDenied: 'ErrorBarCallMacOsCameraAccessDenied'\n};\n\n/**\n * @private\n * @param NotificationType\n * @returns IIconProps | undefined\n */\nexport const NotificationIconProps = (notificationType: NotificationType): IIconProps | undefined => {\n const iconName = customNotificationIconName[notificationType];\n return iconName ? { iconName } : undefined;\n};\n\n/**\n * @private\n */\nexport const customNotificationIconName: Partial<{ [key in NotificationType]: string }> = {\n callNetworkQualityLow: 'ErrorBarCallNetworkQualityLow',\n teamsMeetingCallNetworkQualityLow: 'ErrorBarCallNetworkQualityLow',\n callNoSpeakerFound: 'ErrorBarCallNoSpeakerFound',\n callNoMicrophoneFound: 'ErrorBarCallNoMicrophoneFound',\n callMicrophoneAccessDenied: 'ErrorBarCallMicrophoneAccessDenied',\n callMicrophoneAccessDeniedSafari: 'ErrorBarCallMicrophoneAccessDenied',\n callMicrophoneMutedBySystem: 'ErrorBarCallMicrophoneMutedBySystem',\n callMicrophoneUnmutedBySystem: 'ErrorBarCallMicrophoneUnmutedBySystem',\n callMacOsMicrophoneAccessDenied: 'ErrorBarCallMacOsMicrophoneAccessDenied',\n callLocalVideoFreeze: 'ErrorBarCallLocalVideoFreeze',\n callCameraAccessDenied: 'ErrorBarCallCameraAccessDenied',\n callCameraAccessDeniedSafari: 'ErrorBarCallCameraAccessDenied',\n callCameraAlreadyInUse: 'ErrorBarCallCameraAlreadyInUse',\n callVideoStoppedBySystem: 'ErrorBarCallVideoStoppedBySystem',\n callVideoRecoveredBySystem: 'ErrorBarCallVideoRecoveredBySystem',\n callMacOsCameraAccessDenied: 'ErrorBarCallMacOsCameraAccessDenied',\n mutedByRemoteParticipant: 'ErrorBarMutedByRemoteParticipant',\n speakingWhileMuted: 'ErrorBarCallMicrophoneMutedBySystem',\n recordingStarted: 'NotificationBarRecording',\n transcriptionStarted: 'NotificationBarRecording',\n recordingStopped: 'NotificationBarRecording',\n transcriptionStopped: 'NotificationBarRecording',\n recordingAndTranscriptionStarted: 'NotificationBarRecording',\n recordingAndTranscriptionStopped: 'NotificationBarRecording',\n recordingStoppedStillTranscribing: 'NotificationBarRecording',\n transcriptionStoppedStillRecording: 'NotificationBarRecording',\n /* @conditional-compile-remove(breakout-rooms) */\n assignedBreakoutRoomOpened: 'NotificationBarBreakoutRoomOpened',\n /* @conditional-compile-remove(breakout-rooms) */\n assignedBreakoutRoomOpenedPromptJoin: 'NotificationBarBreakoutRoomPromptJoin',\n /* @conditional-compile-remove(breakout-rooms) */\n assignedBreakoutRoomChanged: 'NotificationBarBreakoutRoomChanged',\n /* @conditional-compile-remove(breakout-rooms) */\n breakoutRoomJoined: 'NotificationBarBreakoutRoomJoined',\n /* @conditional-compile-remove(breakout-rooms) */\n breakoutRoomClosingSoon: 'NotificationBarBreakoutRoomClosingSoon'\n};\n\n/**\n * @private\n */\nexport const isValidString = (string: string | undefined): string is string => {\n return !!string && string.length > 0;\n};\n\n/**\n * Chunk an array into rows of a given size.\n * @private\n */\nexport function chunk<T>(options: T[], itemsPerRow: number): T[][] {\n const rows: T[][] = [];\n let currentRow: T[] = [];\n for (const option of options) {\n currentRow.push(option);\n if (currentRow.length === itemsPerRow) {\n rows.push(currentRow);\n currentRow = [];\n }\n }\n if (currentRow.length > 0) {\n rows.push(currentRow);\n }\n return rows;\n}\n\n/**\n * @private\n */\nexport const defaultSpokenLanguage: _SupportedSpokenLanguage = 'en-us';\n\n/**\n * @private\n */\nconst SAFARI_COMPOSITION_KEYCODE = 229;\n/**\n * Determine if the press of the enter key is from a composition session or not (Safari only)\n *\n * @private\n */\nexport const isEnterKeyEventFromCompositionSession = (e: KeyboardEvent): boolean => {\n // Uses KeyCode 229 and which code 229 to determine if the press of the enter key is from a composition session or not (the code check is needed for Safari only, for everything else e.isComposing check is enough)\n const isComposing =\n e.isComposing || e.keyCode === SAFARI_COMPOSITION_KEYCODE || e.which === SAFARI_COMPOSITION_KEYCODE;\n return isComposing && e.key === 'Enter';\n};\n\n/**\n * @private\n */\nexport const nullToUndefined = <T>(value: T | null): T | undefined => (value === null ? undefined : value);\n\n/**\n * @private\n */\nexport const formatMoreButtonAriaDescription = (\n displayName?: string,\n isMuted?: boolean,\n isHandRaised?: boolean,\n state?: string,\n isSpeaking?: boolean,\n strings?: VideoTileStrings\n): string => {\n const mutedState = isMuted\n ? strings?.moreOptionsParticipantMutedStateMutedAriaLabel\n : strings?.moreOptionsParticipantMutedStateUnmutedAriaLabel;\n const handRaisedState = isHandRaised ? strings?.moreOptionsParticipantHandRaisedAriaLabel : undefined;\n const isSpeakingState = isSpeaking ? strings?.moreOptionsParticipantIsSpeakingAriaLabel : undefined;\n\n const description = strings?.moreOptionsButtonAriaLabel\n ? _formatString(strings?.moreOptionsButtonAriaLabel, {\n displayName: displayName ?? ' ',\n isMuted: mutedState ?? ' ',\n isHandRaised: handRaisedState ?? ' ',\n state: state ?? ' ',\n isSpeaking: isSpeakingState ?? ' '\n })\n : '';\n\n return description;\n};\n"]}
@@ -39,6 +39,6 @@ export type { BlockedMessage } from './types';
39
39
  export type { SurveyIssues } from './types';
40
40
  export type { SurveyIssuesHeadingStrings } from './types';
41
41
  export type { CallSurveyImprovementSuggestions } from './types';
42
- export type { TogetherModeStreamViewResult } from './types';
42
+ export type { TogetherModeStreamViewResult, VideoGalleryTogetherModeParticipantPosition, VideoGalleryTogetherModeSeatingInfo, VideoGalleryTogetherModeStreams, TogetherModeStreamOptions } from './types';
43
43
  export type { MediaAccess } from './types';
44
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../react-components/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAEtF,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AA6CxC,OAAO,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from './components';\nexport { _IdentifierProvider } from './identifiers';\nexport type { _Identifiers, _IdentifierProviderProps } from './identifiers';\nexport * from './localization/locales';\nexport { LocalizationProvider } from './localization';\nexport { COMPONENT_LOCALE_EN_GB } from './localization/locales/en-GB/ComponentLocale';\nexport { COMPONENT_LOCALE_AR_SA } from './localization/locales/ar-SA/ComponentLocale';\nexport { COMPONENT_LOCALE_CS_CZ } from './localization/locales/cs-CZ/ComponentLocale';\nexport { COMPONENT_LOCALE_CY_GB } from './localization/locales/cy-GB/ComponentLocale';\nexport { COMPONENT_LOCALE_DE_DE } from './localization/locales/de-DE/ComponentLocale';\nexport { COMPONENT_LOCALE_ES_ES } from './localization/locales/es-ES/ComponentLocale';\nexport { COMPONENT_LOCALE_ES_MX } from './localization/locales/es-MX/ComponentLocale';\nexport { COMPONENT_LOCALE_FI_FI } from './localization/locales/fi-FI/ComponentLocale';\nexport { COMPONENT_LOCALE_FR_FR } from './localization/locales/fr-FR/ComponentLocale';\nexport { COMPONENT_LOCALE_FR_CA } from './localization/locales/fr-CA/ComponentLocale';\nexport { COMPONENT_LOCALE_HE_IL } from './localization/locales/he-IL/ComponentLocale';\nexport { COMPONENT_LOCALE_IT_IT } from './localization/locales/it-IT/ComponentLocale';\nexport { COMPONENT_LOCALE_JA_JP } from './localization/locales/ja-JP/ComponentLocale';\nexport { COMPONENT_LOCALE_KO_KR } from './localization/locales/ko-KR/ComponentLocale';\nexport { COMPONENT_LOCALE_NB_NO } from './localization/locales/nb-NO/ComponentLocale';\nexport { COMPONENT_LOCALE_NL_NL } from './localization/locales/nl-NL/ComponentLocale';\nexport { COMPONENT_LOCALE_PL_PL } from './localization/locales/pl-PL/ComponentLocale';\nexport { COMPONENT_LOCALE_PT_BR } from './localization/locales/pt-BR/ComponentLocale';\nexport { COMPONENT_LOCALE_RU_RU } from './localization/locales/ru-RU/ComponentLocale';\nexport { COMPONENT_LOCALE_SV_SE } from './localization/locales/sv-SE/ComponentLocale';\nexport { COMPONENT_LOCALE_TR_TR } from './localization/locales/tr-TR/ComponentLocale';\nexport { COMPONENT_LOCALE_ZH_CN } from './localization/locales/zh-CN/ComponentLocale';\nexport { COMPONENT_LOCALE_ZH_TW } from './localization/locales/zh-TW/ComponentLocale';\nexport type { ComponentStrings, ComponentLocale, LocalizationProviderProps } from './localization';\nexport * from './theming';\nexport * from './theming/generateTheme';\n\nexport type {\n BaseCustomStyles,\n CallParticipantListParticipant,\n ChatMessage,\n CommunicationParticipant,\n ComponentSlotStyle,\n ContentSystemMessage,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n OnRenderAvatarCallback,\n ParticipantAddedSystemMessage,\n ParticipantListParticipant,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ReadReceiptsBySenderId,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoStreamOptions,\n ViewScalingMode\n} from './types';\n\nexport type { RaisedHand } from './types';\n\nexport type { Spotlight } from './types';\n\nexport type { Reaction, ReactionResources, ReactionSprite } from './types';\n\nexport type {\n SpokenLanguageStrings,\n CaptionLanguageStrings,\n _SupportedSpokenLanguage,\n _SupportedCaptionLanguage\n} from './types';\nexport { _spokenLanguageToCaptionLanguage } from './types';\n\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from './types';\n\nexport type { SurveyIssues } from './types';\n\nexport type { SurveyIssuesHeadingStrings } from './types';\n\nexport type { CallSurveyImprovementSuggestions } from './types';\n\n/* @conditional-compile-remove(together-mode) */\nexport type { TogetherModeStreamViewResult } from './types';\n\n/* @conditional-compile-remove(media-access) */\nexport type { MediaAccess } from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../react-components/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAEtF,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AA6CxC,OAAO,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from './components';\nexport { _IdentifierProvider } from './identifiers';\nexport type { _Identifiers, _IdentifierProviderProps } from './identifiers';\nexport * from './localization/locales';\nexport { LocalizationProvider } from './localization';\nexport { COMPONENT_LOCALE_EN_GB } from './localization/locales/en-GB/ComponentLocale';\nexport { COMPONENT_LOCALE_AR_SA } from './localization/locales/ar-SA/ComponentLocale';\nexport { COMPONENT_LOCALE_CS_CZ } from './localization/locales/cs-CZ/ComponentLocale';\nexport { COMPONENT_LOCALE_CY_GB } from './localization/locales/cy-GB/ComponentLocale';\nexport { COMPONENT_LOCALE_DE_DE } from './localization/locales/de-DE/ComponentLocale';\nexport { COMPONENT_LOCALE_ES_ES } from './localization/locales/es-ES/ComponentLocale';\nexport { COMPONENT_LOCALE_ES_MX } from './localization/locales/es-MX/ComponentLocale';\nexport { COMPONENT_LOCALE_FI_FI } from './localization/locales/fi-FI/ComponentLocale';\nexport { COMPONENT_LOCALE_FR_FR } from './localization/locales/fr-FR/ComponentLocale';\nexport { COMPONENT_LOCALE_FR_CA } from './localization/locales/fr-CA/ComponentLocale';\nexport { COMPONENT_LOCALE_HE_IL } from './localization/locales/he-IL/ComponentLocale';\nexport { COMPONENT_LOCALE_IT_IT } from './localization/locales/it-IT/ComponentLocale';\nexport { COMPONENT_LOCALE_JA_JP } from './localization/locales/ja-JP/ComponentLocale';\nexport { COMPONENT_LOCALE_KO_KR } from './localization/locales/ko-KR/ComponentLocale';\nexport { COMPONENT_LOCALE_NB_NO } from './localization/locales/nb-NO/ComponentLocale';\nexport { COMPONENT_LOCALE_NL_NL } from './localization/locales/nl-NL/ComponentLocale';\nexport { COMPONENT_LOCALE_PL_PL } from './localization/locales/pl-PL/ComponentLocale';\nexport { COMPONENT_LOCALE_PT_BR } from './localization/locales/pt-BR/ComponentLocale';\nexport { COMPONENT_LOCALE_RU_RU } from './localization/locales/ru-RU/ComponentLocale';\nexport { COMPONENT_LOCALE_SV_SE } from './localization/locales/sv-SE/ComponentLocale';\nexport { COMPONENT_LOCALE_TR_TR } from './localization/locales/tr-TR/ComponentLocale';\nexport { COMPONENT_LOCALE_ZH_CN } from './localization/locales/zh-CN/ComponentLocale';\nexport { COMPONENT_LOCALE_ZH_TW } from './localization/locales/zh-TW/ComponentLocale';\nexport type { ComponentStrings, ComponentLocale, LocalizationProviderProps } from './localization';\nexport * from './theming';\nexport * from './theming/generateTheme';\n\nexport type {\n BaseCustomStyles,\n CallParticipantListParticipant,\n ChatMessage,\n CommunicationParticipant,\n ComponentSlotStyle,\n ContentSystemMessage,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n OnRenderAvatarCallback,\n ParticipantAddedSystemMessage,\n ParticipantListParticipant,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ReadReceiptsBySenderId,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoStreamOptions,\n ViewScalingMode\n} from './types';\n\nexport type { RaisedHand } from './types';\n\nexport type { Spotlight } from './types';\n\nexport type { Reaction, ReactionResources, ReactionSprite } from './types';\n\nexport type {\n SpokenLanguageStrings,\n CaptionLanguageStrings,\n _SupportedSpokenLanguage,\n _SupportedCaptionLanguage\n} from './types';\nexport { _spokenLanguageToCaptionLanguage } from './types';\n\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from './types';\n\nexport type { SurveyIssues } from './types';\n\nexport type { SurveyIssuesHeadingStrings } from './types';\n\nexport type { CallSurveyImprovementSuggestions } from './types';\n\n/* @conditional-compile-remove(together-mode) */\nexport type {\n TogetherModeStreamViewResult,\n VideoGalleryTogetherModeParticipantPosition,\n VideoGalleryTogetherModeSeatingInfo,\n VideoGalleryTogetherModeStreams,\n TogetherModeStreamOptions\n} from './types';\n\n/* @conditional-compile-remove(media-access) */\nexport type { MediaAccess } from './types';\n"]}
@@ -500,6 +500,26 @@
500
500
  "title": "Room time limit about to expire.",
501
501
  "message": "This room will close in 30 seconds",
502
502
  "dismissButtonAriaLabel": "Close"
503
+ },
504
+ "capabilityTurnVideoOnPresent": {
505
+ "title": "Your camera has been enabled",
506
+ "message": "Turn it on if you'd like to share video.",
507
+ "dismissButtonAriaLabel": "Close"
508
+ },
509
+ "capabilityTurnVideoOnAbsent": {
510
+ "title": "Your camera has been disabled",
511
+ "message": "You can no longer share video.",
512
+ "dismissButtonAriaLabel": "Close"
513
+ },
514
+ "capabilityUnmuteMicPresent": {
515
+ "title": "Your mic has been enabled",
516
+ "message": "Unmute if you'd like to speak.",
517
+ "dismissButtonAriaLabel": "Close"
518
+ },
519
+ "capabilityUnmuteMicAbsent": {
520
+ "title": "Your mic has been disabled",
521
+ "message": "You can no longer unmute.",
522
+ "dismissButtonAriaLabel": "Close"
503
523
  }
504
524
  },
505
525
  "videoGallery": {
@@ -528,7 +548,15 @@
528
548
  "stopSpotlightOnSelfVideoTileMenuLabel": "Exit spotlight",
529
549
  "attendeeRole": "Attendee",
530
550
  "muteParticipantMenuItemLabel": "Mute",
531
- "waitingScreenText": "Waiting for others to join"
551
+ "waitingScreenText": "Waiting for others to join",
552
+ "forbidAudio": "Disable mic",
553
+ "permitAudio": "Allow mic",
554
+ "forbidAudioTileMenuLabel": "Disable mic",
555
+ "permitAudioTileMenuLabel": "Allow mic",
556
+ "forbidVideo": "Disable camera",
557
+ "permitVideo": "Allow camera",
558
+ "forbidVideoTileMenuLabel": "Disable camera",
559
+ "permitVideoTileMenuLabel": "Allow camera"
532
560
  },
533
561
  "dialpad": {
534
562
  "placeholderText": "Enter phone number",
@@ -68,10 +68,10 @@ export declare class AzureCommunicationCallAdapter<AgentType extends CallAgent |
68
68
  disposeScreenShareStreamView(remoteUserId: string): Promise<void>;
69
69
  disposeRemoteVideoStreamView(remoteUserId: string): Promise<void>;
70
70
  disposeLocalVideoStreamView(): Promise<void>;
71
- createTogetherModeStreamViews(options?: VideoStreamOptions): Promise<void | TogetherModeStreamViewResult>;
71
+ createTogetherModeStreamView(options?: VideoStreamOptions): Promise<void | TogetherModeStreamViewResult>;
72
72
  startTogetherMode(): Promise<void>;
73
73
  setTogetherModeSceneSize(width: number, height: number): void;
74
- disposeTogetherModeStreamViews(): Promise<void>;
74
+ disposeTogetherModeStreamView(): Promise<void>;
75
75
  leaveCall(forEveryone?: boolean): Promise<void>;
76
76
  setCamera(device: VideoDeviceInfo, options?: VideoStreamOptions): Promise<void>;
77
77
  setMicrophone(device: AudioDeviceInfo): Promise<void>;