strapi-plugin-comments 2.2.15 → 2.2.16

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 (73) hide show
  1. package/README.md +3 -3
  2. package/admin/src/components/CommentReviewModal/index.d.ts +0 -1
  3. package/admin/src/components/ConfirmationDialog/index.d.ts +0 -1
  4. package/admin/src/components/DiscussionStatus/index.d.ts +0 -1
  5. package/admin/src/components/DiscussionThread/index.d.ts +0 -1
  6. package/admin/src/components/DiscussionThreadItem/index.d.ts +0 -1
  7. package/admin/src/components/DiscussionThreadItemActions/index.d.ts +0 -1
  8. package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.d.ts +0 -1
  9. package/admin/src/components/DiscussionThreadItemFooter/index.d.ts +0 -1
  10. package/admin/src/components/DiscussionThreadItemReviewAction/index.d.ts +0 -1
  11. package/admin/src/components/FormSwitch/index.d.ts +0 -1
  12. package/admin/src/components/LoadingIndicatorOverlay/index.d.ts +0 -1
  13. package/admin/src/components/ModeratorResponse/index.js +5 -8
  14. package/admin/src/components/ModeratorResponseModal/ModeratorResponseModal.js +5 -8
  15. package/admin/src/components/Nav/index.d.ts +0 -1
  16. package/admin/src/components/PluginIcon/index.d.ts +0 -1
  17. package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.d.ts +18 -1
  18. package/admin/src/components/ReportsActions/components/BlockMenu/index.d.ts +0 -1
  19. package/admin/src/components/ReportsActions/index.d.ts +0 -1
  20. package/admin/src/components/ReportsReviewModal/index.d.ts +0 -1
  21. package/admin/src/components/ReportsReviewTable/index.d.ts +0 -1
  22. package/admin/src/components/StatusBadge/index.d.ts +0 -1
  23. package/admin/src/components/TableFilters/index.d.ts +0 -1
  24. package/admin/src/components/TablePagination/index.d.ts +0 -1
  25. package/admin/src/components/Wysiwyg/Editor.d.ts +24 -12
  26. package/admin/src/components/Wysiwyg/Editor.js +375 -21
  27. package/admin/src/components/Wysiwyg/EditorLayout.d.ts +9 -8
  28. package/admin/src/components/Wysiwyg/EditorLayout.js +37 -51
  29. package/admin/src/components/Wysiwyg/Field.d.ts +15 -0
  30. package/admin/src/components/Wysiwyg/{index.js → Field.js} +48 -49
  31. package/admin/src/components/Wysiwyg/PreviewWysiwyg.d.ts +6 -0
  32. package/admin/src/components/Wysiwyg/PreviewWysiwyg.js +191 -0
  33. package/admin/src/components/Wysiwyg/WysiwygFooter.d.ts +7 -6
  34. package/admin/src/components/Wysiwyg/WysiwygFooter.js +32 -13
  35. package/admin/src/components/Wysiwyg/WysiwygNav.d.ts +12 -10
  36. package/admin/src/components/Wysiwyg/WysiwygNav.js +76 -58
  37. package/admin/src/components/Wysiwyg/WysiwygStyles.d.ts +0 -1
  38. package/admin/src/components/Wysiwyg/WysiwygStyles.js +8 -13
  39. package/admin/src/components/Wysiwyg/utils/continueList.d.ts +5 -2
  40. package/admin/src/components/Wysiwyg/utils/continueList.js +2 -1
  41. package/admin/src/components/Wysiwyg/utils/mdRenderer.d.ts +5 -0
  42. package/admin/src/components/Wysiwyg/utils/mdRenderer.js +63 -0
  43. package/admin/src/components/Wysiwyg/utils/utils.d.ts +11 -9
  44. package/admin/src/components/Wysiwyg/utils/utils.js +13 -12
  45. package/admin/src/components/icons/comments.d.ts +0 -1
  46. package/admin/src/components/icons/lock.d.ts +0 -1
  47. package/admin/src/components/icons/review.d.ts +0 -1
  48. package/admin/src/components/icons/strapiIcons.d.ts +0 -1
  49. package/admin/src/components/icons/unlock.d.ts +0 -1
  50. package/admin/src/custom-fields/comments/components/icon.d.ts +0 -1
  51. package/admin/src/index.d.ts +3 -1
  52. package/admin/src/index.js +1 -1
  53. package/admin/src/pages/App/index.d.ts +14 -2
  54. package/admin/src/pages/App/reducer/selectors.d.ts +5 -1
  55. package/admin/src/pages/Details/components/DetailsEntity/index.d.ts +0 -1
  56. package/admin/src/pages/Details/components/DetailsFilters/index.d.ts +0 -1
  57. package/admin/src/pages/Details/index.d.ts +9 -2
  58. package/admin/src/pages/Discover/components/DiscoverTableRow/index.d.ts +0 -1
  59. package/admin/src/pages/Discover/index.d.ts +9 -2
  60. package/admin/src/pages/NoAccessPage/index.d.ts +0 -1
  61. package/admin/src/pages/Reports/components/ReportsTableRow/index.d.ts +0 -1
  62. package/admin/src/pages/Reports/index.d.ts +9 -2
  63. package/admin/src/pages/Settings/index.d.ts +0 -1
  64. package/admin/src/pages/Settings/index.js +2 -5
  65. package/admin/src/permissions.js +0 -1
  66. package/package.json +7 -8
  67. package/server/services/common.js +3 -4
  68. package/tsconfig.tsbuildinfo +1 -1
  69. package/admin/src/components/Wysiwyg/EditorStylesContainer.d.ts +0 -2
  70. package/admin/src/components/Wysiwyg/EditorStylesContainer.js +0 -348
  71. package/admin/src/components/Wysiwyg/index.d.ts +0 -28
  72. package/admin/src/components/Wysiwyg/tests/index.test.d.ts +0 -2
  73. package/admin/src/components/Wysiwyg/tests/index.test.js +0 -1633
