@azure/communication-react 1.30.0 → 1.31.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/communication-react.d.ts +1373 -24
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-DdSFdo_m.js +213 -0
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-DdSFdo_m.js.map +1 -0
- package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-C2HrwCVY.js +49 -0
- package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-C2HrwCVY.js.map +1 -0
- package/dist/dist-cjs/communication-react/index-CH39vOsT.js +46344 -0
- package/dist/dist-cjs/communication-react/index-CH39vOsT.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +174 -40373
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/common.d.ts +13 -0
- package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/constants.d.ts +5 -0
- package/dist/dist-esm/acs-ui-common/src/constants.js +5 -0
- package/dist/dist-esm/acs-ui-common/src/constants.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/dataConversion.d.ts +6 -0
- package/dist/dist-esm/acs-ui-common/src/dataConversion.js +20 -0
- package/dist/dist-esm/acs-ui-common/src/dataConversion.js.map +1 -0
- package/dist/dist-esm/acs-ui-common/src/index.d.ts +4 -0
- package/dist/dist-esm/acs-ui-common/src/index.js +3 -0
- package/dist/dist-esm/acs-ui-common/src/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/removeImageTags.d.ts +7 -0
- package/dist/dist-esm/acs-ui-common/src/removeImageTags.js +18 -0
- package/dist/dist-esm/acs-ui-common/src/removeImageTags.js.map +1 -0
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js +2 -0
- package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +2 -0
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +6 -0
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js +25 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/participantListSelector.d.ts +1 -0
- package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js +3 -1
- package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js +4 -0
- package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +42 -2
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +6 -0
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js +35 -0
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.d.ts +4 -0
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +24 -4
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/Converter.js +3 -0
- package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/LocalRecordingSubscriber.d.ts +17 -0
- package/dist/dist-esm/calling-stateful-client/src/LocalRecordingSubscriber.js +33 -0
- package/dist/dist-esm/calling-stateful-client/src/LocalRecordingSubscriber.js.map +1 -0
- package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.d.ts +1 -0
- package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.js +7 -1
- package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js +17 -0
- package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/index-public.d.ts +1 -0
- package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +6 -2
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +36 -2
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.d.ts +2 -1
- package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js +4 -0
- package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +25 -2
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.d.ts +6 -0
- package/dist/dist-esm/chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.js +20 -0
- package/dist/dist-esm/chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.js.map +1 -0
- package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js +3 -3
- package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ChatClientState.d.ts +15 -1
- package/dist/dist-esm/chat-stateful-client/src/ChatClientState.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js +2 -1
- package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/index.d.ts +1 -0
- package/dist/dist-esm/chat-stateful-client/src/index.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +21 -0
- package/dist/dist-esm/communication-react/src/index.js +3 -0
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.d.ts +2 -0
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js +1 -0
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +13 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js +9 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +11 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +32 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.d.ts +10 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.js +15 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +8 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js +9 -5
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.d.ts +2 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js +4 -4
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.d.ts +4 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js +31 -6
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +15 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js +9 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.d.ts +24 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +203 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +23 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +17 -6
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts +8 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js +10 -6
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js +5 -5
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.d.ts +69 -0
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.js +36 -0
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.d.ts +75 -0
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.js +67 -0
- package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.d.ts +105 -0
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.js +51 -0
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.d.ts +86 -0
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.js +40 -0
- package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ImageOverlay.js +2 -0
- package/dist/dist-esm/react-components/src/components/ImageOverlay.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/InputBoxComponent.d.ts +2 -0
- package/dist/dist-esm/react-components/src/components/InputBoxComponent.js +15 -0
- package/dist/dist-esm/react-components/src/components/InputBoxComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MentionPopover.d.ts +121 -0
- package/dist/dist-esm/react-components/src/components/MentionPopover.js +119 -0
- package/dist/dist-esm/react-components/src/components/MentionPopover.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +81 -5
- package/dist/dist-esm/react-components/src/components/MessageThread.js +13 -3
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ParticipantList.d.ts +15 -0
- package/dist/dist-esm/react-components/src/components/ParticipantList.js +12 -3
- package/dist/dist-esm/react-components/src/components/ParticipantList.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.d.ts +9 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.js +29 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.d.ts +30 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js +98 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.d.ts +19 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.js +43 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.d.ts +15 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js +42 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.d.ts +24 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.js +64 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.d.ts +20 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.js +45 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.d.ts +14 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.js +42 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.d.ts +30 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js +99 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.d.ts +59 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +334 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.d.ts +37 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +78 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +215 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +184 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.d.ts +16 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.js +75 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxUtils.d.ts +9 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxUtils.js +16 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxUtils.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.d.ts +19 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js +229 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.d.ts +7 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.js +51 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTablePane.d.ts +15 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTablePane.js +64 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTablePane.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.d.ts +6 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.js +13 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/SendBox.d.ts +51 -1
- package/dist/dist-esm/react-components/src/components/SendBox.js +58 -6
- package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.d.ts +56 -0
- package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.js +75 -0
- package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/SendBoxErrors.d.ts +14 -0
- package/dist/dist-esm/react-components/src/components/SendBoxErrors.js +18 -0
- package/dist/dist-esm/react-components/src/components/SendBoxErrors.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.d.ts +24 -0
- package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js +550 -0
- package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.d.ts +152 -0
- package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js +819 -0
- package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/index.d.ts +21 -0
- package/dist/dist-esm/react-components/src/components/index.js +8 -0
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.d.ts +58 -0
- package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.js +144 -0
- package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.d.ts +26 -0
- package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.js +69 -0
- package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +8 -0
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.d.ts +82 -0
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +328 -0
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.d.ts +21 -0
- package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.js +38 -0
- package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.d.ts +38 -0
- package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js +99 -0
- package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/styles/Stack.style.d.ts +5 -0
- package/dist/dist-esm/react-components/src/components/styles/Stack.style.js +32 -0
- package/dist/dist-esm/react-components/src/components/styles/Stack.style.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +38 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +30 -3
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +4 -2
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +9 -2
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.d.ts +73 -0
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js +178 -0
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.d.ts +33 -0
- package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js +119 -0
- package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +47 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +154 -4
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.js +2 -0
- package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.d.ts +2 -1
- package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/merge.d.ts +7 -0
- package/dist/dist-esm/react-components/src/components/utils/merge.js +16 -0
- package/dist/dist-esm/react-components/src/components/utils/merge.js.map +1 -0
- package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.d.ts +4 -0
- package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js +3 -1
- package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/index.d.ts +1 -0
- package/dist/dist-esm/react-components/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts +45 -0
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/icons.d.ts +24 -0
- package/dist/dist-esm/react-components/src/theming/icons.js +67 -0
- package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/icons.styles.d.ts +6 -0
- package/dist/dist-esm/react-components/src/theming/icons.styles.js +25 -0
- package/dist/dist-esm/react-components/src/theming/icons.styles.js.map +1 -0
- package/dist/dist-esm/react-components/src/theming/themes.d.ts +6 -0
- package/dist/dist-esm/react-components/src/theming/themes.js +9 -0
- package/dist/dist-esm/react-components/src/theming/themes.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/Attachment.d.ts +13 -0
- package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +20 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +59 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +15 -10
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +38 -6
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +12 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +2 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.d.ts +46 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js +200 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.d.ts +2 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.js +19 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageErrorBar.js +10 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageErrorBar.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.d.ts +2 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.js +19 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js +5 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +3 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +3 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.d.ts +7 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +43 -5
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +8 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +68 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +52 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +10 -4
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +10 -3
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +20 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +16 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +10 -4
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +14 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/AttachmentDownloadErrorBar.d.ts +15 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/AttachmentDownloadErrorBar.js +23 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/AttachmentDownloadErrorBar.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +27 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js +2 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.d.ts +2 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +189 -11
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.d.ts +18 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.js +18 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadReducer.d.ts +49 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadReducer.js +44 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadReducer.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.d.ts +39 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.js +267 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.d.ts +20 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +6 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +36 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +12 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.d.ts +80 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js +36 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.d.ts +38 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js +66 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +5 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js +5 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +13 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +2 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts +4 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +4 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/ParticipantContainer.js +2 -1
- package/dist/dist-esm/react-composites/src/composites/common/ParticipantContainer.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.d.ts +10 -0
- package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js +16 -0
- package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.d.ts +41 -2
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js +21 -0
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/constants.d.ts +5 -0
- package/dist/dist-esm/react-composites/src/composites/common/constants.js +5 -0
- package/dist/dist-esm/react-composites/src/composites/common/constants.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +26 -1
- package/dist/dist-esm/react-composites/src/composites/common/icons.js +2 -0
- package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -1
- package/package.json +4 -4
@@ -0,0 +1,178 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
/**
|
4
|
+
* Plugin event type for RoosterJS plugins
|
5
|
+
* @private
|
6
|
+
*/
|
7
|
+
export var PluginEventType;
|
8
|
+
(function (PluginEventType) {
|
9
|
+
PluginEventType["EditorReady"] = "editorReady";
|
10
|
+
PluginEventType["BeforeDispose"] = "beforeDispose";
|
11
|
+
PluginEventType["ContentChanged"] = "contentChanged";
|
12
|
+
PluginEventType["BeforeSetContent"] = "beforeSetContent";
|
13
|
+
PluginEventType["Input"] = "input";
|
14
|
+
PluginEventType["KeyDown"] = "keyDown";
|
15
|
+
PluginEventType["BeforeCutCopy"] = "beforeCutCopy";
|
16
|
+
PluginEventType["BeforePaste"] = "beforePaste";
|
17
|
+
PluginEventType["ZoomChanged"] = "zoomChanged";
|
18
|
+
PluginEventType["MouseUp"] = "mouseUp";
|
19
|
+
PluginEventType["CompositionEnd"] = "compositionEnd";
|
20
|
+
})(PluginEventType || (PluginEventType = {}));
|
21
|
+
/**
|
22
|
+
* ContentChanged event source for RoosterJS
|
23
|
+
* @private
|
24
|
+
*/
|
25
|
+
export var ContentChangedEventSource;
|
26
|
+
(function (ContentChangedEventSource) {
|
27
|
+
ContentChangedEventSource["Paste"] = "Paste";
|
28
|
+
})(ContentChangedEventSource || (ContentChangedEventSource = {}));
|
29
|
+
/**
|
30
|
+
* Applies the border format to the specified element.
|
31
|
+
* If the element is an HTMLTableCellElement, it skips setting editing info
|
32
|
+
* and to use classes instead of inline styles.
|
33
|
+
* For all other cases, the default format applier is used.
|
34
|
+
*/
|
35
|
+
export const borderApplier = (format, element, context) => {
|
36
|
+
if (element instanceof HTMLTableCellElement) {
|
37
|
+
// don't set format for table cell
|
38
|
+
// as it will set inline styles for them
|
39
|
+
// we want to use classes instead
|
40
|
+
}
|
41
|
+
else if (context.defaultFormatAppliers.border) {
|
42
|
+
// apply default formats for all other cases
|
43
|
+
context.defaultFormatAppliers.border(format, element, context);
|
44
|
+
}
|
45
|
+
};
|
46
|
+
/**
|
47
|
+
* Applies the dataset format to the given HTML element.
|
48
|
+
* If the element is an HTMLTableElement, it skips setting editing info
|
49
|
+
* and to use classes instead of inline styles.
|
50
|
+
* For all other cases, it applies the default formats.
|
51
|
+
*/
|
52
|
+
export const dataSetApplier = (format, element, context) => {
|
53
|
+
if (element instanceof HTMLTableElement) {
|
54
|
+
// don't set editing info for tables
|
55
|
+
// as it will set inline styles for them
|
56
|
+
// we want to use classes instead
|
57
|
+
}
|
58
|
+
else if (context.defaultFormatAppliers.dataset) {
|
59
|
+
// apply default formats for all other cases
|
60
|
+
context.defaultFormatAppliers.dataset(format, element, context);
|
61
|
+
}
|
62
|
+
};
|
63
|
+
/**
|
64
|
+
* @internal
|
65
|
+
*/
|
66
|
+
export const getPreviousInlineImages = (content) => {
|
67
|
+
if (!content) {
|
68
|
+
return [];
|
69
|
+
}
|
70
|
+
const previousInlineImages = [];
|
71
|
+
const document = new DOMParser().parseFromString(content !== null && content !== void 0 ? content : '', 'text/html');
|
72
|
+
document.querySelectorAll('img').forEach(img => {
|
73
|
+
const imageAttributes = getInlineImageAttributes(img);
|
74
|
+
previousInlineImages.push(imageAttributes);
|
75
|
+
});
|
76
|
+
return previousInlineImages;
|
77
|
+
};
|
78
|
+
/**
|
79
|
+
* @internal
|
80
|
+
*/
|
81
|
+
export const getRemovedInlineImages = (content, previousInlineImages) => {
|
82
|
+
const document = new DOMParser().parseFromString(content !== null && content !== void 0 ? content : '', 'text/html');
|
83
|
+
const currentContentIds = Array.from(document.querySelectorAll('img')).map(img => img.id);
|
84
|
+
previousInlineImages = previousInlineImages === null || previousInlineImages === void 0 ? void 0 : previousInlineImages.filter(img => !!img.id && !(currentContentIds === null || currentContentIds === void 0 ? void 0 : currentContentIds.includes(img.id)));
|
85
|
+
const removedInlineImages = [...previousInlineImages];
|
86
|
+
return removedInlineImages;
|
87
|
+
};
|
88
|
+
/**
|
89
|
+
* @internal
|
90
|
+
*/
|
91
|
+
export const getInsertedInlineImages = (content, previousInlineImages) => {
|
92
|
+
const document = new DOMParser().parseFromString(content !== null && content !== void 0 ? content : '', 'text/html');
|
93
|
+
const currentContentInlineImages = Array.from(document.querySelectorAll('img'));
|
94
|
+
const previousContentIds = Array.from(previousInlineImages).map(img => img.id);
|
95
|
+
// if check is updated, also update getRemovedInlineImages
|
96
|
+
const insertedInlineImages = currentContentInlineImages.filter(img => !previousContentIds.includes(img.id));
|
97
|
+
return insertedInlineImages;
|
98
|
+
};
|
99
|
+
/**
|
100
|
+
* @internal
|
101
|
+
*/
|
102
|
+
export const getInlineImageAttributes = (image) => {
|
103
|
+
const imageAttributes = {};
|
104
|
+
image.getAttributeNames().forEach(attrName => {
|
105
|
+
const attrValue = image.getAttribute(attrName);
|
106
|
+
if (attrValue) {
|
107
|
+
imageAttributes[attrName] = attrValue;
|
108
|
+
}
|
109
|
+
});
|
110
|
+
return imageAttributes;
|
111
|
+
};
|
112
|
+
/**
|
113
|
+
* @internal
|
114
|
+
*/
|
115
|
+
/**
|
116
|
+
* Update the scroll position of the editor to ensure the content is visible.
|
117
|
+
*/
|
118
|
+
export const scrollToBottomRichTextEditor = () => {
|
119
|
+
// Get the current selection in the document
|
120
|
+
const selection = document.getSelection();
|
121
|
+
// Check if a selection exists and it has at least one range
|
122
|
+
if (!selection || selection.rangeCount <= 0) {
|
123
|
+
// If no selection or range, exit the function
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
// Get the first range of the selection
|
127
|
+
// A user can normally only select one range at a time, so the rangeCount will usually be 1
|
128
|
+
const range = selection.getRangeAt(0);
|
129
|
+
// If the common ancestor container of the range is the document itself,
|
130
|
+
// it might mean that the editable element is getting removed from the DOM
|
131
|
+
// In such cases, especially in Safari, trying to modify the range might throw a HierarchyRequest error
|
132
|
+
if (range.commonAncestorContainer === document) {
|
133
|
+
return;
|
134
|
+
}
|
135
|
+
// Create a temporary span element to use as an anchor for scrolling
|
136
|
+
// We can't use the anchor node directly because if it's a Text node, calling scrollIntoView() on it will throw an error
|
137
|
+
const tempElement = document.createElement('span');
|
138
|
+
// Collapse the range to its end point
|
139
|
+
// This means the start and end points of the range will be the same, and it will not contain any content
|
140
|
+
range.collapse(false);
|
141
|
+
// Insert the temporary element at the cursor's position at the end of the range
|
142
|
+
range.insertNode(tempElement);
|
143
|
+
// Scroll the temporary element into view
|
144
|
+
// the element will be aligned at the center of the scroll container, otherwise, text and images may be positioned incorrectly
|
145
|
+
tempElement.scrollIntoView({
|
146
|
+
block: 'center'
|
147
|
+
});
|
148
|
+
tempElement.remove();
|
149
|
+
};
|
150
|
+
/**
|
151
|
+
* Revoke the blob urls in the removedInlineImages and remove them from the currentLocalBlobMap
|
152
|
+
* @internal
|
153
|
+
*/
|
154
|
+
export const removeLocalBlobs = (currentLocalBlobMap, removedInlineImages) => {
|
155
|
+
removedInlineImages.forEach(image => {
|
156
|
+
if (!image.id) {
|
157
|
+
return;
|
158
|
+
}
|
159
|
+
removeSingleLocalBlob(currentLocalBlobMap, image.id);
|
160
|
+
});
|
161
|
+
};
|
162
|
+
/**
|
163
|
+
* Revoke all the blob urls in the currentLocalBlobMap and clean up the currentLocalBlobMap
|
164
|
+
* @internal
|
165
|
+
*/
|
166
|
+
export const cleanAllLocalBlobs = (currentLocalBlobMap) => {
|
167
|
+
Object.keys(currentLocalBlobMap).forEach(imageId => {
|
168
|
+
removeSingleLocalBlob(currentLocalBlobMap, imageId);
|
169
|
+
});
|
170
|
+
};
|
171
|
+
const removeSingleLocalBlob = (currentLocalBlobMap, imageId) => {
|
172
|
+
const blobUrl = currentLocalBlobMap[imageId];
|
173
|
+
if (blobUrl) {
|
174
|
+
URL.revokeObjectURL(blobUrl);
|
175
|
+
delete currentLocalBlobMap[imageId];
|
176
|
+
}
|
177
|
+
};
|
178
|
+
//# sourceMappingURL=RichTextEditorUtils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RichTextEditorUtils.js","sourceRoot":"","sources":["../../../../../../preprocess-dist/react-components/src/components/utils/RichTextEditorUtils.ts"],"names":[],"mappings":"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","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 * @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 * @internal\n */\nexport const getRemovedInlineImages = (content: string, previousInlineImages: Record<string, string>[]): 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 const removedInlineImages = [...previousInlineImages];\n return removedInlineImages;\n};\n/**\n * @internal\n */\nexport const getInsertedInlineImages = (content: string, previousInlineImages: NodeListOf<HTMLImageElement>): 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 * @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 * @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 * Revoke the blob urls in the removedInlineImages and remove them from the currentLocalBlobMap\n * @internal\n */\nexport const removeLocalBlobs = (currentLocalBlobMap: Record<string, string>, removedInlineImages: Record<string, string>[]): void => {\n removedInlineImages.forEach(image => {\n if (!image.id) {\n return;\n }\n removeSingleLocalBlob(currentLocalBlobMap, image.id);\n });\n};\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};\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};"]}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { RichTextStrings } from '../RichTextEditor/RichTextSendBox';
|
2
|
+
import { IEditor } from 'roosterjs-content-model-types';
|
3
|
+
import { IContextualMenuItem } from '@fluentui/react';
|
4
|
+
/**
|
5
|
+
* @private
|
6
|
+
*
|
7
|
+
* String to be replaces by actual values of row and column.
|
8
|
+
*/
|
9
|
+
export declare const ColumnRowReplaceString = "{column} x {row}";
|
10
|
+
/**
|
11
|
+
* @private
|
12
|
+
*
|
13
|
+
* Function to create key pair for the selected table size.
|
14
|
+
*/
|
15
|
+
export declare function createKey(row: number, column: number): string;
|
16
|
+
/**
|
17
|
+
* @private
|
18
|
+
*
|
19
|
+
* Function to parse key to the selected table size valules.
|
20
|
+
*/
|
21
|
+
export declare function parseKey(key: string): {
|
22
|
+
row: number;
|
23
|
+
column: number;
|
24
|
+
};
|
25
|
+
/**
|
26
|
+
* Returns an array of context menu items for editing a rich text table.
|
27
|
+
*
|
28
|
+
* @param editor - The editor instance.
|
29
|
+
* @param strings - An object containing localized strings for the context menu items.
|
30
|
+
* @returns An array of context menu items.
|
31
|
+
*/
|
32
|
+
export declare const getTableEditContextMenuItems: (editor: IEditor, strings: Partial<RichTextStrings>) => IContextualMenuItem[];
|
33
|
+
//# sourceMappingURL=RichTextTableUtils.d.ts.map
|
@@ -0,0 +1,119 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
import { editTable } from 'roosterjs-content-model-api';
|
4
|
+
import { tableContextMenuIconStyles } from '../styles/RichTextEditor.styles';
|
5
|
+
/**
|
6
|
+
* @private
|
7
|
+
*
|
8
|
+
* String to be replaces by actual values of row and column.
|
9
|
+
*/
|
10
|
+
export const ColumnRowReplaceString = '{column} x {row}';
|
11
|
+
/**
|
12
|
+
* @private
|
13
|
+
*
|
14
|
+
* Function to create key pair for the selected table size.
|
15
|
+
*/
|
16
|
+
export function createKey(row, column) {
|
17
|
+
return `${row},${column}`;
|
18
|
+
}
|
19
|
+
/**
|
20
|
+
* @private
|
21
|
+
*
|
22
|
+
* Function to parse key to the selected table size valules.
|
23
|
+
*/
|
24
|
+
export function parseKey(key) {
|
25
|
+
const [row, column] = key.split(',');
|
26
|
+
if (row === undefined || column === undefined) {
|
27
|
+
throw new Error('Invalid key format');
|
28
|
+
}
|
29
|
+
return {
|
30
|
+
row: parseInt(row),
|
31
|
+
column: parseInt(column)
|
32
|
+
};
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Returns an array of context menu items for editing a rich text table.
|
36
|
+
*
|
37
|
+
* @param editor - The editor instance.
|
38
|
+
* @param strings - An object containing localized strings for the context menu items.
|
39
|
+
* @returns An array of context menu items.
|
40
|
+
*/
|
41
|
+
export const getTableEditContextMenuItems = (editor, strings) => {
|
42
|
+
return [{
|
43
|
+
key: 'RichTextTableEditMenuTableInsert',
|
44
|
+
text: strings.richTextInsertRowOrColumnMenu,
|
45
|
+
ariaLabel: strings.richTextInsertRowOrColumnMenu,
|
46
|
+
iconProps: {
|
47
|
+
iconName: 'RichTextTableInsertMenuIcon',
|
48
|
+
styles: {
|
49
|
+
root: tableContextMenuIconStyles
|
50
|
+
}
|
51
|
+
},
|
52
|
+
subMenuProps: {
|
53
|
+
items: [{
|
54
|
+
key: 'RichTextTableEditMenuTableInsertRowAbove',
|
55
|
+
text: strings.richTextInsertRowAboveMenu,
|
56
|
+
ariaLabel: strings.richTextInsertRowAboveMenu,
|
57
|
+
onClick: () => {
|
58
|
+
editTable(editor, 'insertAbove');
|
59
|
+
}
|
60
|
+
}, {
|
61
|
+
key: 'RichTextTableEditMenuTableInsertRowBelow',
|
62
|
+
text: strings.richTextInsertRowBelowMenu,
|
63
|
+
ariaLabel: strings.richTextInsertRowBelowMenu,
|
64
|
+
onClick: () => {
|
65
|
+
editTable(editor, 'insertBelow');
|
66
|
+
}
|
67
|
+
}, {
|
68
|
+
key: 'RichTextTableEditMenuTableInsertColumnLeft',
|
69
|
+
text: strings.richTextInsertColumnLeftMenu,
|
70
|
+
ariaLabel: strings.richTextInsertColumnLeftMenu,
|
71
|
+
onClick: () => {
|
72
|
+
editTable(editor, 'insertLeft');
|
73
|
+
}
|
74
|
+
}, {
|
75
|
+
key: 'RichTextTableEditMenuTableInsertColumnRight',
|
76
|
+
text: strings.richTextInsertColumnRightMenu,
|
77
|
+
ariaLabel: strings.richTextInsertColumnRightMenu,
|
78
|
+
onClick: () => {
|
79
|
+
editTable(editor, 'insertRight');
|
80
|
+
}
|
81
|
+
}]
|
82
|
+
}
|
83
|
+
}, {
|
84
|
+
key: 'RichTextTableEditMenuTableDelete',
|
85
|
+
text: strings.richTextDeleteRowOrColumnMenu,
|
86
|
+
ariaLabel: strings.richTextDeleteRowOrColumnMenu,
|
87
|
+
iconProps: {
|
88
|
+
iconName: 'RichTextTableDeleteMenuIcon',
|
89
|
+
styles: {
|
90
|
+
root: tableContextMenuIconStyles
|
91
|
+
}
|
92
|
+
},
|
93
|
+
subMenuProps: {
|
94
|
+
items: [{
|
95
|
+
key: 'RichTextTableEditMenuTableDeleteRow',
|
96
|
+
text: strings.richTextDeleteRowMenu,
|
97
|
+
ariaLabel: strings.richTextDeleteRowMenu,
|
98
|
+
onClick: () => {
|
99
|
+
editTable(editor, 'deleteRow');
|
100
|
+
}
|
101
|
+
}, {
|
102
|
+
key: 'RichTextTableEditMenuTableDeleteColumn',
|
103
|
+
text: strings.richTextDeleteColumnMenu,
|
104
|
+
ariaLabel: strings.richTextDeleteColumnMenu,
|
105
|
+
onClick: () => {
|
106
|
+
editTable(editor, 'deleteColumn');
|
107
|
+
}
|
108
|
+
}, {
|
109
|
+
key: 'RichTextTableEditMenuTableDeleteTable',
|
110
|
+
text: strings.richTextDeleteTableMenu,
|
111
|
+
ariaLabel: strings.richTextDeleteTableMenu,
|
112
|
+
onClick: () => {
|
113
|
+
editTable(editor, 'deleteTable');
|
114
|
+
}
|
115
|
+
}]
|
116
|
+
}
|
117
|
+
}];
|
118
|
+
};
|
119
|
+
//# sourceMappingURL=RichTextTableUtils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RichTextTableUtils.js","sourceRoot":"","sources":["../../../../../../preprocess-dist/react-components/src/components/utils/RichTextTableUtils.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { editTable } from 'roosterjs-content-model-api';\nimport { tableContextMenuIconStyles } from '../styles/RichTextEditor.styles';\nimport { RichTextStrings } from '../RichTextEditor/RichTextSendBox';\nimport { IEditor } from 'roosterjs-content-model-types';\nimport { IContextualMenuItem } from '@fluentui/react';\n\n/**\n * @private\n *\n * String to be replaces by actual values of row and column.\n */\nexport const ColumnRowReplaceString = '{column} x {row}';\n\n/**\n * @private\n *\n * Function to create key pair for the selected table size.\n */\nexport function createKey(row: number, column: number): string {\n return `${row},${column}`;\n}\n\n/**\n * @private\n *\n * Function to parse key to the selected table size valules.\n */\nexport function parseKey(key: string): {\n row: number;\n column: number;\n} {\n const [row, column] = key.split(',');\n if (row === undefined || column === undefined) {\n throw new Error('Invalid key format');\n }\n return {\n row: parseInt(row),\n column: parseInt(column)\n };\n}\n\n/**\n * Returns an array of context menu items for editing a rich text table.\n *\n * @param editor - The editor instance.\n * @param strings - An object containing localized strings for the context menu items.\n * @returns An array of context menu items.\n */\nexport const getTableEditContextMenuItems = (editor: IEditor, strings: Partial<RichTextStrings>): IContextualMenuItem[] => {\n return [{\n key: 'RichTextTableEditMenuTableInsert',\n text: strings.richTextInsertRowOrColumnMenu,\n ariaLabel: strings.richTextInsertRowOrColumnMenu,\n iconProps: {\n iconName: 'RichTextTableInsertMenuIcon',\n styles: {\n root: tableContextMenuIconStyles\n }\n },\n subMenuProps: {\n items: [{\n key: 'RichTextTableEditMenuTableInsertRowAbove',\n text: strings.richTextInsertRowAboveMenu,\n ariaLabel: strings.richTextInsertRowAboveMenu,\n onClick: () => {\n editTable(editor, 'insertAbove');\n }\n }, {\n key: 'RichTextTableEditMenuTableInsertRowBelow',\n text: strings.richTextInsertRowBelowMenu,\n ariaLabel: strings.richTextInsertRowBelowMenu,\n onClick: () => {\n editTable(editor, 'insertBelow');\n }\n }, {\n key: 'RichTextTableEditMenuTableInsertColumnLeft',\n text: strings.richTextInsertColumnLeftMenu,\n ariaLabel: strings.richTextInsertColumnLeftMenu,\n onClick: () => {\n editTable(editor, 'insertLeft');\n }\n }, {\n key: 'RichTextTableEditMenuTableInsertColumnRight',\n text: strings.richTextInsertColumnRightMenu,\n ariaLabel: strings.richTextInsertColumnRightMenu,\n onClick: () => {\n editTable(editor, 'insertRight');\n }\n }]\n }\n }, {\n key: 'RichTextTableEditMenuTableDelete',\n text: strings.richTextDeleteRowOrColumnMenu,\n ariaLabel: strings.richTextDeleteRowOrColumnMenu,\n iconProps: {\n iconName: 'RichTextTableDeleteMenuIcon',\n styles: {\n root: tableContextMenuIconStyles\n }\n },\n subMenuProps: {\n items: [{\n key: 'RichTextTableEditMenuTableDeleteRow',\n text: strings.richTextDeleteRowMenu,\n ariaLabel: strings.richTextDeleteRowMenu,\n onClick: () => {\n editTable(editor, 'deleteRow');\n }\n }, {\n key: 'RichTextTableEditMenuTableDeleteColumn',\n text: strings.richTextDeleteColumnMenu,\n ariaLabel: strings.richTextDeleteColumnMenu,\n onClick: () => {\n editTable(editor, 'deleteColumn');\n }\n }, {\n key: 'RichTextTableEditMenuTableDeleteTable',\n text: strings.richTextDeleteTableMenu,\n ariaLabel: strings.richTextDeleteTableMenu,\n onClick: () => {\n editTable(editor, 'deleteTable');\n }\n }]\n }\n }];\n};"]}
|
@@ -1,7 +1,40 @@
|
|
1
|
+
import { AttachmentMetadataInProgress } from "../../../../acs-ui-common/src";
|
2
|
+
import { AttachmentMetadata } from "../../../../acs-ui-common/src";
|
1
3
|
/**
|
2
4
|
* @private
|
3
5
|
*/
|
4
6
|
export declare const MAXIMUM_LENGTH_OF_MESSAGE = 8000;
|
7
|
+
/**
|
8
|
+
* @private
|
9
|
+
*/
|
10
|
+
export declare const hasIncompleteAttachmentUploads: (attachmentsWithProgress: AttachmentMetadataInProgress[] | undefined) => boolean;
|
11
|
+
/**
|
12
|
+
* @private
|
13
|
+
*/
|
14
|
+
export declare const isAttachmentUploadCompleted: (attachmentsWithProgress: AttachmentMetadataInProgress[] | undefined) => boolean;
|
15
|
+
/**
|
16
|
+
* Obtain any image nodes from the content DOM passed in
|
17
|
+
* returns a list of image IDs
|
18
|
+
* @internal
|
19
|
+
*/
|
20
|
+
export declare const inlineImageIds: (content?: string) => {
|
21
|
+
id: string;
|
22
|
+
url?: string;
|
23
|
+
}[];
|
24
|
+
/**
|
25
|
+
* Check if the content has inline image.
|
26
|
+
* @internal
|
27
|
+
*/
|
28
|
+
export declare const hasInlineImageContent: (content: string) => boolean;
|
29
|
+
/**
|
30
|
+
* @internal
|
31
|
+
*
|
32
|
+
* @param message - The message content to update.
|
33
|
+
* @param initialInlineImages - The initial inline images that comes with the message before editing.
|
34
|
+
*
|
35
|
+
* @returns The updated message content.
|
36
|
+
*/
|
37
|
+
export declare const updateStylesOfInlineImages: (message: string, initialInlineImages: Record<string, string>[]) => Promise<string>;
|
5
38
|
/**
|
6
39
|
* @private
|
7
40
|
*/
|
@@ -19,13 +52,26 @@ export declare const sanitizeText: (message: string) => string;
|
|
19
52
|
* @param disabled - Indicates whether the send box is disabled.
|
20
53
|
* @returns A boolean value indicating whether the send box should be disabled.
|
21
54
|
*/
|
22
|
-
export declare const isSendBoxButtonDisabled: ({ hasContent, hasError, disabled }: {
|
55
|
+
export declare const isSendBoxButtonDisabled: ({ hasContent, hasCompletedAttachmentUploads, hasError, disabled }: {
|
23
56
|
hasContent: boolean;
|
57
|
+
hasCompletedAttachmentUploads: boolean;
|
24
58
|
hasError: boolean;
|
25
59
|
disabled: boolean;
|
26
60
|
}) => boolean;
|
61
|
+
/**
|
62
|
+
* @internal
|
63
|
+
*/
|
64
|
+
export declare const toAttachmentMetadata: (attachmentsWithProgress: AttachmentMetadataInProgress[] | undefined) => AttachmentMetadata[] | undefined;
|
27
65
|
/**
|
28
66
|
* @internal
|
29
67
|
*/
|
30
68
|
export declare const modifyInlineImagesInContentString: (content: string, initialInlineImages: Record<string, string>[], onCompleted?: (content: string) => void) => Promise<void>;
|
69
|
+
/**
|
70
|
+
* @internal
|
71
|
+
*/
|
72
|
+
export declare const removeBrokenImageContentAndClearImageSizeStyles: (content: string) => string;
|
73
|
+
/**
|
74
|
+
* @internal
|
75
|
+
*/
|
76
|
+
export declare const getContentWithUpdatedInlineImagesInfo: (content: string, inlineImageWithProgress: AttachmentMetadataInProgress[]) => string;
|
31
77
|
//# sourceMappingURL=SendBoxUtils.d.ts.map
|
@@ -7,13 +7,98 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
8
|
});
|
9
9
|
};
|
10
|
-
// Copyright (c) Microsoft Corporation.
|
11
|
-
// Licensed under the MIT License.
|
12
10
|
/**
|
13
11
|
* @private
|
14
12
|
*/
|
15
13
|
export const MAXIMUM_LENGTH_OF_MESSAGE = 8000;
|
16
14
|
const EMPTY_MESSAGE_REGEX = /^\s*$/;
|
15
|
+
/**
|
16
|
+
* @private
|
17
|
+
*/
|
18
|
+
export const hasIncompleteAttachmentUploads = (attachmentsWithProgress) => {
|
19
|
+
return !!((attachmentsWithProgress === null || attachmentsWithProgress === void 0 ? void 0 : attachmentsWithProgress.length) && !attachmentsWithProgress.filter(attachmentUpload => !attachmentUpload.error).every(attachmentUpload => attachmentUpload.progress === 1 && attachmentUpload.progress !== undefined));
|
20
|
+
};
|
21
|
+
/**
|
22
|
+
* @private
|
23
|
+
*/
|
24
|
+
export const isAttachmentUploadCompleted = (attachmentsWithProgress) => {
|
25
|
+
return !!(attachmentsWithProgress === null || attachmentsWithProgress === void 0 ? void 0 : attachmentsWithProgress.find(attachment => !attachment.error));
|
26
|
+
};
|
27
|
+
/**
|
28
|
+
* Obtain any image nodes from the content DOM passed in
|
29
|
+
* returns a list of image IDs
|
30
|
+
* @internal
|
31
|
+
*/
|
32
|
+
export const inlineImageIds = (content) => {
|
33
|
+
if (!content) {
|
34
|
+
return [];
|
35
|
+
}
|
36
|
+
const document = new DOMParser().parseFromString(content, 'text/html');
|
37
|
+
const imageTags = document.querySelectorAll('img');
|
38
|
+
const ids = [];
|
39
|
+
imageTags.forEach(node => {
|
40
|
+
const id = node.id;
|
41
|
+
const url = node.src;
|
42
|
+
if (id) {
|
43
|
+
ids.push({
|
44
|
+
id,
|
45
|
+
url
|
46
|
+
});
|
47
|
+
}
|
48
|
+
});
|
49
|
+
return ids;
|
50
|
+
};
|
51
|
+
/**
|
52
|
+
* Check if the content has inline image.
|
53
|
+
* @internal
|
54
|
+
*/
|
55
|
+
export const hasInlineImageContent = (content) => {
|
56
|
+
return inlineImageIds(content).length > 0;
|
57
|
+
};
|
58
|
+
/**
|
59
|
+
* @internal
|
60
|
+
*
|
61
|
+
* @param message - The message content to update.
|
62
|
+
* @param initialInlineImages - The initial inline images that comes with the message before editing.
|
63
|
+
*
|
64
|
+
* @returns The updated message content.
|
65
|
+
*/
|
66
|
+
export const updateStylesOfInlineImages = (message, initialInlineImages) => __awaiter(void 0, void 0, void 0, function* () {
|
67
|
+
if (message === '') {
|
68
|
+
return message;
|
69
|
+
}
|
70
|
+
const initialInlineImagesIds = initialInlineImages.map(initialInlineImage => initialInlineImage.id);
|
71
|
+
const document = new DOMParser().parseFromString(message !== null && message !== void 0 ? message : '', 'text/html');
|
72
|
+
const imagesPromise = Array.from(document.querySelectorAll('img')).map(img => {
|
73
|
+
return new Promise((resolve, rejects) => {
|
74
|
+
// The message might content images that comes with the message before editing.
|
75
|
+
// This function should only modify the message content for images that are newly added.
|
76
|
+
if (initialInlineImagesIds.includes(img.id)) {
|
77
|
+
resolve();
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
const imageElement = new Image();
|
81
|
+
imageElement.src = img.src;
|
82
|
+
imageElement.onload = () => {
|
83
|
+
// imageElement is a copy of original img element, so changes need to be made to the original img element
|
84
|
+
img.width = imageElement.width;
|
85
|
+
img.height = imageElement.height;
|
86
|
+
img.style.aspectRatio = `${imageElement.width} / ${imageElement.height}`;
|
87
|
+
// Clear maxWidth and maxHeight styles that are set by roosterJS.
|
88
|
+
// This is so that they can be set in messageThread styles without using the important flag.
|
89
|
+
img.style.maxWidth = '';
|
90
|
+
img.style.maxHeight = '';
|
91
|
+
resolve();
|
92
|
+
};
|
93
|
+
imageElement.onerror = () => {
|
94
|
+
rejects(`Error loading image ${img.id}`);
|
95
|
+
};
|
96
|
+
});
|
97
|
+
});
|
98
|
+
yield Promise.all(imagesPromise);
|
99
|
+
const newMessage = document.body.innerHTML;
|
100
|
+
return newMessage;
|
101
|
+
});
|
17
102
|
/**
|
18
103
|
* @private
|
19
104
|
*/
|
@@ -40,18 +125,83 @@ export const sanitizeText = (message) => {
|
|
40
125
|
* @param disabled - Indicates whether the send box is disabled.
|
41
126
|
* @returns A boolean value indicating whether the send box should be disabled.
|
42
127
|
*/
|
43
|
-
export const isSendBoxButtonDisabled = ({ hasContent, hasError, disabled }) => {
|
128
|
+
export const isSendBoxButtonDisabled = ({ hasContent, hasCompletedAttachmentUploads, hasError, disabled }) => {
|
44
129
|
return (
|
45
130
|
// no content
|
46
|
-
!hasContent ||
|
131
|
+
!(hasContent || hasCompletedAttachmentUploads) ||
|
47
132
|
//error message exists
|
48
133
|
hasError || disabled);
|
49
134
|
};
|
135
|
+
/**
|
136
|
+
* @internal
|
137
|
+
*/
|
138
|
+
export const toAttachmentMetadata = (attachmentsWithProgress) => {
|
139
|
+
return attachmentsWithProgress === null || attachmentsWithProgress === void 0 ? void 0 : attachmentsWithProgress.filter(attachment => {
|
140
|
+
var _a;
|
141
|
+
return !('error' in attachment) && !((_a = attachment.error) === null || _a === void 0 ? void 0 : _a.message);
|
142
|
+
}).map(attachment => {
|
143
|
+
var _a;
|
144
|
+
return {
|
145
|
+
id: attachment.id,
|
146
|
+
name: attachment.name,
|
147
|
+
url: (_a = attachment.url) !== null && _a !== void 0 ? _a : ''
|
148
|
+
};
|
149
|
+
});
|
150
|
+
};
|
50
151
|
/**
|
51
152
|
* @internal
|
52
153
|
*/
|
53
154
|
export const modifyInlineImagesInContentString = (content, initialInlineImages, onCompleted) => __awaiter(void 0, void 0, void 0, function* () {
|
54
155
|
let newContent = content;
|
156
|
+
try {
|
157
|
+
newContent = yield updateStylesOfInlineImages(content, initialInlineImages);
|
158
|
+
}
|
159
|
+
catch (error) {
|
160
|
+
console.error('Error updating inline images: ', error);
|
161
|
+
}
|
55
162
|
onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(newContent);
|
56
163
|
});
|
164
|
+
/**
|
165
|
+
* @internal
|
166
|
+
*/
|
167
|
+
export const removeBrokenImageContentAndClearImageSizeStyles = (content) => {
|
168
|
+
const document = new DOMParser().parseFromString(content, 'text/html');
|
169
|
+
document.querySelectorAll('img').forEach(img => {
|
170
|
+
// Before submitting/resend the message, we need to trim the unnecessary attributes such as src,
|
171
|
+
// which is set to a local svg of a broken image icon at this point.
|
172
|
+
// Once message is submitted/resent, it will be fetched again and might not be a broken image anymore,
|
173
|
+
// That's why we need to remove the class and data-ui-id attribute of 'broken-image-wrapper'
|
174
|
+
if (img.className === 'broken-image-wrapper') {
|
175
|
+
img.removeAttribute('class');
|
176
|
+
img.removeAttribute('src');
|
177
|
+
img.removeAttribute('data-ui-id');
|
178
|
+
}
|
179
|
+
// Clear maxWidth and maxHeight styles that are set by roosterJS.
|
180
|
+
// Clear width and height styles as the width and height is set in attributes
|
181
|
+
// This is so that they can be set in messageThread styles without using the important flag.
|
182
|
+
img.style.width = '';
|
183
|
+
img.style.height = '';
|
184
|
+
img.style.maxWidth = '';
|
185
|
+
img.style.maxHeight = '';
|
186
|
+
});
|
187
|
+
return document.body.innerHTML;
|
188
|
+
};
|
189
|
+
/**
|
190
|
+
* @internal
|
191
|
+
*/
|
192
|
+
export const getContentWithUpdatedInlineImagesInfo = (content, inlineImageWithProgress) => {
|
193
|
+
if (!inlineImageWithProgress || inlineImageWithProgress.length <= 0) {
|
194
|
+
return content;
|
195
|
+
}
|
196
|
+
const document = new DOMParser().parseFromString(content, 'text/html');
|
197
|
+
document.querySelectorAll('img').forEach(img => {
|
198
|
+
const imageId = img.id;
|
199
|
+
const inlineImage = inlineImageWithProgress.find(image => !image.error && image.progress === 1 && image.id === imageId);
|
200
|
+
if (inlineImage) {
|
201
|
+
img.id = inlineImage.id;
|
202
|
+
img.src = inlineImage.url || img.src;
|
203
|
+
}
|
204
|
+
});
|
205
|
+
return document.body.innerHTML;
|
206
|
+
};
|
57
207
|
//# sourceMappingURL=SendBoxUtils.js.map
|