strapi-plugin-comments 2.1.8 → 2.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/admin/src/components/Avatar/index.d.ts +3 -2
- package/admin/src/components/CommentReviewModal/index.d.ts +11 -0
- package/admin/src/components/CommentReviewModal/index.js +19 -0
- package/admin/src/components/ConfirmationDialog/index.d.ts +12 -10
- package/admin/src/components/ConfirmationDialog/index.js +3 -3
- package/admin/src/components/DiscussionStatus/index.d.ts +2 -1
- package/admin/src/components/DiscussionThread/index.d.ts +11 -5
- package/admin/src/components/DiscussionThread/index.js +3 -3
- package/admin/src/components/DiscussionThreadItem/index.d.ts +2 -7
- package/admin/src/components/DiscussionThreadItem/index.js +3 -12
- package/admin/src/components/DiscussionThreadItemActions/index.d.ts +10 -6
- package/admin/src/components/DiscussionThreadItemActions/index.js +75 -53
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.d.ts +9 -6
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +6 -9
- package/admin/src/components/DiscussionThreadItemFooter/index.d.ts +14 -7
- package/admin/src/components/DiscussionThreadItemFooter/index.js +3 -3
- package/admin/src/components/DiscussionThreadItemReviewAction/index.d.ts +14 -18
- package/admin/src/components/DiscussionThreadItemReviewAction/index.js +71 -52
- package/admin/src/components/FormSwitch/index.d.ts +2 -1
- package/admin/src/components/Hint/index.d.ts +14 -0
- package/admin/src/components/Hint/index.js +22 -0
- package/admin/src/components/LoadingIndicatorOverlay/index.d.ts +2 -1
- package/admin/src/components/ModeratorResponse/index.d.ts +8 -0
- package/admin/src/components/ModeratorResponse/index.js +108 -0
- package/admin/src/components/ModeratorResponse/styles.d.ts +2 -0
- package/admin/src/components/ModeratorResponse/styles.js +12 -0
- package/admin/src/components/ModeratorResponseModal/ModeratorResponseModal.d.ts +11 -0
- package/admin/src/components/ModeratorResponseModal/ModeratorResponseModal.js +98 -0
- package/admin/src/components/Nav/index.d.ts +2 -1
- package/admin/src/components/Nav/index.js +6 -9
- package/admin/src/components/PluginIcon/index.d.ts +2 -1
- package/admin/src/components/PluginIcon/index.js +2 -6
- package/admin/src/components/PreviewWysiwyg/Wrapper.d.ts +3 -0
- package/admin/src/components/PreviewWysiwyg/Wrapper.js +162 -0
- package/admin/src/components/PreviewWysiwyg/index.d.ts +7 -0
- package/admin/src/components/PreviewWysiwyg/index.js +39 -0
- package/admin/src/components/PreviewWysiwyg/utils/mdRenderer.d.ts +3 -0
- package/admin/src/components/PreviewWysiwyg/utils/mdRenderer.js +88 -0
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.d.ts +3 -0
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.js +18 -0
- package/admin/src/components/ReportsActions/components/BlockMenu/index.d.ts +16 -0
- package/admin/src/components/ReportsActions/components/BlockMenu/index.js +51 -0
- package/admin/src/components/ReportsActions/index.d.ts +12 -0
- package/admin/src/components/ReportsActions/index.js +31 -0
- package/admin/src/components/ReportsReviewModal/index.d.ts +14 -8
- package/admin/src/components/ReportsReviewTable/index.d.ts +13 -24
- package/admin/src/components/ReportsReviewTable/index.js +11 -24
- package/admin/src/components/StatusBadge/index.d.ts +2 -1
- package/admin/src/components/TableFilters/index.d.ts +12 -2
- package/admin/src/components/TableFilters/index.js +2 -2
- package/admin/src/components/TablePagination/index.d.ts +9 -2
- package/admin/src/components/Wysiwyg/Editor.d.ts +17 -0
- package/admin/src/components/Wysiwyg/Editor.js +84 -0
- package/admin/src/components/Wysiwyg/EditorLayout.d.ts +12 -0
- package/admin/src/components/Wysiwyg/EditorLayout.js +99 -0
- package/admin/src/components/Wysiwyg/EditorStylesContainer.d.ts +2 -0
- package/admin/src/components/Wysiwyg/EditorStylesContainer.js +348 -0
- package/admin/src/components/Wysiwyg/WysiwygFooter.d.ts +7 -0
- package/admin/src/components/Wysiwyg/WysiwygFooter.js +25 -0
- package/admin/src/components/Wysiwyg/WysiwygNav.d.ts +13 -0
- package/admin/src/components/Wysiwyg/WysiwygNav.js +118 -0
- package/admin/src/components/Wysiwyg/WysiwygStyles.d.ts +8 -0
- package/admin/src/components/Wysiwyg/WysiwygStyles.js +59 -0
- package/admin/src/components/Wysiwyg/index.d.ts +28 -0
- package/admin/src/components/Wysiwyg/index.js +136 -0
- package/admin/src/components/Wysiwyg/tests/index.test.d.ts +2 -0
- package/admin/src/components/Wysiwyg/tests/index.test.js +1633 -0
- package/admin/src/components/Wysiwyg/utils/continueList.d.ts +3 -0
- package/admin/src/components/Wysiwyg/utils/continueList.js +83 -0
- package/admin/src/components/Wysiwyg/utils/utils.d.ts +15 -0
- package/admin/src/components/Wysiwyg/utils/utils.js +249 -0
- package/admin/src/components/icons/comments.d.ts +2 -1
- package/admin/src/components/icons/index.d.ts +2 -5
- package/admin/src/components/icons/index.js +24 -12
- package/admin/src/components/icons/lock.d.ts +2 -1
- package/admin/src/components/icons/review.d.ts +2 -1
- package/admin/src/components/icons/strapiIcons.d.ts +24 -0
- package/admin/src/components/icons/strapiIcons.js +35 -0
- package/admin/src/components/icons/unlock.d.ts +2 -1
- package/admin/src/custom-fields/comments/components/icon.d.ts +3 -0
- package/admin/src/custom-fields/comments/components/icon.js +14 -0
- package/admin/src/custom-fields/comments/components/index.d.ts +3 -0
- package/admin/src/custom-fields/comments/components/index.js +19 -0
- package/admin/src/custom-fields/comments/components/input/index.d.ts +3 -0
- package/admin/src/custom-fields/comments/components/input/index.js +5 -0
- package/admin/src/custom-fields/comments/components/input/input.d.ts +4 -0
- package/admin/src/custom-fields/comments/components/input/input.js +102 -0
- package/admin/src/custom-fields/comments/components/input/types.d.ts +10 -0
- package/admin/src/custom-fields/comments/components/input/types.js +3 -0
- package/admin/src/custom-fields/comments/components/input/utils.d.ts +35 -0
- package/admin/src/custom-fields/comments/components/input/utils.js +146 -0
- package/admin/src/custom-fields/comments/index.d.ts +3 -0
- package/admin/src/custom-fields/comments/index.js +53 -0
- package/admin/src/custom-fields/index.d.ts +3 -0
- package/admin/src/custom-fields/index.js +13 -0
- package/admin/src/hooks/useConfig.d.ts +4 -4
- package/admin/src/hooks/useConfig.js +3 -6
- package/admin/src/hooks/useReportsActionsHandlers.d.ts +19 -0
- package/admin/src/hooks/useReportsActionsHandlers.js +70 -0
- package/admin/src/index.d.ts +2 -1
- package/admin/src/index.js +4 -2
- package/admin/src/pages/App/index.js +8 -7
- package/admin/src/pages/App/reducer/index.d.ts +1 -1
- package/admin/src/pages/ComingSoonPage/index.d.ts +2 -1
- package/admin/src/pages/ComingSoonPage/index.js +2 -2
- package/admin/src/pages/Details/components/DetailsEntity/index.d.ts +8 -6
- package/admin/src/pages/Details/components/DetailsFilters/index.d.ts +5 -3
- package/admin/src/pages/Details/index.js +10 -7
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.d.ts +11 -5
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.js +7 -81
- package/admin/src/pages/Discover/index.js +14 -13
- package/admin/src/pages/NoAccessPage/index.d.ts +4 -0
- package/admin/src/pages/NoAccessPage/index.js +31 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/index.d.ts +16 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/index.js +91 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/styles.d.ts +2 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/styles.js +14 -0
- package/admin/src/pages/Reports/index.d.ts +4 -0
- package/admin/src/pages/Reports/index.js +196 -0
- package/admin/src/pages/Reports/utils/api.d.ts +2 -0
- package/admin/src/pages/Reports/utils/api.js +16 -0
- package/admin/src/pages/Reports/utils/filtersSchema.d.ts +11 -0
- package/admin/src/pages/Reports/utils/filtersSchema.js +11 -0
- package/admin/src/pages/Settings/index.d.ts +2 -1
- package/admin/src/pages/Settings/index.js +6 -7
- package/admin/src/pages/utils/api.d.ts +17 -10
- package/admin/src/pages/utils/api.js +25 -2
- package/admin/src/reducers.d.ts +1 -1
- package/admin/src/translations/en.json +49 -1
- package/admin/src/utils/axiosInstance.d.ts +1 -1
- package/admin/src/utils/constants.d.ts +9 -5
- package/admin/src/utils/constants.js +5 -3
- package/admin/src/utils/errors.d.ts +5 -0
- package/admin/src/utils/errors.js +10 -0
- package/admin/src/utils/functions.d.ts +2 -0
- package/admin/src/utils/functions.js +11 -0
- package/admin/src/utils/getMessage.d.ts +1 -1
- package/admin/src/utils/getMessage.js +1 -1
- package/admin/src/utils/getRelatedGroups.d.ts +6 -2
- package/admin/src/utils/handleAPIError.d.ts +1 -1
- package/admin/src/utils/index.d.ts +16 -11
- package/admin/src/utils/index.js +12 -1
- package/admin/src/utils/resolveCommentStatus.d.ts +8 -2
- package/admin/src/utils/resolveReportStatus.d.ts +4 -0
- package/admin/src/utils/resolveReportStatus.js +23 -0
- package/admin/src/utils/resolveReportStatusColor.d.ts +4 -0
- package/admin/src/utils/resolveReportStatusColor.js +17 -0
- package/package.json +6 -3
- package/server/controllers/admin.js +67 -2
- package/server/index.d.ts +1 -1
- package/server/register/custom-fields/comments.d.ts +6 -0
- package/server/register/custom-fields/comments.js +9 -0
- package/server/register/custom-fields/index.d.ts +3 -0
- package/server/register/custom-fields/index.js +14 -0
- package/server/register/index.d.ts +4 -0
- package/server/register/index.js +8 -0
- package/server/routes/admin.js +56 -0
- package/server/services/admin.d.ts +1 -1
- package/server/services/admin.js +196 -10
- package/server/utils/error.js +1 -1
- package/strapi-server.d.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/types/utils.d.ts +5 -0
- package/types/utils.js +10 -0
- package/server/register.d.ts +0 -3
- package/server/register.js +0 -4
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import PropTypes from "prop-types";
|
|
1
3
|
declare const TablePagination: {
|
|
2
4
|
({ pagination }: {
|
|
3
5
|
pagination: any;
|
|
4
|
-
}):
|
|
6
|
+
}): JSX.Element;
|
|
5
7
|
defaultProps: {
|
|
6
8
|
pagination: {
|
|
7
9
|
pageCount: number;
|
|
@@ -10,7 +12,12 @@ declare const TablePagination: {
|
|
|
10
12
|
};
|
|
11
13
|
};
|
|
12
14
|
propTypes: {
|
|
13
|
-
pagination:
|
|
15
|
+
pagination: PropTypes.Requireable<PropTypes.InferProps<{
|
|
16
|
+
page: PropTypes.Requireable<number>;
|
|
17
|
+
pageCount: PropTypes.Requireable<number>;
|
|
18
|
+
pageSize: PropTypes.Requireable<number>;
|
|
19
|
+
total: PropTypes.Requireable<number>;
|
|
20
|
+
}>>;
|
|
14
21
|
};
|
|
15
22
|
};
|
|
16
23
|
export default TablePagination;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'codemirror/addon/display/placeholder';
|
|
3
|
+
declare type EditorProps = {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
editorRef: any;
|
|
6
|
+
error?: string;
|
|
7
|
+
isPreviewMode: boolean;
|
|
8
|
+
isExpandMode: boolean;
|
|
9
|
+
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;
|
|
17
|
+
//# sourceMappingURL=Editor.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const codemirror_1 = __importDefault(require("codemirror"));
|
|
31
|
+
require("codemirror/addon/display/placeholder");
|
|
32
|
+
const PreviewWysiwyg_1 = __importDefault(require("../PreviewWysiwyg"));
|
|
33
|
+
const EditorStylesContainer_1 = require("./EditorStylesContainer");
|
|
34
|
+
const WysiwygStyles_1 = require("./WysiwygStyles");
|
|
35
|
+
const continueList_1 = __importDefault(require("./utils/continueList"));
|
|
36
|
+
const Editor = ({ disabled, editorRef, error, isPreviewMode, isExpandMode, name, onChange, placeholder, textareaRef, value, }) => {
|
|
37
|
+
const onChangeRef = (0, react_1.useRef)(onChange);
|
|
38
|
+
(0, react_1.useEffect)(() => {
|
|
39
|
+
editorRef.current = codemirror_1.default.fromTextArea(textareaRef.current, {
|
|
40
|
+
lineWrapping: true,
|
|
41
|
+
extraKeys: {
|
|
42
|
+
Enter: 'newlineAndIndentContinueMarkdownList',
|
|
43
|
+
Tab: false,
|
|
44
|
+
'Shift-Tab': false,
|
|
45
|
+
},
|
|
46
|
+
readOnly: false,
|
|
47
|
+
smartIndent: false,
|
|
48
|
+
placeholder,
|
|
49
|
+
spellcheck: true,
|
|
50
|
+
inputStyle: 'contenteditable',
|
|
51
|
+
});
|
|
52
|
+
codemirror_1.default.commands.newlineAndIndentContinueMarkdownList = continueList_1.default;
|
|
53
|
+
editorRef.current.on('change', doc => {
|
|
54
|
+
onChangeRef.current({ target: { name, value: doc.getValue(), type: 'wysiwyg' } });
|
|
55
|
+
});
|
|
56
|
+
}, [editorRef, textareaRef, name, placeholder]);
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
if (value && !editorRef.current.state.focused) {
|
|
59
|
+
editorRef.current.setValue(value);
|
|
60
|
+
}
|
|
61
|
+
}, [editorRef, value]);
|
|
62
|
+
(0, react_1.useEffect)(() => {
|
|
63
|
+
if (isPreviewMode || disabled) {
|
|
64
|
+
editorRef.current.setOption('readOnly', 'nocursor');
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
editorRef.current.setOption('readOnly', false);
|
|
68
|
+
}
|
|
69
|
+
}, [disabled, isPreviewMode, editorRef]);
|
|
70
|
+
(0, react_1.useEffect)(() => {
|
|
71
|
+
if (error) {
|
|
72
|
+
editorRef.current.setOption('screenReaderLabel', error);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
editorRef.current.setOption('screenReaderLabel', 'Editor');
|
|
76
|
+
}
|
|
77
|
+
}, [editorRef, error]);
|
|
78
|
+
return (react_1.default.createElement(WysiwygStyles_1.EditorAndPreviewWrapper, null,
|
|
79
|
+
react_1.default.createElement(EditorStylesContainer_1.EditorStylesContainer, { isExpandMode: isExpandMode, disabled: disabled || isPreviewMode },
|
|
80
|
+
react_1.default.createElement("textarea", { ref: textareaRef })),
|
|
81
|
+
isPreviewMode && react_1.default.createElement(PreviewWysiwyg_1.default, { data: value })));
|
|
82
|
+
};
|
|
83
|
+
exports.default = Editor;
|
|
84
|
+
//# sourceMappingURL=Editor.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const ExpandButton: any;
|
|
3
|
+
declare type EditorLayoutProps = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
error: string | undefined;
|
|
6
|
+
isExpandMode: boolean;
|
|
7
|
+
previewContent: string;
|
|
8
|
+
onCollapse: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const EditorLayout: React.FC<EditorLayoutProps>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=EditorLayout.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.EditorLayout = exports.ExpandButton = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const Flex_1 = require("@strapi/design-system/Flex");
|
|
33
|
+
const Box_1 = require("@strapi/design-system/Box");
|
|
34
|
+
const FocusTrap_1 = require("@strapi/design-system/FocusTrap");
|
|
35
|
+
const Portal_1 = require("@strapi/design-system/Portal");
|
|
36
|
+
const BaseButton_1 = require("@strapi/design-system/BaseButton");
|
|
37
|
+
const Typography_1 = require("@strapi/design-system/Typography");
|
|
38
|
+
const helper_plugin_1 = require("@strapi/helper-plugin");
|
|
39
|
+
const Collapse_1 = __importDefault(require("@strapi/icons/Collapse"));
|
|
40
|
+
const react_intl_1 = require("react-intl");
|
|
41
|
+
const PreviewWysiwyg_1 = __importDefault(require("../PreviewWysiwyg"));
|
|
42
|
+
const setOpacity = (hex, alpha) => `${hex}${Math.floor(alpha * 255)
|
|
43
|
+
.toString(16)
|
|
44
|
+
.padStart(2, 0)}`;
|
|
45
|
+
const ExpandWrapper = (0, styled_components_1.default)(Flex_1.Flex) `
|
|
46
|
+
background: ${({ theme }) => setOpacity(theme.colors.neutral800, 0.2)};
|
|
47
|
+
`;
|
|
48
|
+
const BoxWithBorder = (0, styled_components_1.default)(Box_1.Box) `
|
|
49
|
+
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
50
|
+
`;
|
|
51
|
+
exports.ExpandButton = (0, styled_components_1.default)(BaseButton_1.BaseButton) `
|
|
52
|
+
background-color: transparent;
|
|
53
|
+
border: none;
|
|
54
|
+
align-items: center;
|
|
55
|
+
|
|
56
|
+
svg {
|
|
57
|
+
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
|
58
|
+
path {
|
|
59
|
+
fill: ${({ theme }) => theme.colors.neutral700};
|
|
60
|
+
width: ${12 / 16}rem;
|
|
61
|
+
height: ${12 / 16}rem;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
const EditorLayout = ({ children, isExpandMode, error, previewContent, onCollapse }) => {
|
|
66
|
+
const { formatMessage } = (0, react_intl_1.useIntl)();
|
|
67
|
+
(0, react_1.useEffect)(() => {
|
|
68
|
+
const body = document.body;
|
|
69
|
+
if (isExpandMode) {
|
|
70
|
+
body.classList.add('lock-body-scroll');
|
|
71
|
+
}
|
|
72
|
+
return () => {
|
|
73
|
+
if (isExpandMode) {
|
|
74
|
+
body.classList.remove('lock-body-scroll');
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}, [isExpandMode]);
|
|
78
|
+
if (isExpandMode) {
|
|
79
|
+
return (react_1.default.createElement(Portal_1.Portal, { role: "dialog", "aria-modal": false },
|
|
80
|
+
react_1.default.createElement(FocusTrap_1.FocusTrap, { onEscape: onCollapse },
|
|
81
|
+
react_1.default.createElement(ExpandWrapper, { position: "fixed", top: 0, left: 0, right: 0, bottom: 0, zIndex: 4, justifyContent: "center", onClick: onCollapse },
|
|
82
|
+
react_1.default.createElement(Box_1.Box, { id: "wysiwyg-expand", background: "neutral0", hasRadius: true, shadow: "popupShadow", overflow: "hidden", width: "70%", height: "70%", onClick: (e) => e.stopPropagation() },
|
|
83
|
+
react_1.default.createElement(Flex_1.Flex, { height: "100%", alignItems: "flex-start" },
|
|
84
|
+
react_1.default.createElement(BoxWithBorder, { flex: "1", height: "100%" }, children),
|
|
85
|
+
react_1.default.createElement(Box_1.Box, { flex: "1", height: "100%" },
|
|
86
|
+
react_1.default.createElement(Flex_1.Flex, { height: (0, helper_plugin_1.pxToRem)(48), background: "neutral100", justifyContent: "flex-end" },
|
|
87
|
+
react_1.default.createElement(exports.ExpandButton, { id: "collapse", onClick: onCollapse },
|
|
88
|
+
react_1.default.createElement(Typography_1.Typography, null, formatMessage({
|
|
89
|
+
id: 'components.Wysiwyg.collapse',
|
|
90
|
+
defaultMessage: 'Collapse',
|
|
91
|
+
})),
|
|
92
|
+
react_1.default.createElement(Collapse_1.default, null))),
|
|
93
|
+
react_1.default.createElement(Box_1.Box, { position: "relative", height: "100%" },
|
|
94
|
+
react_1.default.createElement(PreviewWysiwyg_1.default, { data: previewContent })))))))));
|
|
95
|
+
}
|
|
96
|
+
return (react_1.default.createElement(Box_1.Box, { borderColor: error ? 'danger600' : 'neutral200', borderStyle: "solid", borderWidth: "1px", hasRadius: true }, children));
|
|
97
|
+
};
|
|
98
|
+
exports.EditorLayout = EditorLayout;
|
|
99
|
+
//# sourceMappingURL=EditorLayout.js.map
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EditorStylesContainer = void 0;
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
exports.EditorStylesContainer = styled_components_1.default.div `
|
|
9
|
+
cursor: ${({ disabled }) => (disabled ? 'not-allowed !important' : 'auto')};
|
|
10
|
+
height: 100%;
|
|
11
|
+
/* BASICS */
|
|
12
|
+
.CodeMirror-placeholder {
|
|
13
|
+
color: ${({ theme }) => theme.colors.neutral600} !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.CodeMirror {
|
|
17
|
+
/* Set height, width, borders, and global font properties here */
|
|
18
|
+
font-size: ${14 / 16}rem;
|
|
19
|
+
height: ${({ isExpandMode }) => (isExpandMode ? '100%' : '290px')};
|
|
20
|
+
color: ${({ theme }) => theme.colors.neutral800};
|
|
21
|
+
direction: ltr;
|
|
22
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
|
23
|
+
'Open Sans', 'Helvetica Neue', sans-serif;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* PADDING */
|
|
27
|
+
|
|
28
|
+
.CodeMirror-lines {
|
|
29
|
+
padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
|
|
30
|
+
/* Vertical padding around content */
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.CodeMirror-scrollbar-filler,
|
|
34
|
+
.CodeMirror-gutter-filler {
|
|
35
|
+
/* The little square between H and V scrollbars */
|
|
36
|
+
background-color: ${({ theme }) => `${theme.colors.neutral0}`};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* GUTTER */
|
|
40
|
+
|
|
41
|
+
.CodeMirror-gutters {
|
|
42
|
+
border-right: 1px solid #ddd;
|
|
43
|
+
background-color: #f7f7f7;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
}
|
|
46
|
+
.CodeMirror-linenumbers {
|
|
47
|
+
}
|
|
48
|
+
.CodeMirror-linenumber {
|
|
49
|
+
padding: 0 3px 0 5px;
|
|
50
|
+
min-width: 20px;
|
|
51
|
+
text-align: right;
|
|
52
|
+
color: #999;
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.CodeMirror-guttermarker {
|
|
57
|
+
color: black;
|
|
58
|
+
}
|
|
59
|
+
.CodeMirror-guttermarker-subtle {
|
|
60
|
+
color: #999;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* CURSOR */
|
|
64
|
+
|
|
65
|
+
.CodeMirror-cursor {
|
|
66
|
+
border-left: 1px solid black;
|
|
67
|
+
border-right: none;
|
|
68
|
+
width: 0;
|
|
69
|
+
}
|
|
70
|
+
/* Shown when moving in bi-directional text */
|
|
71
|
+
.CodeMirror div.CodeMirror-secondarycursor {
|
|
72
|
+
border-left: 1px solid silver;
|
|
73
|
+
}
|
|
74
|
+
.cm-fat-cursor .CodeMirror-cursor {
|
|
75
|
+
width: auto;
|
|
76
|
+
border: 0 !important;
|
|
77
|
+
background: #7e7;
|
|
78
|
+
}
|
|
79
|
+
.cm-fat-cursor div.CodeMirror-cursors {
|
|
80
|
+
/* z-index: 1; */
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.cm-fat-cursor-mark {
|
|
84
|
+
background-color: rgba(20, 255, 20, 0.5);
|
|
85
|
+
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
86
|
+
-moz-animation: blink 1.06s steps(1) infinite;
|
|
87
|
+
animation: blink 1.06s steps(1) infinite;
|
|
88
|
+
}
|
|
89
|
+
.cm-animate-fat-cursor {
|
|
90
|
+
width: auto;
|
|
91
|
+
border: 0;
|
|
92
|
+
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
93
|
+
-moz-animation: blink 1.06s steps(1) infinite;
|
|
94
|
+
animation: blink 1.06s steps(1) infinite;
|
|
95
|
+
background-color: #7e7;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Can style cursor different in overwrite (non-insert) mode */
|
|
99
|
+
.CodeMirror-overwrite .CodeMirror-cursor {
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.cm-tab {
|
|
103
|
+
display: inline-block;
|
|
104
|
+
text-decoration: inherit;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.CodeMirror-rulers {
|
|
108
|
+
position: absolute;
|
|
109
|
+
left: 0;
|
|
110
|
+
right: 0;
|
|
111
|
+
top: -50px;
|
|
112
|
+
bottom: 0;
|
|
113
|
+
overflow: hidden;
|
|
114
|
+
}
|
|
115
|
+
.CodeMirror-ruler {
|
|
116
|
+
border-left: 1px solid #ccc;
|
|
117
|
+
top: 0;
|
|
118
|
+
bottom: 0;
|
|
119
|
+
position: absolute;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* DEFAULT THEME */
|
|
123
|
+
|
|
124
|
+
.cm-header,
|
|
125
|
+
.cm-strong {
|
|
126
|
+
font-weight: bold;
|
|
127
|
+
}
|
|
128
|
+
.cm-em {
|
|
129
|
+
font-style: italic;
|
|
130
|
+
}
|
|
131
|
+
.cm-link {
|
|
132
|
+
text-decoration: underline;
|
|
133
|
+
}
|
|
134
|
+
.cm-strikethrough {
|
|
135
|
+
text-decoration: line-through;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.CodeMirror-composing {
|
|
139
|
+
border-bottom: 2px solid;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* Default styles for common addons */
|
|
143
|
+
|
|
144
|
+
div.CodeMirror span.CodeMirror-matchingbracket {
|
|
145
|
+
color: #0b0;
|
|
146
|
+
}
|
|
147
|
+
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
|
148
|
+
color: #a22;
|
|
149
|
+
}
|
|
150
|
+
.CodeMirror-matchingtag {
|
|
151
|
+
background: rgba(255, 150, 0, 0.3);
|
|
152
|
+
}
|
|
153
|
+
.CodeMirror-activeline-background {
|
|
154
|
+
background: #e8f2ff;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* STOP */
|
|
158
|
+
|
|
159
|
+
/* The rest of this file contains styles related to the mechanics of
|
|
160
|
+
the editor. You probably shouldn't touch them. */
|
|
161
|
+
|
|
162
|
+
.CodeMirror {
|
|
163
|
+
position: relative;
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
background: ${({ theme }) => `${theme.colors.neutral0}`};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.CodeMirror-scroll {
|
|
169
|
+
overflow: scroll !important; /* Things will break if this is overridden */
|
|
170
|
+
/* 50px is the magic margin used to hide the element's real scrollbars */
|
|
171
|
+
/* See overflow: hidden in .CodeMirror */
|
|
172
|
+
margin-bottom: -50px;
|
|
173
|
+
margin-right: -50px;
|
|
174
|
+
padding-bottom: 50px;
|
|
175
|
+
height: 100%;
|
|
176
|
+
outline: none; /* Prevent dragging from highlighting the element */
|
|
177
|
+
position: relative;
|
|
178
|
+
}
|
|
179
|
+
.CodeMirror-sizer {
|
|
180
|
+
position: relative;
|
|
181
|
+
border-right: 50px solid transparent;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
|
185
|
+
before actual scrolling happens, thus preventing shaking and
|
|
186
|
+
flickering artifacts. */
|
|
187
|
+
.CodeMirror-vscrollbar,
|
|
188
|
+
.CodeMirror-hscrollbar,
|
|
189
|
+
.CodeMirror-scrollbar-filler,
|
|
190
|
+
.CodeMirror-gutter-filler {
|
|
191
|
+
position: absolute;
|
|
192
|
+
z-index: 1;
|
|
193
|
+
display: none;
|
|
194
|
+
outline: none;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.CodeMirror-vscrollbar {
|
|
198
|
+
right: 0;
|
|
199
|
+
top: 0;
|
|
200
|
+
overflow-x: hidden;
|
|
201
|
+
overflow-y: scroll;
|
|
202
|
+
}
|
|
203
|
+
.CodeMirror-hscrollbar {
|
|
204
|
+
bottom: 0;
|
|
205
|
+
left: 0;
|
|
206
|
+
overflow-y: hidden;
|
|
207
|
+
overflow-x: scroll;
|
|
208
|
+
}
|
|
209
|
+
.CodeMirror-scrollbar-filler {
|
|
210
|
+
right: 0;
|
|
211
|
+
bottom: 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.CodeMirror-lines {
|
|
215
|
+
cursor: text;
|
|
216
|
+
min-height: 1px; /* prevents collapsing before first draw */
|
|
217
|
+
}
|
|
218
|
+
/* Reset some styles that the rest of the page might have set */
|
|
219
|
+
.CodeMirror pre.CodeMirror-line,
|
|
220
|
+
.CodeMirror pre.CodeMirror-line-like {
|
|
221
|
+
-moz-border-radius: 0;
|
|
222
|
+
-webkit-border-radius: 0;
|
|
223
|
+
border-radius: 0;
|
|
224
|
+
border-width: 0;
|
|
225
|
+
background: transparent;
|
|
226
|
+
font-family: inherit;
|
|
227
|
+
font-size: inherit;
|
|
228
|
+
margin: 0;
|
|
229
|
+
white-space: pre;
|
|
230
|
+
word-wrap: normal;
|
|
231
|
+
line-height: 1.5;
|
|
232
|
+
color: inherit;
|
|
233
|
+
/* z-index: 2; */
|
|
234
|
+
position: relative;
|
|
235
|
+
overflow: visible;
|
|
236
|
+
-webkit-tap-highlight-color: transparent;
|
|
237
|
+
-webkit-font-variant-ligatures: contextual;
|
|
238
|
+
font-variant-ligatures: contextual;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.CodeMirror pre.CodeMirror-line-like {
|
|
242
|
+
z-index: 2;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.CodeMirror-wrap pre.CodeMirror-line,
|
|
246
|
+
.CodeMirror-wrap pre.CodeMirror-line-like {
|
|
247
|
+
word-wrap: break-word;
|
|
248
|
+
white-space: pre-wrap;
|
|
249
|
+
word-break: normal;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.CodeMirror-linebackground {
|
|
253
|
+
position: absolute;
|
|
254
|
+
left: 0;
|
|
255
|
+
right: 0;
|
|
256
|
+
top: 0;
|
|
257
|
+
bottom: 0;
|
|
258
|
+
z-index: 0;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.CodeMirror-linewidget {
|
|
262
|
+
position: relative;
|
|
263
|
+
/* z-index: 2; */
|
|
264
|
+
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.CodeMirror-widget {
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.CodeMirror-rtl pre {
|
|
271
|
+
direction: rtl;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.CodeMirror-code {
|
|
275
|
+
outline: none;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Force content-box sizing for the elements where we expect it */
|
|
279
|
+
.CodeMirror-scroll,
|
|
280
|
+
.CodeMirror-sizer,
|
|
281
|
+
.CodeMirror-gutter,
|
|
282
|
+
.CodeMirror-gutters,
|
|
283
|
+
.CodeMirror-linenumber {
|
|
284
|
+
-moz-box-sizing: content-box;
|
|
285
|
+
box-sizing: content-box;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.CodeMirror-measure {
|
|
289
|
+
position: absolute;
|
|
290
|
+
width: 100%;
|
|
291
|
+
height: 0;
|
|
292
|
+
overflow: hidden;
|
|
293
|
+
visibility: hidden;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.CodeMirror-cursor {
|
|
297
|
+
position: absolute;
|
|
298
|
+
pointer-events: none;
|
|
299
|
+
border-color: ${({ theme }) => `${theme.colors.neutral800}`};
|
|
300
|
+
}
|
|
301
|
+
.CodeMirror-measure pre {
|
|
302
|
+
position: static;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
div.CodeMirror-cursors {
|
|
306
|
+
visibility: hidden;
|
|
307
|
+
position: relative;
|
|
308
|
+
+ div {
|
|
309
|
+
z-index: 0 !important;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
div.CodeMirror-dragcursors {
|
|
314
|
+
visibility: visible;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.CodeMirror-focused div.CodeMirror-cursors {
|
|
318
|
+
visibility: visible;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.CodeMirror-selected {
|
|
322
|
+
background: ${({ theme }) => theme.colors.neutral200};
|
|
323
|
+
/* z-index: -10; */
|
|
324
|
+
}
|
|
325
|
+
.CodeMirror-crosshair {
|
|
326
|
+
cursor: crosshair;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* Used to force a border model for a node */
|
|
330
|
+
.cm-force-border {
|
|
331
|
+
padding-right: 0.1px;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/* See issue #2901 */
|
|
335
|
+
.cm-tab-wrap-hack:after {
|
|
336
|
+
content: '';
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/* Help users use markselection to safely style text background */
|
|
340
|
+
span.CodeMirror-selectedtext {
|
|
341
|
+
background: none;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
span {
|
|
345
|
+
color: ${({ theme }) => theme.colors.neutral800} !important;
|
|
346
|
+
}
|
|
347
|
+
`;
|
|
348
|
+
//# sourceMappingURL=EditorStylesContainer.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const react_intl_1 = require("react-intl");
|
|
8
|
+
const Box_1 = require("@strapi/design-system/Box");
|
|
9
|
+
const Flex_1 = require("@strapi/design-system/Flex");
|
|
10
|
+
const Typography_1 = require("@strapi/design-system/Typography");
|
|
11
|
+
const Expand_1 = __importDefault(require("@strapi/icons/Expand"));
|
|
12
|
+
const WysiwygStyles_1 = require("./WysiwygStyles");
|
|
13
|
+
const WysiwygFooter = ({ onToggleExpand }) => {
|
|
14
|
+
const { formatMessage } = (0, react_intl_1.useIntl)();
|
|
15
|
+
return (react_1.default.createElement(Box_1.Box, { padding: 2, background: "neutral100", hasRadius: true },
|
|
16
|
+
react_1.default.createElement(Flex_1.Flex, { justifyContent: "flex-end", alignItems: "flex-end" },
|
|
17
|
+
react_1.default.createElement(WysiwygStyles_1.ExpandButton, { id: "expand", onClick: onToggleExpand },
|
|
18
|
+
react_1.default.createElement(Typography_1.Typography, null, formatMessage({
|
|
19
|
+
id: 'components.WysiwygBottomControls.fullscreen',
|
|
20
|
+
defaultMessage: 'Expand',
|
|
21
|
+
})),
|
|
22
|
+
react_1.default.createElement(Expand_1.default, null)))));
|
|
23
|
+
};
|
|
24
|
+
exports.default = WysiwygFooter;
|
|
25
|
+
//# sourceMappingURL=WysiwygFooter.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type WysiwygNavProps = {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
editorRef: any;
|
|
5
|
+
isExpandMode: boolean;
|
|
6
|
+
isPreviewMode: boolean;
|
|
7
|
+
onActionClick: (value: string, currentEditorRef: string, togglePopover?: any) => void;
|
|
8
|
+
onToggleMediaLib: () => void;
|
|
9
|
+
onTogglePreviewMode: undefined | (() => void);
|
|
10
|
+
};
|
|
11
|
+
declare const WysiwygNav: React.FC<WysiwygNavProps>;
|
|
12
|
+
export default WysiwygNav;
|
|
13
|
+
//# sourceMappingURL=WysiwygNav.d.ts.map
|