@azure/communication-react 1.17.0-alpha-202405160013 → 1.17.0-alpha-202405180013

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 (153) hide show
  1. package/dist/communication-react.d.ts +1 -1
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-LLjD-Jp0.js → ChatMessageComponentAsRichTextEditBox-r0U_8d3I.js} +22 -17
  3. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-r0U_8d3I.js.map +1 -0
  4. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-D7SB5NwN.js → RichTextSendBoxWrapper-DNlYAgO2.js} +6 -8
  5. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-D7SB5NwN.js.map → RichTextSendBoxWrapper-DNlYAgO2.js.map} +1 -1
  6. package/dist/dist-cjs/communication-react/{index-CfI_of00.js → index-BLj9R9ms.js} +939 -526
  7. package/dist/dist-cjs/communication-react/index-BLj9R9ms.js.map +1 -0
  8. package/dist/dist-cjs/communication-react/index.js +5 -7
  9. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  10. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  11. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  12. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js +1 -6
  13. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js.map +1 -1
  14. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js +1 -1
  15. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js.map +1 -1
  16. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +1 -1
  17. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  18. package/dist/dist-esm/calling-stateful-client/src/CallContext.js +0 -4
  19. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  20. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +0 -3
  21. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
  22. package/dist/dist-esm/calling-stateful-client/src/Converter.js +0 -1
  23. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  24. package/dist/dist-esm/calling-stateful-client/src/PPTLiveSubscriber.js +0 -2
  25. package/dist/dist-esm/calling-stateful-client/src/PPTLiveSubscriber.js.map +1 -1
  26. package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
  27. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +17 -10
  28. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
  29. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js +1 -1
  30. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js.map +1 -1
  31. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.d.ts +9 -0
  32. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.js +29 -0
  33. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.js.map +1 -0
  34. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.d.ts +1 -1
  35. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js +15 -20
  36. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js.map +1 -1
  37. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.d.ts +12 -0
  38. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.js +23 -0
  39. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.js.map +1 -0
  40. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.d.ts +15 -0
  41. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js +39 -0
  42. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js.map +1 -0
  43. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.d.ts +24 -0
  44. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.js +66 -0
  45. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.js.map +1 -0
  46. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.d.ts +20 -0
  47. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.js +46 -0
  48. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.js.map +1 -0
  49. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.d.ts +29 -0
  50. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js +71 -0
  51. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js.map +1 -0
  52. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.d.ts +7 -10
  53. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +170 -91
  54. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -1
  55. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.d.ts +0 -1
  56. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +29 -12
  57. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +1 -1
  58. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +12 -46
  59. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
  60. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.d.ts +19 -0
  61. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js +209 -0
  62. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js.map +1 -0
  63. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.d.ts +7 -0
  64. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.js +49 -0
  65. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.js.map +1 -0
  66. package/dist/dist-esm/react-components/src/components/RichTextEditor/{Buttons → Toolbar}/Table/RichTextInsertTablePane.d.ts +2 -2
  67. package/dist/dist-esm/react-components/src/components/RichTextEditor/{Buttons → Toolbar}/Table/RichTextInsertTablePane.js +3 -3
  68. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTablePane.js.map +1 -0
  69. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.d.ts +6 -0
  70. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.js +13 -0
  71. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.js.map +1 -0
  72. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js +1 -1
  73. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js.map +1 -1
  74. package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteScreenShare.js +1 -4
  75. package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteScreenShare.js.map +1 -1
  76. package/dist/dist-esm/react-components/src/components/VideoGallery.js +1 -3
  77. package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
  78. package/dist/dist-esm/react-components/src/components/VideoTile.js +0 -1
  79. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  80. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +3 -1
  81. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
  82. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.d.ts +3 -3
  83. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +4 -5
  84. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +1 -1
  85. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.d.ts +37 -0
  86. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js +60 -0
  87. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js.map +1 -0
  88. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.d.ts +11 -0
  89. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js +95 -0
  90. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js.map +1 -1
  91. package/dist/dist-esm/react-components/src/components/utils.d.ts +1 -1
  92. package/dist/dist-esm/react-components/src/components/utils.js +1 -3
  93. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  94. package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +22 -1
  95. package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +22 -1
  96. package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +22 -1
  97. package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +22 -1
  98. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +2 -1
  99. package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +22 -1
  100. package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +23 -2
  101. package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +31 -10
  102. package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +22 -1
  103. package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +22 -1
  104. package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +31 -10
  105. package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +31 -10
  106. package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +22 -1
  107. package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +22 -1
  108. package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +22 -1
  109. package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +31 -10
  110. package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +22 -1
  111. package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +22 -1
  112. package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +22 -1
  113. package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +30 -9
  114. package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +24 -3
  115. package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +4 -0
  116. package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +4 -0
  117. package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +4 -0
  118. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +4 -0
  119. package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +4 -0
  120. package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +4 -0
  121. package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +4 -0
  122. package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +4 -0
  123. package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +4 -0
  124. package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +4 -0
  125. package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +4 -0
  126. package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +4 -0
  127. package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +4 -0
  128. package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +4 -0
  129. package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +4 -0
  130. package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +4 -0
  131. package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +4 -0
  132. package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +4 -0
  133. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +4 -0
  134. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +4 -0
  135. package/package.json +6 -8
  136. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-LLjD-Jp0.js.map +0 -1
  137. package/dist/dist-cjs/communication-react/index-CfI_of00.js.map +0 -1
  138. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/RichTextRibbonButtons.d.ts +0 -7
  139. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/RichTextRibbonButtons.js +0 -86
  140. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/RichTextRibbonButtons.js.map +0 -1
  141. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTableButton.d.ts +0 -7
  142. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTableButton.js +0 -55
  143. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTableButton.js.map +0 -1
  144. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTablePane.js.map +0 -1
  145. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextTableContextMenu.d.ts +0 -8
  146. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextTableContextMenu.js +0 -66
  147. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextTableContextMenu.js.map +0 -1
  148. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/insertTableAction.d.ts +0 -9
  149. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/insertTableAction.js +0 -56
  150. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/insertTableAction.js.map +0 -1
  151. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.d.ts +0 -15
  152. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js +0 -39
  153. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js.map +0 -1
