@azure/communication-react 1.18.0-alpha-202407180014 → 1.18.0-alpha-202407200014

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/communication-react.d.ts +71 -18
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-Bi4Or6hk.js → ChatMessageComponentAsRichTextEditBox-D4ctXnw1.js} +27 -6
  3. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-D4ctXnw1.js.map +1 -0
  4. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CaXswhPn.js → RichTextSendBoxWrapper-F6eqVXer.js} +2 -2
  5. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CaXswhPn.js.map → RichTextSendBoxWrapper-F6eqVXer.js.map} +1 -1
  6. package/dist/dist-cjs/communication-react/{index-B3X0l4SB.js → index-BJO_NOTU.js} +658 -367
  7. package/dist/dist-cjs/communication-react/index-BJO_NOTU.js.map +1 -0
  8. package/dist/dist-cjs/communication-react/index.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  10. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  11. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.d.ts +3 -3
  12. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js.map +1 -1
  13. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.d.ts +1 -1
  14. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js +15 -7
  15. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js.map +1 -1
  16. package/dist/dist-esm/calling-stateful-client/src/IncomingCallDeclarative.d.ts +2 -8
  17. package/dist/dist-esm/calling-stateful-client/src/IncomingCallDeclarative.js.map +1 -1
  18. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.d.ts +14 -2
  19. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js.map +1 -1
  20. package/dist/dist-esm/calling-stateful-client/src/TeamsIncomingCallDeclarative.d.ts +17 -0
  21. package/dist/dist-esm/calling-stateful-client/src/TeamsIncomingCallDeclarative.js +49 -0
  22. package/dist/dist-esm/calling-stateful-client/src/TeamsIncomingCallDeclarative.js.map +1 -0
  23. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.d.ts +9 -1
  24. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js +16 -0
  25. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js.map +1 -1
  26. package/dist/dist-esm/calling-stateful-client/src/index-public.d.ts +1 -1
  27. package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
  28. package/dist/dist-esm/communication-react/src/index.d.ts +1 -1
  29. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  30. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js +14 -8
  31. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js.map +1 -1
  32. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +8 -2
  33. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
  34. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +6 -4
  35. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js +2 -12
  36. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
  37. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.d.ts +2 -2
  38. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +25 -4
  39. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
  40. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +8 -6
  41. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +12 -3
  42. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
  43. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js +27 -3
  44. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -1
  45. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +9 -15
  46. package/dist/dist-esm/react-components/src/components/MessageThread.js +10 -1
  47. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  48. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +28 -22
  49. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -1
  50. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +49 -0
  51. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +16 -4
  52. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
  53. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js +20 -2
  54. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js.map +1 -1
  55. package/dist/dist-esm/react-components/src/components/index.d.ts +2 -1
  56. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  57. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +2 -2
  58. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js +15 -17
  59. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js.map +1 -1
  60. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +3 -0
  61. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +1 -1
  62. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.d.ts +1 -5
  63. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js +0 -21
  64. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js.map +1 -1
  65. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +9 -1
  66. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +10 -2
  67. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
  68. package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +101 -63
  69. package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +99 -61
  70. package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +99 -61
  71. package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +99 -61
  72. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +8 -2
  73. package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +99 -61
  74. package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +99 -61
  75. package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +102 -64
  76. package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +99 -61
  77. package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +99 -61
  78. package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +101 -63
  79. package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +106 -68
  80. package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +99 -61
  81. package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +105 -67
  82. package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +104 -66
  83. package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +102 -64
  84. package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +100 -62
  85. package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +99 -61
  86. package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +100 -62
  87. package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +101 -63
  88. package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +100 -62
  89. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +66 -31
  90. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  91. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadReducer.d.ts +49 -0
  92. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadReducer.js +48 -0
  93. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadReducer.js.map +1 -0
  94. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.d.ts +33 -1
  95. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.js +198 -6
  96. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.js.map +1 -1
  97. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.d.ts +7 -7
  98. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +1 -1
  99. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.d.ts +2 -5
  100. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js.map +1 -1
  101. package/dist/dist-esm/react-composites/src/composites/common/constants.d.ts +4 -0
  102. package/dist/dist-esm/react-composites/src/composites/common/constants.js +4 -0
  103. package/dist/dist-esm/react-composites/src/composites/common/constants.js.map +1 -1
  104. package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +10 -5
  105. package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +6 -1
  106. package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +6 -1
  107. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +6 -1
  108. package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +6 -1
  109. package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +10 -5
  110. package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +10 -5
  111. package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +10 -5
  112. package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +10 -5
  113. package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +6 -1
  114. package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +10 -5
  115. package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +6 -1
  116. package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +6 -1
  117. package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +6 -1
  118. package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +10 -5
  119. package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +6 -1
  120. package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +10 -5
  121. package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +6 -1
  122. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +10 -5
  123. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +10 -5
  124. package/package.json +14 -14
  125. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-Bi4Or6hk.js.map +0 -1
  126. package/dist/dist-cjs/communication-react/index-B3X0l4SB.js.map +0 -1
  127. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/useImageUpload.d.ts +0 -12
  128. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/useImageUpload.js +0 -115
  129. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/useImageUpload.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MessageThread.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/MessageThread.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,IAAI,EAAU,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EACL,aAAa,EACb,8BAA8B,EAC9B,2BAA2B,EAC3B,kCAAkC,EAClC,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AActC,OAAO,EAAE,YAAY,EAAiB,mCAAgC;AAKtE,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,iCAAiC,MAAM,2CAA2C,CAAC;AAG1F,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,aAAa,MAAM,2BAA2B,CAAC;AAGtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,2BAA2B,EAE5B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,mDAAmD;AACn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E,MAAM,EACd,GAAG,EAAE,OAAO,CAAC,GAAG,EAChB,MAAM,EAAE,MAAM,EACd,6BAA6B,EAAE,QAAQ,EACvC,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,qBAAqB,EAAE,qBAAqB,EAC5C,qBAAqB,EAAE,qBAAqB,EAC5C,mBAAmB,EAAE,uBAAuB,EAC5C,SAAS,EAAE,4BAA4B,EACvC,gBAAgB,EAAE,gBAAgB;4BAClC,mDAAmD;4BACnD,oBAAoB,EAAE,MAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,eAAe,0CAAE,oBAAoB,EAC9E,kBAAkB,EAAE,kBAAkB;4BACtC,0DAA0D;4BAC1D,uBAAuB,EAAE,uBAAuB;4BAChD,0CAA0C;4BAC1C,cAAc,EAAE,cAAc;4BAC9B,mDAAmD;4BACnD,2BAA2B,EAAE,2BAA2B;4BACxD,mDAAmD;4BACnD,qBAAqB,EAAE,qBAAqB,IAC5C,CACH,CAAC;oBACJ,CAAC,CAAC,CACG,CACe,CACV,CACZ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,+BAA+B,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,GAAqC,EAAe,EAAE;IACxG,OAAO,oBAAC,2BAA2B,oBAAK,GAAG,EAAI,CAAC;AAClD,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Icon, IStyle, mergeStyles, PrimaryButton } from '@fluentui/react';\nimport { Chat } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport {\n DownIconStyle,\n newMessageButtonContainerStyle,\n messageThreadContainerStyle,\n messageThreadWrapperContainerStyle,\n useChatStyles,\n buttonWithIconStyles,\n newMessageButtonStyle\n} from './styles/MessageThread.styles';\nimport { delay } from './utils/delay';\nimport {\n BaseCustomStyles,\n ChatMessage,\n CustomMessage,\n SystemMessage,\n OnRenderAvatarCallback,\n Message,\n ReadReceiptsBySenderId,\n ComponentSlotStyle\n} from '../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../types';\nimport { MessageStatusIndicatorProps } from './MessageStatusIndicator';\nimport { memoizeFnAll, MessageStatus } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\nimport { useLocale } from '../localization/LocalizationProvider';\nimport { isNarrowWidth, _useContainerWidth } from './utils/responsive';\nimport getParticipantsWhoHaveReadMessage from './utils/getParticipantsWhoHaveReadMessage';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentOptions } from '../types/Attachment';\nimport { useTheme } from '../theming';\nimport { FluentV9ThemeProvider } from './../theming/FluentV9ThemeProvider';\nimport LiveAnnouncer from './Announcer/LiveAnnouncer';\n/* @conditional-compile-remove(mention) */\nimport { MentionOptions } from './MentionPopover';\nimport { createStyleFromV8Style } from './styles/v8StyleShim';\nimport {\n ChatMessageComponentWrapper,\n ChatMessageComponentWrapperProps\n} from './ChatMessage/ChatMessageComponentWrapper';\nimport { InlineImageOptions } from './ChatMessage/ChatMessageContent';\nimport { MessageStatusIndicatorInternal } from './MessageStatusIndicatorInternal';\nimport { Announcer } from './Announcer';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { RichTextStrings } from './RichTextEditor/RichTextSendBox';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { loadChatMessageComponentAsRichTextEditBox } from './ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker';\n\nconst isMessageSame = (first: ChatMessage, second: ChatMessage): boolean => {\n return (\n first.messageId === second.messageId &&\n first.content === second.content &&\n first.contentType === second.contentType &&\n JSON.stringify(first.createdOn) === JSON.stringify(second.createdOn) &&\n first.senderId === second.senderId &&\n first.senderDisplayName === second.senderDisplayName &&\n JSON.stringify(first.editedOn) === JSON.stringify(second.editedOn)\n );\n};\n\n/**\n * Get the latest message from the message array.\n *\n * @param messages\n */\nconst getLatestChatMessage = (messages: Message[]): ChatMessage | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message.messageType === 'chat' && !!message.createdOn) {\n return message;\n }\n }\n return undefined;\n};\n\n/**\n * Compare latestMessageFromPreviousMessages & latestMessageFromNewMessages to see if the new message is not from\n * current user.\n */\nconst isThereNewMessageNotFromCurrentUser = (\n userId: string,\n latestMessageFromPreviousMessages?: ChatMessage,\n latestMessageFromNewMessages?: ChatMessage\n): boolean => {\n if (latestMessageFromNewMessages === undefined) {\n return false;\n }\n if (latestMessageFromPreviousMessages === undefined) {\n return latestMessageFromNewMessages.senderId !== userId;\n }\n return (\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\n latestMessageFromNewMessages.senderId !== userId\n );\n};\n\n/**\n * Returns true if the current user sent the latest message and false otherwise. It will ignore messages that have no\n * sender, messages that have failed to send, and messages from the current user that is marked as SEEN. This is meant\n * as an indirect way to detect if user is at bottom of the chat when the component updates with new messages. If we\n * updated this component due to current user sending a message we want to then call scrollToBottom.\n */\nconst didUserSendTheLatestMessage = (\n userId: string,\n latestMessageFromPreviousMessages?: ChatMessage,\n latestMessageFromNewMessages?: ChatMessage\n): boolean => {\n if (latestMessageFromNewMessages === undefined) {\n return false;\n }\n if (latestMessageFromPreviousMessages === undefined) {\n return latestMessageFromNewMessages.senderId === userId;\n }\n return (\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\n latestMessageFromNewMessages.senderId === userId\n );\n};\n\n/**\n * Fluent styles for {@link MessageThread}.\n *\n * @public\n */\nexport interface MessageThreadStyles extends BaseCustomStyles {\n /** Styles for load previous messages container. */\n loadPreviousMessagesButtonContainer?: IStyle;\n /** Styles for new message container. */\n newMessageButtonContainer?: IStyle;\n /** Styles for chat container. */\n chatContainer?: ComponentSlotStyle;\n /** styles for my chat items. */\n myChatItemMessageContainer?: ComponentSlotStyle;\n /** styles for chat items. */\n chatItemMessageContainer?: ComponentSlotStyle;\n /** Styles for my chat message container. */\n myChatMessageContainer?: ComponentSlotStyle;\n /** Styles for my chat message container in case of failure. */\n failedMyChatMessageContainer?: ComponentSlotStyle;\n /** Styles for chat message container. */\n chatMessageContainer?: ComponentSlotStyle;\n /** Styles for system message container. */\n systemMessageContainer?: ComponentSlotStyle;\n /** Styles for blocked message container. */\n /* @conditional-compile-remove(data-loss-prevention) */\n blockedMessageContainer?: ComponentSlotStyle;\n /** Styles for message status indicator container. */\n messageStatusContainer?: (mine: boolean) => IStyle;\n}\n\n/**\n * Strings of {@link MessageThread} that can be overridden.\n *\n * @public\n */\nexport interface MessageThreadStrings {\n /** String for Sunday */\n sunday: string;\n /** String for Monday */\n monday: string;\n /** String for Tuesday */\n tuesday: string;\n /** String for Wednesday */\n wednesday: string;\n /** String for Thursday */\n thursday: string;\n /** String for Friday */\n friday: string;\n /** String for Saturday */\n saturday: string;\n /** String for Yesterday */\n yesterday: string;\n /** String for participants joined */\n participantJoined: string;\n /** String for participants left */\n participantLeft: string;\n /** Tag shown on a message that has been edited */\n editedTag: string;\n /** String for editing message in floating menu */\n editMessage: string;\n /** String for removing message in floating menu */\n removeMessage: string;\n /** String for resending failed message in floating menu */\n resendMessage?: string;\n /** String for indicating failed to send messages */\n failToSendTag?: string;\n /** String for LiveMessage introduction for the Chat Message */\n liveAuthorIntro: string;\n /** String for aria text of remote user's message content */\n messageContentAriaText: string;\n /** String for aria text of local user's message content */\n messageContentMineAriaText: string;\n /** String for warning on text limit exceeded in EditBox*/\n editBoxTextLimit: string;\n /** String for placeholder text in EditBox when there is no user input*/\n editBoxPlaceholderText: string;\n /** String for new messages indicator*/\n newMessagesIndicator: string;\n /** String for showing message read status in floating menu */\n messageReadCount?: string;\n /** String for replacing display name when there is none*/\n noDisplayNameSub: string;\n /** String for Cancel button in EditBox*/\n editBoxCancelButton: string;\n /** String for Submit in EditBox when there is no user input*/\n editBoxSubmitButton: string;\n /** String for action menu indicating there are more options */\n actionMenuMoreOptions?: string;\n /** Aria label to announce when a message is deleted */\n messageDeletedAnnouncementAriaLabel: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /** String for download attachment button in attachment card */\n downloadAttachment: string;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n /** String for open attachment button in attachment card */\n openAttachment: string;\n /* @conditional-compile-remove(data-loss-prevention) */\n /** String for policy violation message removal */\n blockedWarningText: string;\n /* @conditional-compile-remove(data-loss-prevention) */\n /** String for policy violation message removal details link */\n blockedWarningLinkText: string;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n /** String for aria text in attachment card group*/\n attachmentCardGroupMessage: string;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Error message indicating that all attachment uploads are not complete.\n */\n attachmentUploadsPendingError: string;\n}\n\n/**\n * Arguments for {@link MessageThreadProps.onRenderJumpToNewMessageButton}.\n *\n * @public\n */\nexport interface JumpToNewMessageButtonProps {\n /** String for button text */\n text: string;\n /** Callback for when button is clicked */\n onClick: () => void;\n}\n\nconst DefaultJumpToNewMessageButton = (props: JumpToNewMessageButtonProps): JSX.Element => {\n const { text, onClick } = props;\n return (\n <PrimaryButton\n className={newMessageButtonStyle}\n styles={buttonWithIconStyles}\n text={text}\n onClick={onClick}\n onRenderIcon={() => <Icon iconName=\"Down\" className={DownIconStyle} />}\n />\n );\n};\n\n/**\n * A component to render a single message.\n *\n * @public\n */\nexport type MessageRenderer = (props: MessageProps) => JSX.Element;\n\nconst memoizeAllMessages = memoizeFnAll(\n (\n message: Message,\n showMessageDate: boolean,\n showMessageStatus: boolean,\n strings: MessageThreadStrings,\n index: number,\n onUpdateMessage?: UpdateMessageCallback,\n onCancelEditMessage?: CancelEditCallback,\n onDeleteMessage?: (messageId: string) => Promise<void>,\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>,\n disableEditing?: boolean,\n lastSeenChatMessage?: string,\n lastSendingChatMessage?: string,\n lastDeliveredChatMessage?: string\n ): _ChatMessageProps => {\n let key: string | undefined = message.messageId;\n let statusToRender: MessageStatus | undefined = undefined;\n\n if (\n message.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked'\n ) {\n if ((!message.messageId || message.messageId === '') && 'clientMessageId' in message) {\n key = message.clientMessageId;\n }\n if (showMessageStatus && message.mine) {\n switch (message.messageId) {\n case lastSeenChatMessage: {\n statusToRender = 'seen';\n break;\n }\n case lastSendingChatMessage: {\n statusToRender = 'sending';\n break;\n }\n case lastDeliveredChatMessage: {\n statusToRender = 'delivered';\n break;\n }\n }\n }\n if (message.mine && message.status === 'failed') {\n statusToRender = 'failed';\n }\n }\n return {\n key: key ?? 'id_' + index,\n statusToRender,\n message,\n strings,\n showDate: showMessageDate,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessage,\n onSendMessage,\n disableEditing,\n showMessageStatus\n };\n }\n);\n\nconst getLastChatMessageIdWithStatus = (messages: Message[], status: MessageStatus): string | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message.messageType === 'chat' && message.status === status && message.mine) {\n return message.messageId;\n }\n }\n return undefined;\n};\n\nconst getLastChatMessageForCurrentUser = (messages: Message[]): ChatMessage | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message.messageType === 'chat' && message.mine) {\n return message;\n }\n }\n return undefined;\n};\n\n/**\n * @public\n * Callback function run when a message is updated.\n */\nexport type UpdateMessageCallback = (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n) => Promise<void>;\n/**\n * @public\n * Callback function run when a message edit is cancelled.\n */\nexport type CancelEditCallback = (messageId: string) => void;\n\n/**\n * Props for {@link MessageThread}.\n *\n * @public\n */\nexport type MessageThreadProps = {\n /**\n * UserId of the current user.\n */\n userId: string;\n /**\n * Messages to render in message thread. A message can be of type `ChatMessage`, `SystemMessage`, `BlockedMessage` or `CustomMessage`.\n */\n messages: (\n | ChatMessage\n | SystemMessage\n | CustomMessage\n | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage\n )[];\n /**\n * number of participants in the thread\n */\n participantCount?: number;\n /**\n * read receipts for each sender in the chat\n */\n readReceiptsBySenderId?: ReadReceiptsBySenderId;\n /**\n * Allows users to pass an object containing custom CSS styles.\n * @Example\n * ```\n * <MessageThread styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: MessageThreadStyles;\n /**\n * Whether the new message button is disabled or not.\n *\n * @defaultValue `false`\n */\n disableJumpToNewMessageButton?: boolean;\n /**\n * Whether the date of each message is displayed or not.\n * It is ignored when onDisplayDateTimeString is supplied.\n *\n * @defaultValue `false`\n */\n showMessageDate?: boolean;\n /**\n * Whether the status indicator for each message is displayed or not.\n *\n * @defaultValue `false`\n */\n showMessageStatus?: boolean;\n /**\n * Number of chat messages to reload each time onLoadPreviousChatMessages is called.\n *\n * @defaultValue 0\n */\n numberOfChatMessagesToReload?: number;\n /**\n * Optional callback to override actions on message being seen.\n *\n * @param messageId - message Id\n */\n onMessageSeen?: (messageId: string) => Promise<void>;\n /**\n * Optional callback to override render of the message status indicator.\n *\n * @param messageStatusIndicatorProps - props of type MessageStatusIndicatorProps\n */\n onRenderMessageStatus?: (messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n /**\n * Optional callback to override render of the button for jumping to the new message.\n *\n * @param newMessageButtonProps - button props of type JumpToNewMessageButtonProps 0 */\n onRenderJumpToNewMessageButton?: (newMessageButtonProps: JumpToNewMessageButtonProps) => JSX.Element;\n /**\n * Optional callback to override loading of previous messages.\n * It accepts the number of history chat messages that we want to load and return a boolean Promise indicating if we have got all the history messages.\n * If the promise resolves to `true`, we have load all chat messages into the message thread and `loadPreviousMessagesButton` will not be rendered anymore.\n */\n onLoadPreviousChatMessages?: (messagesToLoad: number) => Promise<boolean>;\n /**\n * Optional callback to override render of a message.\n *\n * @param messageProps - props of type {@link communication-react#MessageProps}\n * @param defaultOnRender - default render of type {@link communication-react#MessageRenderer}\n *\n * @remarks\n * `messageRenderer` is not provided for `CustomMessage` and thus only available for `ChatMessage` and `SystemMessage`.\n */\n onRenderMessage?: (messageProps: MessageProps, messageRenderer?: MessageRenderer) => JSX.Element;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to render attachments in the message component.\n * @beta\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /**\n * Optional callback to edit a message.\n *\n * @param messageId - message id from chatClient\n * @param content - new content of the message\n *\n */\n onUpdateMessage?: UpdateMessageCallback;\n\n /**\n * Optional callback for when a message edit is cancelled.\n *\n * @param messageId - message id from chatClient\n */\n onCancelEditMessage?: CancelEditCallback;\n /**\n * Optional callback to delete a message.\n *\n * @param messageId - message id from chatClient\n *\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n\n /**\n * Optional callback to send a message.\n *\n * @param content - message body to send\n * @param options - message options to be included in the message\n *\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n\n /**\n /**\n * Disable editing messages.\n *\n * @remarks This removes the action menu on messages.\n *\n * @defaultValue `false`\n */\n disableEditing?: boolean;\n\n /**\n * Optional strings to override in component\n */\n strings?: Partial<MessageThreadStrings>;\n\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * @beta\n * Optional attachment options, which defines behvaiour for uploading and downloading attachments.\n * As this moment, the uploadOptions would be ignored and this option is intended for download only.\n */\n attachmentOptions?: AttachmentOptions;\n\n /* @conditional-compile-remove(date-time-customization) */\n /**\n * Optional function to provide customized date format.\n * @beta\n */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to lookup a mention query and display mentions\n * @beta\n */\n mentionOptions?: MentionOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n\n /* @conditional-compile-remove(rich-text-editor) */\n /**\n * Options to enable rich text editor for the edit box.\n * @beta\n */\n richTextEditorOptions?: RichTextEditorOptions;\n};\n\n/* @conditional-compile-remove(rich-text-editor) */\n/**\n * Options for the rich text editor configuration.\n *\n * @beta\n */\nexport interface RichTextEditorOptions {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to handle paste event.\n */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to upload an inline image in the rich text editor.\n */\n onUploadInlineImage?: (imageUrl: string, imageFileName: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to remove the attachment upload or delete the image before sending.\n */\n onCancelInlineImageUpload?: (imageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional array of type {@link AttachmentMetadataInProgress}\n * to render inline images being uploaded in the RichTextSendBox.\n */\n imageUploadsInProgress?: AttachmentMetadataInProgress[];\n}\n\n/**\n * Props to render a single message.\n *\n * See {@link MessageRenderer}.\n *\n * @public\n */\nexport type MessageProps = {\n /**\n * Message to render. It can type `ChatMessage` or `SystemMessage`, `BlockedMessage` or `CustomMessage`.\n */\n message: Message;\n /**\n * Strings from parent MessageThread component\n */\n strings: MessageThreadStrings & /* @conditional-compile-remove(rich-text-editor) */ Partial<RichTextStrings>;\n /**\n * Custom CSS styles for chat message container.\n */\n messageContainerStyle?: ComponentSlotStyle;\n /**\n * Whether the date of a message is displayed or not.\n *\n * @defaultValue `false`\n */\n showDate?: boolean;\n /**\n * Disable editing messages.\n *\n * @remarks This removes the action menu on messages.\n *\n * @defaultValue `false`\n */\n disableEditing?: boolean;\n /**\n * Optional callback to edit a message.\n *\n * @param messageId - message id from chatClient\n * @param content - new content of the message\n */\n onUpdateMessage?: UpdateMessageCallback;\n\n /**\n * Optional callback for when a message edit is cancelled.\n *\n * @param messageId - message id from chatClient\n */\n onCancelEditMessage?: CancelEditCallback;\n /**\n * Optional callback to delete a message.\n *\n * @param messageId - message id from chatClient\n *\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n\n /**\n * Optional callback to send a message.\n *\n * @param content - message content from chatClient\n * @param options - message options to be included in the message\n *\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n};\n\n/**\n * @internal\n */\nexport type _ChatMessageProps = MessageProps & {\n key: string;\n statusToRender: MessageStatus | undefined;\n showMessageStatus?: boolean;\n};\n\n/**\n * `MessageThread` allows you to easily create a component for rendering chat messages, handling scrolling behavior of new/old messages and customizing icons & controls inside the chat thread.\n * @param props - of type MessageThreadProps\n *\n * Users will need to provide at least chat messages and userId to render the `MessageThread` component.\n * Users can also customize `MessageThread` by passing in their own Avatar, `MessageStatusIndicator` icon, `JumpToNewMessageButton`, `LoadPreviousMessagesButton` and the behavior of these controls.\n *\n * `MessageThread` internally uses the `Chat` component from `@fluentui-contrib/chat`. You can checkout the details about these components [here](https://microsoft.github.io/fluentui-contrib/react-chat/).\n *\n * @public\n */\nexport const MessageThread = (props: MessageThreadProps): JSX.Element => {\n const theme = useTheme();\n\n const chatBody = useMemo(() => {\n return (\n <FluentV9ThemeProvider v8Theme={theme}>\n {/* Wrapper is required to call \"useClasses\" hook with proper context values */}\n <MessageThreadWrapper {...props} />\n </FluentV9ThemeProvider>\n );\n }, [theme, props]);\n\n return <div className={mergeStyles(messageThreadContainerStyle, props.styles?.root)}>{chatBody}</div>;\n};\n\n/**\n * @private\n */\nexport const MessageThreadWrapper = (props: MessageThreadProps): JSX.Element => {\n const {\n messages: newMessages,\n userId,\n participantCount,\n readReceiptsBySenderId,\n styles,\n disableJumpToNewMessageButton = false,\n showMessageDate = false,\n showMessageStatus = false,\n numberOfChatMessagesToReload = 5,\n onMessageSeen,\n onRenderMessageStatus,\n onRenderAvatar,\n onLoadPreviousChatMessages,\n onRenderJumpToNewMessageButton,\n onRenderMessage,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessage,\n onSendMessage,\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString,\n /* @conditional-compile-remove(mention) */\n mentionOptions,\n inlineImageOptions,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentOptions,\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(rich-text-editor) */\n richTextEditorOptions\n } = props;\n // We need this state to wait for one tick and scroll to bottom after messages have been initialized.\n // Otherwise chatScrollDivRef.current.clientHeight is wrong if we scroll to bottom before messages are initialized.\n const [chatMessagesInitialized, setChatMessagesInitialized] = useState<boolean>(false);\n const [isAtBottomOfScroll, setIsAtBottomOfScroll] = useState<boolean>(true);\n const [forceUpdate, setForceUpdate] = useState<number>(0);\n\n // Used to decide if should auto scroll to bottom or show \"new message\" button\n const [latestPreviousChatMessage, setLatestPreviousChatMessage] = useState<ChatMessage | undefined>(undefined);\n const [latestCurrentChatMessage, setLatestCurrentChatMessage] = useState<ChatMessage | undefined>(undefined);\n const [existsNewChatMessage, setExistsNewChatMessage] = useState<boolean>(false);\n\n const [lastSeenChatMessage, setLastSeenChatMessage] = useState<string | undefined>(undefined);\n const [lastDeliveredChatMessage, setLastDeliveredChatMessage] = useState<string | undefined>(undefined);\n const [lastSendingChatMessage, setLastSendingChatMessage] = useState<string | undefined>(undefined);\n\n // readCount and participantCount will only need to be updated on-fly when user hover on an indicator\n const [readCountForHoveredIndicator, setReadCountForHoveredIndicator] = useState<number | undefined>(undefined);\n\n const localeStrings = useLocale().strings.messageThread;\n const strings = useMemo(() => ({ ...localeStrings, ...props.strings }), [localeStrings, props.strings]);\n // it is required to use useState for messages\n // as the scrolling logic requires re - render at a specific point in time\n const [messages, setMessages] = useState<Message[]>([]);\n\n // id for the latest deleted message\n const [latestDeletedMessageId, setLatestDeletedMessageId] = useState<string | undefined>(undefined);\n // this value is used to check if a message is deleted for the previous value of messages array\n const previousMessagesRef = useRef<Message[]>([]);\n // an aria label for Narrator to notify when a message is deleted\n const [deletedMessageAriaLabel, setDeletedMessageAriaLabel] = useState<string | undefined>(undefined);\n /* @conditional-compile-remove(rich-text-editor) */\n useEffect(() => {\n // if rich text editor is enabled, the rich text editor component should be loaded early for good UX\n if (richTextEditorOptions !== undefined) {\n // this line is needed to load the Rooster JS dependencies early in the lifecycle\n // when the rich text editor is enabled\n loadChatMessageComponentAsRichTextEditBox();\n }\n }, [richTextEditorOptions]);\n\n const onDeleteMessageCallback = useCallback(\n async (messageId: string): Promise<void> => {\n if (!onDeleteMessage) {\n return;\n }\n try {\n // reset deleted message label in case if there was a value already (messages are deleted 1 after another)\n setDeletedMessageAriaLabel(undefined);\n setLatestDeletedMessageId(messageId);\n lastChatMessageStatus.current = 'deleted';\n // we should set up latestDeletedMessageId before the onDeleteMessage call\n // as otherwise in very rare cases the messages array can be updated before latestDeletedMessageId\n await onDeleteMessage(messageId);\n } catch (e) {\n console.log('onDeleteMessage failed: messageId', messageId, 'error', e);\n }\n },\n [onDeleteMessage]\n );\n\n const isAllChatMessagesLoadedRef = useRef(false);\n // isAllChatMessagesLoadedRef needs to be updated every time when a new adapter is set in order to display correct data\n // onLoadPreviousChatMessages is updated when a new adapter is set\n useEffect(() => {\n if (onLoadPreviousChatMessages) {\n isAllChatMessagesLoadedRef.current = false;\n }\n }, [onLoadPreviousChatMessages]);\n\n const previousTopRef = useRef<number>(-1);\n const previousHeightRef = useRef<number>(-1);\n\n const messageIdSeenByMeRef = useRef<string>('');\n\n const chatScrollDivRef = useRef<HTMLDivElement>(null);\n const isLoadingChatMessagesRef = useRef(false);\n\n useEffect(() => {\n if (latestDeletedMessageId === undefined) {\n setDeletedMessageAriaLabel(undefined);\n } else {\n if (!previousMessagesRef.current.find((message) => message.messageId === latestDeletedMessageId)) {\n // the message is deleted in previousMessagesRef\n // no need to update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(undefined);\n } else if (!messages.find((message) => message.messageId === latestDeletedMessageId)) {\n // the message is deleted in messages array but still exists in previousMessagesRef\n // update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(strings.messageDeletedAnnouncementAriaLabel);\n } else {\n // the message exists in both arrays\n // no need to update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(undefined);\n }\n }\n previousMessagesRef.current = messages;\n }, [latestDeletedMessageId, messages, strings.messageDeletedAnnouncementAriaLabel]);\n\n const messagesRef = useRef(messages);\n const setMessagesRef = (messagesWithAttachedValue: Message[]): void => {\n messagesRef.current = messagesWithAttachedValue;\n setMessages(messagesWithAttachedValue);\n };\n\n const isAtBottomOfScrollRef = useRef(isAtBottomOfScroll);\n const setIsAtBottomOfScrollRef = (isAtBottomOfScrollValue: boolean): void => {\n isAtBottomOfScrollRef.current = isAtBottomOfScrollValue;\n setIsAtBottomOfScroll(isAtBottomOfScrollValue);\n };\n\n const chatMessagesInitializedRef = useRef(chatMessagesInitialized);\n const setChatMessagesInitializedRef = (chatMessagesInitialized: boolean): void => {\n chatMessagesInitializedRef.current = chatMessagesInitialized;\n setChatMessagesInitialized(chatMessagesInitialized);\n };\n\n const chatThreadRef = useRef<HTMLDivElement>(null);\n\n // When the chat thread is narrow, we perform space optimizations such as overlapping\n // the avatar on top of the chat message and moving the chat accept/reject edit buttons\n // to a new line\n const chatThreadWidth = _useContainerWidth(chatThreadRef);\n const isNarrow = chatThreadWidth ? isNarrowWidth(chatThreadWidth) : false;\n\n /**\n * ClientHeight controls the number of messages to render. However ClientHeight will not be initialized after the\n * first render (not sure but I guess Fluent is updating it in hook which is after render maybe?) so we need to\n * trigger a re-render until ClientHeight is initialized. This force re-render should only happen once.\n */\n const clientHeight = chatThreadRef.current?.clientHeight;\n\n // we try to only send those message status if user is scrolled to the bottom.\n const sendMessageStatusIfAtBottom = useCallback(async (): Promise<void> => {\n if (\n !isAtBottomOfScrollRef.current ||\n !document.hasFocus() ||\n !messagesRef.current ||\n messagesRef.current.length === 0 ||\n !showMessageStatus\n ) {\n return;\n }\n const messagesWithId = messagesRef.current.filter((message) => {\n return message.messageType === 'chat' && !message.mine && !!message.messageId;\n });\n if (messagesWithId.length === 0) {\n return;\n }\n const lastMessage: ChatMessage = messagesWithId[messagesWithId.length - 1] as ChatMessage;\n try {\n if (\n onMessageSeen &&\n lastMessage &&\n lastMessage.messageId &&\n lastMessage.messageId !== messageIdSeenByMeRef.current\n ) {\n await onMessageSeen(lastMessage.messageId);\n messageIdSeenByMeRef.current = lastMessage.messageId;\n }\n } catch (e) {\n console.log('onMessageSeen Error', lastMessage, e);\n }\n }, [showMessageStatus, onMessageSeen]);\n\n const scrollToBottom = useCallback((): void => {\n if (chatScrollDivRef.current) {\n chatScrollDivRef.current.scrollTop = chatScrollDivRef.current.scrollHeight;\n }\n setExistsNewChatMessage(false);\n setIsAtBottomOfScrollRef(true);\n sendMessageStatusIfAtBottom();\n }, [sendMessageStatusIfAtBottom]);\n\n const handleScrollToTheBottom = useCallback((): void => {\n if (!chatScrollDivRef.current) {\n return;\n }\n\n const atBottom =\n Math.ceil(chatScrollDivRef.current.scrollTop) >=\n chatScrollDivRef.current.scrollHeight - chatScrollDivRef.current.clientHeight;\n if (atBottom) {\n sendMessageStatusIfAtBottom();\n if (!isAtBottomOfScrollRef.current) {\n scrollToBottom();\n }\n }\n setIsAtBottomOfScrollRef(atBottom);\n }, [scrollToBottom, sendMessageStatusIfAtBottom]);\n\n // Infinite scrolling + threadInitialize function\n const fetchNewMessageWhenAtTop = useCallback(async () => {\n if (!isLoadingChatMessagesRef.current) {\n if (onLoadPreviousChatMessages) {\n isLoadingChatMessagesRef.current = true;\n try {\n // Fetch message until scrollTop reach the threshold for fetching new message\n while (\n !isAllChatMessagesLoadedRef.current &&\n chatScrollDivRef.current &&\n chatScrollDivRef.current.scrollTop <= 500\n ) {\n isAllChatMessagesLoadedRef.current = await onLoadPreviousChatMessages(numberOfChatMessagesToReload);\n await delay(200);\n }\n } finally {\n // Set isLoadingChatMessagesRef to false after messages are fetched\n isLoadingChatMessagesRef.current = false;\n }\n }\n }\n }, [numberOfChatMessagesToReload, onLoadPreviousChatMessages]);\n\n // The below 2 of useEffects are design for fixing infinite scrolling problem\n // Scrolling element will behave differently when scrollTop = 0(it sticks at the top)\n // we need to get previousTop before it prepend contents\n // Execute order [newMessage useEffect] => get previousTop => dom update => [messages useEffect]\n useEffect(() => {\n if (!chatScrollDivRef.current) {\n return;\n }\n previousTopRef.current = chatScrollDivRef.current.scrollTop;\n previousHeightRef.current = chatScrollDivRef.current.scrollHeight;\n }, [newMessages]);\n\n useEffect(() => {\n if (!chatScrollDivRef.current) {\n return;\n }\n chatScrollDivRef.current.scrollTop =\n chatScrollDivRef.current.scrollHeight - (previousHeightRef.current - previousTopRef.current);\n }, [messages]);\n\n // Fetch more messages to make the scroll bar appear, infinity scroll is then handled in the handleScroll function.\n useEffect(() => {\n fetchNewMessageWhenAtTop();\n }, [fetchNewMessageWhenAtTop]);\n\n /**\n * One time run useEffects. Sets up listeners when component is mounted and tears down listeners when component\n * unmounts unless these function changed\n */\n useEffect(() => {\n window && window.addEventListener('click', sendMessageStatusIfAtBottom);\n window && window.addEventListener('focus', sendMessageStatusIfAtBottom);\n return () => {\n window && window.removeEventListener('click', sendMessageStatusIfAtBottom);\n window && window.removeEventListener('focus', sendMessageStatusIfAtBottom);\n };\n }, [sendMessageStatusIfAtBottom]);\n\n useEffect(() => {\n const chatScrollDiv = chatScrollDivRef.current;\n chatScrollDiv?.addEventListener('scroll', handleScrollToTheBottom);\n chatScrollDiv?.addEventListener('scroll', fetchNewMessageWhenAtTop);\n\n return () => {\n chatScrollDiv?.removeEventListener('scroll', handleScrollToTheBottom);\n chatScrollDiv?.removeEventListener('scroll', fetchNewMessageWhenAtTop);\n };\n }, [fetchNewMessageWhenAtTop, handleScrollToTheBottom]);\n\n useEffect(() => {\n if (clientHeight === undefined) {\n setForceUpdate(forceUpdate + 1);\n return;\n }\n // Only scroll to bottom if isAtBottomOfScrollRef is true\n isAtBottomOfScrollRef.current && scrollToBottom();\n }, [clientHeight, forceUpdate, scrollToBottom, chatMessagesInitialized]);\n useEffect(() => {\n const newStatus = getLastChatMessageForCurrentUser(newMessages)?.status;\n if (newStatus !== undefined) {\n if (lastChatMessageStatus.current === 'deleted' && newStatus === 'sending') {\n // enforce message life cycle\n // message status should always be [ sending -> delivered -> seen (optional) -> deleted ] or [sending -> failed -> deleted]\n // not any other way around\n // therefore, if current message status is deleted, we should only update it if newStatus is sending\n lastChatMessageStatus.current = newStatus;\n } else if (lastChatMessageStatus.current !== 'deleted') {\n lastChatMessageStatus.current = newStatus;\n }\n }\n // The hook should depend on newMessages not on messages as otherwise it will skip the sending status for a first message\n }, [newMessages]);\n\n /**\n * This needs to run to update latestPreviousChatMessage & latestCurrentChatMessage.\n * These two states are used to manipulate scrollbar\n */\n useEffect(() => {\n setLatestPreviousChatMessage(getLatestChatMessage(messagesRef.current));\n setLatestCurrentChatMessage(getLatestChatMessage(newMessages));\n setMessagesRef(newMessages);\n !chatMessagesInitializedRef.current && setChatMessagesInitializedRef(true);\n setLastDeliveredChatMessage(getLastChatMessageIdWithStatus(newMessages, 'delivered'));\n setLastSeenChatMessage(getLastChatMessageIdWithStatus(newMessages, 'seen'));\n setLastSendingChatMessage(getLastChatMessageIdWithStatus(newMessages, 'sending'));\n }, [newMessages]);\n\n /**\n * This needs to run after messages are rendered so we can manipulate the scroll bar.\n */\n useEffect(() => {\n // If user just sent the latest message then we assume we can move user to bottom of scroll.\n if (\n isThereNewMessageNotFromCurrentUser(userId, latestPreviousChatMessage, latestCurrentChatMessage) &&\n !isAtBottomOfScrollRef.current\n ) {\n setExistsNewChatMessage(true);\n } else if (\n didUserSendTheLatestMessage(userId, latestPreviousChatMessage, latestCurrentChatMessage) ||\n isAtBottomOfScrollRef.current\n ) {\n scrollToBottom();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messages]);\n\n const lastChatMessageStatus = useRef<string | undefined>(undefined);\n const participantCountRef = useRef(participantCount);\n const readReceiptsBySenderIdRef = useRef(readReceiptsBySenderId);\n\n participantCountRef.current = participantCount;\n readReceiptsBySenderIdRef.current = readReceiptsBySenderId;\n\n const onActionButtonClickMemo = useCallback(\n (message: ChatMessage, setMessageReadBy: (readBy: { id: string; displayName: string }[]) => void) => {\n if (participantCountRef.current && participantCountRef.current - 1 > 1 && readReceiptsBySenderIdRef.current) {\n setMessageReadBy(getParticipantsWhoHaveReadMessage(message, readReceiptsBySenderIdRef.current));\n }\n },\n []\n );\n\n const defaultStatusRenderer = useCallback(\n (\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage,\n participantCount: number,\n readCount: number,\n status?: MessageStatus\n ) => {\n // we should only announce label if the message status isn't deleted\n // because after message is deleted, we now need to render statusIndicator for previous messages\n // and their status has been announced already and we should not announce them again\n const shouldAnnounce = lastChatMessageStatus.current !== 'deleted';\n\n const onToggleToolTip = (isToggled: boolean): void => {\n if (isToggled && readReceiptsBySenderIdRef.current) {\n setReadCountForHoveredIndicator(\n getParticipantsWhoHaveReadMessage(message, readReceiptsBySenderIdRef.current).length\n );\n } else {\n setReadCountForHoveredIndicator(undefined);\n }\n };\n return (\n <MessageStatusIndicatorInternal\n status={status}\n readCount={readCount}\n onToggleToolTip={onToggleToolTip}\n // -1 because participant count does not include myself\n remoteParticipantsCount={participantCount ? participantCount - 1 : 0}\n shouldAnnounce={shouldAnnounce}\n />\n );\n },\n []\n );\n\n const theme = useTheme();\n\n const messagesToDisplay = useMemo(() => {\n return memoizeAllMessages((memoizedMessageFn) => {\n return messages.map((message: Message, index: number): _ChatMessageProps => {\n return memoizedMessageFn(\n message,\n showMessageDate,\n showMessageStatus,\n strings,\n index,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessageCallback,\n onSendMessage,\n props.disableEditing,\n lastDeliveredChatMessage,\n lastSeenChatMessage,\n lastSendingChatMessage\n );\n });\n });\n }, [\n lastDeliveredChatMessage,\n lastSeenChatMessage,\n lastSendingChatMessage,\n messages,\n onCancelEditMessage,\n onDeleteMessageCallback,\n onSendMessage,\n onUpdateMessage,\n props.disableEditing,\n showMessageDate,\n showMessageStatus,\n strings\n ]);\n\n const classes = useChatStyles();\n\n return (\n <div className={mergeStyles(messageThreadWrapperContainerStyle)} ref={chatThreadRef}>\n {/* Always ensure New Messages button is above the chat body element in the DOM tree. This is to ensure correct\n tab ordering. Because the New Messages button floats on top of the chat body it is in a higher z-index and\n thus Users should be able to tab navigate to the new messages button _before_ tab focus is taken to the chat body.*/}\n {existsNewChatMessage && !disableJumpToNewMessageButton && (\n <div className={mergeStyles(newMessageButtonContainerStyle, styles?.newMessageButtonContainer)}>\n {onRenderJumpToNewMessageButton ? (\n onRenderJumpToNewMessageButton({ text: strings.newMessagesIndicator, onClick: scrollToBottom })\n ) : (\n <DefaultJumpToNewMessageButton text={strings.newMessagesIndicator} onClick={scrollToBottom} />\n )}\n </div>\n )}\n <LiveAnnouncer>\n <FluentV9ThemeProvider v8Theme={theme}>\n <Chat\n // styles?.chatContainer used in className and style prop as style prop can't handle CSS selectors\n className={mergeClasses(classes.root, mergeStyles(styles?.chatContainer))}\n ref={chatScrollDivRef}\n style={{ ...createStyleFromV8Style(styles?.chatContainer) }}\n >\n {latestDeletedMessageId && (\n <Announcer\n key={latestDeletedMessageId}\n announcementString={deletedMessageAriaLabel}\n ariaLive={'polite'}\n />\n )}\n {messagesToDisplay.map((message: _ChatMessageProps): JSX.Element => {\n return (\n <MemoChatMessageComponentWrapper\n {...message}\n userId={userId}\n key={message.key}\n styles={styles}\n shouldOverlapAvatarAndMessage={isNarrow}\n strings={strings}\n onRenderAvatar={onRenderAvatar}\n onRenderMessage={onRenderMessage}\n onRenderMessageStatus={onRenderMessageStatus}\n defaultStatusRenderer={defaultStatusRenderer}\n onActionButtonClick={onActionButtonClickMemo}\n readCount={readCountForHoveredIndicator}\n participantCount={participantCount}\n /* @conditional-compile-remove(file-sharing-acs) */\n actionsForAttachment={attachmentOptions?.downloadOptions?.actionsForAttachment}\n inlineImageOptions={inlineImageOptions}\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString={onDisplayDateTimeString}\n /* @conditional-compile-remove(mention) */\n mentionOptions={mentionOptions}\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads={onRenderAttachmentDownloads}\n /* @conditional-compile-remove(rich-text-editor) */\n richTextEditorOptions={richTextEditorOptions}\n />\n );\n })}\n </Chat>\n </FluentV9ThemeProvider>\n </LiveAnnouncer>\n </div>\n );\n};\n\nconst MemoChatMessageComponentWrapper = React.memo((obj: ChatMessageComponentWrapperProps): JSX.Element => {\n return <ChatMessageComponentWrapper {...obj} />;\n});\n"]}
1
+ {"version":3,"file":"MessageThread.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/MessageThread.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,IAAI,EAAU,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EACL,aAAa,EACb,8BAA8B,EAC9B,2BAA2B,EAC3B,kCAAkC,EAClC,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE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AqB;4BAChD,gEAAgE;4BAChE,OAAO,EAAE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,OAAO;4BACvC,gEAAgE;4BAChE,mBAAmB,EAAE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,mBAAmB;4BAC/D,gEAAgE;4BAChE,sBAAsB,EACpB,CAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,8BAA8B;iCACrD,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,8BAA8B,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;4BAElF,gEAAgE;4BAChE,yBAAyB,EAAE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,yBAAyB,IAC3E,CACH,CAAC;oBACJ,CAAC,CAAC,CACG,CACe,CACV,CACZ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,+BAA+B,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,GAAqC,EAAe,EAAE;IACxG,OAAO,oBAAC,2BAA2B,oBAAK,GAAG,EAAI,CAAC;AAClD,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Icon, IStyle, mergeStyles, PrimaryButton } from '@fluentui/react';\nimport { Chat } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport {\n DownIconStyle,\n newMessageButtonContainerStyle,\n messageThreadContainerStyle,\n messageThreadWrapperContainerStyle,\n useChatStyles,\n buttonWithIconStyles,\n newMessageButtonStyle\n} from './styles/MessageThread.styles';\nimport { delay } from './utils/delay';\nimport {\n BaseCustomStyles,\n ChatMessage,\n CustomMessage,\n SystemMessage,\n OnRenderAvatarCallback,\n Message,\n ReadReceiptsBySenderId,\n ComponentSlotStyle\n} from '../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../types';\nimport { MessageStatusIndicatorProps } from './MessageStatusIndicator';\nimport { memoizeFnAll, MessageStatus } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\nimport { useLocale } from '../localization/LocalizationProvider';\nimport { isNarrowWidth, _useContainerWidth } from './utils/responsive';\nimport getParticipantsWhoHaveReadMessage from './utils/getParticipantsWhoHaveReadMessage';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentOptions } from '../types/Attachment';\nimport { useTheme } from '../theming';\nimport { FluentV9ThemeProvider } from './../theming/FluentV9ThemeProvider';\nimport LiveAnnouncer from './Announcer/LiveAnnouncer';\n/* @conditional-compile-remove(mention) */\nimport { MentionOptions } from './MentionPopover';\nimport { createStyleFromV8Style } from './styles/v8StyleShim';\nimport {\n ChatMessageComponentWrapper,\n ChatMessageComponentWrapperProps\n} from './ChatMessage/ChatMessageComponentWrapper';\nimport { InlineImageOptions } from './ChatMessage/ChatMessageContent';\nimport { MessageStatusIndicatorInternal } from './MessageStatusIndicatorInternal';\nimport { Announcer } from './Announcer';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { RichTextEditorOptions, RichTextStrings } from './RichTextEditor/RichTextSendBox';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { loadChatMessageComponentAsRichTextEditBox } from './ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker';\n\nconst isMessageSame = (first: ChatMessage, second: ChatMessage): boolean => {\n return (\n first.messageId === second.messageId &&\n first.content === second.content &&\n first.contentType === second.contentType &&\n JSON.stringify(first.createdOn) === JSON.stringify(second.createdOn) &&\n first.senderId === second.senderId &&\n first.senderDisplayName === second.senderDisplayName &&\n JSON.stringify(first.editedOn) === JSON.stringify(second.editedOn)\n );\n};\n\n/**\n * Get the latest message from the message array.\n *\n * @param messages\n */\nconst getLatestChatMessage = (messages: Message[]): ChatMessage | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message.messageType === 'chat' && !!message.createdOn) {\n return message;\n }\n }\n return undefined;\n};\n\n/**\n * Compare latestMessageFromPreviousMessages & latestMessageFromNewMessages to see if the new message is not from\n * current user.\n */\nconst isThereNewMessageNotFromCurrentUser = (\n userId: string,\n latestMessageFromPreviousMessages?: ChatMessage,\n latestMessageFromNewMessages?: ChatMessage\n): boolean => {\n if (latestMessageFromNewMessages === undefined) {\n return false;\n }\n if (latestMessageFromPreviousMessages === undefined) {\n return latestMessageFromNewMessages.senderId !== userId;\n }\n return (\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\n latestMessageFromNewMessages.senderId !== userId\n );\n};\n\n/**\n * Returns true if the current user sent the latest message and false otherwise. It will ignore messages that have no\n * sender, messages that have failed to send, and messages from the current user that is marked as SEEN. This is meant\n * as an indirect way to detect if user is at bottom of the chat when the component updates with new messages. If we\n * updated this component due to current user sending a message we want to then call scrollToBottom.\n */\nconst didUserSendTheLatestMessage = (\n userId: string,\n latestMessageFromPreviousMessages?: ChatMessage,\n latestMessageFromNewMessages?: ChatMessage\n): boolean => {\n if (latestMessageFromNewMessages === undefined) {\n return false;\n }\n if (latestMessageFromPreviousMessages === undefined) {\n return latestMessageFromNewMessages.senderId === userId;\n }\n return (\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\n latestMessageFromNewMessages.senderId === userId\n );\n};\n\n/**\n * Fluent styles for {@link MessageThread}.\n *\n * @public\n */\nexport interface MessageThreadStyles extends BaseCustomStyles {\n /** Styles for load previous messages container. */\n loadPreviousMessagesButtonContainer?: IStyle;\n /** Styles for new message container. */\n newMessageButtonContainer?: IStyle;\n /** Styles for chat container. */\n chatContainer?: ComponentSlotStyle;\n /** styles for my chat items. */\n myChatItemMessageContainer?: ComponentSlotStyle;\n /** styles for chat items. */\n chatItemMessageContainer?: ComponentSlotStyle;\n /** Styles for my chat message container. */\n myChatMessageContainer?: ComponentSlotStyle;\n /** Styles for my chat message container in case of failure. */\n failedMyChatMessageContainer?: ComponentSlotStyle;\n /** Styles for chat message container. */\n chatMessageContainer?: ComponentSlotStyle;\n /** Styles for system message container. */\n systemMessageContainer?: ComponentSlotStyle;\n /** Styles for blocked message container. */\n /* @conditional-compile-remove(data-loss-prevention) */\n blockedMessageContainer?: ComponentSlotStyle;\n /** Styles for message status indicator container. */\n messageStatusContainer?: (mine: boolean) => IStyle;\n}\n\n/**\n * Strings of {@link MessageThread} that can be overridden.\n *\n * @public\n */\nexport interface MessageThreadStrings {\n /** String for Sunday */\n sunday: string;\n /** String for Monday */\n monday: string;\n /** String for Tuesday */\n tuesday: string;\n /** String for Wednesday */\n wednesday: string;\n /** String for Thursday */\n thursday: string;\n /** String for Friday */\n friday: string;\n /** String for Saturday */\n saturday: string;\n /** String for Yesterday */\n yesterday: string;\n /** String for participants joined */\n participantJoined: string;\n /** String for participants left */\n participantLeft: string;\n /** Tag shown on a message that has been edited */\n editedTag: string;\n /** String for editing message in floating menu */\n editMessage: string;\n /** String for removing message in floating menu */\n removeMessage: string;\n /** String for resending failed message in floating menu */\n resendMessage?: string;\n /** String for indicating failed to send messages */\n failToSendTag?: string;\n /** String for LiveMessage introduction for the Chat Message */\n liveAuthorIntro: string;\n /** String for aria text of remote user's message content */\n messageContentAriaText: string;\n /** String for aria text of local user's message content */\n messageContentMineAriaText: string;\n /** String for warning on text limit exceeded in EditBox*/\n editBoxTextLimit: string;\n /** String for placeholder text in EditBox when there is no user input*/\n editBoxPlaceholderText: string;\n /** String for new messages indicator*/\n newMessagesIndicator: string;\n /** String for showing message read status in floating menu */\n messageReadCount?: string;\n /** String for replacing display name when there is none*/\n noDisplayNameSub: string;\n /** String for Cancel button in EditBox*/\n editBoxCancelButton: string;\n /** String for Submit in EditBox when there is no user input*/\n editBoxSubmitButton: string;\n /** String for action menu indicating there are more options */\n actionMenuMoreOptions?: string;\n /** Aria label to announce when a message is deleted */\n messageDeletedAnnouncementAriaLabel: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /** String for download attachment button in attachment card */\n downloadAttachment: string;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n /** String for open attachment button in attachment card */\n openAttachment: string;\n /* @conditional-compile-remove(data-loss-prevention) */\n /** String for policy violation message removal */\n blockedWarningText: string;\n /* @conditional-compile-remove(data-loss-prevention) */\n /** String for policy violation message removal details link */\n blockedWarningLinkText: string;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n /** String for aria text in attachment card group*/\n attachmentCardGroupMessage: string;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Error message indicating that all attachment uploads are not complete.\n */\n attachmentUploadsPendingError: string;\n}\n\n/**\n * Arguments for {@link MessageThreadProps.onRenderJumpToNewMessageButton}.\n *\n * @public\n */\nexport interface JumpToNewMessageButtonProps {\n /** String for button text */\n text: string;\n /** Callback for when button is clicked */\n onClick: () => void;\n}\n\nconst DefaultJumpToNewMessageButton = (props: JumpToNewMessageButtonProps): JSX.Element => {\n const { text, onClick } = props;\n return (\n <PrimaryButton\n className={newMessageButtonStyle}\n styles={buttonWithIconStyles}\n text={text}\n onClick={onClick}\n onRenderIcon={() => <Icon iconName=\"Down\" className={DownIconStyle} />}\n />\n );\n};\n\n/**\n * A component to render a single message.\n *\n * @public\n */\nexport type MessageRenderer = (props: MessageProps) => JSX.Element;\n\nconst memoizeAllMessages = memoizeFnAll(\n (\n message: Message,\n showMessageDate: boolean,\n showMessageStatus: boolean,\n strings: MessageThreadStrings,\n index: number,\n onUpdateMessage?: UpdateMessageCallback,\n onCancelEditMessage?: CancelEditCallback,\n onDeleteMessage?: (messageId: string) => Promise<void>,\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>,\n disableEditing?: boolean,\n lastSeenChatMessage?: string,\n lastSendingChatMessage?: string,\n lastDeliveredChatMessage?: string\n ): _ChatMessageProps => {\n let key: string | undefined = message.messageId;\n let statusToRender: MessageStatus | undefined = undefined;\n\n if (\n message.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked'\n ) {\n if ((!message.messageId || message.messageId === '') && 'clientMessageId' in message) {\n key = message.clientMessageId;\n }\n if (showMessageStatus && message.mine) {\n switch (message.messageId) {\n case lastSeenChatMessage: {\n statusToRender = 'seen';\n break;\n }\n case lastSendingChatMessage: {\n statusToRender = 'sending';\n break;\n }\n case lastDeliveredChatMessage: {\n statusToRender = 'delivered';\n break;\n }\n }\n }\n if (message.mine && message.status === 'failed') {\n statusToRender = 'failed';\n }\n }\n return {\n key: key ?? 'id_' + index,\n statusToRender,\n message,\n strings,\n showDate: showMessageDate,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessage,\n onSendMessage,\n disableEditing,\n showMessageStatus\n };\n }\n);\n\nconst getLastChatMessageIdWithStatus = (messages: Message[], status: MessageStatus): string | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message.messageType === 'chat' && message.status === status && message.mine) {\n return message.messageId;\n }\n }\n return undefined;\n};\n\nconst getLastChatMessageForCurrentUser = (messages: Message[]): ChatMessage | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message.messageType === 'chat' && message.mine) {\n return message;\n }\n }\n return undefined;\n};\n\n/**\n * @public\n * Callback function run when a message is updated.\n */\nexport type UpdateMessageCallback = (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n) => Promise<void>;\n/**\n * @public\n * Callback function run when a message edit is cancelled.\n */\nexport type CancelEditCallback = (messageId: string) => void;\n\n/**\n * Props for {@link MessageThread}.\n *\n * @public\n */\nexport type MessageThreadProps = {\n /**\n * UserId of the current user.\n */\n userId: string;\n /**\n * Messages to render in message thread. A message can be of type `ChatMessage`, `SystemMessage`, `BlockedMessage` or `CustomMessage`.\n */\n messages: (\n | ChatMessage\n | SystemMessage\n | CustomMessage\n | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage\n )[];\n /**\n * number of participants in the thread\n */\n participantCount?: number;\n /**\n * read receipts for each sender in the chat\n */\n readReceiptsBySenderId?: ReadReceiptsBySenderId;\n /**\n * Allows users to pass an object containing custom CSS styles.\n * @Example\n * ```\n * <MessageThread styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: MessageThreadStyles;\n /**\n * Whether the new message button is disabled or not.\n *\n * @defaultValue `false`\n */\n disableJumpToNewMessageButton?: boolean;\n /**\n * Whether the date of each message is displayed or not.\n * It is ignored when onDisplayDateTimeString is supplied.\n *\n * @defaultValue `false`\n */\n showMessageDate?: boolean;\n /**\n * Whether the status indicator for each message is displayed or not.\n *\n * @defaultValue `false`\n */\n showMessageStatus?: boolean;\n /**\n * Number of chat messages to reload each time onLoadPreviousChatMessages is called.\n *\n * @defaultValue 0\n */\n numberOfChatMessagesToReload?: number;\n /**\n * Optional callback to override actions on message being seen.\n *\n * @param messageId - message Id\n */\n onMessageSeen?: (messageId: string) => Promise<void>;\n /**\n * Optional callback to override render of the message status indicator.\n *\n * @param messageStatusIndicatorProps - props of type MessageStatusIndicatorProps\n */\n onRenderMessageStatus?: (messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n /**\n * Optional callback to override render of the button for jumping to the new message.\n *\n * @param newMessageButtonProps - button props of type JumpToNewMessageButtonProps 0 */\n onRenderJumpToNewMessageButton?: (newMessageButtonProps: JumpToNewMessageButtonProps) => JSX.Element;\n /**\n * Optional callback to override loading of previous messages.\n * It accepts the number of history chat messages that we want to load and return a boolean Promise indicating if we have got all the history messages.\n * If the promise resolves to `true`, we have load all chat messages into the message thread and `loadPreviousMessagesButton` will not be rendered anymore.\n */\n onLoadPreviousChatMessages?: (messagesToLoad: number) => Promise<boolean>;\n /**\n * Optional callback to override render of a message.\n *\n * @param messageProps - props of type {@link communication-react#MessageProps}\n * @param defaultOnRender - default render of type {@link communication-react#MessageRenderer}\n *\n * @remarks\n * `messageRenderer` is not provided for `CustomMessage` and thus only available for `ChatMessage` and `SystemMessage`.\n */\n onRenderMessage?: (messageProps: MessageProps, messageRenderer?: MessageRenderer) => JSX.Element;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to render attachments in the message component.\n * @beta\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /**\n * Optional callback to edit a message.\n *\n * @param messageId - message id from chatClient\n * @param content - new content of the message\n *\n */\n onUpdateMessage?: UpdateMessageCallback;\n\n /**\n * Optional callback for when a message edit is cancelled.\n *\n * @param messageId - message id from chatClient\n */\n onCancelEditMessage?: CancelEditCallback;\n /**\n * Optional callback to delete a message.\n *\n * @param messageId - message id from chatClient\n *\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n\n /**\n * Optional callback to send a message.\n *\n * @param content - message body to send\n * @param options - message options to be included in the message\n *\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n\n /**\n /**\n * Disable editing messages.\n *\n * @remarks This removes the action menu on messages.\n *\n * @defaultValue `false`\n */\n disableEditing?: boolean;\n\n /**\n * Optional strings to override in component\n */\n strings?: Partial<MessageThreadStrings>;\n\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * @beta\n * Optional attachment options, which defines behvaiour for uploading and downloading attachments.\n * As this moment, the uploadOptions would be ignored and this option is intended for download only.\n */\n attachmentOptions?: AttachmentOptions;\n\n /* @conditional-compile-remove(date-time-customization) */\n /**\n * Optional function to provide customized date format.\n * @beta\n */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to lookup a mention query and display mentions\n * @beta\n */\n mentionOptions?: MentionOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n\n /* @conditional-compile-remove(rich-text-editor) */\n /**\n * Options to enable rich text editor for the edit box.\n * @beta\n */\n richTextEditorOptions?: RichTextEditBoxOptions;\n};\n\n/* @conditional-compile-remove(rich-text-editor) */\n/**\n * Options for the rich text editor edit box configuration.\n *\n * @beta\n */\nexport interface RichTextEditBoxOptions extends RichTextEditorOptions {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to upload an inline image in the rich text editor.\n */\n onUploadInlineImage?: (imageUrl: string, imageFileName: string, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to remove the attachment upload or delete the image before sending.\n */\n onCancelInlineImageUpload?: (imageId: string, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional Record of type {@link AttachmentMetadataInProgress}\n * to render inline images being uploaded in the MessageThread's edit box.\n */\n messagesImageUploadsInProgress?: Record<string, AttachmentMetadataInProgress[]>;\n}\n\n/**\n * Props to render a single message.\n *\n * See {@link MessageRenderer}.\n *\n * @public\n */\nexport type MessageProps = {\n /**\n * Message to render. It can type `ChatMessage` or `SystemMessage`, `BlockedMessage` or `CustomMessage`.\n */\n message: Message;\n /**\n * Strings from parent MessageThread component\n */\n strings: MessageThreadStrings & /* @conditional-compile-remove(rich-text-editor) */ Partial<RichTextStrings>;\n /**\n * Custom CSS styles for chat message container.\n */\n messageContainerStyle?: ComponentSlotStyle;\n /**\n * Whether the date of a message is displayed or not.\n *\n * @defaultValue `false`\n */\n showDate?: boolean;\n /**\n * Disable editing messages.\n *\n * @remarks This removes the action menu on messages.\n *\n * @defaultValue `false`\n */\n disableEditing?: boolean;\n /**\n * Optional callback to edit a message.\n *\n * @param messageId - message id from chatClient\n * @param content - new content of the message\n */\n onUpdateMessage?: UpdateMessageCallback;\n\n /**\n * Optional callback for when a message edit is cancelled.\n *\n * @param messageId - message id from chatClient\n */\n onCancelEditMessage?: CancelEditCallback;\n /**\n * Optional callback to delete a message.\n *\n * @param messageId - message id from chatClient\n *\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n\n /**\n * Optional callback to send a message.\n *\n * @param content - message content from chatClient\n * @param options - message options to be included in the message\n *\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n};\n\n/**\n * @internal\n */\nexport type _ChatMessageProps = MessageProps & {\n key: string;\n statusToRender: MessageStatus | undefined;\n showMessageStatus?: boolean;\n};\n\n/**\n * `MessageThread` allows you to easily create a component for rendering chat messages, handling scrolling behavior of new/old messages and customizing icons & controls inside the chat thread.\n * @param props - of type MessageThreadProps\n *\n * Users will need to provide at least chat messages and userId to render the `MessageThread` component.\n * Users can also customize `MessageThread` by passing in their own Avatar, `MessageStatusIndicator` icon, `JumpToNewMessageButton`, `LoadPreviousMessagesButton` and the behavior of these controls.\n *\n * `MessageThread` internally uses the `Chat` component from `@fluentui-contrib/chat`. You can checkout the details about these components [here](https://microsoft.github.io/fluentui-contrib/react-chat/).\n *\n * @public\n */\nexport const MessageThread = (props: MessageThreadProps): JSX.Element => {\n const theme = useTheme();\n\n const chatBody = useMemo(() => {\n return (\n <FluentV9ThemeProvider v8Theme={theme}>\n {/* Wrapper is required to call \"useClasses\" hook with proper context values */}\n <MessageThreadWrapper {...props} />\n </FluentV9ThemeProvider>\n );\n }, [theme, props]);\n\n return <div className={mergeStyles(messageThreadContainerStyle, props.styles?.root)}>{chatBody}</div>;\n};\n\n/**\n * @private\n */\nexport const MessageThreadWrapper = (props: MessageThreadProps): JSX.Element => {\n const {\n messages: newMessages,\n userId,\n participantCount,\n readReceiptsBySenderId,\n styles,\n disableJumpToNewMessageButton = false,\n showMessageDate = false,\n showMessageStatus = false,\n numberOfChatMessagesToReload = 5,\n onMessageSeen,\n onRenderMessageStatus,\n onRenderAvatar,\n onLoadPreviousChatMessages,\n onRenderJumpToNewMessageButton,\n onRenderMessage,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessage,\n onSendMessage,\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString,\n /* @conditional-compile-remove(mention) */\n mentionOptions,\n inlineImageOptions,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentOptions,\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(rich-text-editor) */\n richTextEditorOptions\n } = props;\n // We need this state to wait for one tick and scroll to bottom after messages have been initialized.\n // Otherwise chatScrollDivRef.current.clientHeight is wrong if we scroll to bottom before messages are initialized.\n const [chatMessagesInitialized, setChatMessagesInitialized] = useState<boolean>(false);\n const [isAtBottomOfScroll, setIsAtBottomOfScroll] = useState<boolean>(true);\n const [forceUpdate, setForceUpdate] = useState<number>(0);\n\n // Used to decide if should auto scroll to bottom or show \"new message\" button\n const [latestPreviousChatMessage, setLatestPreviousChatMessage] = useState<ChatMessage | undefined>(undefined);\n const [latestCurrentChatMessage, setLatestCurrentChatMessage] = useState<ChatMessage | undefined>(undefined);\n const [existsNewChatMessage, setExistsNewChatMessage] = useState<boolean>(false);\n\n const [lastSeenChatMessage, setLastSeenChatMessage] = useState<string | undefined>(undefined);\n const [lastDeliveredChatMessage, setLastDeliveredChatMessage] = useState<string | undefined>(undefined);\n const [lastSendingChatMessage, setLastSendingChatMessage] = useState<string | undefined>(undefined);\n\n // readCount and participantCount will only need to be updated on-fly when user hover on an indicator\n const [readCountForHoveredIndicator, setReadCountForHoveredIndicator] = useState<number | undefined>(undefined);\n\n const localeStrings = useLocale().strings.messageThread;\n const strings = useMemo(() => ({ ...localeStrings, ...props.strings }), [localeStrings, props.strings]);\n // it is required to use useState for messages\n // as the scrolling logic requires re - render at a specific point in time\n const [messages, setMessages] = useState<Message[]>([]);\n\n // id for the latest deleted message\n const [latestDeletedMessageId, setLatestDeletedMessageId] = useState<string | undefined>(undefined);\n // this value is used to check if a message is deleted for the previous value of messages array\n const previousMessagesRef = useRef<Message[]>([]);\n // an aria label for Narrator to notify when a message is deleted\n const [deletedMessageAriaLabel, setDeletedMessageAriaLabel] = useState<string | undefined>(undefined);\n /* @conditional-compile-remove(rich-text-editor) */\n useEffect(() => {\n // if rich text editor is enabled, the rich text editor component should be loaded early for good UX\n if (richTextEditorOptions !== undefined) {\n // this line is needed to load the Rooster JS dependencies early in the lifecycle\n // when the rich text editor is enabled\n loadChatMessageComponentAsRichTextEditBox();\n }\n }, [richTextEditorOptions]);\n\n const onDeleteMessageCallback = useCallback(\n async (messageId: string): Promise<void> => {\n if (!onDeleteMessage) {\n return;\n }\n try {\n // reset deleted message label in case if there was a value already (messages are deleted 1 after another)\n setDeletedMessageAriaLabel(undefined);\n setLatestDeletedMessageId(messageId);\n lastChatMessageStatus.current = 'deleted';\n // we should set up latestDeletedMessageId before the onDeleteMessage call\n // as otherwise in very rare cases the messages array can be updated before latestDeletedMessageId\n await onDeleteMessage(messageId);\n } catch (e) {\n console.log('onDeleteMessage failed: messageId', messageId, 'error', e);\n }\n },\n [onDeleteMessage]\n );\n\n const isAllChatMessagesLoadedRef = useRef(false);\n // isAllChatMessagesLoadedRef needs to be updated every time when a new adapter is set in order to display correct data\n // onLoadPreviousChatMessages is updated when a new adapter is set\n useEffect(() => {\n if (onLoadPreviousChatMessages) {\n isAllChatMessagesLoadedRef.current = false;\n }\n }, [onLoadPreviousChatMessages]);\n\n const previousTopRef = useRef<number>(-1);\n const previousHeightRef = useRef<number>(-1);\n\n const messageIdSeenByMeRef = useRef<string>('');\n\n const chatScrollDivRef = useRef<HTMLDivElement>(null);\n const isLoadingChatMessagesRef = useRef(false);\n\n useEffect(() => {\n if (latestDeletedMessageId === undefined) {\n setDeletedMessageAriaLabel(undefined);\n } else {\n if (!previousMessagesRef.current.find((message) => message.messageId === latestDeletedMessageId)) {\n // the message is deleted in previousMessagesRef\n // no need to update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(undefined);\n } else if (!messages.find((message) => message.messageId === latestDeletedMessageId)) {\n // the message is deleted in messages array but still exists in previousMessagesRef\n // update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(strings.messageDeletedAnnouncementAriaLabel);\n } else {\n // the message exists in both arrays\n // no need to update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(undefined);\n }\n }\n previousMessagesRef.current = messages;\n }, [latestDeletedMessageId, messages, strings.messageDeletedAnnouncementAriaLabel]);\n\n const messagesRef = useRef(messages);\n const setMessagesRef = (messagesWithAttachedValue: Message[]): void => {\n messagesRef.current = messagesWithAttachedValue;\n setMessages(messagesWithAttachedValue);\n };\n\n const isAtBottomOfScrollRef = useRef(isAtBottomOfScroll);\n const setIsAtBottomOfScrollRef = (isAtBottomOfScrollValue: boolean): void => {\n isAtBottomOfScrollRef.current = isAtBottomOfScrollValue;\n setIsAtBottomOfScroll(isAtBottomOfScrollValue);\n };\n\n const chatMessagesInitializedRef = useRef(chatMessagesInitialized);\n const setChatMessagesInitializedRef = (chatMessagesInitialized: boolean): void => {\n chatMessagesInitializedRef.current = chatMessagesInitialized;\n setChatMessagesInitialized(chatMessagesInitialized);\n };\n\n const chatThreadRef = useRef<HTMLDivElement>(null);\n\n // When the chat thread is narrow, we perform space optimizations such as overlapping\n // the avatar on top of the chat message and moving the chat accept/reject edit buttons\n // to a new line\n const chatThreadWidth = _useContainerWidth(chatThreadRef);\n const isNarrow = chatThreadWidth ? isNarrowWidth(chatThreadWidth) : false;\n\n /**\n * ClientHeight controls the number of messages to render. However ClientHeight will not be initialized after the\n * first render (not sure but I guess Fluent is updating it in hook which is after render maybe?) so we need to\n * trigger a re-render until ClientHeight is initialized. This force re-render should only happen once.\n */\n const clientHeight = chatThreadRef.current?.clientHeight;\n\n // we try to only send those message status if user is scrolled to the bottom.\n const sendMessageStatusIfAtBottom = useCallback(async (): Promise<void> => {\n if (\n !isAtBottomOfScrollRef.current ||\n !document.hasFocus() ||\n !messagesRef.current ||\n messagesRef.current.length === 0 ||\n !showMessageStatus\n ) {\n return;\n }\n const messagesWithId = messagesRef.current.filter((message) => {\n return message.messageType === 'chat' && !message.mine && !!message.messageId;\n });\n if (messagesWithId.length === 0) {\n return;\n }\n const lastMessage: ChatMessage = messagesWithId[messagesWithId.length - 1] as ChatMessage;\n try {\n if (\n onMessageSeen &&\n lastMessage &&\n lastMessage.messageId &&\n lastMessage.messageId !== messageIdSeenByMeRef.current\n ) {\n await onMessageSeen(lastMessage.messageId);\n messageIdSeenByMeRef.current = lastMessage.messageId;\n }\n } catch (e) {\n console.log('onMessageSeen Error', lastMessage, e);\n }\n }, [showMessageStatus, onMessageSeen]);\n\n const scrollToBottom = useCallback((): void => {\n if (chatScrollDivRef.current) {\n chatScrollDivRef.current.scrollTop = chatScrollDivRef.current.scrollHeight;\n }\n setExistsNewChatMessage(false);\n setIsAtBottomOfScrollRef(true);\n sendMessageStatusIfAtBottom();\n }, [sendMessageStatusIfAtBottom]);\n\n const handleScrollToTheBottom = useCallback((): void => {\n if (!chatScrollDivRef.current) {\n return;\n }\n\n const atBottom =\n Math.ceil(chatScrollDivRef.current.scrollTop) >=\n chatScrollDivRef.current.scrollHeight - chatScrollDivRef.current.clientHeight;\n if (atBottom) {\n sendMessageStatusIfAtBottom();\n if (!isAtBottomOfScrollRef.current) {\n scrollToBottom();\n }\n }\n setIsAtBottomOfScrollRef(atBottom);\n }, [scrollToBottom, sendMessageStatusIfAtBottom]);\n\n // Infinite scrolling + threadInitialize function\n const fetchNewMessageWhenAtTop = useCallback(async () => {\n if (!isLoadingChatMessagesRef.current) {\n if (onLoadPreviousChatMessages) {\n isLoadingChatMessagesRef.current = true;\n try {\n // Fetch message until scrollTop reach the threshold for fetching new message\n while (\n !isAllChatMessagesLoadedRef.current &&\n chatScrollDivRef.current &&\n chatScrollDivRef.current.scrollTop <= 500\n ) {\n isAllChatMessagesLoadedRef.current = await onLoadPreviousChatMessages(numberOfChatMessagesToReload);\n await delay(200);\n }\n } finally {\n // Set isLoadingChatMessagesRef to false after messages are fetched\n isLoadingChatMessagesRef.current = false;\n }\n }\n }\n }, [numberOfChatMessagesToReload, onLoadPreviousChatMessages]);\n\n // The below 2 of useEffects are design for fixing infinite scrolling problem\n // Scrolling element will behave differently when scrollTop = 0(it sticks at the top)\n // we need to get previousTop before it prepend contents\n // Execute order [newMessage useEffect] => get previousTop => dom update => [messages useEffect]\n useEffect(() => {\n if (!chatScrollDivRef.current) {\n return;\n }\n previousTopRef.current = chatScrollDivRef.current.scrollTop;\n previousHeightRef.current = chatScrollDivRef.current.scrollHeight;\n }, [newMessages]);\n\n useEffect(() => {\n if (!chatScrollDivRef.current) {\n return;\n }\n chatScrollDivRef.current.scrollTop =\n chatScrollDivRef.current.scrollHeight - (previousHeightRef.current - previousTopRef.current);\n }, [messages]);\n\n // Fetch more messages to make the scroll bar appear, infinity scroll is then handled in the handleScroll function.\n useEffect(() => {\n fetchNewMessageWhenAtTop();\n }, [fetchNewMessageWhenAtTop]);\n\n /**\n * One time run useEffects. Sets up listeners when component is mounted and tears down listeners when component\n * unmounts unless these function changed\n */\n useEffect(() => {\n window && window.addEventListener('click', sendMessageStatusIfAtBottom);\n window && window.addEventListener('focus', sendMessageStatusIfAtBottom);\n return () => {\n window && window.removeEventListener('click', sendMessageStatusIfAtBottom);\n window && window.removeEventListener('focus', sendMessageStatusIfAtBottom);\n };\n }, [sendMessageStatusIfAtBottom]);\n\n useEffect(() => {\n const chatScrollDiv = chatScrollDivRef.current;\n chatScrollDiv?.addEventListener('scroll', handleScrollToTheBottom);\n chatScrollDiv?.addEventListener('scroll', fetchNewMessageWhenAtTop);\n\n return () => {\n chatScrollDiv?.removeEventListener('scroll', handleScrollToTheBottom);\n chatScrollDiv?.removeEventListener('scroll', fetchNewMessageWhenAtTop);\n };\n }, [fetchNewMessageWhenAtTop, handleScrollToTheBottom]);\n\n useEffect(() => {\n if (clientHeight === undefined) {\n setForceUpdate(forceUpdate + 1);\n return;\n }\n // Only scroll to bottom if isAtBottomOfScrollRef is true\n isAtBottomOfScrollRef.current && scrollToBottom();\n }, [clientHeight, forceUpdate, scrollToBottom, chatMessagesInitialized]);\n useEffect(() => {\n const newStatus = getLastChatMessageForCurrentUser(newMessages)?.status;\n if (newStatus !== undefined) {\n if (lastChatMessageStatus.current === 'deleted' && newStatus === 'sending') {\n // enforce message life cycle\n // message status should always be [ sending -> delivered -> seen (optional) -> deleted ] or [sending -> failed -> deleted]\n // not any other way around\n // therefore, if current message status is deleted, we should only update it if newStatus is sending\n lastChatMessageStatus.current = newStatus;\n } else if (lastChatMessageStatus.current !== 'deleted') {\n lastChatMessageStatus.current = newStatus;\n }\n }\n // The hook should depend on newMessages not on messages as otherwise it will skip the sending status for a first message\n }, [newMessages]);\n\n /**\n * This needs to run to update latestPreviousChatMessage & latestCurrentChatMessage.\n * These two states are used to manipulate scrollbar\n */\n useEffect(() => {\n setLatestPreviousChatMessage(getLatestChatMessage(messagesRef.current));\n setLatestCurrentChatMessage(getLatestChatMessage(newMessages));\n setMessagesRef(newMessages);\n !chatMessagesInitializedRef.current && setChatMessagesInitializedRef(true);\n setLastDeliveredChatMessage(getLastChatMessageIdWithStatus(newMessages, 'delivered'));\n setLastSeenChatMessage(getLastChatMessageIdWithStatus(newMessages, 'seen'));\n setLastSendingChatMessage(getLastChatMessageIdWithStatus(newMessages, 'sending'));\n }, [newMessages]);\n\n /**\n * This needs to run after messages are rendered so we can manipulate the scroll bar.\n */\n useEffect(() => {\n // If user just sent the latest message then we assume we can move user to bottom of scroll.\n if (\n isThereNewMessageNotFromCurrentUser(userId, latestPreviousChatMessage, latestCurrentChatMessage) &&\n !isAtBottomOfScrollRef.current\n ) {\n setExistsNewChatMessage(true);\n } else if (\n didUserSendTheLatestMessage(userId, latestPreviousChatMessage, latestCurrentChatMessage) ||\n isAtBottomOfScrollRef.current\n ) {\n scrollToBottom();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messages]);\n\n const lastChatMessageStatus = useRef<string | undefined>(undefined);\n const participantCountRef = useRef(participantCount);\n const readReceiptsBySenderIdRef = useRef(readReceiptsBySenderId);\n\n participantCountRef.current = participantCount;\n readReceiptsBySenderIdRef.current = readReceiptsBySenderId;\n\n const onActionButtonClickMemo = useCallback(\n (message: ChatMessage, setMessageReadBy: (readBy: { id: string; displayName: string }[]) => void) => {\n if (participantCountRef.current && participantCountRef.current - 1 > 1 && readReceiptsBySenderIdRef.current) {\n setMessageReadBy(getParticipantsWhoHaveReadMessage(message, readReceiptsBySenderIdRef.current));\n }\n },\n []\n );\n\n const defaultStatusRenderer = useCallback(\n (\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage,\n participantCount: number,\n readCount: number,\n status?: MessageStatus\n ) => {\n // we should only announce label if the message status isn't deleted\n // because after message is deleted, we now need to render statusIndicator for previous messages\n // and their status has been announced already and we should not announce them again\n const shouldAnnounce = lastChatMessageStatus.current !== 'deleted';\n\n const onToggleToolTip = (isToggled: boolean): void => {\n if (isToggled && readReceiptsBySenderIdRef.current) {\n setReadCountForHoveredIndicator(\n getParticipantsWhoHaveReadMessage(message, readReceiptsBySenderIdRef.current).length\n );\n } else {\n setReadCountForHoveredIndicator(undefined);\n }\n };\n return (\n <MessageStatusIndicatorInternal\n status={status}\n readCount={readCount}\n onToggleToolTip={onToggleToolTip}\n // -1 because participant count does not include myself\n remoteParticipantsCount={participantCount ? participantCount - 1 : 0}\n shouldAnnounce={shouldAnnounce}\n />\n );\n },\n []\n );\n\n const theme = useTheme();\n\n const messagesToDisplay = useMemo(() => {\n return memoizeAllMessages((memoizedMessageFn) => {\n return messages.map((message: Message, index: number): _ChatMessageProps => {\n return memoizedMessageFn(\n message,\n showMessageDate,\n showMessageStatus,\n strings,\n index,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessageCallback,\n onSendMessage,\n props.disableEditing,\n lastDeliveredChatMessage,\n lastSeenChatMessage,\n lastSendingChatMessage\n );\n });\n });\n }, [\n lastDeliveredChatMessage,\n lastSeenChatMessage,\n lastSendingChatMessage,\n messages,\n onCancelEditMessage,\n onDeleteMessageCallback,\n onSendMessage,\n onUpdateMessage,\n props.disableEditing,\n showMessageDate,\n showMessageStatus,\n strings\n ]);\n\n const classes = useChatStyles();\n\n return (\n <div className={mergeStyles(messageThreadWrapperContainerStyle)} ref={chatThreadRef}>\n {/* Always ensure New Messages button is above the chat body element in the DOM tree. This is to ensure correct\n tab ordering. Because the New Messages button floats on top of the chat body it is in a higher z-index and\n thus Users should be able to tab navigate to the new messages button _before_ tab focus is taken to the chat body.*/}\n {existsNewChatMessage && !disableJumpToNewMessageButton && (\n <div className={mergeStyles(newMessageButtonContainerStyle, styles?.newMessageButtonContainer)}>\n {onRenderJumpToNewMessageButton ? (\n onRenderJumpToNewMessageButton({ text: strings.newMessagesIndicator, onClick: scrollToBottom })\n ) : (\n <DefaultJumpToNewMessageButton text={strings.newMessagesIndicator} onClick={scrollToBottom} />\n )}\n </div>\n )}\n <LiveAnnouncer>\n <FluentV9ThemeProvider v8Theme={theme}>\n <Chat\n // styles?.chatContainer used in className and style prop as style prop can't handle CSS selectors\n className={mergeClasses(classes.root, mergeStyles(styles?.chatContainer))}\n ref={chatScrollDivRef}\n style={{ ...createStyleFromV8Style(styles?.chatContainer) }}\n >\n {latestDeletedMessageId && (\n <Announcer\n key={latestDeletedMessageId}\n announcementString={deletedMessageAriaLabel}\n ariaLive={'polite'}\n />\n )}\n {messagesToDisplay.map((message: _ChatMessageProps): JSX.Element => {\n return (\n <MemoChatMessageComponentWrapper\n {...message}\n userId={userId}\n key={message.key}\n styles={styles}\n shouldOverlapAvatarAndMessage={isNarrow}\n strings={strings}\n onRenderAvatar={onRenderAvatar}\n onRenderMessage={onRenderMessage}\n onRenderMessageStatus={onRenderMessageStatus}\n defaultStatusRenderer={defaultStatusRenderer}\n onActionButtonClick={onActionButtonClickMemo}\n readCount={readCountForHoveredIndicator}\n participantCount={participantCount}\n /* @conditional-compile-remove(file-sharing-acs) */\n actionsForAttachment={attachmentOptions?.downloadOptions?.actionsForAttachment}\n inlineImageOptions={inlineImageOptions}\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString={onDisplayDateTimeString}\n /* @conditional-compile-remove(mention) */\n mentionOptions={mentionOptions}\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads={onRenderAttachmentDownloads}\n /* @conditional-compile-remove(rich-text-editor) */\n isRichTextEditorEnabled={!!richTextEditorOptions}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={richTextEditorOptions?.onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onUploadInlineImage={richTextEditorOptions?.onUploadInlineImage}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n imageUploadsInProgress={\n richTextEditorOptions?.messagesImageUploadsInProgress &&\n richTextEditorOptions?.messagesImageUploadsInProgress[message.message.messageId]\n }\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onCancelInlineImageUpload={richTextEditorOptions?.onCancelInlineImageUpload}\n />\n );\n })}\n </Chat>\n </FluentV9ThemeProvider>\n </LiveAnnouncer>\n </div>\n );\n};\n\nconst MemoChatMessageComponentWrapper = React.memo((obj: ChatMessageComponentWrapperProps): JSX.Element => {\n return <ChatMessageComponentWrapper {...obj} />;\n});\n"]}
@@ -6,15 +6,15 @@ import { useTheme } from '../../theming';
6
6
  import { isDarkThemed } from '../../theming/themeUtils';
