@azure/communication-react 1.19.0-alpha-202407260014 → 1.19.0-alpha-202407270014
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 +3 -3
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-CWwHwLsl.js → ChatMessageComponentAsRichTextEditBox-BueeC-ud.js} +2 -2
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-CWwHwLsl.js.map → ChatMessageComponentAsRichTextEditBox-BueeC-ud.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-OHSjE5aJ.js → RichTextSendBoxWrapper-Br441vhG.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-OHSjE5aJ.js.map → RichTextSendBoxWrapper-Br441vhG.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-Dl3wPPJe.js → index-DznlW8XT.js} +31 -34
- package/dist/dist-cjs/communication-react/index-DznlW8XT.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +1 -1
- 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-stateful-client/src/CallClientState.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js +0 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/Converter.js +1 -3
- package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +3 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js +3 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery.js +9 -6
- package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +3 -0
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +1 -6
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +6 -4
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +3 -7
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +2 -8
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/package.json +2 -2
- package/dist/dist-cjs/communication-react/index-Dl3wPPJe.js.map +0 -1
@@ -3,9 +3,8 @@
|
|
3
3
|
import { toFlatCommunicationIdentifier } from "../../acs-ui-common/src";
|
4
4
|
/* @conditional-compile-remove(one-to-n-calling) */
|
5
5
|
import { _isTeamsIncomingCall } from './TypeGuards';
|
6
|
-
/* @conditional-compile-remove(teams-identity-support) */ /* @conditional-compile-remove(meeting-id) */
|
7
6
|
import { _isACSCall } from './TypeGuards';
|
8
|
-
/* @conditional-compile-remove(
|
7
|
+
/* @conditional-compile-remove(acs-close-captions) */
|
9
8
|
import { _isTeamsCall } from './TypeGuards';
|
10
9
|
import { Features } from '@azure/communication-calling';
|
11
10
|
/**
|
@@ -132,7 +131,6 @@ export function convertSdkCallToDeclarativeCall(call) {
|
|
132
131
|
},
|
133
132
|
/* @conditional-compile-remove(hide-attendee-name) */
|
134
133
|
hideAttendeeNames,
|
135
|
-
/* @conditional-compile-remove(meeting-id) */
|
136
134
|
info: callInfo,
|
137
135
|
/* @conditional-compile-remove(teams-meeting-conference) */
|
138
136
|
meetingConference: { conferencePhones: [] }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Converter.js","sourceRoot":"","sources":["../../../../../calling-stateful-client/src/Converter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAqBlC,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAaxE,mDAAmD;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,yDAAyD,CAAC,6CAA6C;AACvG,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,6CAA6C,CAAC,qDAAqD;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAUxD;;GAEG;AACH,MAAM,UAAU,6CAA6C,CAC3D,MAA2B;IAE3B,MAAM,0BAA0B,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAEzE,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,IAAI,EAAE,SAAS;QAEf,YAAY,EAAE,kDAAkD,CAAC,0BAA0B,CAAC,aAAa,CAAC;KAC3G,CAA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":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n RemoteParticipant as SdkRemoteParticipant,\n RemoteVideoStream as SdkRemoteVideoStream,\n LocalVideoStream as SdkLocalVideoStream,\n VideoStreamRendererView,\n IncomingCall,\n IncomingCallCommon\n} from '@azure/communication-calling';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { TeamsIncomingCall } from '@azure/communication-calling';\nimport { TeamsCaptionsInfo } from '@azure/communication-calling';\n/* @conditional-compile-remove(acs-close-captions) */\nimport { CaptionsInfo as AcsCaptionsInfo } from '@azure/communication-calling';\n/* @conditional-compile-remove(teams-identity-support) */\nimport { CallKind } from '@azure/communication-calling';\n/* @conditional-compile-remove(meeting-id) */\nimport { TeamsCallInfo } from '@azure/communication-calling';\n/* @conditional-compile-remove(calling-beta-sdk) */\nimport { CallInfo } from '@azure/communication-calling';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport {\n CallState,\n RemoteParticipantState as DeclarativeRemoteParticipant,\n RemoteVideoStreamState as DeclarativeRemoteVideoStream,\n LocalVideoStreamState as DeclarativeLocalVideoStream,\n IncomingCallState as DeclarativeIncomingCall,\n VideoStreamRendererViewState as DeclarativeVideoStreamRendererView,\n CallInfoState\n} from './CallClientState';\nimport { CaptionsInfo } from './CallClientState';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { TeamsIncomingCallState as DeclarativeTeamsIncomingCall } from './CallClientState';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { _isTeamsIncomingCall } from './TypeGuards';\n/* @conditional-compile-remove(teams-identity-support) */ /* @conditional-compile-remove(meeting-id) */\nimport { _isACSCall } from './TypeGuards';\n/* @conditional-compile-remove(meeting-id) */ /* @conditional-compile-remove(acs-close-captions) */\nimport { _isTeamsCall } from './TypeGuards';\nimport { CallCommon } from './BetaToStableTypes';\n\nimport { Features } from '@azure/communication-calling';\n\nimport { VideoEffectName } from '@azure/communication-calling';\n\nimport { LocalVideoStreamVideoEffectsState } from './CallClientState';\nimport { RaisedHand } from '@azure/communication-calling';\nimport { RaisedHandState } from './CallClientState';\nimport { TeamsMeetingAudioConferencingDetails } from '@azure/communication-calling';\nimport { ConferencePhoneInfo } from './CallClientState';\n\n/**\n * @private\n */\nexport function convertSdkLocalStreamToDeclarativeLocalStream(\n stream: SdkLocalVideoStream\n): DeclarativeLocalVideoStream {\n const localVideoStreamEffectsAPI = stream.feature(Features.VideoEffects);\n\n return {\n source: stream.source,\n mediaStreamType: stream.mediaStreamType,\n view: undefined,\n\n videoEffects: convertFromSDKToDeclarativeVideoStreamVideoEffects(localVideoStreamEffectsAPI.activeEffects)\n };\n}\n\n/**\n * @private\n */\nexport function convertSdkRemoteStreamToDeclarativeRemoteStream(\n stream: SdkRemoteVideoStream\n): DeclarativeRemoteVideoStream {\n return {\n id: stream.id,\n mediaStreamType: stream.mediaStreamType,\n isAvailable: stream.isAvailable,\n /* @conditional-compile-remove(video-stream-is-receiving-flag) */\n isReceiving: stream.isReceiving,\n view: undefined,\n streamSize: stream.size\n };\n}\n\n/**\n * @private\n */\nexport function convertSdkParticipantToDeclarativeParticipant(\n participant: SdkRemoteParticipant\n): DeclarativeRemoteParticipant {\n const declarativeVideoStreams: { [key: number]: DeclarativeRemoteVideoStream } = {};\n for (const videoStream of participant.videoStreams) {\n declarativeVideoStreams[videoStream.id] = convertSdkRemoteStreamToDeclarativeRemoteStream(videoStream);\n }\n return {\n identifier: participant.identifier,\n displayName: participant.displayName,\n state: participant.state,\n callEndReason: participant.callEndReason,\n videoStreams: declarativeVideoStreams,\n isMuted: participant.isMuted,\n isSpeaking: participant.isSpeaking,\n raisedHand: undefined,\n /* @conditional-compile-remove(hide-attendee-name) */\n role: participant.role,\n spotlight: undefined\n };\n}\n\n/**\n * @private\n *\n * Note at the time of writing only one LocalVideoStream is supported by the SDK.\n */\nexport function convertSdkCallToDeclarativeCall(call: CallCommon): CallState {\n const declarativeRemoteParticipants: { [key: string]: DeclarativeRemoteParticipant } = {};\n call.remoteParticipants.forEach((participant: SdkRemoteParticipant) => {\n declarativeRemoteParticipants[toFlatCommunicationIdentifier(participant.identifier)] =\n convertSdkParticipantToDeclarativeParticipant(participant);\n });\n /* @conditional-compile-remove(hide-attendee-name) */\n let hideAttendeeNames = false;\n /* @conditional-compile-remove(hide-attendee-name) */\n if (\n call.feature(Features.Capabilities).capabilities &&\n call.feature(Features.Capabilities).capabilities.viewAttendeeNames\n ) {\n const viewAttendeeNames = call.feature(Features.Capabilities).capabilities.viewAttendeeNames;\n if (!viewAttendeeNames.isPresent && viewAttendeeNames.reason === 'MeetingRestricted') {\n hideAttendeeNames = true;\n }\n }\n\n let callInfo: TeamsCallInfo | undefined | /* @conditional-compile-remove(calling-beta-sdk) */ CallInfo;\n if ('info' in call) {\n callInfo = call.info as TeamsCallInfo | undefined | /* @conditional-compile-remove(calling-beta-sdk) */ CallInfo;\n }\n\n return {\n id: call.id,\n /* @conditional-compile-remove(teams-identity-support) */\n kind: _isACSCall(call) ? ('Call' as CallKind) : ('TeamsCall' as CallKind),\n callerInfo: call.callerInfo,\n state: call.state,\n callEndReason: call.callEndReason,\n diagnostics: {\n network: {\n latest: {}\n },\n media: {\n latest: {}\n }\n },\n direction: call.direction,\n isMuted: call.isMuted,\n isScreenSharingOn: call.isScreenSharingOn,\n localVideoStreams: call.localVideoStreams.map(convertSdkLocalStreamToDeclarativeLocalStream),\n remoteParticipants: declarativeRemoteParticipants,\n remoteParticipantsEnded: {},\n recording: { isRecordingActive: false },\n /* @conditional-compile-remove(local-recording-notification) */\n localRecording: { isLocalRecordingActive: false },\n pptLive: { isActive: false },\n raiseHand: { raisedHands: [] },\n localParticipantReaction: undefined,\n transcription: { isTranscriptionActive: false },\n screenShareRemoteParticipant: undefined,\n startTime: new Date(),\n endTime: undefined,\n role: call.role,\n captionsFeature: {\n captions: [],\n supportedSpokenLanguages: [],\n supportedCaptionLanguages: [],\n currentCaptionLanguage: '',\n currentSpokenLanguage: '',\n isCaptionsFeatureActive: false,\n startCaptionsInProgress: false,\n /* @conditional-compile-remove(acs-close-captions) */\n captionsKind: _isTeamsCall(call) ? 'TeamsCaptions' : 'Captions'\n },\n transfer: {\n acceptedTransfers: {}\n },\n optimalVideoCount: {\n maxRemoteVideoStreams: call.feature(Features.OptimalVideoCount).optimalVideoCount\n },\n /* @conditional-compile-remove(hide-attendee-name) */\n hideAttendeeNames,\n /* @conditional-compile-remove(meeting-id) */\n info: callInfo,\n /* @conditional-compile-remove(teams-meeting-conference) */\n meetingConference: { conferencePhones: [] }\n };\n}\n\n/**\n * @private\n */\nexport function convertSdkIncomingCallToDeclarativeIncomingCall(\n call: IncomingCallCommon\n): DeclarativeIncomingCall | /* @conditional-compile-remove(one-to-n-calling) */ DeclarativeTeamsIncomingCall {\n /* @conditional-compile-remove(one-to-n-calling) */\n if (_isTeamsIncomingCall(call)) {\n const newInfo: CallInfoState = { ...(call as TeamsIncomingCall).info, kind: call.kind };\n return {\n id: call.id,\n info: newInfo,\n callerInfo: call.callerInfo,\n startTime: new Date(),\n endTime: undefined\n };\n } else {\n const newInfo: CallInfoState = { ...(call as IncomingCall).info, kind: call.kind };\n return {\n id: call.id,\n info: newInfo,\n callerInfo: call.callerInfo,\n startTime: new Date(),\n endTime: undefined\n };\n }\n const newInfo: CallInfoState = { ...(call as IncomingCall).info, kind: call.kind };\n return {\n id: call.id,\n info: newInfo,\n callerInfo: call.callerInfo,\n startTime: new Date(),\n endTime: undefined\n };\n}\n\n/**\n * @private\n */\nexport function convertFromSDKToDeclarativeVideoStreamRendererView(\n view: VideoStreamRendererView\n): DeclarativeVideoStreamRendererView {\n return {\n scalingMode: view.scalingMode,\n isMirrored: view.isMirrored,\n target: view.target\n };\n}\n\n/**\n * @private\n */\nexport function convertFromTeamsSDKToCaptionInfoState(caption: TeamsCaptionsInfo): CaptionsInfo {\n return {\n ...caption\n };\n}\n\n/* @conditional-compile-remove(acs-close-captions) */\n/**\n * @private\n */\nexport function convertFromSDKToCaptionInfoState(caption: AcsCaptionsInfo): CaptionsInfo {\n return {\n captionText: caption.spokenText,\n ...caption\n };\n}\n\n/** @private */\nexport function convertFromSDKToDeclarativeVideoStreamVideoEffects(\n videoEffects: VideoEffectName[]\n): LocalVideoStreamVideoEffectsState {\n return {\n activeEffects: videoEffects\n };\n}\n\n/**\n * @private\n */\nexport function convertFromSDKToRaisedHandState(raisedHand: RaisedHand): RaisedHandState {\n return {\n raisedHandOrderPosition: raisedHand.order\n };\n}\n\n/** @private */\nexport function convertConferencePhoneInfo(\n meetingConferencePhoneInfo?: TeamsMeetingAudioConferencingDetails\n): ConferencePhoneInfo[] {\n if (!meetingConferencePhoneInfo) {\n return [];\n }\n\n return meetingConferencePhoneInfo.phoneNumbers.flatMap((phoneNumber) => {\n const common = {\n conferenceId: meetingConferencePhoneInfo.phoneConferenceId,\n country: phoneNumber.countryName,\n city: phoneNumber.cityName,\n phoneNumber: '',\n isTollFree: false\n };\n const toll = Object.assign({}, common);\n toll.phoneNumber = phoneNumber.tollPhoneNumber?.phoneNumber ?? '';\n toll.isTollFree = false;\n\n const tollFree = Object.assign({}, common);\n tollFree.phoneNumber = phoneNumber.tollFreePhoneNumber?.phoneNumber ?? '';\n tollFree.isTollFree = true;\n\n return [toll, tollFree].filter((phoneInfo) => phoneInfo.phoneNumber);\n });\n}\n"]}
|
1
|
+
{"version":3,"file":"Converter.js","sourceRoot":"","sources":["../../../../../calling-stateful-client/src/Converter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAoBlC,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAaxE,mDAAmD;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,qDAAqD;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAUxD;;GAEG;AACH,MAAM,UAAU,6C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AA,WAAW,CAAC,mBAAmB,0CAAE,WAAW,mCAAI,EAAE,CAAC;QAC1E,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;QAE3B,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n RemoteParticipant as SdkRemoteParticipant,\n RemoteVideoStream as SdkRemoteVideoStream,\n LocalVideoStream as SdkLocalVideoStream,\n VideoStreamRendererView,\n IncomingCall,\n IncomingCallCommon\n} from '@azure/communication-calling';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { TeamsIncomingCall } from '@azure/communication-calling';\nimport { TeamsCaptionsInfo } from '@azure/communication-calling';\n/* @conditional-compile-remove(acs-close-captions) */\nimport { CaptionsInfo as AcsCaptionsInfo } from '@azure/communication-calling';\n/* @conditional-compile-remove(teams-identity-support) */\nimport { CallKind } from '@azure/communication-calling';\nimport { TeamsCallInfo } from '@azure/communication-calling';\n/* @conditional-compile-remove(calling-beta-sdk) */\nimport { CallInfo } from '@azure/communication-calling';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport {\n CallState,\n RemoteParticipantState as DeclarativeRemoteParticipant,\n RemoteVideoStreamState as DeclarativeRemoteVideoStream,\n LocalVideoStreamState as DeclarativeLocalVideoStream,\n IncomingCallState as DeclarativeIncomingCall,\n VideoStreamRendererViewState as DeclarativeVideoStreamRendererView,\n CallInfoState\n} from './CallClientState';\nimport { CaptionsInfo } from './CallClientState';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { TeamsIncomingCallState as DeclarativeTeamsIncomingCall } from './CallClientState';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { _isTeamsIncomingCall } from './TypeGuards';\nimport { _isACSCall } from './TypeGuards';\n/* @conditional-compile-remove(acs-close-captions) */\nimport { _isTeamsCall } from './TypeGuards';\nimport { CallCommon } from './BetaToStableTypes';\n\nimport { Features } from '@azure/communication-calling';\n\nimport { VideoEffectName } from '@azure/communication-calling';\n\nimport { LocalVideoStreamVideoEffectsState } from './CallClientState';\nimport { RaisedHand } from '@azure/communication-calling';\nimport { RaisedHandState } from './CallClientState';\nimport { TeamsMeetingAudioConferencingDetails } from '@azure/communication-calling';\nimport { ConferencePhoneInfo } from './CallClientState';\n\n/**\n * @private\n */\nexport function convertSdkLocalStreamToDeclarativeLocalStream(\n stream: SdkLocalVideoStream\n): DeclarativeLocalVideoStream {\n const localVideoStreamEffectsAPI = stream.feature(Features.VideoEffects);\n\n return {\n source: stream.source,\n mediaStreamType: stream.mediaStreamType,\n view: undefined,\n\n videoEffects: convertFromSDKToDeclarativeVideoStreamVideoEffects(localVideoStreamEffectsAPI.activeEffects)\n };\n}\n\n/**\n * @private\n */\nexport function convertSdkRemoteStreamToDeclarativeRemoteStream(\n stream: SdkRemoteVideoStream\n): DeclarativeRemoteVideoStream {\n return {\n id: stream.id,\n mediaStreamType: stream.mediaStreamType,\n isAvailable: stream.isAvailable,\n /* @conditional-compile-remove(video-stream-is-receiving-flag) */\n isReceiving: stream.isReceiving,\n view: undefined,\n streamSize: stream.size\n };\n}\n\n/**\n * @private\n */\nexport function convertSdkParticipantToDeclarativeParticipant(\n participant: SdkRemoteParticipant\n): DeclarativeRemoteParticipant {\n const declarativeVideoStreams: { [key: number]: DeclarativeRemoteVideoStream } = {};\n for (const videoStream of participant.videoStreams) {\n declarativeVideoStreams[videoStream.id] = convertSdkRemoteStreamToDeclarativeRemoteStream(videoStream);\n }\n return {\n identifier: participant.identifier,\n displayName: participant.displayName,\n state: participant.state,\n callEndReason: participant.callEndReason,\n videoStreams: declarativeVideoStreams,\n isMuted: participant.isMuted,\n isSpeaking: participant.isSpeaking,\n raisedHand: undefined,\n /* @conditional-compile-remove(hide-attendee-name) */\n role: participant.role,\n spotlight: undefined\n };\n}\n\n/**\n * @private\n *\n * Note at the time of writing only one LocalVideoStream is supported by the SDK.\n */\nexport function convertSdkCallToDeclarativeCall(call: CallCommon): CallState {\n const declarativeRemoteParticipants: { [key: string]: DeclarativeRemoteParticipant } = {};\n call.remoteParticipants.forEach((participant: SdkRemoteParticipant) => {\n declarativeRemoteParticipants[toFlatCommunicationIdentifier(participant.identifier)] =\n convertSdkParticipantToDeclarativeParticipant(participant);\n });\n /* @conditional-compile-remove(hide-attendee-name) */\n let hideAttendeeNames = false;\n /* @conditional-compile-remove(hide-attendee-name) */\n if (\n call.feature(Features.Capabilities).capabilities &&\n call.feature(Features.Capabilities).capabilities.viewAttendeeNames\n ) {\n const viewAttendeeNames = call.feature(Features.Capabilities).capabilities.viewAttendeeNames;\n if (!viewAttendeeNames.isPresent && viewAttendeeNames.reason === 'MeetingRestricted') {\n hideAttendeeNames = true;\n }\n }\n\n let callInfo: TeamsCallInfo | undefined | /* @conditional-compile-remove(calling-beta-sdk) */ CallInfo;\n if ('info' in call) {\n callInfo = call.info as TeamsCallInfo | undefined | /* @conditional-compile-remove(calling-beta-sdk) */ CallInfo;\n }\n\n return {\n id: call.id,\n /* @conditional-compile-remove(teams-identity-support) */\n kind: _isACSCall(call) ? ('Call' as CallKind) : ('TeamsCall' as CallKind),\n callerInfo: call.callerInfo,\n state: call.state,\n callEndReason: call.callEndReason,\n diagnostics: {\n network: {\n latest: {}\n },\n media: {\n latest: {}\n }\n },\n direction: call.direction,\n isMuted: call.isMuted,\n isScreenSharingOn: call.isScreenSharingOn,\n localVideoStreams: call.localVideoStreams.map(convertSdkLocalStreamToDeclarativeLocalStream),\n remoteParticipants: declarativeRemoteParticipants,\n remoteParticipantsEnded: {},\n recording: { isRecordingActive: false },\n /* @conditional-compile-remove(local-recording-notification) */\n localRecording: { isLocalRecordingActive: false },\n pptLive: { isActive: false },\n raiseHand: { raisedHands: [] },\n localParticipantReaction: undefined,\n transcription: { isTranscriptionActive: false },\n screenShareRemoteParticipant: undefined,\n startTime: new Date(),\n endTime: undefined,\n role: call.role,\n captionsFeature: {\n captions: [],\n supportedSpokenLanguages: [],\n supportedCaptionLanguages: [],\n currentCaptionLanguage: '',\n currentSpokenLanguage: '',\n isCaptionsFeatureActive: false,\n startCaptionsInProgress: false,\n /* @conditional-compile-remove(acs-close-captions) */\n captionsKind: _isTeamsCall(call) ? 'TeamsCaptions' : 'Captions'\n },\n transfer: {\n acceptedTransfers: {}\n },\n optimalVideoCount: {\n maxRemoteVideoStreams: call.feature(Features.OptimalVideoCount).optimalVideoCount\n },\n /* @conditional-compile-remove(hide-attendee-name) */\n hideAttendeeNames,\n info: callInfo,\n /* @conditional-compile-remove(teams-meeting-conference) */\n meetingConference: { conferencePhones: [] }\n };\n}\n\n/**\n * @private\n */\nexport function convertSdkIncomingCallToDeclarativeIncomingCall(\n call: IncomingCallCommon\n): DeclarativeIncomingCall | /* @conditional-compile-remove(one-to-n-calling) */ DeclarativeTeamsIncomingCall {\n /* @conditional-compile-remove(one-to-n-calling) */\n if (_isTeamsIncomingCall(call)) {\n const newInfo: CallInfoState = { ...(call as TeamsIncomingCall).info, kind: call.kind };\n return {\n id: call.id,\n info: newInfo,\n callerInfo: call.callerInfo,\n startTime: new Date(),\n endTime: undefined\n };\n } else {\n const newInfo: CallInfoState = { ...(call as IncomingCall).info, kind: call.kind };\n return {\n id: call.id,\n info: newInfo,\n callerInfo: call.callerInfo,\n startTime: new Date(),\n endTime: undefined\n };\n }\n const newInfo: CallInfoState = { ...(call as IncomingCall).info, kind: call.kind };\n return {\n id: call.id,\n info: newInfo,\n callerInfo: call.callerInfo,\n startTime: new Date(),\n endTime: undefined\n };\n}\n\n/**\n * @private\n */\nexport function convertFromSDKToDeclarativeVideoStreamRendererView(\n view: VideoStreamRendererView\n): DeclarativeVideoStreamRendererView {\n return {\n scalingMode: view.scalingMode,\n isMirrored: view.isMirrored,\n target: view.target\n };\n}\n\n/**\n * @private\n */\nexport function convertFromTeamsSDKToCaptionInfoState(caption: TeamsCaptionsInfo): CaptionsInfo {\n return {\n ...caption\n };\n}\n\n/* @conditional-compile-remove(acs-close-captions) */\n/**\n * @private\n */\nexport function convertFromSDKToCaptionInfoState(caption: AcsCaptionsInfo): CaptionsInfo {\n return {\n captionText: caption.spokenText,\n ...caption\n };\n}\n\n/** @private */\nexport function convertFromSDKToDeclarativeVideoStreamVideoEffects(\n videoEffects: VideoEffectName[]\n): LocalVideoStreamVideoEffectsState {\n return {\n activeEffects: videoEffects\n };\n}\n\n/**\n * @private\n */\nexport function convertFromSDKToRaisedHandState(raisedHand: RaisedHand): RaisedHandState {\n return {\n raisedHandOrderPosition: raisedHand.order\n };\n}\n\n/** @private */\nexport function convertConferencePhoneInfo(\n meetingConferencePhoneInfo?: TeamsMeetingAudioConferencingDetails\n): ConferencePhoneInfo[] {\n if (!meetingConferencePhoneInfo) {\n return [];\n }\n\n return meetingConferencePhoneInfo.phoneNumbers.flatMap((phoneNumber) => {\n const common = {\n conferenceId: meetingConferencePhoneInfo.phoneConferenceId,\n country: phoneNumber.countryName,\n city: phoneNumber.cityName,\n phoneNumber: '',\n isTollFree: false\n };\n const toll = Object.assign({}, common);\n toll.phoneNumber = phoneNumber.tollPhoneNumber?.phoneNumber ?? '';\n toll.isTollFree = false;\n\n const tollFree = Object.assign({}, common);\n tollFree.phoneNumber = phoneNumber.tollFreePhoneNumber?.phoneNumber ?? '';\n tollFree.isTollFree = true;\n\n return [toll, tollFree].filter((phoneInfo) => phoneInfo.phoneNumber);\n });\n}\n"]}
|
@@ -19,6 +19,6 @@ export declare class RichTextToolbarPlugin implements EditorPlugin {
|
|
19
19
|
* Updates the format state of the rich text editor and triggers the `onFormatChanged` callback
|
20
20
|
* if there is any difference between the new and the current format states.
|
21
21
|
*/
|
22
|
-
|
22
|
+
updateFormat(): void;
|
23
23
|
}
|
24
24
|
//# sourceMappingURL=RichTextToolbarPlugin.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RichTextToolbarPlugin.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAAlC;QACU,gBAAW,GAAmC,IAAI,CAAC;QACnD,WAAM,GAAmB,IAAI,CAAC;QACtC,oBAAe,GAA4D,IAAI,CAAC;IA0DlF,CAAC;IAxDC,OAAO;QACL,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,UAAU,CAAC,MAAe;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,aAAa,CAAC,KAAkB;QAC9B,QAAQ,KAAK,CAAC,SAAS,EAAE,CAAC;YACxB,4GAA4G;YAC5G,KAAK,eAAe,CAAC,WAAW,CAAC;YACjC,KAAK,eAAe,CAAC,cAAc,CAAC;YACpC,KAAK,eAAe,CAAC,WAAW,CAAC;YACjC,KAAK,eAAe,CAAC,OAAO,CAAC;YAC7B,KAAK,eAAe,CAAC,OAAO;gBAC1B,IAAI,CAAC,YAAY,EAAE,CAAC;gBACpB,MAAM;QACV,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,oBAAoB,CAAC,YAAuC;QAC1D,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;YAC7C,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1B,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IAED;;;OAGG;
|
1
|
+
{"version":3,"file":"RichTextToolbarPlugin.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAAlC;QACU,gBAAW,GAAmC,IAAI,CAAC;QACnD,WAAM,GAAmB,IAAI,CAAC;QACtC,oBAAe,GAA4D,IAAI,CAAC;IA0DlF,CAAC;IAxDC,OAAO;QACL,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,UAAU,CAAC,MAAe;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,aAAa,CAAC,KAAkB;QAC9B,QAAQ,KAAK,CAAC,SAAS,EAAE,CAAC;YACxB,4GAA4G;YAC5G,KAAK,eAAe,CAAC,WAAW,CAAC;YACjC,KAAK,eAAe,CAAC,cAAc,CAAC;YACpC,KAAK,eAAe,CAAC,WAAW,CAAC;YACjC,KAAK,eAAe,CAAC,OAAO,CAAC;YAC7B,KAAK,eAAe,CAAC,OAAO;gBAC1B,IAAI,CAAC,YAAY,EAAE,CAAC;gBACpB,MAAM;QACV,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,oBAAoB,CAAC,YAAuC;QAC1D,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;YAC7C,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1B,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,YAAY;QACV,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACxC,MAAM,cAAc,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnD,0GAA0G;YAC1G,MAAM,IAAI,GACR,CAAC,IAAI,CAAC,WAAW,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM;gBAChG,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC;gBAC/B,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACtC,6FAA6F;YAC7F,kGAAkG;YAClG,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,WAAC,OAAA,cAAc,CAAC,GAAG,CAAC,MAAK,MAAA,IAAI,CAAC,WAAW,0CAAG,GAAG,CAAC,CAAA,CAAA,EAAA,CAAC,EAAE,CAAC;gBAC7F,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC;gBAClC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getFormatState } from 'roosterjs-content-model-api';\nimport { getObjectKeys } from 'roosterjs-content-model-dom';\nimport type { ContentModelFormatState, EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';\nimport { PluginEventType } from '../../utils/RichTextEditorUtils';\n\n/**\n * KeyboardInputPlugin is a plugin for handling keyboard events in the editor.\n */\nexport class RichTextToolbarPlugin implements EditorPlugin {\n private formatState: ContentModelFormatState | null = null;\n private editor: IEditor | null = null;\n onFormatChanged: ((formatState: ContentModelFormatState) => void) | null = null;\n\n getName(): string {\n return 'RichTextToolbarPlugin';\n }\n\n initialize(editor: IEditor): void {\n this.editor = editor;\n }\n\n dispose(): void {\n this.editor = null;\n }\n\n onPluginEvent(event: PluginEvent): void {\n switch (event.eventType) {\n // KeyDown and MouseUp are used to update the state when the editor is already shown and focused by the user\n case PluginEventType.EditorReady:\n case PluginEventType.ContentChanged:\n case PluginEventType.ZoomChanged:\n case PluginEventType.KeyDown:\n case PluginEventType.MouseUp:\n this.updateFormat();\n break;\n }\n }\n\n /**\n * Handles the click event of a toolbar button.\n * @param buttonAction - The action to be performed when the button is clicked.\n */\n onToolbarButtonClick(buttonAction: (editor: IEditor) => void): void {\n if (this.editor && !this.editor.isDisposed()) {\n buttonAction(this.editor);\n this.updateFormat();\n }\n }\n\n /**\n * Updates the format state of the rich text editor and triggers the `onFormatChanged` callback\n * if there is any difference between the new and the current format states.\n */\n updateFormat(): void {\n if (this.editor && this.onFormatChanged) {\n const newFormatState = getFormatState(this.editor);\n // use keys from the format that has more keys or the new format state if there is no current format state\n const keys =\n !this.formatState || getObjectKeys(newFormatState).length > getObjectKeys(this.formatState).length\n ? getObjectKeys(newFormatState)\n : getObjectKeys(this.formatState);\n // check if there is any difference between the new format state and the current format state\n // otherwise the states will produce new objects every time even when the format state is the same\n if (!this.formatState || keys.some((key) => newFormatState[key] !== this.formatState?.[key])) {\n this.formatState = newFormatState;\n this.onFormatChanged(newFormatState);\n }\n }\n }\n}\n"]}
|
@@ -267,7 +267,9 @@ const createEditorInitialModel = (initialContent, contentModel) => {
|
|
267
267
|
}
|
268
268
|
};
|
269
269
|
const setSelectionAfterLastSegment = (model, block) => {
|
270
|
-
|
270
|
+
//selection marker should have the same format as the last segment if any
|
271
|
+
const format = block.segments.length > 0 ? block.segments[block.segments.length - 1].format : undefined;
|
272
|
+
const marker = createSelectionMarker(format);
|
271
273
|
block.segments.push(marker);
|
272
274
|
setSelection(model, marker);
|
273
275
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RichTextEditor.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/RichTextEditor/RichTextEditor.tsx"],"names":[],"mapp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YACxD,CAAC;iBAAM,CAAC;gBACN,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;gBACrC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAChC,4BAA4B,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;gBAClD,iFAAiF;gBACjF,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAG,CAAC,KAAqC,EAAE,KAA4B,EAAQ,EAAE;IACjH,MAAM,MAAM,GAAG,qBAAqB,EAAE,CAAC;IACvC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAY,EAAiB,EAAE;IACrD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AACnC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport { richTextEditorWrapperStyle, richTextEditorStyle } from '../styles/RichTextEditor.styles';\nimport { useTheme } from '../../theming';\nimport { RichTextStrings } from './RichTextSendBox';\nimport { isDarkThemed } from '../../theming/themeUtils';\nimport CopyPastePlugin from './Plugins/CopyPastePlugin';\nimport type {\n ContentModelDocument,\n ContentModelParagraph,\n EditorPlugin,\n IEditor,\n ReadonlyContentModelBlockGroup,\n ShallowMutableContentModelDocument,\n KnownAnnounceStrings\n} from 'roosterjs-content-model-types';\nimport { createModelFromHtml, Editor, exportContent } from 'roosterjs-content-model-core';\nimport {\n createBr,\n createEmptyModel,\n createParagraph,\n createSelectionMarker,\n setSelection\n} from 'roosterjs-content-model-dom';\nimport { KeyboardInputPlugin } from './Plugins/KeyboardInputPlugin';\nimport {\n AutoFormatPlugin,\n EditPlugin,\n PastePlugin,\n ShortcutPlugin,\n DefaultSanitizers\n} from 'roosterjs-content-model-plugins';\nimport { UpdateContentPlugin, UpdateEvent } from './Plugins/UpdateContentPlugin';\nimport { RichTextToolbar } from './Toolbar/RichTextToolbar';\nimport { RichTextToolbarPlugin } from './Plugins/RichTextToolbarPlugin';\nimport { ContextMenuPlugin } from './Plugins/ContextMenuPlugin';\nimport { TableEditContextMenuProvider } from './Plugins/TableEditContextMenuProvider';\nimport { borderApplier, dataSetApplier } from '../utils/RichTextEditorUtils';\nimport { ContextualMenu, IContextualMenuItem, IContextualMenuProps, Theme } from '@fluentui/react';\nimport { PlaceholderPlugin } from './Plugins/PlaceholderPlugin';\nimport { getFormatState, setDirection } from 'roosterjs-content-model-api';\n\n/**\n * Style props for {@link RichTextEditor}.\n *\n * @private\n */\nexport interface RichTextEditorStyleProps {\n minHeight: string;\n maxHeight: string;\n}\n\n/**\n * Props for {@link RichTextEditor}.\n *\n * @private\n */\nexport interface RichTextEditorProps {\n // the initial content of editor that is set when editor is created (e.g. when editing a message)\n initialContent?: string;\n onChange: (newValue?: string, imageSrcArray?: Array<string>) => void;\n onKeyDown?: (ev: KeyboardEvent) => void;\n // update the current content of the rich text editor\n onContentModelUpdate?: (contentModel: ContentModelDocument | undefined) => void;\n contentModel?: ContentModelDocument | undefined;\n placeholderText?: string;\n strings: Partial<RichTextStrings>;\n showRichTextEditorFormatting: boolean;\n styles: RichTextEditorStyleProps;\n autoFocus?: 'sendBoxTextField';\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage?: (imageUrl: string, imageFileName: string) => void;\n}\n\n/**\n * Represents a reference to the RichTextEditor component.\n */\nexport interface RichTextEditorComponentRef {\n /**\n * Sets focus on the RichTextEditor component.\n */\n focus: () => void;\n\n /**\n * Sets the content of the RichTextEditor component to an empty string.\n */\n setEmptyContent: () => void;\n\n /**\n * Retrieves the plain text content of the RichTextEditor component.\n * @returns The plain text content of the RichTextEditor component, or undefined if the editor isn't available.\n */\n getPlainContent: () => string | undefined;\n}\n\n/**\n * A component to wrap RoosterJS Rich Text Editor.\n *\n * @beta\n */\nexport const RichTextEditor = React.forwardRef<RichTextEditorComponentRef, RichTextEditorProps>((props, ref) => {\n const {\n initialContent,\n onChange,\n placeholderText,\n strings,\n showRichTextEditorFormatting,\n autoFocus,\n onKeyDown,\n onContentModelUpdate,\n contentModel,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage\n } = props;\n const editor = useRef<IEditor | null>(null);\n const editorDiv = useRef<HTMLDivElement>(null);\n const theme = useTheme();\n const [contextMenuProps, setContextMenuProps] = useState<IContextualMenuProps | null>(null);\n const previousThemeDirection = useRef(themeDirection(theme));\n\n useImperativeHandle(ref, () => {\n return {\n focus() {\n if (editor.current) {\n editor.current.focus();\n }\n },\n setEmptyContent() {\n if (editor.current) {\n // remove all content from the editor and update the model\n // ContentChanged event will be sent by RoosterJS automatically\n editor.current.formatContentModel((model: ShallowMutableContentModelDocument): boolean => {\n // Create a new empty paragraph with selection marker\n // this is needed for correct processing of images after the content is deleted\n const newModel = createEmptyModel();\n model.blocks = newModel.blocks;\n return true;\n });\n //reset content model\n onContentModelUpdate && onContentModelUpdate(editor.current.getContentModelCopy('disconnected'));\n }\n },\n getPlainContent() {\n if (editor.current) {\n return exportContent(editor.current, 'PlainTextFast');\n } else {\n return undefined;\n }\n }\n };\n }, [onContentModelUpdate]);\n\n const toolbarPlugin = React.useMemo(() => {\n return new RichTextToolbarPlugin();\n }, []);\n\n const placeholderPlugin = useMemo(() => {\n const textColor = theme.palette?.neutralSecondary;\n return new PlaceholderPlugin(\n '',\n textColor\n ? {\n textColor: textColor\n }\n : undefined\n );\n }, [theme]);\n\n useEffect(() => {\n if (placeholderText !== undefined) {\n placeholderPlugin.updatePlaceholder(placeholderText);\n }\n }, [placeholderPlugin, placeholderText]);\n\n const toolbar = useMemo(() => {\n return <RichTextToolbar plugin={toolbarPlugin} strings={strings} />;\n }, [strings, toolbarPlugin]);\n\n const updatePlugin = useMemo(() => {\n return new UpdateContentPlugin();\n }, []);\n\n const copyPastePlugin = useMemo(() => {\n return new CopyPastePlugin();\n }, []);\n\n useEffect(() => {\n // don't set callback in plugin constructor to update callback without plugin recreation\n updatePlugin.onUpdate = (event: string, imageSrcArray?: Array<string>) => {\n if (editor.current === null) {\n return;\n }\n if (event === UpdateEvent.Blur || event === UpdateEvent.Dispose) {\n onContentModelUpdate && onContentModelUpdate(editor.current.getContentModelCopy('disconnected'));\n } else {\n onChange && onChange(exportContent(editor.current), imageSrcArray);\n }\n };\n }, [onChange, onContentModelUpdate, updatePlugin]);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n useEffect(() => {\n copyPastePlugin.onInsertInlineImage = onInsertInlineImage;\n }, [copyPastePlugin, onInsertInlineImage]);\n\n const keyboardInputPlugin = useMemo(() => {\n return new KeyboardInputPlugin();\n }, []);\n\n useEffect(() => {\n // don't set callback in plugin constructor to update callback without plugin recreation\n keyboardInputPlugin.onKeyDown = onKeyDown;\n }, [keyboardInputPlugin, onKeyDown]);\n\n const tableContextMenuPlugin = useMemo(() => {\n return new TableEditContextMenuProvider();\n }, []);\n\n useEffect(() => {\n tableContextMenuPlugin.updateStrings(strings);\n }, [tableContextMenuPlugin, strings]);\n\n const onContextMenuRender = useCallback(\n (container: HTMLElement, items: IContextualMenuItem[], onDismiss: () => void): void => {\n setContextMenuProps({\n items: items,\n target: container,\n onDismiss: onDismiss\n });\n },\n []\n );\n\n const onContextMenuDismiss = useCallback((): void => {\n setContextMenuProps(null);\n }, []);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n useEffect(() => {\n copyPastePlugin.onPaste = onPaste;\n }, [copyPastePlugin, onPaste]);\n\n const plugins: EditorPlugin[] = useMemo(() => {\n const contentEdit = new EditPlugin({ handleTabKey: false });\n // AutoFormatPlugin previously was a part of the edit plugin\n const autoFormatPlugin = new AutoFormatPlugin({ autoBullet: true, autoNumbering: true, autoLink: true });\n const roosterPastePlugin = new PastePlugin(false, {\n additionalDisallowedTags: ['head', '!doctype', '!cdata', '#comment'],\n additionalAllowedTags: [],\n styleSanitizers: DefaultSanitizers,\n attributeSanitizers: {}\n });\n\n const shortcutPlugin = new ShortcutPlugin();\n const contextMenuPlugin = new ContextMenuPlugin(onContextMenuRender, onContextMenuDismiss);\n return [\n placeholderPlugin,\n keyboardInputPlugin,\n contentEdit,\n autoFormatPlugin,\n updatePlugin,\n copyPastePlugin,\n roosterPastePlugin,\n toolbarPlugin,\n shortcutPlugin,\n // contextPlugin and tableEditMenuProvider allow to show insert/delete menu for the table\n contextMenuPlugin,\n tableContextMenuPlugin\n ];\n }, [\n onContextMenuRender,\n onContextMenuDismiss,\n placeholderPlugin,\n keyboardInputPlugin,\n updatePlugin,\n copyPastePlugin,\n toolbarPlugin,\n tableContextMenuPlugin\n ]);\n\n const announcerStringGetter = useCallback(\n (key: KnownAnnounceStrings): string => {\n switch (key) {\n case 'announceListItemBullet':\n return strings.richTextNewBulletedListItemAnnouncement ?? '';\n case 'announceListItemNumbering':\n return strings.richTextNewNumberedListItemAnnouncement ?? '';\n case 'announceOnFocusLastCell':\n return '';\n }\n },\n [strings.richTextNewBulletedListItemAnnouncement, strings.richTextNewNumberedListItemAnnouncement]\n );\n\n useEffect(() => {\n const initialModel = createEditorInitialModel(initialContent, contentModel);\n if (editorDiv.current) {\n editor.current = new Editor(editorDiv.current, {\n inDarkMode: isDarkThemed(theme),\n // doNotAdjustEditorColor is used to disable default color and background color for Rooster component\n doNotAdjustEditorColor: true,\n imageSelectionBorderColor: theme.palette.themePrimary,\n tableCellSelectionBackgroundColor: theme.palette.neutralLight,\n plugins: plugins,\n initialModel: initialModel,\n defaultModelToDomOptions: {\n formatApplierOverride: {\n // apply border and dataset formats for table\n border: borderApplier,\n dataset: dataSetApplier\n }\n },\n announcerStringGetter: announcerStringGetter\n });\n }\n\n if (autoFocus === 'sendBoxTextField') {\n editor.current?.focus();\n }\n\n return () => {\n if (editor.current) {\n editor.current.dispose();\n editor.current = null;\n }\n };\n // don't update the editor on deps update as everything is handled in separate hooks or plugins\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme, plugins, announcerStringGetter]);\n\n useEffect(() => {\n const themeDirectionValue = themeDirection(theme);\n // check that editor exists and theme was actually changed\n // as format.direction will be undefined if setDirection is not called\n if (editor.current && previousThemeDirection.current !== themeDirectionValue) {\n const format = getFormatState(editor.current);\n if (format.direction !== themeDirectionValue) {\n // should be set after the hook where editor is created as the editor might be null\n // setDirection will cause the focus change back to the editor and this might not be what we want to do (autoFocus prop)\n // that's why it's not part of the create editor hook\n setDirection(editor.current, theme.rtl ? 'rtl' : 'ltr');\n }\n previousThemeDirection.current = themeDirectionValue;\n }\n }, [theme]);\n\n return (\n <div data-testid={'rich-text-editor-wrapper'}>\n {showRichTextEditorFormatting && toolbar}\n <div className={richTextEditorWrapperStyle(theme)}>\n {/* div that is used by Rooster JS as a parent of the editor */}\n <div\n id=\"richTextSendBox\"\n ref={editorDiv}\n tabIndex={0}\n role=\"textbox\"\n aria-multiline=\"true\"\n data-testid={'rooster-rich-text-editor'}\n className={richTextEditorStyle(props.styles)}\n aria-label={placeholderText}\n />\n </div>\n {contextMenuProps && <ContextualMenu {...contextMenuProps} calloutProps={{ isBeakVisible: false }} />}\n </div>\n );\n});\n\nconst createEditorInitialModel = (\n initialContent?: string,\n contentModel?: ContentModelDocument\n): ContentModelDocument | undefined => {\n if (contentModel) {\n // contentModel is the current content of the editor\n return contentModel;\n } else {\n const initialContentValue = initialContent;\n const initialModel =\n initialContentValue && initialContentValue.length > 0 ? createModelFromHtml(initialContentValue) : undefined;\n if (initialModel && initialModel.blocks.length > 0) {\n // lastBlock should have blockType = paragraph, otherwise add a new paragraph\n // to set focus to the end of the content\n const lastBlock = initialModel.blocks[initialModel.blocks.length - 1];\n if (lastBlock?.blockType === 'Paragraph') {\n // now lastBlock is paragraph\n setSelectionAfterLastSegment(initialModel, lastBlock);\n } else {\n const block = createParagraph(false);\n initialModel.blocks.push(block);\n setSelectionAfterLastSegment(initialModel, block);\n // add content to the paragraph, otherwise height might be calculated incorrectly\n block.segments.push(createBr());\n }\n }\n return initialModel;\n }\n};\n\nconst setSelectionAfterLastSegment = (model: ReadonlyContentModelBlockGroup, block: ContentModelParagraph): void => {\n const marker = createSelectionMarker();\n block.segments.push(marker);\n setSelection(model, marker);\n};\n\nconst themeDirection = (theme: Theme): 'rtl' | 'ltr' => {\n return theme.rtl ? 'rtl' : 'ltr';\n};\n"]}
|
1
|
+
{"version":3,"file":"RichTextEditor.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/RichTextEditor/RichTextEditor.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtG,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAUxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,YAAY,EACb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,+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AAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACxG,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAY,EAAiB,EAAE;IACrD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AACnC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport { richTextEditorWrapperStyle, richTextEditorStyle } from '../styles/RichTextEditor.styles';\nimport { useTheme } from '../../theming';\nimport { RichTextStrings } from './RichTextSendBox';\nimport { isDarkThemed } from '../../theming/themeUtils';\nimport CopyPastePlugin from './Plugins/CopyPastePlugin';\nimport type {\n ContentModelDocument,\n ContentModelParagraph,\n EditorPlugin,\n IEditor,\n ReadonlyContentModelBlockGroup,\n ShallowMutableContentModelDocument,\n KnownAnnounceStrings\n} from 'roosterjs-content-model-types';\nimport { createModelFromHtml, Editor, exportContent } from 'roosterjs-content-model-core';\nimport {\n createBr,\n createEmptyModel,\n createParagraph,\n createSelectionMarker,\n setSelection\n} from 'roosterjs-content-model-dom';\nimport { KeyboardInputPlugin } from './Plugins/KeyboardInputPlugin';\nimport {\n AutoFormatPlugin,\n EditPlugin,\n PastePlugin,\n ShortcutPlugin,\n DefaultSanitizers\n} from 'roosterjs-content-model-plugins';\nimport { UpdateContentPlugin, UpdateEvent } from './Plugins/UpdateContentPlugin';\nimport { RichTextToolbar } from './Toolbar/RichTextToolbar';\nimport { RichTextToolbarPlugin } from './Plugins/RichTextToolbarPlugin';\nimport { ContextMenuPlugin } from './Plugins/ContextMenuPlugin';\nimport { TableEditContextMenuProvider } from './Plugins/TableEditContextMenuProvider';\nimport { borderApplier, dataSetApplier } from '../utils/RichTextEditorUtils';\nimport { ContextualMenu, IContextualMenuItem, IContextualMenuProps, Theme } from '@fluentui/react';\nimport { PlaceholderPlugin } from './Plugins/PlaceholderPlugin';\nimport { getFormatState, setDirection } from 'roosterjs-content-model-api';\n\n/**\n * Style props for {@link RichTextEditor}.\n *\n * @private\n */\nexport interface RichTextEditorStyleProps {\n minHeight: string;\n maxHeight: string;\n}\n\n/**\n * Props for {@link RichTextEditor}.\n *\n * @private\n */\nexport interface RichTextEditorProps {\n // the initial content of editor that is set when editor is created (e.g. when editing a message)\n initialContent?: string;\n onChange: (newValue?: string, imageSrcArray?: Array<string>) => void;\n onKeyDown?: (ev: KeyboardEvent) => void;\n // update the current content of the rich text editor\n onContentModelUpdate?: (contentModel: ContentModelDocument | undefined) => void;\n contentModel?: ContentModelDocument | undefined;\n placeholderText?: string;\n strings: Partial<RichTextStrings>;\n showRichTextEditorFormatting: boolean;\n styles: RichTextEditorStyleProps;\n autoFocus?: 'sendBoxTextField';\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage?: (imageUrl: string, imageFileName: string) => void;\n}\n\n/**\n * Represents a reference to the RichTextEditor component.\n */\nexport interface RichTextEditorComponentRef {\n /**\n * Sets focus on the RichTextEditor component.\n */\n focus: () => void;\n\n /**\n * Sets the content of the RichTextEditor component to an empty string.\n */\n setEmptyContent: () => void;\n\n /**\n * Retrieves the plain text content of the RichTextEditor component.\n * @returns The plain text content of the RichTextEditor component, or undefined if the editor isn't available.\n */\n getPlainContent: () => string | undefined;\n}\n\n/**\n * A component to wrap RoosterJS Rich Text Editor.\n *\n * @beta\n */\nexport const RichTextEditor = React.forwardRef<RichTextEditorComponentRef, RichTextEditorProps>((props, ref) => {\n const {\n initialContent,\n onChange,\n placeholderText,\n strings,\n showRichTextEditorFormatting,\n autoFocus,\n onKeyDown,\n onContentModelUpdate,\n contentModel,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage\n } = props;\n const editor = useRef<IEditor | null>(null);\n const editorDiv = useRef<HTMLDivElement>(null);\n const theme = useTheme();\n const [contextMenuProps, setContextMenuProps] = useState<IContextualMenuProps | null>(null);\n const previousThemeDirection = useRef(themeDirection(theme));\n\n useImperativeHandle(ref, () => {\n return {\n focus() {\n if (editor.current) {\n editor.current.focus();\n }\n },\n setEmptyContent() {\n if (editor.current) {\n // remove all content from the editor and update the model\n // ContentChanged event will be sent by RoosterJS automatically\n editor.current.formatContentModel((model: ShallowMutableContentModelDocument): boolean => {\n // Create a new empty paragraph with selection marker\n // this is needed for correct processing of images after the content is deleted\n const newModel = createEmptyModel();\n model.blocks = newModel.blocks;\n return true;\n });\n //reset content model\n onContentModelUpdate && onContentModelUpdate(editor.current.getContentModelCopy('disconnected'));\n }\n },\n getPlainContent() {\n if (editor.current) {\n return exportContent(editor.current, 'PlainTextFast');\n } else {\n return undefined;\n }\n }\n };\n }, [onContentModelUpdate]);\n\n const toolbarPlugin = React.useMemo(() => {\n return new RichTextToolbarPlugin();\n }, []);\n\n const placeholderPlugin = useMemo(() => {\n const textColor = theme.palette?.neutralSecondary;\n return new PlaceholderPlugin(\n '',\n textColor\n ? {\n textColor: textColor\n }\n : undefined\n );\n }, [theme]);\n\n useEffect(() => {\n if (placeholderText !== undefined) {\n placeholderPlugin.updatePlaceholder(placeholderText);\n }\n }, [placeholderPlugin, placeholderText]);\n\n const toolbar = useMemo(() => {\n return <RichTextToolbar plugin={toolbarPlugin} strings={strings} />;\n }, [strings, toolbarPlugin]);\n\n const updatePlugin = useMemo(() => {\n return new UpdateContentPlugin();\n }, []);\n\n const copyPastePlugin = useMemo(() => {\n return new CopyPastePlugin();\n }, []);\n\n useEffect(() => {\n // don't set callback in plugin constructor to update callback without plugin recreation\n updatePlugin.onUpdate = (event: string, imageSrcArray?: Array<string>) => {\n if (editor.current === null) {\n return;\n }\n if (event === UpdateEvent.Blur || event === UpdateEvent.Dispose) {\n onContentModelUpdate && onContentModelUpdate(editor.current.getContentModelCopy('disconnected'));\n } else {\n onChange && onChange(exportContent(editor.current), imageSrcArray);\n }\n };\n }, [onChange, onContentModelUpdate, updatePlugin]);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n useEffect(() => {\n copyPastePlugin.onInsertInlineImage = onInsertInlineImage;\n }, [copyPastePlugin, onInsertInlineImage]);\n\n const keyboardInputPlugin = useMemo(() => {\n return new KeyboardInputPlugin();\n }, []);\n\n useEffect(() => {\n // don't set callback in plugin constructor to update callback without plugin recreation\n keyboardInputPlugin.onKeyDown = onKeyDown;\n }, [keyboardInputPlugin, onKeyDown]);\n\n const tableContextMenuPlugin = useMemo(() => {\n return new TableEditContextMenuProvider();\n }, []);\n\n useEffect(() => {\n tableContextMenuPlugin.updateStrings(strings);\n }, [tableContextMenuPlugin, strings]);\n\n const onContextMenuRender = useCallback(\n (container: HTMLElement, items: IContextualMenuItem[], onDismiss: () => void): void => {\n setContextMenuProps({\n items: items,\n target: container,\n onDismiss: onDismiss\n });\n },\n []\n );\n\n const onContextMenuDismiss = useCallback((): void => {\n setContextMenuProps(null);\n }, []);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n useEffect(() => {\n copyPastePlugin.onPaste = onPaste;\n }, [copyPastePlugin, onPaste]);\n\n const plugins: EditorPlugin[] = useMemo(() => {\n const contentEdit = new EditPlugin({ handleTabKey: false });\n // AutoFormatPlugin previously was a part of the edit plugin\n const autoFormatPlugin = new AutoFormatPlugin({ autoBullet: true, autoNumbering: true, autoLink: true });\n const roosterPastePlugin = new PastePlugin(false, {\n additionalDisallowedTags: ['head', '!doctype', '!cdata', '#comment'],\n additionalAllowedTags: [],\n styleSanitizers: DefaultSanitizers,\n attributeSanitizers: {}\n });\n\n const shortcutPlugin = new ShortcutPlugin();\n const contextMenuPlugin = new ContextMenuPlugin(onContextMenuRender, onContextMenuDismiss);\n return [\n placeholderPlugin,\n keyboardInputPlugin,\n contentEdit,\n autoFormatPlugin,\n updatePlugin,\n copyPastePlugin,\n roosterPastePlugin,\n toolbarPlugin,\n shortcutPlugin,\n // contextPlugin and tableEditMenuProvider allow to show insert/delete menu for the table\n contextMenuPlugin,\n tableContextMenuPlugin\n ];\n }, [\n onContextMenuRender,\n onContextMenuDismiss,\n placeholderPlugin,\n keyboardInputPlugin,\n updatePlugin,\n copyPastePlugin,\n toolbarPlugin,\n tableContextMenuPlugin\n ]);\n\n const announcerStringGetter = useCallback(\n (key: KnownAnnounceStrings): string => {\n switch (key) {\n case 'announceListItemBullet':\n return strings.richTextNewBulletedListItemAnnouncement ?? '';\n case 'announceListItemNumbering':\n return strings.richTextNewNumberedListItemAnnouncement ?? '';\n case 'announceOnFocusLastCell':\n return '';\n }\n },\n [strings.richTextNewBulletedListItemAnnouncement, strings.richTextNewNumberedListItemAnnouncement]\n );\n\n useEffect(() => {\n const initialModel = createEditorInitialModel(initialContent, contentModel);\n if (editorDiv.current) {\n editor.current = new Editor(editorDiv.current, {\n inDarkMode: isDarkThemed(theme),\n // doNotAdjustEditorColor is used to disable default color and background color for Rooster component\n doNotAdjustEditorColor: true,\n imageSelectionBorderColor: theme.palette.themePrimary,\n tableCellSelectionBackgroundColor: theme.palette.neutralLight,\n plugins: plugins,\n initialModel: initialModel,\n defaultModelToDomOptions: {\n formatApplierOverride: {\n // apply border and dataset formats for table\n border: borderApplier,\n dataset: dataSetApplier\n }\n },\n announcerStringGetter: announcerStringGetter\n });\n }\n\n if (autoFocus === 'sendBoxTextField') {\n editor.current?.focus();\n }\n\n return () => {\n if (editor.current) {\n editor.current.dispose();\n editor.current = null;\n }\n };\n // don't update the editor on deps update as everything is handled in separate hooks or plugins\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme, plugins, announcerStringGetter]);\n\n useEffect(() => {\n const themeDirectionValue = themeDirection(theme);\n // check that editor exists and theme was actually changed\n // as format.direction will be undefined if setDirection is not called\n if (editor.current && previousThemeDirection.current !== themeDirectionValue) {\n const format = getFormatState(editor.current);\n if (format.direction !== themeDirectionValue) {\n // should be set after the hook where editor is created as the editor might be null\n // setDirection will cause the focus change back to the editor and this might not be what we want to do (autoFocus prop)\n // that's why it's not part of the create editor hook\n setDirection(editor.current, theme.rtl ? 'rtl' : 'ltr');\n }\n previousThemeDirection.current = themeDirectionValue;\n }\n }, [theme]);\n\n return (\n <div data-testid={'rich-text-editor-wrapper'}>\n {showRichTextEditorFormatting && toolbar}\n <div className={richTextEditorWrapperStyle(theme)}>\n {/* div that is used by Rooster JS as a parent of the editor */}\n <div\n id=\"richTextSendBox\"\n ref={editorDiv}\n tabIndex={0}\n role=\"textbox\"\n aria-multiline=\"true\"\n data-testid={'rooster-rich-text-editor'}\n className={richTextEditorStyle(props.styles)}\n aria-label={placeholderText}\n />\n </div>\n {contextMenuProps && <ContextualMenu {...contextMenuProps} calloutProps={{ isBeakVisible: false }} />}\n </div>\n );\n});\n\nconst createEditorInitialModel = (\n initialContent?: string,\n contentModel?: ContentModelDocument\n): ContentModelDocument | undefined => {\n if (contentModel) {\n // contentModel is the current content of the editor\n return contentModel;\n } else {\n const initialContentValue = initialContent;\n const initialModel =\n initialContentValue && initialContentValue.length > 0 ? createModelFromHtml(initialContentValue) : undefined;\n if (initialModel && initialModel.blocks.length > 0) {\n // lastBlock should have blockType = paragraph, otherwise add a new paragraph\n // to set focus to the end of the content\n const lastBlock = initialModel.blocks[initialModel.blocks.length - 1];\n if (lastBlock?.blockType === 'Paragraph') {\n // now lastBlock is paragraph\n setSelectionAfterLastSegment(initialModel, lastBlock);\n } else {\n const block = createParagraph(false);\n initialModel.blocks.push(block);\n setSelectionAfterLastSegment(initialModel, block);\n // add content to the paragraph, otherwise height might be calculated incorrectly\n block.segments.push(createBr());\n }\n }\n return initialModel;\n }\n};\n\nconst setSelectionAfterLastSegment = (model: ReadonlyContentModelBlockGroup, block: ContentModelParagraph): void => {\n //selection marker should have the same format as the last segment if any\n const format = block.segments.length > 0 ? block.segments[block.segments.length - 1].format : undefined;\n const marker = createSelectionMarker(format);\n block.segments.push(marker);\n setSelection(model, marker);\n};\n\nconst themeDirection = (theme: Theme): 'rtl' | 'ltr' => {\n return theme.rtl ? 'rtl' : 'ltr';\n};\n"]}
|
package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js
CHANGED
@@ -21,6 +21,9 @@ export const RichTextToolbar = (props) => {
|
|
21
21
|
useEffect(() => {
|
22
22
|
// update the format state on editor events
|
23
23
|
plugin.onFormatChanged = setFormatState;
|
24
|
+
// plugin editor ready event may happen before onFormatChanged is set
|
25
|
+
// call update format function to ensure the format state is set
|
26
|
+
plugin.updateFormat();
|
24
27
|
}, [plugin]);
|
25
28
|
const boldButton = useMemo(() => {
|
26
29
|
return getCommandBarItem({
|
package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RichTextToolbar.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EACL,UAAU,EACV,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,WAA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S,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7B,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,QAAQ;QAClB,YAAY,oBACP,kBAAkB,CAAC,KAAK,CAAC,CAC7B;QACD,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,QAAQ;KACnB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,KAAY,EAAE,GAAW,EAAwB,EAAE;IAChF,OAAO;QACL,GAAG,EAAE,GAAG;QACR,QAAQ,EAAE,IAAI;QACd,gDAAgD;QAChD,QAAQ,EAAE,sBAAsB,CAAC,OAAO;QACxC,kFAAkF;QAClF,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,GAAG,EAAE,CAAC,oBAAC,IAAI,IAAC,QAAQ,EAAC,qBAAqB,EAAC,SAAS,EAAE,kBAAkB,CAAC,KAAK,CAAC,GAAI;KAC9F,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { RichTextToolbarPlugin } from '../Plugins/RichTextToolbarPlugin';\nimport { CommandBar, ContextualMenuItemType, Icon } from '@fluentui/react';\nimport type { ICommandBarItemProps, Theme } from '@fluentui/react';\nimport {\n toolbarButtonStyle,\n ribbonDividerStyle,\n ribbonOverflowButtonStyle,\n richTextToolbarStyle\n} from '../../styles/RichTextEditor.styles';\nimport { useTheme } from '../../../theming';\nimport { ContentModelFormatState } from 'roosterjs-content-model-types';\nimport {\n toggleBold,\n toggleItalic,\n toggleUnderline,\n toggleBullet,\n toggleNumbering,\n setIndentation,\n insertTable\n} from 'roosterjs-content-model-api';\nimport { RichTextStrings } from '../RichTextSendBox';\nimport { richTextInsertTableCommandBarItem } from './Table/RichTextInsertTableCommandBarItem';\n\nconst MaxRowsNumber = 5;\nconst MaxColumnsNumber = 5;\n\n/**\n * Props for {@link RichTextToolbar}.\n *\n * @private\n */\nexport interface RichTextToolbarProps {\n // The rich text toolbar plugin used for connect editor and the ribbon.\n plugin: RichTextToolbarPlugin;\n // Strings for localization.\n strings: Partial<RichTextStrings>;\n}\n\n/**\n * A component to display rich text toolbar.\n *\n * @beta\n */\nexport const RichTextToolbar = (props: RichTextToolbarProps): JSX.Element => {\n const { plugin, strings } = props;\n const theme = useTheme();\n // need to re-render the buttons when format state changes\n const [formatState, setFormatState] = React.useState<ContentModelFormatState | undefined>(undefined);\n\n useEffect(() => {\n // update the format state on editor events\n plugin.onFormatChanged = setFormatState;\n }, [plugin]);\n\n const boldButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-bold-button',\n key: 'RichTextToolbarBoldButton',\n icon: 'RichTextBoldButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n toggleBold(editor);\n });\n },\n text: strings.richTextBoldTooltip,\n checked: formatState !== undefined && formatState.isBold === true,\n theme: theme\n });\n }, [formatState, plugin, strings.richTextBoldTooltip, theme]);\n\n const italicButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-italic-button',\n key: 'RichTextToolbarItalicButton',\n icon: 'RichTextItalicButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n toggleItalic(editor);\n });\n },\n text: strings.richTextItalicTooltip,\n checked: formatState !== undefined && formatState?.isItalic === true,\n theme: theme\n });\n }, [formatState, plugin, strings.richTextItalicTooltip, theme]);\n\n const underlineButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-underline-button',\n key: 'RichTextToolbarUnderlineButton',\n icon: 'RichTextUnderlineButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n toggleUnderline(editor);\n });\n },\n text: strings.richTextUnderlineTooltip,\n checked: formatState !== undefined && formatState?.isUnderline === true,\n theme: theme\n });\n }, [formatState, plugin, strings.richTextUnderlineTooltip, theme]);\n\n const bulletListButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-bullet-list-button',\n key: 'RichTextToolbarBulletListButton',\n icon: 'RichTextBulletListButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n // check the format state to see if the bulleted list is already applied\n const isBullet = formatState?.isBullet;\n toggleBullet(editor);\n // the bulleted list was added\n if (!isBullet) {\n setTimeout(() => {\n // a small delay and polite aria live are needed for MacOS VoiceOver to announce the change\n editor.announce({ ariaLiveMode: 'polite', text: strings.richTextBulletedListAppliedAnnouncement });\n }, 50);\n }\n });\n },\n text: strings.richTextBulletListTooltip,\n checked: formatState !== undefined && formatState?.isBullet === true,\n theme: theme\n });\n }, [formatState, plugin, strings.richTextBulletListTooltip, strings.richTextBulletedListAppliedAnnouncement, theme]);\n\n const numberListButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-number-list-button',\n key: 'RichTextToolbarNumberListButton',\n icon: 'RichTextNumberListButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n // check the format state to see if the numbered list is already applied\n const isNumbering = formatState?.isNumbering;\n toggleNumbering(editor);\n // the numbered list was added\n if (!isNumbering) {\n // a small delay and polite aria live are needed for MacOS VoiceOver to announce the change\n setTimeout(() => {\n editor.announce({ ariaLiveMode: 'polite', text: strings.richTextNumberedListAppliedAnnouncement });\n }, 50);\n }\n });\n },\n text: strings.richTextNumberListTooltip,\n checked: formatState !== undefined && formatState?.isNumbering === true,\n theme: theme\n });\n }, [formatState, plugin, strings.richTextNumberListTooltip, strings.richTextNumberedListAppliedAnnouncement, theme]);\n\n const indentDecreaseButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-indent-decrease-button',\n key: 'RichTextToolbarIndentDecreaseButton',\n icon: 'RichTextIndentDecreaseButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n setIndentation(editor, 'outdent');\n });\n },\n text: strings.richTextDecreaseIndentTooltip,\n canCheck: false,\n theme: theme\n });\n }, [plugin, strings.richTextDecreaseIndentTooltip, theme]);\n\n const indentIncreaseButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-indent-increase-button',\n key: 'RichTextToolbarIndentIncreaseButton',\n icon: 'RichTextIndentIncreaseButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n setIndentation(editor, 'indent');\n });\n },\n text: strings.richTextIncreaseIndentTooltip,\n canCheck: false,\n theme: theme\n });\n }, [plugin, strings.richTextIncreaseIndentTooltip, theme]);\n\n const divider = useCallback(\n (key: string) => {\n return dividerCommandBarItem(theme, key);\n },\n [theme]\n );\n\n const tableButton: ICommandBarItemProps = useMemo(() => {\n return richTextInsertTableCommandBarItem(\n theme,\n MaxRowsNumber,\n MaxColumnsNumber,\n strings,\n (column: number, row: number) => {\n plugin.onToolbarButtonClick((editor) => {\n //add format\n insertTable(editor, column, row);\n // when subMenuProps is used and the menu is dismissed, focus is set to the command bar item that opened the menu\n // set focus to editor on next re-render\n setTimeout(() => {\n editor.focus();\n });\n });\n }\n );\n }, [plugin, strings, theme]);\n\n const buttons: ICommandBarItemProps[] = useMemo(() => {\n return [\n boldButton,\n italicButton,\n underlineButton,\n divider('RichTextRibbonTextFormatDivider'),\n bulletListButton,\n numberListButton,\n indentDecreaseButton,\n indentIncreaseButton,\n divider('RichTextRibbonTableDivider'),\n tableButton\n ];\n }, [\n boldButton,\n italicButton,\n underlineButton,\n divider,\n bulletListButton,\n numberListButton,\n indentDecreaseButton,\n indentIncreaseButton,\n tableButton\n ]);\n\n const overflowButtonProps = useMemo(() => {\n return {\n ariaLabel: strings.richTextToolbarMoreButtonAriaLabel,\n styles: toolbarButtonStyle(theme),\n menuProps: {\n items: [], // CommandBar will determine items rendered in overflow\n isBeakVisible: false,\n styles: ribbonOverflowButtonStyle(theme)\n }\n };\n }, [strings.richTextToolbarMoreButtonAriaLabel, theme]);\n\n return (\n <CommandBar\n items={buttons}\n data-testid={'rich-text-editor-toolbar'}\n styles={richTextToolbarStyle}\n overflowButtonProps={overflowButtonProps}\n />\n );\n};\n\nconst getCommandBarItem = ({\n key,\n icon,\n onClick,\n text,\n canCheck = true,\n checked = false,\n disabled = false,\n theme,\n dataTestId\n}: {\n key: string;\n icon: string;\n onClick: () => void;\n text?: string;\n canCheck?: boolean;\n checked?: boolean;\n disabled?: boolean;\n theme: Theme;\n dataTestId: string;\n}): ICommandBarItemProps => {\n return {\n role: canCheck ? 'menuitemcheckbox' : 'menuitem',\n 'aria-checked': canCheck ? checked : undefined, // `menuitem` role doesn't support `aria-checked`\n 'data-testid': dataTestId,\n key: key,\n iconProps: { iconName: icon },\n onClick: onClick,\n text: text,\n ariaLabel: text,\n iconOnly: true,\n canCheck: canCheck,\n buttonStyles: {\n ...toolbarButtonStyle(theme)\n },\n checked: checked,\n disabled: disabled\n };\n};\n\nconst dividerCommandBarItem = (theme: Theme, key: string): ICommandBarItemProps => {\n return {\n key: key,\n disabled: true,\n // show the item correctly for the overflow menu\n itemType: ContextualMenuItemType.Divider,\n // this is still needed to remove checkmark icon space even though it is a divider\n canCheck: false,\n onRender: () => <Icon iconName=\"RichTextDividerIcon\" className={ribbonDividerStyle(theme)} />\n };\n};\n"]}
|
1
|
+
{"version":3,"file":"RichTextToolbar.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,E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,GAAG,KAAK,EAChB,KAAK,EACL,UAAU,EAWX,EAAwB,EAAE;IACzB,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,UAAU;QAChD,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,iDAAiD;QACjG,aAAa,EAAE,UAAU;QACzB,GAAG,EAAE,GAAG;QACR,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7B,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,QAAQ;QAClB,YAAY,oBACP,kBAAkB,CAAC,KAAK,CAAC,CAC7B;QACD,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,QAAQ;KACnB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,KAAY,EAAE,GAAW,EAAwB,EAAE;IAChF,OAAO;QACL,GAAG,EAAE,GAAG;QACR,QAAQ,EAAE,IAAI;QACd,gDAAgD;QAChD,QAAQ,EAAE,sBAAsB,CAAC,OAAO;QACxC,kFAAkF;QAClF,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,GAAG,EAAE,CAAC,oBAAC,IAAI,IAAC,QAAQ,EAAC,qBAAqB,EAAC,SAAS,EAAE,kBAAkB,CAAC,KAAK,CAAC,GAAI;KAC9F,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { RichTextToolbarPlugin } from '../Plugins/RichTextToolbarPlugin';\nimport { CommandBar, ContextualMenuItemType, Icon } from '@fluentui/react';\nimport type { ICommandBarItemProps, Theme } from '@fluentui/react';\nimport {\n toolbarButtonStyle,\n ribbonDividerStyle,\n ribbonOverflowButtonStyle,\n richTextToolbarStyle\n} from '../../styles/RichTextEditor.styles';\nimport { useTheme } from '../../../theming';\nimport { ContentModelFormatState } from 'roosterjs-content-model-types';\nimport {\n toggleBold,\n toggleItalic,\n toggleUnderline,\n toggleBullet,\n toggleNumbering,\n setIndentation,\n insertTable\n} from 'roosterjs-content-model-api';\nimport { RichTextStrings } from '../RichTextSendBox';\nimport { richTextInsertTableCommandBarItem } from './Table/RichTextInsertTableCommandBarItem';\n\nconst MaxRowsNumber = 5;\nconst MaxColumnsNumber = 5;\n\n/**\n * Props for {@link RichTextToolbar}.\n *\n * @private\n */\nexport interface RichTextToolbarProps {\n // The rich text toolbar plugin used for connect editor and the ribbon.\n plugin: RichTextToolbarPlugin;\n // Strings for localization.\n strings: Partial<RichTextStrings>;\n}\n\n/**\n * A component to display rich text toolbar.\n *\n * @beta\n */\nexport const RichTextToolbar = (props: RichTextToolbarProps): JSX.Element => {\n const { plugin, strings } = props;\n const theme = useTheme();\n // need to re-render the buttons when format state changes\n const [formatState, setFormatState] = React.useState<ContentModelFormatState | undefined>(undefined);\n\n useEffect(() => {\n // update the format state on editor events\n plugin.onFormatChanged = setFormatState;\n // plugin editor ready event may happen before onFormatChanged is set\n // call update format function to ensure the format state is set\n plugin.updateFormat();\n }, [plugin]);\n\n const boldButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-bold-button',\n key: 'RichTextToolbarBoldButton',\n icon: 'RichTextBoldButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n toggleBold(editor);\n });\n },\n text: strings.richTextBoldTooltip,\n checked: formatState !== undefined && formatState.isBold === true,\n theme: theme\n });\n }, [formatState, plugin, strings.richTextBoldTooltip, theme]);\n\n const italicButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-italic-button',\n key: 'RichTextToolbarItalicButton',\n icon: 'RichTextItalicButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n toggleItalic(editor);\n });\n },\n text: strings.richTextItalicTooltip,\n checked: formatState !== undefined && formatState?.isItalic === true,\n theme: theme\n });\n }, [formatState, plugin, strings.richTextItalicTooltip, theme]);\n\n const underlineButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-underline-button',\n key: 'RichTextToolbarUnderlineButton',\n icon: 'RichTextUnderlineButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n toggleUnderline(editor);\n });\n },\n text: strings.richTextUnderlineTooltip,\n checked: formatState !== undefined && formatState?.isUnderline === true,\n theme: theme\n });\n }, [formatState, plugin, strings.richTextUnderlineTooltip, theme]);\n\n const bulletListButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-bullet-list-button',\n key: 'RichTextToolbarBulletListButton',\n icon: 'RichTextBulletListButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n // check the format state to see if the bulleted list is already applied\n const isBullet = formatState?.isBullet;\n toggleBullet(editor);\n // the bulleted list was added\n if (!isBullet) {\n setTimeout(() => {\n // a small delay and polite aria live are needed for MacOS VoiceOver to announce the change\n editor.announce({ ariaLiveMode: 'polite', text: strings.richTextBulletedListAppliedAnnouncement });\n }, 50);\n }\n });\n },\n text: strings.richTextBulletListTooltip,\n checked: formatState !== undefined && formatState?.isBullet === true,\n theme: theme\n });\n }, [formatState, plugin, strings.richTextBulletListTooltip, strings.richTextBulletedListAppliedAnnouncement, theme]);\n\n const numberListButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-number-list-button',\n key: 'RichTextToolbarNumberListButton',\n icon: 'RichTextNumberListButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n // check the format state to see if the numbered list is already applied\n const isNumbering = formatState?.isNumbering;\n toggleNumbering(editor);\n // the numbered list was added\n if (!isNumbering) {\n // a small delay and polite aria live are needed for MacOS VoiceOver to announce the change\n setTimeout(() => {\n editor.announce({ ariaLiveMode: 'polite', text: strings.richTextNumberedListAppliedAnnouncement });\n }, 50);\n }\n });\n },\n text: strings.richTextNumberListTooltip,\n checked: formatState !== undefined && formatState?.isNumbering === true,\n theme: theme\n });\n }, [formatState, plugin, strings.richTextNumberListTooltip, strings.richTextNumberedListAppliedAnnouncement, theme]);\n\n const indentDecreaseButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-indent-decrease-button',\n key: 'RichTextToolbarIndentDecreaseButton',\n icon: 'RichTextIndentDecreaseButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n setIndentation(editor, 'outdent');\n });\n },\n text: strings.richTextDecreaseIndentTooltip,\n canCheck: false,\n theme: theme\n });\n }, [plugin, strings.richTextDecreaseIndentTooltip, theme]);\n\n const indentIncreaseButton: ICommandBarItemProps = useMemo(() => {\n return getCommandBarItem({\n dataTestId: 'rich-text-toolbar-indent-increase-button',\n key: 'RichTextToolbarIndentIncreaseButton',\n icon: 'RichTextIndentIncreaseButtonIcon',\n onClick: () => {\n plugin.onToolbarButtonClick((editor) => {\n setIndentation(editor, 'indent');\n });\n },\n text: strings.richTextIncreaseIndentTooltip,\n canCheck: false,\n theme: theme\n });\n }, [plugin, strings.richTextIncreaseIndentTooltip, theme]);\n\n const divider = useCallback(\n (key: string) => {\n return dividerCommandBarItem(theme, key);\n },\n [theme]\n );\n\n const tableButton: ICommandBarItemProps = useMemo(() => {\n return richTextInsertTableCommandBarItem(\n theme,\n MaxRowsNumber,\n MaxColumnsNumber,\n strings,\n (column: number, row: number) => {\n plugin.onToolbarButtonClick((editor) => {\n //add format\n insertTable(editor, column, row);\n // when subMenuProps is used and the menu is dismissed, focus is set to the command bar item that opened the menu\n // set focus to editor on next re-render\n setTimeout(() => {\n editor.focus();\n });\n });\n }\n );\n }, [plugin, strings, theme]);\n\n const buttons: ICommandBarItemProps[] = useMemo(() => {\n return [\n boldButton,\n italicButton,\n underlineButton,\n divider('RichTextRibbonTextFormatDivider'),\n bulletListButton,\n numberListButton,\n indentDecreaseButton,\n indentIncreaseButton,\n divider('RichTextRibbonTableDivider'),\n tableButton\n ];\n }, [\n boldButton,\n italicButton,\n underlineButton,\n divider,\n bulletListButton,\n numberListButton,\n indentDecreaseButton,\n indentIncreaseButton,\n tableButton\n ]);\n\n const overflowButtonProps = useMemo(() => {\n return {\n ariaLabel: strings.richTextToolbarMoreButtonAriaLabel,\n styles: toolbarButtonStyle(theme),\n menuProps: {\n items: [], // CommandBar will determine items rendered in overflow\n isBeakVisible: false,\n styles: ribbonOverflowButtonStyle(theme)\n }\n };\n }, [strings.richTextToolbarMoreButtonAriaLabel, theme]);\n\n return (\n <CommandBar\n items={buttons}\n data-testid={'rich-text-editor-toolbar'}\n styles={richTextToolbarStyle}\n overflowButtonProps={overflowButtonProps}\n />\n );\n};\n\nconst getCommandBarItem = ({\n key,\n icon,\n onClick,\n text,\n canCheck = true,\n checked = false,\n disabled = false,\n theme,\n dataTestId\n}: {\n key: string;\n icon: string;\n onClick: () => void;\n text?: string;\n canCheck?: boolean;\n checked?: boolean;\n disabled?: boolean;\n theme: Theme;\n dataTestId: string;\n}): ICommandBarItemProps => {\n return {\n role: canCheck ? 'menuitemcheckbox' : 'menuitem',\n 'aria-checked': canCheck ? checked : undefined, // `menuitem` role doesn't support `aria-checked`\n 'data-testid': dataTestId,\n key: key,\n iconProps: { iconName: icon },\n onClick: onClick,\n text: text,\n ariaLabel: text,\n iconOnly: true,\n canCheck: canCheck,\n buttonStyles: {\n ...toolbarButtonStyle(theme)\n },\n checked: checked,\n disabled: disabled\n };\n};\n\nconst dividerCommandBarItem = (theme: Theme, key: string): ICommandBarItemProps => {\n return {\n key: key,\n disabled: true,\n // show the item correctly for the overflow menu\n itemType: ContextualMenuItemType.Divider,\n // this is still needed to remove checkmark icon space even though it is a divider\n canCheck: false,\n onRender: () => <Icon iconName=\"RichTextDividerIcon\" className={ribbonDividerStyle(theme)} />\n };\n};\n"]}
|
@@ -61,7 +61,7 @@ export const MAX_PINNED_REMOTE_VIDEO_TILES = 4;
|
|
61
61
|
* @public
|
62
62
|
*/
|
63
63
|
export const VideoGallery = (props) => {
|
64
|
-
var _a, _b, _c
|
64
|
+
var _a, _b, _c;
|
65
65
|
const { localParticipant, remoteParticipants = [], localVideoViewOptions, remoteVideoViewOptions, dominantSpeakers, onRenderLocalVideoTile, onRenderRemoteVideoTile, onCreateLocalStreamView, onDisposeLocalStreamView, onCreateRemoteStreamView, onDisposeRemoteScreenShareStreamView, onDisposeRemoteVideoStreamView, styles, layout, onRenderAvatar, showMuteIndicator, maxRemoteVideoStreams = DEFAULT_MAX_REMOTE_VIDEO_STREAMS, showCameraSwitcherInLocalPreview, localVideoCameraCycleButtonProps, onPinParticipant: onPinParticipantHandler, onUnpinParticipant: onUnpinParticipantHandler, remoteVideoTileMenu = DEFAULT_REMOTE_VIDEO_TILE_MENU_OPTIONS, overflowGalleryPosition = 'horizontalBottom', localVideoTileSize = 'followDeviceOrientation', spotlightedParticipants, onStartLocalSpotlight, onStartRemoteSpotlight, onStopLocalSpotlight, onStopRemoteSpotlight, maxParticipantsToSpotlight, reactionResources, videoTilesOptions,
|
66
66
|
/* @conditional-compile-remove(soft-mute) */
|
67
67
|
onMuteParticipant } = props;
|
@@ -97,7 +97,10 @@ export const VideoGallery = (props) => {
|
|
97
97
|
});
|
98
98
|
}, [props.pinnedParticipants, props.remoteParticipants]);
|
99
99
|
// Use pinnedParticipants from props but if it is not defined use the maintained state of pinned participants
|
100
|
-
const pinnedParticipants = (
|
100
|
+
const pinnedParticipants = useMemo(() => {
|
101
|
+
var _a;
|
102
|
+
return (_a = props.pinnedParticipants) !== null && _a !== void 0 ? _a : pinnedParticipantsState.filter((pinnedParticipantId) => remoteParticipants.find((remoteParticipant) => remoteParticipant.userId === pinnedParticipantId));
|
103
|
+
}, [props.pinnedParticipants, pinnedParticipantsState, remoteParticipants]);
|
101
104
|
const showLocalVideoTileLabel = !((localTileNotInGrid && isNarrow) || localVideoTileSize === '9:16') || layout === 'default';
|
102
105
|
/**
|
103
106
|
* Utility function for memoized rendering of LocalParticipant.
|
@@ -152,11 +155,11 @@ export const VideoGallery = (props) => {
|
|
152
155
|
if (pinnedParticipants.length >= MAX_PINNED_REMOTE_VIDEO_TILES) {
|
153
156
|
return;
|
154
157
|
}
|
155
|
-
if (!
|
156
|
-
setPinnedParticipantsState(
|
158
|
+
if (!pinnedParticipants.includes(userId)) {
|
159
|
+
setPinnedParticipantsState(pinnedParticipants.concat(userId));
|
157
160
|
}
|
158
161
|
onPinParticipantHandler === null || onPinParticipantHandler === void 0 ? void 0 : onPinParticipantHandler(userId);
|
159
|
-
}, [pinnedParticipants
|
162
|
+
}, [pinnedParticipants, setPinnedParticipantsState, onPinParticipantHandler]);
|
160
163
|
const onUnpinParticipant = useCallback((userId) => {
|
161
164
|
setPinnedParticipantsState(pinnedParticipantsState.filter((p) => p !== userId));
|
162
165
|
onUnpinParticipantHandler === null || onUnpinParticipantHandler === void 0 ? void 0 : onUnpinParticipantHandler(userId);
|
@@ -230,7 +233,7 @@ export const VideoGallery = (props) => {
|
|
230
233
|
]);
|
231
234
|
const screenShareParticipant = remoteParticipants.find((participant) => { var _a; return (_a = participant.screenShareStream) === null || _a === void 0 ? void 0 : _a.isAvailable; });
|
232
235
|
const localScreenShareStreamComponent = React.createElement(LocalScreenShare, { localParticipant: localParticipant });
|
233
|
-
const remoteScreenShareComponent = screenShareParticipant && (React.createElement(RemoteScreenShare, Object.assign({}, screenShareParticipant, { renderElement: (
|
236
|
+
const remoteScreenShareComponent = screenShareParticipant && (React.createElement(RemoteScreenShare, Object.assign({}, screenShareParticipant, { renderElement: (_a = screenShareParticipant.screenShareStream) === null || _a === void 0 ? void 0 : _a.renderElement, onCreateRemoteStreamView: onCreateRemoteStreamView, onDisposeRemoteStreamView: onDisposeRemoteScreenShareStreamView, isReceiving: (_b = screenShareParticipant.screenShareStream) === null || _b === void 0 ? void 0 : _b.isReceiving, participantVideoScalingMode: selectedScalingModeState[screenShareParticipant.userId], localParticipant: localParticipant, remoteParticipants: remoteParticipants, reactionResources: reactionResources, isPPTLive: !((_c = screenShareParticipant.screenShareStream) === null || _c === void 0 ? void 0 : _c.id) })));
|
234
237
|
const screenShareComponent = remoteScreenShareComponent
|
235
238
|
? remoteScreenShareComponent
|
236
239
|
: localParticipant.isScreenSharingOn
|