@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 @@
|
|
|
1
|
+
{"version":3,"file":"TableEditContextMenuProvider.js","sourceRoot":"","sources":["../../../../../../../preprocess-dist/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E;;GAEG;AACH,MAAM,OAAO,4BAA4B;IAAzC;QACU,WAAM,GAAmB,IAAI,CAAC;QACtC,YAAO,GAA6B,EAAE,CAAC;QAC/B,UAAK,GAAiC,IAAI,CAAC;IA4BrD,CAAC;IA3BC,aAAa,CAAC,OAAiC;QAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,4BAA4B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IACD,OAAO;QACL,OAAO,8BAA8B,CAAC;IACxC,CAAC;IACD,UAAU,CAAC,MAAe;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,4BAA4B,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IACD,mBAAmB,CAAC,IAAU;QAC5B,IAAI,IAAI,CAAC,MAAM,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;YACtD,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF;AACD,MAAM,eAAe,GAAG,CAAC,MAAe,EAAE,IAAU,EAAW,EAAE;IAC/D,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;IACxC,MAAM,EAAE,GAAG,SAAS,CAAC,0BAA0B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,EAAE,IAAI,SAAS,CAAC,0BAA0B,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACtE,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,MAAK,IAAI,CAAC;AAC3C,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { ContextMenuProvider, IEditor } from 'roosterjs-content-model-types';\nimport { RichTextStrings } from '../RichTextSendBox';\nimport { IContextualMenuItem } from '@fluentui/react';\nimport { getTableEditContextMenuItems } from '../../utils/RichTextTableUtils';\n\n/**\n * Provides a context menu for editing tables in the rich text editor.\n */\nexport class TableEditContextMenuProvider implements ContextMenuProvider<IContextualMenuItem> {\n private editor: IEditor | null = null;\n strings: Partial<RichTextStrings> = {};\n private items: IContextualMenuItem[] | null = null;\n updateStrings(strings: Partial<RichTextStrings>): void {\n this.strings = strings;\n if (this.editor) {\n this.items = getTableEditContextMenuItems(this.editor, this.strings);\n }\n }\n getName(): string {\n return 'TableEditContextMenuProvider';\n }\n initialize(editor: IEditor): void {\n this.editor = editor;\n this.items = getTableEditContextMenuItems(editor, this.strings);\n }\n\n /**\n * Dispose this plugin\n */\n dispose(): void {\n this.editor = null;\n }\n getContextMenuItems(node: Node): IContextualMenuItem[] | null {\n if (this.editor && isTableEditable(this.editor, node)) {\n return this.items;\n } else {\n return null;\n }\n }\n}\nconst isTableEditable = (editor: IEditor, node: Node): boolean => {\n const domHelper = editor.getDOMHelper();\n const td = domHelper.findClosestElementAncestor(node, 'TD,TH');\n const table = td && domHelper.findClosestElementAncestor(td, 'table');\n return table?.isContentEditable === true;\n};"]}
|
package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PluginEvent, EditorPlugin, IEditor } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* UndoRedoPlugin is a plugin for additional handling undo and redo events in the editor.
|
|
4
|
+
*/
|
|
5
|
+
export default class UndoRedoPlugin implements EditorPlugin {
|
|
6
|
+
private editor;
|
|
7
|
+
onInsertInlineImage?: (imageAttributes: Record<string, string>) => void;
|
|
8
|
+
onUpdateContent?: (() => void) | null;
|
|
9
|
+
getName(): string;
|
|
10
|
+
initialize(editor: IEditor): void;
|
|
11
|
+
dispose(): void;
|
|
12
|
+
onPluginEvent(event: PluginEvent): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=UndoRedoPlugin.d.ts.map
|
package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PluginEventType, scrollToBottomRichTextEditor, getInsertedInlineImages } from '../../utils/RichTextEditorUtils';
|
|
2
|
+
import { getInlineImageAttributes } from '../../utils/RichTextEditorUtils';
|
|
3
|
+
import { ChangeSource } from 'roosterjs-content-model-dom';
|
|
4
|
+
/**
|
|
5
|
+
* UndoRedoPlugin is a plugin for additional handling undo and redo events in the editor.
|
|
6
|
+
*/
|
|
7
|
+
export default class UndoRedoPlugin {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.editor = null;
|
|
10
|
+
this.onUpdateContent = null;
|
|
11
|
+
}
|
|
12
|
+
getName() {
|
|
13
|
+
return 'CustomUndoRedoPlugin';
|
|
14
|
+
}
|
|
15
|
+
initialize(editor) {
|
|
16
|
+
this.editor = editor;
|
|
17
|
+
}
|
|
18
|
+
dispose() { }
|
|
19
|
+
onPluginEvent(event) {
|
|
20
|
+
// handle when new images are added to the editor because of undo/redo
|
|
21
|
+
if (this.editor && event.eventType === PluginEventType.BeforeSetContent && this.onInsertInlineImage) {
|
|
22
|
+
handleBeforeSetEvent(event, this.editor, this.onInsertInlineImage);
|
|
23
|
+
}
|
|
24
|
+
// handle deleted images and updated content
|
|
25
|
+
if (this.onUpdateContent && event.eventType === PluginEventType.ContentChanged && event.source === ChangeSource.SetContent) {
|
|
26
|
+
this.onUpdateContent();
|
|
27
|
+
}
|
|
28
|
+
if (this.editor && !this.editor.isDisposed() && event.eventType === PluginEventType.ContentChanged && event.source === ChangeSource.SetContent) {
|
|
29
|
+
// scroll the editor to the correct position after undo/redo actions
|
|
30
|
+
scrollToBottomRichTextEditor();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const handleBeforeSetEvent = (event, editor, onInsertInlineImage) => {
|
|
35
|
+
const currentImagesList = editor.getDocument().querySelectorAll('img');
|
|
36
|
+
const insertedImages = getInsertedInlineImages(event.newContent, currentImagesList);
|
|
37
|
+
insertedImages.forEach(image => {
|
|
38
|
+
const imageAttributes = getInlineImageAttributes(image);
|
|
39
|
+
onInsertInlineImage(imageAttributes);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=UndoRedoPlugin.js.map
|
package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UndoRedoPlugin.js","sourceRoot":"","sources":["../../../../../../../preprocess-dist/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACzH,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IAAnC;QACU,WAAM,GAAmB,IAAI,CAAC;QAGtC,oBAAe,GAAyB,IAAI,CAAC;IAuB/C,CAAC;IAtBC,OAAO;QACL,OAAO,sBAAsB,CAAC;IAChC,CAAC;IACD,UAAU,CAAC,MAAe;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IACD,OAAO,KAAU,CAAC;IAClB,aAAa,CAAC,KAAkB;QAC9B,sEAAsE;QACtE,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,eAAe,CAAC,gBAAgB,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACpG,oBAAoB,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QACrE,CAAC;QAED,4CAA4C;QAC5C,IAAI,IAAI,CAAC,eAAe,IAAI,KAAK,CAAC,SAAS,KAAK,eAAe,CAAC,cAAc,IAAI,KAAK,CAAC,MAAM,KAAK,YAAY,CAAC,UAAU,EAAE,CAAC;YAC3H,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,KAAK,CAAC,SAAS,KAAK,eAAe,CAAC,cAAc,IAAI,KAAK,CAAC,MAAM,KAAK,YAAY,CAAC,UAAU,EAAE,CAAC;YAC/I,oEAAoE;YACpE,4BAA4B,EAAE,CAAC;QACjC,CAAC;IACH,CAAC;CACF;AACD,MAAM,oBAAoB,GAAG,CAAC,KAA4B,EAAE,MAAe,EAAE,mBAAsE,EAAQ,EAAE;IAC3J,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,cAAc,GAAG,uBAAuB,CAAC,KAAK,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;IACpF,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAC7B,MAAM,eAAe,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC;QACxD,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { PluginEvent, EditorPlugin, IEditor } from 'roosterjs-content-model-types';\nimport type { BeforeSetContentEvent } from 'roosterjs-content-model-types';\nimport { PluginEventType, scrollToBottomRichTextEditor, getInsertedInlineImages } from '../../utils/RichTextEditorUtils';\nimport { getInlineImageAttributes } from '../../utils/RichTextEditorUtils';\nimport { ChangeSource } from 'roosterjs-content-model-dom';\n\n/**\n * UndoRedoPlugin is a plugin for additional handling undo and redo events in the editor.\n */\nexport default class UndoRedoPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n // don't set value in constructor to be able to update it without plugin recreation\n onInsertInlineImage?: (imageAttributes: Record<string, string>) => void;\n onUpdateContent?: (() => void) | null = null;\n getName(): string {\n return 'CustomUndoRedoPlugin';\n }\n initialize(editor: IEditor): void {\n this.editor = editor;\n }\n dispose(): void {}\n onPluginEvent(event: PluginEvent): void {\n // handle when new images are added to the editor because of undo/redo\n if (this.editor && event.eventType === PluginEventType.BeforeSetContent && this.onInsertInlineImage) {\n handleBeforeSetEvent(event, this.editor, this.onInsertInlineImage);\n }\n\n // handle deleted images and updated content\n if (this.onUpdateContent && event.eventType === PluginEventType.ContentChanged && event.source === ChangeSource.SetContent) {\n this.onUpdateContent();\n }\n if (this.editor && !this.editor.isDisposed() && event.eventType === PluginEventType.ContentChanged && event.source === ChangeSource.SetContent) {\n // scroll the editor to the correct position after undo/redo actions\n scrollToBottomRichTextEditor();\n }\n }\n}\nconst handleBeforeSetEvent = (event: BeforeSetContentEvent, editor: IEditor, onInsertInlineImage: (imageAttributes: Record<string, string>) => void): void => {\n const currentImagesList = editor.getDocument().querySelectorAll('img');\n const insertedImages = getInsertedInlineImages(event.newContent, currentImagesList);\n insertedImages.forEach(image => {\n const imageAttributes = getInlineImageAttributes(image);\n onInsertInlineImage(imageAttributes);\n });\n};"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* An update mode to indicate when the content update happens
|
|
4
|
+
*/
|
|
5
|
+
export declare enum UpdateEvent {
|
|
6
|
+
Init = "Init",
|
|
7
|
+
Dispose = "Dispose",
|
|
8
|
+
ContentChanged = "ContentChanged",
|
|
9
|
+
UserInput = "UserInput",
|
|
10
|
+
Blur = "Blur"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A plugin to handle content update
|
|
14
|
+
*/
|
|
15
|
+
export declare class UpdateContentPlugin implements EditorPlugin {
|
|
16
|
+
private editor;
|
|
17
|
+
private disposer;
|
|
18
|
+
onUpdate: ((event: UpdateEvent, shouldRemoveInlineImages?: boolean) => void) | null;
|
|
19
|
+
getName(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Initialize this plugin
|
|
22
|
+
* @param editor The editor instance
|
|
23
|
+
*/
|
|
24
|
+
initialize(editor: IEditor): void;
|
|
25
|
+
dispose(): void;
|
|
26
|
+
onPluginEvent(event: PluginEvent): void;
|
|
27
|
+
private onCompositionUpdate;
|
|
28
|
+
private onBlur;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=UpdateContentPlugin.d.ts.map
|
package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { PluginEventType } from '../../utils/RichTextEditorUtils';
|
|
4
|
+
import { ChangeSource } from 'roosterjs-content-model-dom';
|
|
5
|
+
/**
|
|
6
|
+
* An update mode to indicate when the content update happens
|
|
7
|
+
*/
|
|
8
|
+
export var UpdateEvent;
|
|
9
|
+
(function (UpdateEvent) {
|
|
10
|
+
UpdateEvent["Init"] = "Init";
|
|
11
|
+
UpdateEvent["Dispose"] = "Dispose";
|
|
12
|
+
UpdateEvent["ContentChanged"] = "ContentChanged";
|
|
13
|
+
UpdateEvent["UserInput"] = "UserInput";
|
|
14
|
+
UpdateEvent["Blur"] = "Blur";
|
|
15
|
+
})(UpdateEvent || (UpdateEvent = {}));
|
|
16
|
+
var Keys;
|
|
17
|
+
(function (Keys) {
|
|
18
|
+
Keys[Keys["BACKSPACE"] = 8] = "BACKSPACE";
|
|
19
|
+
Keys[Keys["DELETE"] = 46] = "DELETE";
|
|
20
|
+
})(Keys || (Keys = {}));
|
|
21
|
+
/**
|
|
22
|
+
* A plugin to handle content update
|
|
23
|
+
*/
|
|
24
|
+
export class UpdateContentPlugin {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.editor = null;
|
|
27
|
+
this.disposer = null;
|
|
28
|
+
// don't set callback in constructor to be able to update callback without plugin recreation
|
|
29
|
+
this.onUpdate = null;
|
|
30
|
+
this.onCompositionUpdate = () => {
|
|
31
|
+
if (this.onUpdate === null) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.onUpdate(UpdateEvent.ContentChanged);
|
|
35
|
+
};
|
|
36
|
+
this.onBlur = () => {
|
|
37
|
+
if (this.onUpdate === null) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.onUpdate(UpdateEvent.Blur);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
getName() {
|
|
44
|
+
return 'UpdateContentPlugin';
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Initialize this plugin
|
|
48
|
+
* @param editor The editor instance
|
|
49
|
+
*/
|
|
50
|
+
initialize(editor) {
|
|
51
|
+
this.editor = editor;
|
|
52
|
+
this.disposer = this.editor.attachDomEvent({
|
|
53
|
+
blur: {
|
|
54
|
+
beforeDispatch: this.onBlur
|
|
55
|
+
},
|
|
56
|
+
compositionupdate: {
|
|
57
|
+
beforeDispatch: this.onCompositionUpdate
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
dispose() {
|
|
62
|
+
this.editor = null;
|
|
63
|
+
if (this.disposer) {
|
|
64
|
+
this.disposer();
|
|
65
|
+
this.disposer = null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
onPluginEvent(event) {
|
|
69
|
+
if (this.onUpdate === null) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
switch (event.eventType) {
|
|
73
|
+
case PluginEventType.EditorReady:
|
|
74
|
+
this.onUpdate(UpdateEvent.Init);
|
|
75
|
+
break;
|
|
76
|
+
case PluginEventType.BeforeDispose:
|
|
77
|
+
this.onUpdate(UpdateEvent.Dispose);
|
|
78
|
+
break;
|
|
79
|
+
case PluginEventType.CompositionEnd:
|
|
80
|
+
this.onUpdate(UpdateEvent.ContentChanged);
|
|
81
|
+
break;
|
|
82
|
+
case PluginEventType.ContentChanged:
|
|
83
|
+
if (event.source === ChangeSource.Cut ||
|
|
84
|
+
// We need to add the paste source here for an edge case:
|
|
85
|
+
// when user select an image that's already in the editor, then paste in an image to replace the selected one,
|
|
86
|
+
// we will only get a paste event.
|
|
87
|
+
// In this case, we need to update the removedInlineImage array to include the replaced image.
|
|
88
|
+
event.source === ChangeSource.Paste || event.source === ChangeSource.Keyboard && (event.data === Keys.BACKSPACE || event.data === Keys.DELETE)) {
|
|
89
|
+
this.onUpdate(UpdateEvent.ContentChanged, true);
|
|
90
|
+
}
|
|
91
|
+
this.onUpdate(UpdateEvent.ContentChanged);
|
|
92
|
+
break;
|
|
93
|
+
case PluginEventType.Input:
|
|
94
|
+
this.onUpdate(UpdateEvent.UserInput);
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=UpdateContentPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateContentPlugin.js","sourceRoot":"","sources":["../../../../../../../preprocess-dist/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAN,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,gDAAiC,CAAA;IACjC,sCAAuB,CAAA;IACvB,4BAAa,CAAA;AACf,CAAC,EANW,WAAW,KAAX,WAAW,QAMtB;AACD,IAAW,IAGV;AAHD,WAAW,IAAI;IACb,yCAAa,CAAA;IACb,oCAAW,CAAA;AACb,CAAC,EAHU,IAAI,KAAJ,IAAI,QAGd;AAED;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAAhC;QACU,WAAM,GAAmB,IAAI,CAAC;QAC9B,aAAQ,GAAwB,IAAI,CAAC;QAC7C,4FAA4F;QAC5F,aAAQ,GAA8E,IAAI,CAAC;QAyDnF,wBAAmB,GAAG,GAAS,EAAE;YACvC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAC3B,OAAO;YACT,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QAC5C,CAAC,CAAC;QACM,WAAM,GAAG,GAAS,EAAE;YAC1B,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAC3B,OAAO;YACT,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC,CAAC;IACJ,CAAC;IApEC,OAAO;QACL,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,MAAe;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;YACzC,IAAI,EAAE;gBACJ,cAAc,EAAE,IAAI,CAAC,MAAM;aAC5B;YACD,iBAAiB,EAAE;gBACjB,cAAc,EAAE,IAAI,CAAC,mBAAmB;aACzC;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO;QACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;IACD,aAAa,CAAC,KAAkB;QAC9B,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC3B,OAAO;QACT,CAAC;QACD,QAAQ,KAAK,CAAC,SAAS,EAAE,CAAC;YACxB,KAAK,eAAe,CAAC,WAAW;gBAC9B,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBAChC,MAAM;YACR,KAAK,eAAe,CAAC,aAAa;gBAChC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBACnC,MAAM;YACR,KAAK,eAAe,CAAC,cAAc;gBACjC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;gBAC1C,MAAM;YACR,KAAK,eAAe,CAAC,cAAc;gBACjC,IAAI,KAAK,CAAC,MAAM,KAAK,YAAY,CAAC,GAAG;oBACrC,yDAAyD;oBACzD,8GAA8G;oBAC9G,kCAAkC;oBAClC,8FAA8F;oBAC9F,KAAK,CAAC,MAAM,KAAK,YAAY,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,YAAY,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC/I,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;gBAClD,CAAC;gBACD,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;gBAC1C,MAAM;YACR,KAAK,eAAe,CAAC,KAAK;gBACxB,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;gBACrC,MAAM;QACV,CAAC;IACH,CAAC;CAaF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';\nimport { PluginEventType } from '../../utils/RichTextEditorUtils';\nimport { ChangeSource } from 'roosterjs-content-model-dom';\n\n/**\n * An update mode to indicate when the content update happens\n */\nexport enum UpdateEvent {\n Init = 'Init',\n Dispose = 'Dispose',\n ContentChanged = 'ContentChanged',\n UserInput = 'UserInput',\n Blur = 'Blur',\n}\nconst enum Keys {\n BACKSPACE = 8,\n DELETE = 46,\n}\n\n/**\n * A plugin to handle content update\n */\nexport class UpdateContentPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private disposer: (() => void) | null = null;\n // don't set callback in constructor to be able to update callback without plugin recreation\n onUpdate: ((event: UpdateEvent, shouldRemoveInlineImages?: boolean) => void) | null = null;\n getName(): string {\n return 'UpdateContentPlugin';\n }\n\n /**\n * Initialize this plugin\n * @param editor The editor instance\n */\n initialize(editor: IEditor): void {\n this.editor = editor;\n this.disposer = this.editor.attachDomEvent({\n blur: {\n beforeDispatch: this.onBlur\n },\n compositionupdate: {\n beforeDispatch: this.onCompositionUpdate\n }\n });\n }\n dispose(): void {\n this.editor = null;\n if (this.disposer) {\n this.disposer();\n this.disposer = null;\n }\n }\n onPluginEvent(event: PluginEvent): void {\n if (this.onUpdate === null) {\n return;\n }\n switch (event.eventType) {\n case PluginEventType.EditorReady:\n this.onUpdate(UpdateEvent.Init);\n break;\n case PluginEventType.BeforeDispose:\n this.onUpdate(UpdateEvent.Dispose);\n break;\n case PluginEventType.CompositionEnd:\n this.onUpdate(UpdateEvent.ContentChanged);\n break;\n case PluginEventType.ContentChanged:\n if (event.source === ChangeSource.Cut ||\n // We need to add the paste source here for an edge case:\n // when user select an image that's already in the editor, then paste in an image to replace the selected one,\n // we will only get a paste event.\n // In this case, we need to update the removedInlineImage array to include the replaced image.\n event.source === ChangeSource.Paste || event.source === ChangeSource.Keyboard && (event.data === Keys.BACKSPACE || event.data === Keys.DELETE)) {\n this.onUpdate(UpdateEvent.ContentChanged, true);\n }\n this.onUpdate(UpdateEvent.ContentChanged);\n break;\n case PluginEventType.Input:\n this.onUpdate(UpdateEvent.UserInput);\n break;\n }\n }\n private onCompositionUpdate = (): void => {\n if (this.onUpdate === null) {\n return;\n }\n this.onUpdate(UpdateEvent.ContentChanged);\n };\n private onBlur = (): void => {\n if (this.onUpdate === null) {\n return;\n }\n this.onUpdate(UpdateEvent.Blur);\n };\n}"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RichTextStrings } from './RichTextSendBox';
|
|
3
|
+
import type { ContentModelDocument } from 'roosterjs-content-model-types';
|
|
4
|
+
/**
|
|
5
|
+
* Style props for {@link RichTextEditor}.
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export interface RichTextEditorStyleProps {
|
|
10
|
+
minHeight: string;
|
|
11
|
+
maxHeight: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Props for {@link RichTextEditor}.
|
|
15
|
+
*
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
export interface RichTextEditorProps {
|
|
19
|
+
initialContent?: string;
|
|
20
|
+
onChange: (newValue?: string, removedInlineImages?: Record<string, string>[]) => void;
|
|
21
|
+
onKeyDown?: (ev: KeyboardEvent) => void;
|
|
22
|
+
onCompositionUpdate?: () => void;
|
|
23
|
+
onContentModelUpdate?: (contentModel: ContentModelDocument | undefined) => void;
|
|
24
|
+
contentModel?: ContentModelDocument | undefined;
|
|
25
|
+
placeholderText?: string;
|
|
26
|
+
strings: Partial<RichTextStrings>;
|
|
27
|
+
showRichTextEditorFormatting: boolean;
|
|
28
|
+
styles: RichTextEditorStyleProps;
|
|
29
|
+
autoFocus?: 'sendBoxTextField';
|
|
30
|
+
onPaste?: (event: {
|
|
31
|
+
content: DocumentFragment;
|
|
32
|
+
}) => void;
|
|
33
|
+
onInsertInlineImage?: (imageAttributes: Record<string, string>) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Represents a reference to the RichTextEditor component.
|
|
37
|
+
*/
|
|
38
|
+
export interface RichTextEditorComponentRef {
|
|
39
|
+
/**
|
|
40
|
+
* Sets focus on the RichTextEditor component.
|
|
41
|
+
*/
|
|
42
|
+
focus: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Sets the content of the RichTextEditor component to an empty string.
|
|
45
|
+
*/
|
|
46
|
+
setEmptyContent: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves the plain text content of the RichTextEditor component.
|
|
49
|
+
* @returns The plain text content of the RichTextEditor component, or undefined if the editor isn't available.
|
|
50
|
+
*/
|
|
51
|
+
getPlainContent: () => string | undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A component to wrap RoosterJS Rich Text Editor.
|
|
55
|
+
*
|
|
56
|
+
* @beta
|
|
57
|
+
*/
|
|
58
|
+
export declare const RichTextEditor: React.ForwardRefExoticComponent<RichTextEditorProps & React.RefAttributes<RichTextEditorComponentRef>>;
|
|
59
|
+
//# sourceMappingURL=RichTextEditor.d.ts.map
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { richTextEditorWrapperStyle, richTextEditorStyle } from '../styles/RichTextEditor.styles';
|
|
5
|
+
import { useTheme } from '../../theming';
|
|
6
|
+
import { isDarkThemed } from '../../theming/themeUtils';
|
|
7
|
+
import CopyPastePlugin from './Plugins/CopyPastePlugin';
|
|
8
|
+
import { createModelFromHtml, Editor, exportContent } from 'roosterjs-content-model-core';
|
|
9
|
+
import { createBr, createEmptyModel, createParagraph, createSelectionMarker, setSelection } from 'roosterjs-content-model-dom';
|
|
10
|
+
import { KeyboardInputPlugin } from './Plugins/KeyboardInputPlugin';
|
|
11
|
+
import { AutoFormatPlugin, EditPlugin, PastePlugin, ShortcutPlugin, DefaultSanitizers } from 'roosterjs-content-model-plugins';
|
|
12
|
+
import { UpdateContentPlugin, UpdateEvent } from './Plugins/UpdateContentPlugin';
|
|
13
|
+
import { RichTextToolbar } from './Toolbar/RichTextToolbar';
|
|
14
|
+
import { RichTextToolbarPlugin } from './Plugins/RichTextToolbarPlugin';
|
|
15
|
+
import { ContextMenuPlugin } from './Plugins/ContextMenuPlugin';
|
|
16
|
+
import { TableEditContextMenuProvider } from './Plugins/TableEditContextMenuProvider';
|
|
17
|
+
import { borderApplier, dataSetApplier } from '../utils/RichTextEditorUtils';
|
|
18
|
+
import { getPreviousInlineImages, getRemovedInlineImages, removeLocalBlobs, cleanAllLocalBlobs } from '../utils/RichTextEditorUtils';
|
|
19
|
+
import { ContextualMenu } from '@fluentui/react';
|
|
20
|
+
import { PlaceholderPlugin } from './Plugins/PlaceholderPlugin';
|
|
21
|
+
import { getFormatState, setDirection } from 'roosterjs-content-model-api';
|
|
22
|
+
import UndoRedoPlugin from './Plugins/UndoRedoPlugin';
|
|
23
|
+
/**
|
|
24
|
+
* A component to wrap RoosterJS Rich Text Editor.
|
|
25
|
+
*
|
|
26
|
+
* @beta
|
|
27
|
+
*/
|
|
28
|
+
export const RichTextEditor = React.forwardRef((props, ref) => {
|
|
29
|
+
const { initialContent, onChange, placeholderText, strings, showRichTextEditorFormatting, autoFocus, onKeyDown, onCompositionUpdate, onContentModelUpdate, contentModel, onPaste, onInsertInlineImage } = props;
|
|
30
|
+
const editor = useRef(null);
|
|
31
|
+
const editorDiv = useRef(null);
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
const [contextMenuProps, setContextMenuProps] = useState(null);
|
|
34
|
+
const previousThemeDirection = useRef(themeDirection(theme)); // This will be set when the editor is initialized and when the content is updated.
|
|
35
|
+
const [previousInlineImages, setPreviousInlineImages] = useState([]);
|
|
36
|
+
const [inlineImageLocalBlobs, setInlineImageLocalBlobs] = useState({});
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
return () => {
|
|
39
|
+
// Cleanup Local Blob URLs when the component is unmounted
|
|
40
|
+
cleanAllLocalBlobs(inlineImageLocalBlobs);
|
|
41
|
+
};
|
|
42
|
+
// This effect should only run once when the component is unmounted, so we don't need to add any dependencies
|
|
43
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
|
+
}, []);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
var _a;
|
|
47
|
+
if (editor.current) {
|
|
48
|
+
if (!showRichTextEditorFormatting) {
|
|
49
|
+
(_a = editor.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, [showRichTextEditorFormatting]);
|
|
53
|
+
useImperativeHandle(ref, () => {
|
|
54
|
+
return {
|
|
55
|
+
focus() {
|
|
56
|
+
if (editor.current) {
|
|
57
|
+
editor.current.focus();
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
setEmptyContent() {
|
|
61
|
+
setPreviousInlineImages([]);
|
|
62
|
+
cleanAllLocalBlobs(inlineImageLocalBlobs);
|
|
63
|
+
if (editor.current) {
|
|
64
|
+
// remove all content from the editor and update the model
|
|
65
|
+
// ContentChanged event will be sent by RoosterJS automatically
|
|
66
|
+
editor.current.formatContentModel((model) => {
|
|
67
|
+
// Create a new empty paragraph with selection marker
|
|
68
|
+
// this is needed for correct processing of images after the content is deleted
|
|
69
|
+
const newModel = createEmptyModel();
|
|
70
|
+
model.blocks = newModel.blocks;
|
|
71
|
+
return true;
|
|
72
|
+
});
|
|
73
|
+
//reset content model
|
|
74
|
+
onContentModelUpdate && onContentModelUpdate(editor.current.getContentModelCopy('disconnected'));
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
getPlainContent() {
|
|
78
|
+
if (editor.current) {
|
|
79
|
+
return exportContent(editor.current, 'PlainTextFast');
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}, [inlineImageLocalBlobs, onContentModelUpdate]);
|
|
87
|
+
const toolbarPlugin = React.useMemo(() => {
|
|
88
|
+
return new RichTextToolbarPlugin();
|
|
89
|
+
}, []);
|
|
90
|
+
const placeholderPlugin = useMemo(() => {
|
|
91
|
+
var _a;
|
|
92
|
+
const textColor = (_a = theme.palette) === null || _a === void 0 ? void 0 : _a.neutralSecondary;
|
|
93
|
+
return new PlaceholderPlugin('', textColor ? {
|
|
94
|
+
textColor: textColor
|
|
95
|
+
} : undefined);
|
|
96
|
+
}, [theme]);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (placeholderText !== undefined) {
|
|
99
|
+
placeholderPlugin.updatePlaceholder(placeholderText);
|
|
100
|
+
}
|
|
101
|
+
}, [placeholderPlugin, placeholderText]);
|
|
102
|
+
const toolbar = useMemo(() => {
|
|
103
|
+
return React.createElement(RichTextToolbar, { plugin: toolbarPlugin, strings: strings });
|
|
104
|
+
}, [strings, toolbarPlugin]);
|
|
105
|
+
const updatePlugin = useMemo(() => {
|
|
106
|
+
return new UpdateContentPlugin();
|
|
107
|
+
}, []);
|
|
108
|
+
const copyPastePlugin = useMemo(() => {
|
|
109
|
+
return new CopyPastePlugin();
|
|
110
|
+
}, []);
|
|
111
|
+
const onChangeContent = useCallback((shouldUpdateInlineImages) => {
|
|
112
|
+
if (editor.current === null) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const content = exportContent(editor.current);
|
|
116
|
+
let removedInlineImages = [];
|
|
117
|
+
if (shouldUpdateInlineImages) {
|
|
118
|
+
removedInlineImages = getRemovedInlineImages(content, previousInlineImages);
|
|
119
|
+
}
|
|
120
|
+
onChange && onChange(content, removedInlineImages);
|
|
121
|
+
setPreviousInlineImages(getPreviousInlineImages(content));
|
|
122
|
+
}, [onChange, previousInlineImages]);
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
// don't set callback in plugin constructor to update callback without plugin recreation
|
|
125
|
+
updatePlugin.onUpdate = (event, shouldRemoveInlineImages) => {
|
|
126
|
+
if (editor.current === null) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (event === UpdateEvent.Blur || event === UpdateEvent.Dispose) {
|
|
130
|
+
onContentModelUpdate && onContentModelUpdate(editor.current.getContentModelCopy('disconnected'));
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
const content = exportContent(editor.current);
|
|
134
|
+
let removedInlineImages = [];
|
|
135
|
+
if (shouldRemoveInlineImages) {
|
|
136
|
+
removedInlineImages = getRemovedInlineImages(content, previousInlineImages);
|
|
137
|
+
if (removedInlineImages.length > 0) {
|
|
138
|
+
removeLocalBlobs(inlineImageLocalBlobs, removedInlineImages);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
onChange && onChange(content, removedInlineImages);
|
|
142
|
+
setPreviousInlineImages(getPreviousInlineImages(content));
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}, [onChange, onContentModelUpdate, updatePlugin, previousInlineImages, inlineImageLocalBlobs]);
|
|
146
|
+
const undoRedoPlugin = useMemo(() => {
|
|
147
|
+
return new UndoRedoPlugin();
|
|
148
|
+
}, []);
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
if (onInsertInlineImage) {
|
|
151
|
+
copyPastePlugin.onInsertInlineImage = (imageAttributes) => {
|
|
152
|
+
const { id, src } = imageAttributes;
|
|
153
|
+
setInlineImageLocalBlobs(prev => {
|
|
154
|
+
if (!id || !src) {
|
|
155
|
+
return prev;
|
|
156
|
+
}
|
|
157
|
+
return Object.assign(Object.assign({}, prev), { [id]: src });
|
|
158
|
+
});
|
|
159
|
+
onInsertInlineImage(imageAttributes);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
copyPastePlugin.onInsertInlineImage = undefined;
|
|
164
|
+
}
|
|
165
|
+
undoRedoPlugin.onInsertInlineImage = onInsertInlineImage;
|
|
166
|
+
}, [copyPastePlugin, onInsertInlineImage, undoRedoPlugin]);
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
undoRedoPlugin.onUpdateContent = () => {
|
|
169
|
+
onChangeContent(true);
|
|
170
|
+
};
|
|
171
|
+
}, [onChangeContent, undoRedoPlugin]);
|
|
172
|
+
const keyboardInputPlugin = useMemo(() => {
|
|
173
|
+
return new KeyboardInputPlugin();
|
|
174
|
+
}, []);
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
// don't set callback in plugin constructor to update callback without plugin recreation
|
|
177
|
+
keyboardInputPlugin.onKeyDown = onKeyDown;
|
|
178
|
+
}, [keyboardInputPlugin, onKeyDown]);
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
// don't set callback in plugin constructor to update callback without plugin recreation
|
|
181
|
+
keyboardInputPlugin.onCompositionUpdate = onCompositionUpdate;
|
|
182
|
+
}, [keyboardInputPlugin, onCompositionUpdate]);
|
|
183
|
+
const tableContextMenuPlugin = useMemo(() => {
|
|
184
|
+
return new TableEditContextMenuProvider();
|
|
185
|
+
}, []);
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
tableContextMenuPlugin.updateStrings(strings);
|
|
188
|
+
}, [tableContextMenuPlugin, strings]);
|
|
189
|
+
const onContextMenuRender = useCallback((container, items, onDismiss) => {
|
|
190
|
+
setContextMenuProps({
|
|
191
|
+
items: items,
|
|
192
|
+
target: container,
|
|
193
|
+
onDismiss: onDismiss
|
|
194
|
+
});
|
|
195
|
+
}, []);
|
|
196
|
+
const onContextMenuDismiss = useCallback(() => {
|
|
197
|
+
setContextMenuProps(null);
|
|
198
|
+
}, []);
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
copyPastePlugin.onPaste = onPaste;
|
|
201
|
+
}, [copyPastePlugin, onPaste]);
|
|
202
|
+
const plugins = useMemo(() => {
|
|
203
|
+
const contentEdit = new EditPlugin({
|
|
204
|
+
handleTabKey: false
|
|
205
|
+
});
|
|
206
|
+
// AutoFormatPlugin previously was a part of the edit plugin
|
|
207
|
+
const autoFormatPlugin = new AutoFormatPlugin({
|
|
208
|
+
autoBullet: true,
|
|
209
|
+
autoNumbering: true,
|
|
210
|
+
autoLink: true
|
|
211
|
+
});
|
|
212
|
+
const roosterPastePlugin = new PastePlugin(false, {
|
|
213
|
+
additionalDisallowedTags: ['head', '!doctype', '!cdata', '#comment'],
|
|
214
|
+
additionalAllowedTags: [],
|
|
215
|
+
styleSanitizers: DefaultSanitizers,
|
|
216
|
+
attributeSanitizers: {}
|
|
217
|
+
});
|
|
218
|
+
const shortcutPlugin = new ShortcutPlugin();
|
|
219
|
+
const contextMenuPlugin = new ContextMenuPlugin(onContextMenuRender, onContextMenuDismiss);
|
|
220
|
+
return [placeholderPlugin, keyboardInputPlugin, contentEdit, autoFormatPlugin, updatePlugin, copyPastePlugin, roosterPastePlugin, toolbarPlugin, shortcutPlugin,
|
|
221
|
+
// contextPlugin and tableEditMenuProvider allow to show insert/delete menu for the table
|
|
222
|
+
contextMenuPlugin, tableContextMenuPlugin, undoRedoPlugin];
|
|
223
|
+
}, [onContextMenuRender, onContextMenuDismiss, placeholderPlugin, keyboardInputPlugin, updatePlugin, copyPastePlugin, toolbarPlugin, tableContextMenuPlugin, undoRedoPlugin]);
|
|
224
|
+
const announcerStringGetter = useCallback((key) => {
|
|
225
|
+
var _a, _b;
|
|
226
|
+
switch (key) {
|
|
227
|
+
case 'announceListItemBullet':
|
|
228
|
+
return (_a = strings.richTextNewBulletedListItemAnnouncement) !== null && _a !== void 0 ? _a : '';
|
|
229
|
+
case 'announceListItemNumbering':
|
|
230
|
+
return (_b = strings.richTextNewNumberedListItemAnnouncement) !== null && _b !== void 0 ? _b : '';
|
|
231
|
+
case 'announceOnFocusLastCell':
|
|
232
|
+
return '';
|
|
233
|
+
}
|
|
234
|
+
}, [strings.richTextNewBulletedListItemAnnouncement, strings.richTextNewNumberedListItemAnnouncement]);
|
|
235
|
+
useEffect(() => {
|
|
236
|
+
var _a;
|
|
237
|
+
const prevInlineImage = getPreviousInlineImages(initialContent);
|
|
238
|
+
setPreviousInlineImages(prevInlineImage);
|
|
239
|
+
const initialModel = createEditorInitialModel(initialContent, contentModel);
|
|
240
|
+
if (editorDiv.current) {
|
|
241
|
+
editor.current = new Editor(editorDiv.current, {
|
|
242
|
+
generateColorKey: color => color,
|
|
243
|
+
// Needed to ensure override of text color in dark mode.
|
|
244
|
+
inDarkMode: isDarkThemed(theme),
|
|
245
|
+
// doNotAdjustEditorColor is used to disable default color and background color for Rooster component
|
|
246
|
+
doNotAdjustEditorColor: true,
|
|
247
|
+
imageSelectionBorderColor: theme.palette.themePrimary,
|
|
248
|
+
tableCellSelectionBackgroundColor: theme.palette.neutralLight,
|
|
249
|
+
plugins: plugins,
|
|
250
|
+
initialModel: initialModel,
|
|
251
|
+
defaultModelToDomOptions: {
|
|
252
|
+
formatApplierOverride: {
|
|
253
|
+
// apply border and dataset formats for table
|
|
254
|
+
border: borderApplier,
|
|
255
|
+
dataset: dataSetApplier
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
announcerStringGetter: announcerStringGetter
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
if (autoFocus === 'sendBoxTextField') {
|
|
262
|
+
(_a = editor.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
263
|
+
}
|
|
264
|
+
return () => {
|
|
265
|
+
if (editor.current) {
|
|
266
|
+
editor.current.dispose();
|
|
267
|
+
editor.current = null;
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
// don't update the editor on deps update as everything is handled in separate hooks or plugins
|
|
271
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
272
|
+
}, [theme, plugins, announcerStringGetter]);
|
|
273
|
+
useEffect(() => {
|
|
274
|
+
const themeDirectionValue = themeDirection(theme);
|
|
275
|
+
// check that editor exists and theme was actually changed
|
|
276
|
+
// as format.direction will be undefined if setDirection is not called
|
|
277
|
+
if (editor.current && previousThemeDirection.current !== themeDirectionValue) {
|
|
278
|
+
const format = getFormatState(editor.current);
|
|
279
|
+
if (format.direction !== themeDirectionValue) {
|
|
280
|
+
// should be set after the hook where editor is created as the editor might be null
|
|
281
|
+
// setDirection will cause the focus change back to the editor and this might not be what we want to do (autoFocus prop)
|
|
282
|
+
// that's why it's not part of the create editor hook
|
|
283
|
+
setDirection(editor.current, theme.rtl ? 'rtl' : 'ltr');
|
|
284
|
+
}
|
|
285
|
+
previousThemeDirection.current = themeDirectionValue;
|
|
286
|
+
}
|
|
287
|
+
}, [theme]);
|
|
288
|
+
return React.createElement("div", { "data-testid": 'rich-text-editor-wrapper' },
|
|
289
|
+
showRichTextEditorFormatting && toolbar,
|
|
290
|
+
React.createElement("div", { className: richTextEditorWrapperStyle(theme) },
|
|
291
|
+
React.createElement("div", { id: "richTextSendBox", ref: editorDiv, tabIndex: 0, role: "textbox", "aria-multiline": "true", "data-testid": 'rooster-rich-text-editor', className: richTextEditorStyle(props.styles), "aria-label": placeholderText })),
|
|
292
|
+
contextMenuProps && React.createElement(ContextualMenu, Object.assign({}, contextMenuProps, { calloutProps: {
|
|
293
|
+
isBeakVisible: false
|
|
294
|
+
} })));
|
|
295
|
+
});
|
|
296
|
+
const createEditorInitialModel = (initialContent, contentModel) => {
|
|
297
|
+
if (contentModel) {
|
|
298
|
+
// contentModel is the current content of the editor
|
|
299
|
+
return contentModel;
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
const initialContentValue = initialContent;
|
|
303
|
+
const initialModel = initialContentValue && initialContentValue.length > 0 ? createModelFromHtml(initialContentValue) : undefined;
|
|
304
|
+
if (initialModel && initialModel.blocks.length > 0) {
|
|
305
|
+
// lastBlock should have blockType = paragraph, otherwise add a new paragraph
|
|
306
|
+
// to set focus to the end of the content
|
|
307
|
+
const lastBlock = initialModel.blocks[initialModel.blocks.length - 1];
|
|
308
|
+
if ((lastBlock === null || lastBlock === void 0 ? void 0 : lastBlock.blockType) === 'Paragraph') {
|
|
309
|
+
// now lastBlock is paragraph
|
|
310
|
+
setSelectionAfterLastSegment(initialModel, lastBlock);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
const block = createParagraph(false);
|
|
314
|
+
initialModel.blocks.push(block);
|
|
315
|
+
setSelectionAfterLastSegment(initialModel, block);
|
|
316
|
+
// add content to the paragraph, otherwise height might be calculated incorrectly
|
|
317
|
+
block.segments.push(createBr());
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return initialModel;
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
const setSelectionAfterLastSegment = (model, block) => {
|
|
324
|
+
var _a;
|
|
325
|
+
//selection marker should have the same format as the last segment if any
|
|
326
|
+
const format = block.segments.length > 0 ? (_a = block.segments[block.segments.length - 1]) === null || _a === void 0 ? void 0 : _a.format : undefined;
|
|
327
|
+
const marker = createSelectionMarker(format);
|
|
328
|
+
block.segments.push(marker);
|
|
329
|
+
setSelection(model, marker);
|
|
330
|
+
};
|
|
331
|
+
const themeDirection = (theme) => {
|
|
332
|
+
return theme.rtl ? 'rtl' : 'ltr';
|
|
333
|
+
};
|
|
334
|
+
//# sourceMappingURL=RichTextEditor.js.map
|