7
7
  import CopyPastePlugin from './Plugins/CopyPastePlugin';
8
8
  import { createModelFromHtml, Editor, exportContent } from 'roosterjs-content-model-core';
9
- import { createParagraph, createSelectionMarker, setSelection } from 'roosterjs-content-model-dom';
9
+ import { createBr, createEmptyModel, createParagraph, createSelectionMarker, setSelection } from 'roosterjs-content-model-dom';
10
10
  import { KeyboardInputPlugin } from './Plugins/KeyboardInputPlugin';
11
- import { AutoFormatPlugin, EditPlugin, PastePlugin, ShortcutPlugin } from 'roosterjs-content-model-plugins';
11
+ import { AutoFormatPlugin, EditPlugin, PastePlugin, ShortcutPlugin, DefaultSanitizers } from 'roosterjs-content-model-plugins';
12
12
  import { UpdateContentPlugin, UpdateEvent } from './Plugins/UpdateContentPlugin';
13
13
  import { RichTextToolbar } from './Toolbar/RichTextToolbar';
14
14
  import { RichTextToolbarPlugin } from './Plugins/RichTextToolbarPlugin';
15
15
  import { ContextMenuPlugin } from './Plugins/ContextMenuPlugin';
16
16
  import { TableEditContextMenuProvider } from './Plugins/TableEditContextMenuProvider';