@@ -1,7 +0,0 @@
1
- import { Theme } from '@fluentui/react';
2
- import { RibbonButton } from 'roosterjs-react';
3
- /**
4
- * @private
5
- */
6
- export declare const ribbonButtons: (theme: Theme) => RibbonButton<string>[];
7
- //# sourceMappingURL=RichTextRibbonButtons.d.ts.map
@@ -1,86 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- import { ContextualMenuItemType, Icon } from '@fluentui/react';
4
- import { KnownRibbonButtonKey, getButtons } from 'roosterjs-react';
5
- import { ribbonButtonStyle, ribbonDividerStyle } from '../../styles/RichTextEditor.styles';
6
- import { insertTableButton } from './Table/RichTextInsertTableButton';
7
- import React from 'react';
8
- const MaxRowsNumber = 5;
9
- const MaxColumnsNumber = 5;
10
- const dividerRibbonButton = (theme, key) => {
11
- return {
12
- key: key,
13
- // the icon will be set in `onRender` callback
14
- // this is needed to make the divider unavailable for keyboard navigation
15
- iconName: '',
16
- // no text is needed here as we don't want to show a tooltip for the divider
17
- unlocalizedText: '',
18
- onClick: () => { },
19
- isDisabled: () => true,
20
- commandBarProperties: {
21
- // show the item correctly for the overflow menu
22
- itemType: ContextualMenuItemType.Divider,
23
- // this is still needed to remove checkmark icon space even though it is a divider
24
- canCheck: false,
25
- onRender: () => React.createElement(Icon, { iconName: "RichTextDividerIcon", className: ribbonDividerStyle(theme) })
26
- }
27
- };
28
- };
29
- const boldButton = (theme) => {
30
- return createKnownRibbonButton(KnownRibbonButtonKey.Bold, theme, 'RichTextBoldButtonIcon');
31
- };
32
- const italicButton = (theme) => {
33
- return createKnownRibbonButton(KnownRibbonButtonKey.Italic, theme, 'RichTextItalicButtonIcon');
34
- };
35
- const underlineButton = (theme) => {
36
- return createKnownRibbonButton(KnownRibbonButtonKey.Underline, theme, 'RichTextUnderlineButtonIcon');
37
- };
38
- const bulletListButton = (theme) => {
39
- return createKnownRibbonButton(KnownRibbonButtonKey.BulletedList, theme, 'RichTextBulletListButtonIcon');
40
- };
41
- const numberListButton = (theme) => {
42
- return createKnownRibbonButton(KnownRibbonButtonKey.NumberedList, theme, 'RichTextNumberListButtonIcon');
43
- };
44
- const indentIncreaseButton = (theme) => {
45
- return createKnownRibbonButton(KnownRibbonButtonKey.IncreaseIndent, theme, 'RichTextIndentIncreaseButtonIcon');
46
- };
47
- const indentDecreaseButton = (theme) => {
48
- return createKnownRibbonButton(KnownRibbonButtonKey.DecreaseIndent, theme, 'RichTextIndentDecreaseButtonIcon');
49
- };
50
- const createKnownRibbonButton = (key, theme, icon) => {
51
- var _a;
52
- const buttons = getButtons([key]);
53
- if (buttons.length > 0) {
54
- const button = buttons[0];
55
- // AllButtonStringKeys is a union of all the string keys of all the buttons
56
- const result = buttons[0];
57
- button.iconName = icon;
58
- button.commandBarProperties = Object.assign(Object.assign({}, button.commandBarProperties), { buttonStyles: Object.assign(Object.assign({}, (_a = button.commandBarProperties) === null || _a === void 0 ? void 0 : _a.buttonStyles), ribbonButtonStyle(theme)), canCheck: false });
59
- return result;
60
- }
61
- return undefined;
62
- };
63
- /**
64
- * @private
65
- */
66
- export const ribbonButtons = (theme) => {
67
- const buttons = [];
68
- [
69
- boldButton(theme),
70
- italicButton(theme),
71
- underlineButton(theme),
72
- dividerRibbonButton(theme, 'RichTextRibbonTextFormatDivider'),
73
- bulletListButton(theme),
74
- numberListButton(theme),
75
- indentDecreaseButton(theme),
76
- indentIncreaseButton(theme),
77
- dividerRibbonButton(theme, 'RichTextRibbonTableDivider'),
78
- insertTableButton(theme, MaxRowsNumber, MaxColumnsNumber)
79
- ].forEach((item) => {
80
- if (item !== undefined) {
81
- buttons.push(item);
82
- }
83
- });
84
- return buttons;
85
- };
86
- //# sourceMappingURL=RichTextRibbonButtons.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RichTextRibbonButtons.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/RichTextEditor/Buttons/RichTextRibbonButtons.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,sBAAsB,EAAE,IAAI,EAAS,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAgB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,mBAAmB,GAAG,CAAC,KAAY,EAAE,GAAW,EAAwB,EAAE;IAC9E,OAAO;QACL,GAAG,EAAE,GAAG;QACR,8CAA8C;QAC9C,yEAAyE;QACzE,QAAQ,EAAE,EAAE;QACZ,4EAA4E;QAC5E,eAAe,EAAE,EAAE;QACnB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI;QACtB,oBAAoB,EAAE;YACpB,gDAAgD;YAChD,QAAQ,EAAE,sBAAsB,CAAC,OAAO;YACxC,kFAAkF;YAClF,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,GAAG,EAAE,CAAC,oBAAC,IAAI,IAAC,QAAQ,EAAC,qBAAqB,EAAC,SAAS,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,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ContextualMenuItemType, Icon, Theme } from '@fluentui/react';\nimport { KnownRibbonButtonKey, RibbonButton, getButtons } from 'roosterjs-react';\nimport { ribbonButtonStyle, ribbonDividerStyle } from '../../styles/RichTextEditor.styles';\nimport { insertTableButton } from './Table/RichTextInsertTableButton';\nimport React from 'react';\n\nconst MaxRowsNumber = 5;\nconst MaxColumnsNumber = 5;\n\nconst dividerRibbonButton = (theme: Theme, key: string): RibbonButton<string> => {\n return {\n key: key,\n // the icon will be set in `onRender` callback\n // this is needed to make the divider unavailable for keyboard navigation\n iconName: '',\n // no text is needed here as we don't want to show a tooltip for the divider\n unlocalizedText: '',\n onClick: () => {},\n isDisabled: () => true,\n commandBarProperties: {\n // show the item correctly for the overflow menu\n itemType: ContextualMenuItemType.Divider,\n // this is still needed to remove checkmark icon space even though it is a divider\n canCheck: false,\n onRender: () => <Icon iconName=\"RichTextDividerIcon\" className={ribbonDividerStyle(theme)} />\n }\n };\n};\n\nconst boldButton = (theme: Theme): RibbonButton<string> | undefined => {\n return createKnownRibbonButton(KnownRibbonButtonKey.Bold, theme, 'RichTextBoldButtonIcon');\n};\n\nconst italicButton = (theme: Theme): RibbonButton<string> | undefined => {\n return createKnownRibbonButton(KnownRibbonButtonKey.Italic, theme, 'RichTextItalicButtonIcon');\n};\n\nconst underlineButton = (theme: Theme): RibbonButton<string> | undefined => {\n return createKnownRibbonButton(KnownRibbonButtonKey.Underline, theme, 'RichTextUnderlineButtonIcon');\n};\n\nconst bulletListButton = (theme: Theme): RibbonButton<string> | undefined => {\n return createKnownRibbonButton(KnownRibbonButtonKey.BulletedList, theme, 'RichTextBulletListButtonIcon');\n};\n\nconst numberListButton = (theme: Theme): RibbonButton<string> | undefined => {\n return createKnownRibbonButton(KnownRibbonButtonKey.NumberedList, theme, 'RichTextNumberListButtonIcon');\n};\n\nconst indentIncreaseButton = (theme: Theme): RibbonButton<string> | undefined => {\n return createKnownRibbonButton(KnownRibbonButtonKey.IncreaseIndent, theme, 'RichTextIndentIncreaseButtonIcon');\n};\n\nconst indentDecreaseButton = (theme: Theme): RibbonButton<string> | undefined => {\n return createKnownRibbonButton(KnownRibbonButtonKey.DecreaseIndent, theme, 'RichTextIndentDecreaseButtonIcon');\n};\n\nconst createKnownRibbonButton = (\n key: KnownRibbonButtonKey,\n theme: Theme,\n icon: string\n): RibbonButton<string> | undefined => {\n const buttons = getButtons([key]);\n if (buttons.length > 0) {\n const button = buttons[0];\n // AllButtonStringKeys is a union of all the string keys of all the buttons\n const result = buttons[0] as RibbonButton<typeof button.key>;\n button.iconName = icon;\n button.commandBarProperties = {\n ...button.commandBarProperties,\n buttonStyles: {\n ...button.commandBarProperties?.buttonStyles,\n ...ribbonButtonStyle(theme)\n },\n canCheck: false\n };\n return result;\n }\n return undefined;\n};\n\n/**\n * @private\n */\nexport const ribbonButtons = (theme: Theme): RibbonButton<string>[] => {\n const buttons: RibbonButton<string>[] = [];\n [\n boldButton(theme),\n italicButton(theme),\n underlineButton(theme),\n dividerRibbonButton(theme, 'RichTextRibbonTextFormatDivider'),\n bulletListButton(theme),\n numberListButton(theme),\n indentDecreaseButton(theme),\n indentIncreaseButton(theme),\n dividerRibbonButton(theme, 'RichTextRibbonTableDivider'),\n insertTableButton(theme, MaxRowsNumber, MaxColumnsNumber)\n ].forEach((item) => {\n if (item !== undefined) {\n buttons.push(item);\n }\n });\n\n return buttons;\n};\n"]}
@@ -1,7 +0,0 @@
1
- import type { RibbonButton } from 'roosterjs-react';
2
- import type { Theme } from '@fluentui/react';
3
- /**
4
- * "Insert table" button for the RoosterJS ribbon
5
- */
6
- export declare const insertTableButton: (theme: Theme, maxRowsNumber: number, maxColumnsNumber: number) => RibbonButton<string>;
7
- //# sourceMappingURL=RichTextInsertTableButton.d.ts.map
@@ -1,55 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- import React from 'react';
4
- import { Icon, Stack } from '@fluentui/react';
5
- import { insertTable as insertTableAction } from './insertTableAction';
6
- import { insertTableMenuTablePane, ribbonTableButtonStyle } from '../../../styles/RichTextEditor.styles';
7
- import { RichTextInsertTablePane } from './RichTextInsertTablePane';
8
- import { ColumnRowReplaceString, parseKey } from '../../../utils/RichTextTableUtils';
9
- // This file uses RoosterJS React package implementation with updates to UI components and styles.
10
- /**
11
- * "Insert table" button for the RoosterJS ribbon
12
- */
13
- export const insertTableButton = (theme, maxRowsNumber, maxColumnsNumber) => {
14
- return {
15
- key: 'buttonNameInsertTable',
16
- unlocalizedText: 'Insert table',
17
- // Icon will be set in onRenderIcon callback
18
- iconName: '',
19
- onClick: (editor, key) => {
20
- const { row, column } = parseKey(key);
21
- insertTableAction(editor, column, row);
22
- },
23
- dropDownMenu: {
24
- items: {
25
- // the key of the item is also used as a key for localization
26
- insertTablePane: `Insert ${ColumnRowReplaceString} table`
27
- },
28
- itemRender: (item, onClick) => {
29
- return (React.createElement(RichTextInsertTablePane, { item: item, onClick: onClick, maxColumnsNumber: maxColumnsNumber, maxRowsNumber: maxRowsNumber }));
30
- },
31
- commandBarSubMenuProperties: {
32
- className: insertTableMenuTablePane
33
- }
34
- },
35
- commandBarProperties: {
36
- // hide the chevron icon
37
- menuIconProps: {
38
- hidden: true
39
- },
40
- onRenderIcon: () => {
41
- return React.createElement(TableIcon, null);
42
- },
43
- buttonStyles: ribbonTableButtonStyle(theme),
44
- canCheck: false
45
- }
46
- };
47
- };
48
- const TableIcon = () => {
49
- return (
50
- // update the visibility of the Table Icon with css classes that are triggered by command bar's state
51
- React.createElement(Stack, null,
52
- React.createElement(Icon, { iconName: "RichTextInsertTableFilledIcon", className: 'ribbon-table-button-filled-icon' }),
53
- React.createElement(Icon, { iconName: "RichTextInsertTableRegularIcon", className: 'ribbon-table-button-regular-icon' })));
54
- };
55
- //# sourceMappingURL=RichTextInsertTableButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RichTextInsertTableButton.js","sourceRoot":"","sources":["../../../../../../../../../react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTableButton.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGvE,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACzG,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAGrF,kGAAkG;AAElG;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAAY,EACZ,aAAqB,EACrB,gBAAwB,EACF,EAAE;IACxB,OAAO;QACL,GAAG,EAAE,uBAAuB;QAC5B,eAAe,EAAE,cAAc;QAC/B,4CAA4C;QAC5C,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,CAAC,MAAe,EAAE,GAAW,EAAE,EAAE;YACxC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;YACtC,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACzC,CAAC;QACD,YAAY,EAAE;YACZ,KAAK,EAAE;gBACL,6DAA6D;gBAC7D,eAAe,EAAE,UAAU,sBAAsB,QAAQ;aAC1D;YACD,UAAU,EAAE,CACV,IAAyB,EACzB,OAAyG,EACzG,EAAE;gBACF,OAAO,CACL,oBAAC,uBAAuB,IACtB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,GAC5B,CACH,CAAC;YACJ,CAAC;YACD,2BAA2B,EAAE;gBAC3B,SAAS,EAAE,wBAAwB;aACpC;SACF;QACD,oBAAoB,EAAE;YACpB,wBAAwB;YACxB,aAAa,EAAE;gBACb,MAAM,EAAE,IAAI;aACb;YACD,YAAY,EAAE,GAAG,EAAE;gBACjB,OAAO,oBAAC,SAAS,OAAG,CAAC;YACvB,CAAC;YACD,YAAY,EAAE,sBAAsB,CAAC,KAAK,CAAC;YAC3C,QAAQ,EAAE,KAAK;SAChB;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,GAAgB,EAAE;IAClC,OAAO;IACL,qGAAqG;IACrG,oBAAC,KAAK;QACJ,oBAAC,IAAI,IAAC,QAAQ,EAAC,+BAA+B,EAAC,SAAS,EAAE,iCAAiC,GAAI;QAC/F,oBAAC,IAAI,IAAC,QAAQ,EAAC,gCAAgC,EAAC,SAAS,EAAE,kCAAkC,GAAI,CAC3F,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React from 'react';\nimport { Icon, Stack } from '@fluentui/react';\nimport { insertTable as insertTableAction } from './insertTableAction';\nimport type { RibbonButton } from 'roosterjs-react';\nimport type { IContextualMenuItem, Theme } from '@fluentui/react';\nimport { insertTableMenuTablePane, ribbonTableButtonStyle } from '../../../styles/RichTextEditor.styles';\nimport { RichTextInsertTablePane } from './RichTextInsertTablePane';\nimport { ColumnRowReplaceString, parseKey } from '../../../utils/RichTextTableUtils';\nimport type { IEditor } from 'roosterjs-editor-types-compatible';\n\n// This file uses RoosterJS React package implementation with updates to UI components and styles.\n\n/**\n * \"Insert table\" button for the RoosterJS ribbon\n */\nexport const insertTableButton = (\n theme: Theme,\n maxRowsNumber: number,\n maxColumnsNumber: number\n): RibbonButton<string> => {\n return {\n key: 'buttonNameInsertTable',\n unlocalizedText: 'Insert table',\n // Icon will be set in onRenderIcon callback\n iconName: '',\n onClick: (editor: IEditor, key: string) => {\n const { row, column } = parseKey(key);\n insertTableAction(editor, column, row);\n },\n dropDownMenu: {\n items: {\n // the key of the item is also used as a key for localization\n insertTablePane: `Insert ${ColumnRowReplaceString} table`\n },\n itemRender: (\n item: IContextualMenuItem,\n onClick: (e: React.MouseEvent<Element> | React.KeyboardEvent<Element>, item: IContextualMenuItem) => void\n ) => {\n return (\n <RichTextInsertTablePane\n item={item}\n onClick={onClick}\n maxColumnsNumber={maxColumnsNumber}\n maxRowsNumber={maxRowsNumber}\n />\n );\n },\n commandBarSubMenuProperties: {\n className: insertTableMenuTablePane\n }\n },\n commandBarProperties: {\n // hide the chevron icon\n menuIconProps: {\n hidden: true\n },\n onRenderIcon: () => {\n return <TableIcon />;\n },\n buttonStyles: ribbonTableButtonStyle(theme),\n canCheck: false\n }\n };\n};\n\nconst TableIcon = (): JSX.Element => {\n return (\n // update the visibility of the Table Icon with css classes that are triggered by command bar's state\n <Stack>\n <Icon iconName=\"RichTextInsertTableFilledIcon\" className={'ribbon-table-button-filled-icon'} />\n <Icon iconName=\"RichTextInsertTableRegularIcon\" className={'ribbon-table-button-regular-icon'} />\n </Stack>\n );\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"RichTextInsertTablePane.js","sourceRoot":"","sources":["../../../../../../../../../react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTablePane.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7E,OAAO,EACL,uCAAuC,EACvC,+BAA+B,EAC/B,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,C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;YACJ,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,aAAa,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAElG,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE;;QACxB,OAAO,UAAU,CAAC,MAAA,IAAI,CAAC,IAAI,mCAAI,EAAE,EAAE,mBAAmB,CAAC,GAAG,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5F,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IAE7B,OAAO,CACL;QACE,6BAAK,SAAS,EAAE,0BAA0B,IAAG,IAAI,CAAO;QACxD,oBAAC,SAAS,IACR,sBAAsB,EAAE,QAAQ,qBAAqB,IAAI,qBAAqB,EAAE,EAChF,SAAS,EAAE,kBAAkB,CAAC,aAAa,EAC3C,sBAAsB,EAAE,UAAU,EAClC,SAAS,EAAE,wBAAwB,CAAC,KAAK,CAAC,IAEzC,KAAK,CACI,CACR,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,GAAW,EAAE,MAAc,EAAU,EAAE;IACvE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,sBAAsB,EAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC/F,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAU,EAAE;IACpD,OAAO,KAAK,GAAG,CAAC,CAAC;AACnB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useMemo } from 'react';\nimport { FocusZone, FocusZoneDirection, mergeStyles } from '@fluentui/react';\nimport type { IContextualMenuItem } from '@fluentui/react';\nimport {\n insertTableMenuCellButtonSelectedStyles,\n insertTableMenuCellButtonStyles,\n insertTableMenuFocusZone,\n insertTableMenuTitleStyles\n} from '../../../styles/RichTextEditor.styles';\nimport { ColumnRowReplaceString, createKey } from '../../../utils/RichTextTableUtils';\nimport { useTheme } from '../../../../theming';\n\n// This file uses RoosterJS React package implementation with updates to UI components and styles.\nconst RowColumnInitialValue = 0;\n\ninterface RichTextInsertTablePaneProps {\n item: IContextualMenuItem;\n onClick: (e: React.MouseEvent<Element> | React.KeyboardEvent<Element>, item: IContextualMenuItem) => void;\n maxRowsNumber: number;\n maxColumnsNumber: number;\n}\n\n/**\n * @private\n * Component for the insert table pane\n */\nexport const RichTextInsertTablePane = (props: RichTextInsertTablePaneProps): JSX.Element => {\n const { item, onClick, maxColumnsNumber, maxRowsNumber } = props;\n const [column, setColumn] = React.useState(RowColumnInitialValue);\n const [row, setRow] = React.useState(RowColumnInitialValue);\n const theme = useTheme();\n\n const updateSize = React.useCallback(\n (target?: HTMLElement) => {\n if (target !== undefined && target.dataset.column !== undefined && target.dataset.row !== undefined) {\n const column = parseInt(target.dataset.column);\n const row = parseInt(target.dataset.row);\n\n if (\n column >= RowColumnInitialValue &&\n column < maxColumnsNumber &&\n row >= RowColumnInitialValue &&\n row < maxRowsNumber\n ) {\n setColumn(column);\n setRow(row);\n }\n }\n },\n [maxColumnsNumber, maxRowsNumber]\n );\n\n const onMouseEnter = React.useCallback(\n (e: React.MouseEvent<HTMLButtonElement>) => {\n updateSize(e.target as HTMLElement);\n },\n [updateSize]\n );\n\n const onClickButton = React.useCallback(\n (e: React.MouseEvent<HTMLButtonElement>) => {\n onClick(e, {\n ...item,\n key: createKey(formatRowColumnText(row), formatRowColumnText(column))\n });\n },\n [row, column, onClick, item]\n );\n\n const items = React.useMemo(() => {\n const items: JSX.Element[] = [];\n\n for (let i = 0; i < maxRowsNumber; i++) {\n for (let j = 0; j < maxColumnsNumber; j++) {\n const key = `cell_${i}_${j}`;\n const isSelected = j <= column && i <= row;\n items.push(\n <button\n className={mergeStyles(\n insertTableMenuCellButtonStyles(theme),\n isSelected ? insertTableMenuCellButtonSelectedStyles(theme) : undefined\n )}\n onClick={onClickButton}\n key={key}\n id={key}\n data-column={j}\n data-row={i}\n data-is-focusable={true}\n onMouseEnter={onMouseEnter}\n aria-label={formatText(item.text ?? '', formatRowColumnText(i), formatRowColumnText(j))}\n data-testid={key}\n />\n );\n }\n }\n\n return items;\n }, [maxRowsNumber, maxColumnsNumber, column, row, theme, onClickButton, onMouseEnter, item.text]);\n\n const text = useMemo(() => {\n return formatText(item.text ?? '', formatRowColumnText(row), formatRowColumnText(column));\n }, [column, item.text, row]);\n\n return (\n <div>\n <div className={insertTableMenuTitleStyles}>{text}</div>\n <FocusZone\n defaultTabbableElement={`cell_${RowColumnInitialValue}_${RowColumnInitialValue}`}\n direction={FocusZoneDirection.bidirectional}\n onActiveElementChanged={updateSize}\n className={insertTableMenuFocusZone(theme)}\n >\n {items}\n </FocusZone>\n </div>\n );\n};\n\nconst formatText = (text: string, row: number, column: number): string => {\n return text.replace(`${ColumnRowReplaceString}`, `${column.toString()} x ${row.toString()}`);\n};\n\nconst formatRowColumnText = (value: number): number => {\n return value + 1;\n};\n"]}
@@ -1,8 +0,0 @@
1
- import { EditorPlugin } from 'roosterjs-editor-types-compatible';
2
- import { LocalizedStrings } from 'roosterjs-react';
3
- /**
4
- * Create a new instance of ContextMenuProvider to support table editing functionalities in context menu
5
- * @returns A new ContextMenuProvider
6
- */
7
- export declare const createTableEditMenuProvider: (strings?: LocalizedStrings<string>) => EditorPlugin;
8
- //# sourceMappingURL=RichTextTableContextMenu.d.ts.map
@@ -1,66 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- import { editTable } from 'roosterjs-editor-api';
4
- import { CompatibleTableOperation } from 'roosterjs-editor-types-compatible';
5
- import { createContextMenuProvider } from 'roosterjs-react';
6
- import { tableContextMenuStrings } from '../../../utils/RichTextEditorStringsUtils';
7
- import { tableContextMenuIconStyles } from '../../../styles/RichTextEditor.styles';
8
- const onClick = (key, editor) => {
9
- editor.focus();
10
- const operation = TableEditOperationMap[key];
11
- if (typeof operation === 'number') {
12
- editTable(editor, operation);
13
- }
14
- };
15
- const TableEditOperationMap = {
16
- menuNameTableInsertAbove: CompatibleTableOperation.InsertAbove,
17
- menuNameTableInsertBelow: CompatibleTableOperation.InsertBelow,
18
- menuNameTableInsertLeft: CompatibleTableOperation.InsertLeft,
19
- menuNameTableInsertRight: CompatibleTableOperation.InsertRight,
20
- menuNameTableDeleteTable: CompatibleTableOperation.DeleteTable,
21
- menuNameTableDeleteColumn: CompatibleTableOperation.DeleteColumn,
22
- menuNameTableDeleteRow: CompatibleTableOperation.DeleteRow
23
- };
24
- const tableEditInsertMenuItem = {
25
- key: 'menuNameTableInsert',
26
- unlocalizedText: 'Insert',
27
- subItems: {
28
- menuNameTableInsertAbove: 'Insert above',
29
- menuNameTableInsertBelow: 'Insert below',
30
- menuNameTableInsertLeft: 'Insert left',
31
- menuNameTableInsertRight: 'Insert right'
32
- },
33
- onClick,
34
- iconProps: {
35
- iconName: 'RichTextTableInsertMenuIcon',
36
- styles: { root: tableContextMenuIconStyles }
37
- }
38
- };
39
- const tableEditDeleteMenuItem = {
40
- key: 'menuNameTableDelete',
41
- unlocalizedText: 'Delete',
42
- subItems: {
43
- menuNameTableDeleteColumn: 'Delete column',
44
- menuNameTableDeleteRow: 'Delete row',
45
- menuNameTableDeleteTable: 'Delete table'
46
- },
47
- onClick,
48
- iconProps: {
49
- iconName: 'RichTextTableDeleteMenuIcon',
50
- styles: { root: tableContextMenuIconStyles }
51
- }
52
- };
53
- const tableActions = [tableEditInsertMenuItem, tableEditDeleteMenuItem];
54
- /**
55
- * Create a new instance of ContextMenuProvider to support table editing functionalities in context menu
56
- * @returns A new ContextMenuProvider
57
- */
58
- export const createTableEditMenuProvider = (strings) => {
59
- return createContextMenuProvider('tableEdit', tableActions, tableContextMenuStrings(strings !== null && strings !== void 0 ? strings : {}), (editor, node) => !!getEditingTable(editor, node));
60
- };
61
- const getEditingTable = (editor, node) => {
62
- const td = editor.getElementAtCursor('TD,TH', node);
63
- const table = td && editor.getElementAtCursor('table', td);
64
- return (table === null || table === void 0 ? void 0 : table.isContentEditable) ? { table, td } : null;
65
- };
66
- //# sourceMappingURL=RichTextTableContextMenu.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RichTextTableContextMenu.js","sourceRoot":"","sources":["../../../../../../../../../react-components/src/components/RichTextEditor/Buttons/Table/RichTextTableContextMenu.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAyB,MAAM,mCAAmC,CAAC;AACpG,OAAO,EAAmB,yBAAyB,EAAoB,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAEnF,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,MAAe,EAAQ,EAAE;IACrD,MAAM,CAAC,KAAK,EAAE,CAAC;IACf,MAAM,SAAS,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAsD;IAC/E,wBAAwB,EAAE,wBAAwB,CAAC,WAAW;IAC9D,wBAAwB,EAAE,wBAAwB,CAAC,WAAW;IAC9D,uBAAuB,EAAE,wBAAwB,CAAC,UAAU;IAC5D,wBAAwB,EAAE,wBAAwB,CAAC,WAAW;IAC9D,wBAAwB,EAAE,wBAAwB,CAAC,WAAW;IAC9D,yBAAyB,EA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AI,CAAyB,CAAC;IAC5E,MAAM,KAAK,GAAG,EAAE,IAAK,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,EAAE,CAAsB,CAAC;IAEjF,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,EAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { editTable } from 'roosterjs-editor-api';\nimport { CompatibleTableOperation, EditorPlugin, IEditor } from 'roosterjs-editor-types-compatible';\nimport { ContextMenuItem, createContextMenuProvider, LocalizedStrings } from 'roosterjs-react';\nimport { tableContextMenuStrings } from '../../../utils/RichTextEditorStringsUtils';\nimport { tableContextMenuIconStyles } from '../../../styles/RichTextEditor.styles';\n\nconst onClick = (key: string, editor: IEditor): void => {\n editor.focus();\n const operation = TableEditOperationMap[key];\n if (typeof operation === 'number') {\n editTable(editor, operation);\n }\n};\n\nconst TableEditOperationMap: Partial<Record<string, CompatibleTableOperation>> = {\n menuNameTableInsertAbove: CompatibleTableOperation.InsertAbove,\n menuNameTableInsertBelow: CompatibleTableOperation.InsertBelow,\n menuNameTableInsertLeft: CompatibleTableOperation.InsertLeft,\n menuNameTableInsertRight: CompatibleTableOperation.InsertRight,\n menuNameTableDeleteTable: CompatibleTableOperation.DeleteTable,\n menuNameTableDeleteColumn: CompatibleTableOperation.DeleteColumn,\n menuNameTableDeleteRow: CompatibleTableOperation.DeleteRow\n};\n\nconst tableEditInsertMenuItem: ContextMenuItem<string> = {\n key: 'menuNameTableInsert',\n unlocalizedText: 'Insert',\n subItems: {\n menuNameTableInsertAbove: 'Insert above',\n menuNameTableInsertBelow: 'Insert below',\n menuNameTableInsertLeft: 'Insert left',\n menuNameTableInsertRight: 'Insert right'\n },\n onClick,\n iconProps: {\n iconName: 'RichTextTableInsertMenuIcon',\n styles: { root: tableContextMenuIconStyles }\n }\n};\n\nconst tableEditDeleteMenuItem: ContextMenuItem<string> = {\n key: 'menuNameTableDelete',\n unlocalizedText: 'Delete',\n subItems: {\n menuNameTableDeleteColumn: 'Delete column',\n menuNameTableDeleteRow: 'Delete row',\n menuNameTableDeleteTable: 'Delete table'\n },\n onClick,\n iconProps: {\n iconName: 'RichTextTableDeleteMenuIcon',\n styles: { root: tableContextMenuIconStyles }\n }\n};\n\nconst tableActions: ContextMenuItem<string>[] = [tableEditInsertMenuItem, tableEditDeleteMenuItem];\n\n/**\n * Create a new instance of ContextMenuProvider to support table editing functionalities in context menu\n * @returns A new ContextMenuProvider\n */\nexport const createTableEditMenuProvider = (strings?: LocalizedStrings<string>): EditorPlugin => {\n return createContextMenuProvider(\n 'tableEdit',\n tableActions,\n tableContextMenuStrings(strings ?? {}),\n (editor: IEditor, node: Node) => !!getEditingTable(editor, node)\n );\n};\n\nconst getEditingTable = (editor: IEditor, node: Node): { table: HTMLTableElement; td: HTMLTableCellElement } | null => {\n const td = editor.getElementAtCursor('TD,TH', node) as HTMLTableCellElement;\n const table = td && (editor.getElementAtCursor('table', td) as HTMLTableElement);\n\n return table?.isContentEditable ? { table, td } : null;\n};\n"]}
@@ -1,9 +0,0 @@
1
- import type { IEditor } from 'roosterjs-editor-types-compatible';
2
- /**
3
- * Insert table into editor at current selection
4
- * @param editor The editor instance
5
- * @param columns Number of columns in table
6
- * @param rows Number of rows in table
7
- */
8
- export declare const insertTable: (editor: IEditor, columns: number, rows: number) => void;
9
- //# sourceMappingURL=insertTableAction.d.ts.map
@@ -1,56 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- import { Position, VTable } from 'roosterjs-editor-dom';
4
- import { CompatibleChangeSource, CompatiblePositionType } from 'roosterjs-editor-types-compatible';
5
- // This file uses RoosterJS React package implementation with updates to change table's size and remove styles
6
- /**
7
- * Insert table into editor at current selection
8
- * @param editor The editor instance
9
- * @param columns Number of columns in table
10
- * @param rows Number of rows in table
11
- */
12
- export const insertTable = (editor, columns, rows) => {
13
- const document = editor.getDocument();
14
- const table = document.createElement('table');
15
- for (let i = 0; i < rows; i++) {
16
- const tr = document.createElement('tr');
17
- table.appendChild(tr);
18
- for (let j = 0; j < columns; j++) {
19
- const td = document.createElement('td');
20
- tr.appendChild(td);
21
- td.appendChild(document.createElement('br'));
22
- // set the width as otherwise insets doesn't work well in table
23
- // review if it's needed when content model packages are used
24
- td.style.width = getTableCellWidth(columns);
25
- }
26
- }
27
- editor.focus();
28
- editor.addUndoSnapshot(() => {
29
- const vTable = new VTable(table);
30
- vTable.writeBack();
31
- editor.insertNode(table);
32
- const nextElementAfterTable = table.nextElementSibling;
33
- // insert br only if there is no next element after the table
34
- if (nextElementAfterTable === null) {
35
- // insert br after the table
36
- // so users can easily input content after table
37
- editor.select(new Position(table, CompatiblePositionType.After));
38
- editor.insertNode(document.createElement('br'));
39
- }
40
- editor.runAsync((editor) => editor.select(new Position(table, CompatiblePositionType.Begin).normalize()));
41
- }, CompatibleChangeSource.Format, undefined /* canUndoByBackspace */, {
42
- formatApiName: 'insertTable'
43
- });
44
- };
45
- function getTableCellWidth(columns) {
46
- if (columns <= 4) {
47
- return '120px';
48
- }
49
- else if (columns <= 6) {
50
- return '100px';
51
- }
52
- else {
53
- return '70px';
54
- }
55
- }
56
- //# sourceMappingURL=insertTableAction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insertTableAction.js","sourceRoot":"","sources":["../../../../../../../../../react-components/src/components/RichTextEditor/Buttons/Table/insertTableAction.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG,+GAA+G;AAE/G;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAe,EAAE,OA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AAC,CAAC;YACjE,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QAClD,CAAC;QAED,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAC5G,CAAC,EACD,sBAAsB,CAAC,MAAM,EAC7B,SAAS,CAAC,wBAAwB,EAClC;QACE,aAAa,EAAE,aAAa;KAC7B,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,iBAAiB,CAAC,OAAe;IACxC,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;QACjB,OAAO,OAAO,CAAC;IACjB,CAAC;SAAM,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC;IACjB,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { Position, VTable } from 'roosterjs-editor-dom';\nimport type { IEditor } from 'roosterjs-editor-types-compatible';\nimport { CompatibleChangeSource, CompatiblePositionType } from 'roosterjs-editor-types-compatible';\n\n// This file uses RoosterJS React package implementation with updates to change table's size and remove styles\n\n/**\n * Insert table into editor at current selection\n * @param editor The editor instance\n * @param columns Number of columns in table\n * @param rows Number of rows in table\n */\nexport const insertTable = (editor: IEditor, columns: number, rows: number): void => {\n const document = editor.getDocument();\n const table = document.createElement('table') as HTMLTableElement;\n for (let i = 0; i < rows; i++) {\n const tr = document.createElement('tr') as HTMLTableRowElement;\n table.appendChild(tr);\n for (let j = 0; j < columns; j++) {\n const td = document.createElement('td') as HTMLTableCellElement;\n tr.appendChild(td);\n td.appendChild(document.createElement('br'));\n\n // set the width as otherwise insets doesn't work well in table\n // review if it's needed when content model packages are used\n td.style.width = getTableCellWidth(columns);\n }\n }\n\n editor.focus();\n editor.addUndoSnapshot(\n () => {\n const vTable = new VTable(table);\n vTable.writeBack();\n editor.insertNode(table);\n const nextElementAfterTable = table.nextElementSibling;\n\n // insert br only if there is no next element after the table\n if (nextElementAfterTable === null) {\n // insert br after the table\n // so users can easily input content after table\n editor.select(new Position(table, CompatiblePositionType.After));\n editor.insertNode(document.createElement('br'));\n }\n\n editor.runAsync((editor) => editor.select(new Position(table, CompatiblePositionType.Begin).normalize()));\n },\n CompatibleChangeSource.Format,\n undefined /* canUndoByBackspace */,\n {\n formatApiName: 'insertTable'\n }\n );\n};\n\nfunction getTableCellWidth(columns: number): string {\n if (columns <= 4) {\n return '120px';\n } else if (columns <= 6) {\n return '100px';\n } else {\n return '70px';\n }\n}\n"]}
@@ -1,15 +0,0 @@
1
- import type { LocalizedStrings } from 'roosterjs-react';
2
- import type { RichTextSendBoxStrings } from '../RichTextEditor/RichTextSendBox';
3
- /**
4
- * @private
5
- *
6
- * Strings for the ribbon buttons where key should match `key` prop if any or the name of the item.
7
- */
8
- export declare const ribbonButtonsStrings: (strings: Partial<RichTextSendBoxStrings>) => LocalizedStrings<string>;
9
- /**
10
- * @private
11
- *
12
- * Strings for the table context menu where key should match `key` prop if any or the name of the item.
13
- */
14
- export declare const tableContextMenuStrings: (strings: Partial<RichTextSendBoxStrings>) => LocalizedStrings<string>;
15
- //# sourceMappingURL=RichTextEditorStringsUtils.d.ts.map
@@ -1,39 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- /**
4
- * @private
5
- *
6
- * Strings for the ribbon buttons where key should match `key` prop if any or the name of the item.
7
- */
8
- export const ribbonButtonsStrings = (strings) => {
9
- return {
10
- buttonNameBold: strings.richTextBoldTooltip,
11
- buttonNameItalic: strings.richTextItalicTooltip,
12
- buttonNameUnderline: strings.richTextUnderlineTooltip,
13
- buttonNameBulletedList: strings.richTextBulletListTooltip,
14
- buttonNameNumberedList: strings.richTextNumberListTooltip,
15
- buttonNameIncreaseIndent: strings.richTextIncreaseIndentTooltip,
16
- buttonNameDecreaseIndent: strings.richTextDecreaseIndentTooltip,
17
- buttonNameInsertTable: strings.richTextInsertTableTooltip,
18
- insertTablePane: strings.richTextInsertTableMenuTitle
19
- };
20
- };
21
- /**
22
- * @private
23
- *
24
- * Strings for the table context menu where key should match `key` prop if any or the name of the item.
25
- */
26
- export const tableContextMenuStrings = (strings) => {
27
- return {
28
- menuNameTableInsert: strings.richTextInsertRowOrColumnMenu,
29
- menuNameTableInsertAbove: strings.richTextInsertRowAboveMenu,
30
- menuNameTableInsertBelow: strings.richTextInsertRowBelowMenu,
31
- menuNameTableInsertLeft: strings.richTextInsertColumnLeftMenu,
32
- menuNameTableInsertRight: strings.richTextInsertColumnRightMenu,
33
- menuNameTableDelete: strings.richTextDeleteRowOrColumnMenu,
34
- menuNameTableDeleteColumn: strings.richTextDeleteColumnMenu,
35
- menuNameTableDeleteRow: strings.richTextDeleteRowMenu,
36
- menuNameTableDeleteTable: strings.richTextDeleteTableMenu
37
- };
38
- };
39
- //# sourceMappingURL=RichTextEditorStringsUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RichTextEditorStringsUtils.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/utils/RichTextEditorStringsUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAwC,EAA4B,EAAE;IACzG,OAAO;QACL,cAAc,EAAE,OAAO,CAAC,mBAAmB;QAC3C,gBAAgB,EAAE,OAAO,CAAC,qBAAqB;QAC/C,mBAAmB,EAAE,OAAO,CAAC,wBAAwB;QACrD,sBAAsB,EAAE,OAAO,CAAC,yBAAyB;QACzD,sBAAsB,EAAE,OAAO,CAAC,yBAAyB;QACzD,wBAAwB,EAAE,OAAO,CAAC,6BAA6B;QAC/D,wBAAwB,EAAE,OAAO,CAAC,6BAA6B;QAC/D,qBAAqB,EAAE,OAAO,CAAC,0BAA0B;QACzD,eAAe,EAAE,OAAO,CAAC,4BAA4B;KACtD,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAAwC,EAA4B,EAAE;IAC5G,OAAO;QACL,mBAAmB,EAAE,OAAO,CAAC,6BAA6B;QAC1D,wBAAwB,EAAE,OAAO,CAAC,0BAA0B;QAC5D,wBAAwB,EAAE,OAAO,CAAC,0BAA0B;QAC5D,uBAAuB,EAAE,OAAO,CAAC,4BAA4B;QAC7D,wBAAwB,EAAE,OAAO,CAAC,6BAA6B;QAC/D,mBAAmB,EAAE,OAAO,CAAC,6BAA6B;QAC1D,yBAAyB,EAAE,OAAO,CAAC,wBAAwB;QAC3D,sBAAsB,EAAE,OAAO,CAAC,qBAAqB;QACrD,wBAAwB,EAAE,OAAO,CAAC,uBAAuB;KAC1D,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { LocalizedStrings } from 'roosterjs-react';\nimport type { RichTextSendBoxStrings } from '../RichTextEditor/RichTextSendBox';\n/**\n * @private\n *\n * Strings for the ribbon buttons where key should match `key` prop if any or the name of the item.\n */\nexport const ribbonButtonsStrings = (strings: Partial<RichTextSendBoxStrings>): LocalizedStrings<string> => {\n return {\n buttonNameBold: strings.richTextBoldTooltip,\n buttonNameItalic: strings.richTextItalicTooltip,\n buttonNameUnderline: strings.richTextUnderlineTooltip,\n buttonNameBulletedList: strings.richTextBulletListTooltip,\n buttonNameNumberedList: strings.richTextNumberListTooltip,\n buttonNameIncreaseIndent: strings.richTextIncreaseIndentTooltip,\n buttonNameDecreaseIndent: strings.richTextDecreaseIndentTooltip,\n buttonNameInsertTable: strings.richTextInsertTableTooltip,\n insertTablePane: strings.richTextInsertTableMenuTitle\n };\n};\n\n/**\n * @private\n *\n * Strings for the table context menu where key should match `key` prop if any or the name of the item.\n */\nexport const tableContextMenuStrings = (strings: Partial<RichTextSendBoxStrings>): LocalizedStrings<string> => {\n return {\n menuNameTableInsert: strings.richTextInsertRowOrColumnMenu,\n menuNameTableInsertAbove: strings.richTextInsertRowAboveMenu,\n menuNameTableInsertBelow: strings.richTextInsertRowBelowMenu,\n menuNameTableInsertLeft: strings.richTextInsertColumnLeftMenu,\n menuNameTableInsertRight: strings.richTextInsertColumnRightMenu,\n menuNameTableDelete: strings.richTextDeleteRowOrColumnMenu,\n menuNameTableDeleteColumn: strings.richTextDeleteColumnMenu,\n menuNameTableDeleteRow: strings.richTextDeleteRowMenu,\n menuNameTableDeleteTable: strings.richTextDeleteTableMenu\n };\n};\n"]}