package/README.md CHANGED
@@ -127,14 +127,14 @@ Complete installation requirements are exact same as for Strapi itself and can b
127
127
 
128
128
  **Minimum environment requirements**
129
129
 
130
- - Node.js `>=14.19.1 <=18.x.x`
130
+ - Node.js `>=16.0.0 <=20.x.x`
131
131
  - NPM `>=7.x.x`
132
132
 
133
133
  In our minimum support we're following [official Node.js releases timelines](https://nodejs.org/en/about/releases/).
134
134
 
135
135
  **Supported Strapi versions**:
136
136
 
137
- - Strapi v4.13.x (recently tested)
137
+ - Strapi v4.20.x (recently tested)
138
138
  - Strapi v4.x
139
139
 
140
140
  > This plugin is designed for **Strapi v4** and is not working with v3.x. To get version for **Strapi v3** install version [v1.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/strapi-v3).
@@ -192,7 +192,7 @@ module.exports = ({ env }) => ({
192
192
  ### Properties
193
193
 
194
194
  - `enabledCollections` - list of Collection and Single Types for which plugin should be enabled in format like `'api::<collection name>.<content type name>'`. By default it's empty and none comments are not enabled for any of type in Strapi.
195
- - `badWords` - Enabled support for [bad words filtering](https://www.npmjs.com/package/bad-words). Can be turned off or overwritten using [options reference](https://www.npmjs.com/package/bad-words#constructor). Default value: `true`.
195
+ - `no-profanity` - Enabled support for [profanity filtering](https://www.npmjs.com/package/no-profanity). Can be turned off or altered using the [options reference](https://www.npmjs.com/package/no-profanity?activeTab=readme#options). Default value: `true`.
196
196
  - `moderatorRoles` - Optional list of names of roles. Users with those roles will be notified by email when a new abuse report is created. This feature requires a built-in [Strapi email plugin](https://docs.strapi.io/developer-docs/latest/plugins/email.html) configured.
197
197
  - `approvalFlow` - list of Content Types which are supporting approval flow. Values must be in format like `'api::<collection name>.<content type name>'`. For not included, posted comments are going to be immediately visible.
198
198
  - `entryLabel` - ordered list of property names per Content Type to generate related entity label. Keys must be in format like `'api::<collection name>.<content type name>'`. Default formatting set as `*`.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const CommentReviewModal: ({ children, endActions, isVisible, item, onClose, startActions, }: {
3
2
  children: any;
4
3
  endActions: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import PropTypes from "prop-types";
3
2
  declare const ConfirmationDialog: {
4
3
  ({ isVisible, isActionAsync, children, onConfirm, onCancel, header, labelCancel, labelConfirm, iconConfirm, }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const DiscussionStatus: {
3
2
  ({ blocked, blockedThread }: {
4
3
  blocked: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import PropTypes from "prop-types";
3
2
  declare const DiscussionThread: {
4
3
  ({ level, selected, allowedActions, isReloading, }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const DiscussionThreadItem: (props: any) => JSX.Element;
3
2
  export default DiscussionThreadItem;
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import PropTypes from "prop-types";
3
2
  declare const DiscussionThreadItemActions: {
4
3
  ({ allowedActions: { canModerate, canAccessReports, canReviewReports }, ...item }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import PropTypes from "prop-types";
3
2
  declare const DiscussionThreadItemApprovalFlowActions: {
4
3
  ({ id, allowedActions: { canModerate }, queryToInvalidate }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import PropTypes from "prop-types";
3
2
  declare const DiscussionThreadItemFooter: {
4
3
  ({ author, isAdminComment, children, createdAt, updatedAt, }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import PropTypes from "prop-types";
3
2
  declare const DiscussionThreadItemReviewAction: {
4
3
  ({ allowedActions: { canModerate, canAccessReports, canReviewReports }, isAnyActionLoading, item, queryToInvalidate }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const FormSwitch: ({ label, hint, ...props }: {
3
2
  [x: string]: any;
4
3
  label: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const LoadingIndicatorOverlay: () => JSX.Element;
3
2
  export default LoadingIndicatorOverlay;
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -22,9 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  const react_1 = __importStar(require("react"));
30
27
  const react_query_1 = require("react-query");
@@ -37,7 +34,7 @@ const Flex_1 = require("@strapi/design-system/Flex");
37
34
  const Button_1 = require("@strapi/design-system/Button");
38
35
  const Divider_1 = require("@strapi/design-system/Divider");
39
36
  const utils_1 = require("../../utils");
40
- const Wysiwyg_1 = __importDefault(require("../Wysiwyg"));
37
+ const Field_1 = require("../Wysiwyg/Field");
41
38
  const helper_plugin_1 = require("@strapi/helper-plugin");
42
39
  const pluginId_1 = require("../../pluginId");
43
40
  const ModeratorResponse = ({ rootThread, }) => {
@@ -62,7 +59,7 @@ const ModeratorResponse = ({ rootThread, }) => {
62
59
  });
63
60
  stateAction(false);
64
61
  setCommentField('');
65
- unlockApp();
62
+ unlockApp && unlockApp();
66
63
  };
67
64
  const onError = (err) => {
68
65
  (0, utils_1.handleAPIError)(err, toggleNotification);
@@ -73,7 +70,7 @@ const ModeratorResponse = ({ rootThread, }) => {
73
70
  onError,
74
71
  });
75
72
  const handleSave = async () => {
76
- lockApp();
73
+ lockApp && lockApp();
77
74
  await postCommentMutation.mutate({
78
75
  threadId,
79
76
  body: commentField,
@@ -81,7 +78,7 @@ const ModeratorResponse = ({ rootThread, }) => {
81
78
  });
82
79
  };
83
80
  const handleReopen = async () => {
84
- lockApp();
81
+ lockApp && lockApp();
85
82
  await unblockItemThreadMutation.mutate(threadId);
86
83
  await postCommentMutation.mutate({
87
84
  threadId,
@@ -100,7 +97,7 @@ const ModeratorResponse = ({ rootThread, }) => {
100
97
  react_1.default.createElement(Box_1.Box, null,
101
98
  react_1.default.createElement(Typography_1.Typography, { variant: "delta", textColor: "neutral800", id: "moderator-reply" }, (0, utils_1.getMessage)("page.details.panel.discussion.reply", "Reply"))),
102
99
  react_1.default.createElement(Box_1.Box, { paddingTop: 2, paddingBottom: 4 },
103
- react_1.default.createElement(Wysiwyg_1.default, { name: "", value: commentField, onChange: handleCommentChange, intlLabel: intlLabel })),
100
+ react_1.default.createElement(Field_1.Wysiwyg, { name: "", type: "wysiwyg", value: commentField, onChange: handleCommentChange, intlLabel: intlLabel })),
104
101
  react_1.default.createElement(Flex_1.Flex, { direction: "row", justifyContent: "flex-end", gap: 2 },
105
102
  blockedThread && (react_1.default.createElement(Button_1.Button, { variant: "secondary", onClick: handleReopen, disabled: isFieldEmpty }, (0, utils_1.getMessage)("page.details.panel.discussion.reopen", "Re-open"))),
106
103
  react_1.default.createElement(Button_1.Button, { variant: "primary", onClick: handleSave, disabled: isFieldEmpty }, (0, utils_1.getMessage)("page.details.panel.discussion.send", "Send"))))));
@@ -22,9 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  const react_1 = __importStar(require("react"));
30
27
  const react_query_1 = require("react-query");
@@ -33,7 +30,7 @@ const ModalLayout_1 = require("@strapi/design-system/ModalLayout");
33
30
  const Typography_1 = require("@strapi/design-system/Typography");
34
31
  const Button_1 = require("@strapi/design-system/Button");
35
32
  const utils_1 = require("../../utils");
36
- const Wysiwyg_1 = __importDefault(require("../Wysiwyg"));
33
+ const Field_1 = require("../Wysiwyg/Field");
37
34
  const helper_plugin_1 = require("@strapi/helper-plugin");
38
35
  const pluginId_1 = require("../../pluginId");
39
36
  const ModeratorResponseModal = ({ content, id, title, onClose, }) => {
@@ -54,7 +51,7 @@ const ModeratorResponseModal = ({ content, id, title, onClose, }) => {
54
51
  message: `${pluginId_1.pluginId}.${message}`,
55
52
  });
56
53
  stateAction(false);
57
- unlockApp();
54
+ unlockApp && unlockApp();
58
55
  };
59
56
  const onError = (err) => {
60
57
  (0, utils_1.handleAPIError)(err, toggleNotification);
@@ -68,7 +65,7 @@ const ModeratorResponseModal = ({ content, id, title, onClose, }) => {
68
65
  onError,
69
66
  });
70
67
  const handlePostComment = async () => {
71
- lockApp();
68
+ lockApp && lockApp();
72
69
  await postCommentMutation.mutate({
73
70
  threadId: id,
74
71
  body: commentField,
@@ -76,7 +73,7 @@ const ModeratorResponseModal = ({ content, id, title, onClose, }) => {
76
73
  });
77
74
  };
78
75
  const handleUpdateComment = async () => {
79
- lockApp();
76
+ lockApp && lockApp();
80
77
  await updateCommentMutation.mutate({
81
78
  id,
82
79
  body: commentField,
@@ -91,7 +88,7 @@ const ModeratorResponseModal = ({ content, id, title, onClose, }) => {
91
88
  react_1.default.createElement(ModalLayout_1.ModalHeader, null,
92
89
  react_1.default.createElement(Typography_1.Typography, { fontWeight: "bold", textColor: "neutral800", as: "h2", id: "title" }, title)),
93
90
  react_1.default.createElement(ModalLayout_1.ModalBody, null,
94
- react_1.default.createElement(Wysiwyg_1.default, { name: "", value: commentField, onChange: handleCommentChange, intlLabel: intlLabel })),
91
+ react_1.default.createElement(Field_1.Wysiwyg, { name: "", value: commentField, onChange: handleCommentChange, intlLabel: intlLabel })),
95
92
  react_1.default.createElement(ModalLayout_1.ModalFooter, { startActions: react_1.default.createElement(Button_1.Button, { onClick: handleClose, variant: "tertiary" }, (0, utils_1.getMessage)("compontents.confirmation.dialog.button.cancel")), endActions: content.length ? (react_1.default.createElement(Button_1.Button, { onClick: handleUpdateComment }, (0, utils_1.getMessage)("page.details.actions.thread.modal.update.comment"))) : (react_1.default.createElement(Button_1.Button, { onClick: handlePostComment }, (0, utils_1.getMessage)("page.details.actions.thread.modal.start.thread"))) })));
96
93
  };
97
94
  exports.default = ModeratorResponseModal;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const Nav: ({ visible, hasNewComments, hasNewReports }: {
3
2
  visible?: boolean | undefined;
4
3
  hasNewComments: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const PluginIcon: () => JSX.Element;
3
2
  export default PluginIcon;
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,20 @@
1
- declare const clean: (dirty: any, options?: any) => any;
1
+ import sanitizeHtml from 'sanitize-html';
2
+ declare const clean: (dirty: any, options?: {
3
+ allowedTags: boolean;
4
+ allowedAttributes: {
5
+ '*': string[];
6
+ img: string[];
7
+ source: string[];
8
+ };
9
+ allowedSchemes: string[];
10
+ allowedSchemesByTag: {
11
+ [index: string]: string[];
12
+ };
13
+ allowedSchemesAppliedToAttributes: string[];
14
+ allowProtocolRelative: boolean;
15
+ disallowedTagsMode: sanitizeHtml.DisallowedTagsModes;
16
+ enforceHtmlBoundary: boolean;
17
+ selfClosing: string[];
18
+ }) => string;
2
19
  export default clean;
3
20
  //# sourceMappingURL=satinizeHtml.d.ts.map
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const BlockMenu: ({ handlers: { handleBlockItemClick, handleBlockItemThreadClick, handleClickResolve, handleResolveAllAbuseReportsForComment, handleResolveAllAbuseReportsForThread, handleUnblockItemClick, handleUnblockThreadClick, }, item, type, }: {
3
2
  handlers: {
4
3
  handleBlockItemClick: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const ReportsActions: ({ allowedActions, item, mutation, onSelectionChange, reports, selectedReports, updateReports, }: {
3
2
  allowedActions: any;
4
3
  item: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import PropTypes from "prop-types";
3
2
  declare const ReportsReviewModal: {
4
3
  ({ isVisible, item, children, onClose, startActions, endActions, }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const ReportsReviewTable: ({ commentId, items, selectedItems, mutation, updateItems, allowedActions: { canAccessReports, canReviewReports }, onBlockButtonsStateChange, onSelectionChange, }: {
3
2
  commentId: any;
4
3
  items: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const StatusBadge: ({ children, textColor, ...rest }: {
3
2
  [x: string]: any;
4
3
  children: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import PropTypes from "prop-types";
3
2
  declare const TableFilters: {
4
3
  ({ displayedFilters }: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import PropTypes from "prop-types";
3
2
  declare const TablePagination: {
4
3
  ({ pagination }: {
@@ -1,17 +1,29 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
+ import { EditorFromTextArea } from 'codemirror5';
2
3
  import 'codemirror5/addon/display/placeholder';
3
- type EditorProps = {
4
+ interface EditorApi {
5
+ focus: () => void;
6
+ scrollIntoView: (args?: Parameters<HTMLElement['scrollIntoView']>[0]) => void;
7
+ }
8
+ interface EditorProps {
4
9
  disabled?: boolean;
5
- editorRef: any;
10
+ editorRef: React.MutableRefObject<EditorFromTextArea>;
6
11
  error?: string;
7
- isPreviewMode: boolean;
8
- isExpandMode: boolean;
12
+ isPreviewMode?: boolean;
13
+ isExpandMode?: boolean;
9
14
  name: string;
10
- onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
11
- placeholder: string;
12
- textareaRef: any;
13
- value: string;
14
- };
15
- declare const Editor: React.FC<EditorProps>;
16
- export default Editor;
15
+ onChange: (event: {
16
+ target: {
17
+ name: string;
18
+ value: string;
19
+ type: string;
20
+ };
21
+ }) => void;
22
+ placeholder?: string;
23
+ textareaRef: React.RefObject<HTMLTextAreaElement>;
24
+ value?: string;
25
+ }
26
+ declare const Editor: React.ForwardRefExoticComponent<EditorProps & React.RefAttributes<EditorApi>>;
27
+ export { Editor };
28
+ export type { EditorProps, EditorApi };
17
29
  //# sourceMappingURL=Editor.d.ts.map