17
- import { borderApplier, dataSetApplier, DefaultSanitizers } from '../utils/RichTextEditorUtils';
17
+ import { borderApplier, dataSetApplier } from '../utils/RichTextEditorUtils';
18
18
  import { ContextualMenu } from '@fluentui/react';
19
19
  import { PlaceholderPlugin } from './Plugins/PlaceholderPlugin';
20
20
  import { getFormatState, setDirection } from 'roosterjs-content-model-api';
@@ -48,9 +48,8 @@ export const RichTextEditor = React.forwardRef((props, ref) => {
48
48
  editor.current.formatContentModel((model) => {
49
49
  // Create a new empty paragraph with selection marker
50
50
  // this is needed for correct processing of images after the content is deleted
51
- const block = createParagraph(true);
52
- setSelectionAfterLastSegment(model, block);
53
- model.blocks = [block];
51
+ const newModel = createEmptyModel();
52
+ model.blocks = newModel.blocks;
54
53
  return true;
55
54
  });
56
55
  //reset content model
@@ -70,13 +69,6 @@ export const RichTextEditor = React.forwardRef((props, ref) => {
70
69
  const toolbarPlugin = React.useMemo(() => {
71
70
  return new RichTextToolbarPlugin();
72
71
  }, []);
73
- const isDarkThemedValue = useMemo(() => {
74
- return isDarkThemed(theme);
75
- }, [theme]);
76
- useEffect(() => {
77
- var _a;
78
- (_a = editor.current) === null || _a === void 0 ? void 0 : _a.setDarkModeState(isDarkThemedValue);
79
- }, [isDarkThemedValue]);
80
72
  const placeholderPlugin = useMemo(() => {
81
73
  var _a;
82
74
  const textColor = (_a = theme.palette) === null || _a === void 0 ? void 0 : _a.neutralSecondary;
@@ -181,16 +173,26 @@ export const RichTextEditor = React.forwardRef((props, ref) => {
181
173
  toolbarPlugin,
182
174
  tableContextMenuPlugin
183
175
  ]);
176
+ const announcerStringGetter = useCallback((key) => {
177
+ var _a, _b;
178
+ switch (key) {
179
+ case 'announceListItemBullet':
180
+ return (_a = strings.richTextNewBulletedListItemAnnouncement) !== null && _a !== void 0 ? _a : '';
181
+ case 'announceListItemNumbering':
182
+ return (_b = strings.richTextNewNumberedListItemAnnouncement) !== null && _b !== void 0 ? _b : '';
183
+ case 'announceOnFocusLastCell':
184
+ return '';
185
+ }
186
+ }, [strings.richTextNewBulletedListItemAnnouncement, strings.richTextNewNumberedListItemAnnouncement]);
184
187
  useEffect(() => {
185
188
  var _a;
186
189
  const initialModel = createEditorInitialModel(initialContent, contentModel);
187
190
  if (editorDiv.current) {
188
191
  editor.current = new Editor(editorDiv.current, {
189
- inDarkMode: isDarkThemedValue,
192
+ inDarkMode: isDarkThemed(theme),
190
193
  // doNotAdjustEditorColor is used to disable default color and background color for Rooster component
191
194
  doNotAdjustEditorColor: true,
192
- // TODO: confirm the color during inline images implementation
193
- imageSelectionBorderColor: 'blue',
195
+ imageSelectionBorderColor: theme.palette.themePrimary,
194
196
  tableCellSelectionBackgroundColor: theme.palette.neutralLight,
195
197
  plugins: plugins,
196
198
  initialModel: initialModel,
@@ -200,7 +202,8 @@ export const RichTextEditor = React.forwardRef((props, ref) => {
200
202
  border: borderApplier,
201
203
  dataset: dataSetApplier
202
204
  }
203
- }
205
+ },
206
+ announcerStringGetter: announcerStringGetter
204
207
  });
205
208
  }
206
209
  if (autoFocus === 'sendBoxTextField') {
@@ -214,7 +217,7 @@ export const RichTextEditor = React.forwardRef((props, ref) => {
214
217
  };
215
218
  // don't update the editor on deps update as everything is handled in separate hooks or plugins
216
219
  // eslint-disable-next-line react-hooks/exhaustive-deps
217
- }, [theme, plugins]);
220
+ }, [theme, plugins, announcerStringGetter]);
218
221
  useEffect(() => {
219
222
  const themeDirectionValue = themeDirection(theme);
220
223
  // check that editor exists and theme was actually changed
@@ -247,15 +250,18 @@ const createEditorInitialModel = (initialContent, contentModel) => {
247
250
  if (initialModel && initialModel.blocks.length > 0) {
248
251
  // lastBlock should have blockType = paragraph, otherwise add a new paragraph
249
252
  // to set focus to the end of the content
250
- let lastBlock = initialModel.blocks[initialModel.blocks.length - 1];
253
+ const lastBlock = initialModel.blocks[initialModel.blocks.length - 1];
251
254
  if ((lastBlock === null || lastBlock === void 0 ? void 0 : lastBlock.blockType) === 'Paragraph') {
252
255
  // now lastBlock is paragraph
256
+ setSelectionAfterLastSegment(initialModel, lastBlock);
253
257
  }
254
258
  else {
255
- lastBlock = createParagraph(true);
256
- initialModel.blocks.push(lastBlock);
259
+ const block = createParagraph(false);
260
+ initialModel.blocks.push(block);
261
+ setSelectionAfterLastSegment(initialModel, block);
262
+ // add content to the paragraph, otherwise height might be calculated incorrectly
263
+ block.segments.push(createBr());
257
264
  }
258
- setSelectionAfterLastSegment(initialModel, lastBlock);
259
265
  }
260
266
  return initialModel;
261
267
  }
@@ -1 +1 @@
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;AASxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC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{ 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} from 'roosterjs-content-model-types';\nimport { createModelFromHtml, Editor, exportContent } from 'roosterjs-content-model-core';\nimport { createParagraph, createSelectionMarker, setSelection } from 'roosterjs-content-model-dom';\nimport { KeyboardInputPlugin } from './Plugins/KeyboardInputPlugin';\nimport { AutoFormatPlugin, EditPlugin, PastePlugin, ShortcutPlugin } 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, DefaultSanitizers } 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 onUploadInlineImage?: (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 onUploadInlineImage\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 block = createParagraph(true);\n setSelectionAfterLastSegment(model, block);\n model.blocks = [block];\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 isDarkThemedValue = useMemo(() => {\n return isDarkThemed(theme);\n }, [theme]);\n\n useEffect(() => {\n editor.current?.setDarkModeState(isDarkThemedValue);\n }, [isDarkThemedValue]);\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.onUploadInlineImage = onUploadInlineImage;\n }, [copyPastePlugin, onUploadInlineImage]);\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 useEffect(() => {\n const initialModel = createEditorInitialModel(initialContent, contentModel);\n if (editorDiv.current) {\n editor.current = new Editor(editorDiv.current, {\n inDarkMode: isDarkThemedValue,\n // doNotAdjustEditorColor is used to disable default color and background color for Rooster component\n doNotAdjustEditorColor: true,\n // TODO: confirm the color during inline images implementation\n imageSelectionBorderColor: 'blue',\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 });\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]);\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 let lastBlock = initialModel.blocks[initialModel.blocks.length - 1];\n if (lastBlock?.blockType === 'Paragraph') {\n // now lastBlock is paragraph\n } else {\n lastBlock = createParagraph(true);\n initialModel.blocks.push(lastBlock);\n }\n setSelectionAfterLastSegment(initialModel, lastBlock);\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,M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H,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 onUploadInlineImage?: (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 onUploadInlineImage\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.onUploadInlineImage = onUploadInlineImage;\n }, [copyPastePlugin, onUploadInlineImage]);\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"]}