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.
- package/README.md +3 -3
- package/admin/src/components/CommentReviewModal/index.d.ts +0 -1
- package/admin/src/components/ConfirmationDialog/index.d.ts +0 -1
- package/admin/src/components/DiscussionStatus/index.d.ts +0 -1
- package/admin/src/components/DiscussionThread/index.d.ts +0 -1
- package/admin/src/components/DiscussionThreadItem/index.d.ts +0 -1
- package/admin/src/components/DiscussionThreadItemActions/index.d.ts +0 -1
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.d.ts +0 -1
- package/admin/src/components/DiscussionThreadItemFooter/index.d.ts +0 -1
- package/admin/src/components/DiscussionThreadItemReviewAction/index.d.ts +0 -1
- package/admin/src/components/FormSwitch/index.d.ts +0 -1
- package/admin/src/components/LoadingIndicatorOverlay/index.d.ts +0 -1
- package/admin/src/components/ModeratorResponse/index.js +5 -8
- package/admin/src/components/ModeratorResponseModal/ModeratorResponseModal.js +5 -8
- package/admin/src/components/Nav/index.d.ts +0 -1
- package/admin/src/components/PluginIcon/index.d.ts +0 -1
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.d.ts +18 -1
- package/admin/src/components/ReportsActions/components/BlockMenu/index.d.ts +0 -1
- package/admin/src/components/ReportsActions/index.d.ts +0 -1
- package/admin/src/components/ReportsReviewModal/index.d.ts +0 -1
- package/admin/src/components/ReportsReviewTable/index.d.ts +0 -1
- package/admin/src/components/StatusBadge/index.d.ts +0 -1
- package/admin/src/components/TableFilters/index.d.ts +0 -1
- package/admin/src/components/TablePagination/index.d.ts +0 -1
- package/admin/src/components/Wysiwyg/Editor.d.ts +24 -12
- package/admin/src/components/Wysiwyg/Editor.js +375 -21
- package/admin/src/components/Wysiwyg/EditorLayout.d.ts +9 -8
- package/admin/src/components/Wysiwyg/EditorLayout.js +37 -51
- package/admin/src/components/Wysiwyg/Field.d.ts +15 -0
- package/admin/src/components/Wysiwyg/{index.js → Field.js} +48 -49
- package/admin/src/components/Wysiwyg/PreviewWysiwyg.d.ts +6 -0
- package/admin/src/components/Wysiwyg/PreviewWysiwyg.js +191 -0
- package/admin/src/components/Wysiwyg/WysiwygFooter.d.ts +7 -6
- package/admin/src/components/Wysiwyg/WysiwygFooter.js +32 -13
- package/admin/src/components/Wysiwyg/WysiwygNav.d.ts +12 -10
- package/admin/src/components/Wysiwyg/WysiwygNav.js +76 -58
- package/admin/src/components/Wysiwyg/WysiwygStyles.d.ts +0 -1
- package/admin/src/components/Wysiwyg/WysiwygStyles.js +8 -13
- package/admin/src/components/Wysiwyg/utils/continueList.d.ts +5 -2
- package/admin/src/components/Wysiwyg/utils/continueList.js +2 -1
- package/admin/src/components/Wysiwyg/utils/mdRenderer.d.ts +5 -0
- package/admin/src/components/Wysiwyg/utils/mdRenderer.js +63 -0
- package/admin/src/components/Wysiwyg/utils/utils.d.ts +11 -9
- package/admin/src/components/Wysiwyg/utils/utils.js +13 -12
- package/admin/src/components/icons/comments.d.ts +0 -1
- package/admin/src/components/icons/lock.d.ts +0 -1
- package/admin/src/components/icons/review.d.ts +0 -1
- package/admin/src/components/icons/strapiIcons.d.ts +0 -1
- package/admin/src/components/icons/unlock.d.ts +0 -1
- package/admin/src/custom-fields/comments/components/icon.d.ts +0 -1
- package/admin/src/index.d.ts +3 -1
- package/admin/src/index.js +1 -1
- package/admin/src/pages/App/index.d.ts +14 -2
- package/admin/src/pages/App/reducer/selectors.d.ts +5 -1
- package/admin/src/pages/Details/components/DetailsEntity/index.d.ts +0 -1
- package/admin/src/pages/Details/components/DetailsFilters/index.d.ts +0 -1
- package/admin/src/pages/Details/index.d.ts +9 -2
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.d.ts +0 -1
- package/admin/src/pages/Discover/index.d.ts +9 -2
- package/admin/src/pages/NoAccessPage/index.d.ts +0 -1
- package/admin/src/pages/Reports/components/ReportsTableRow/index.d.ts +0 -1
- package/admin/src/pages/Reports/index.d.ts +9 -2
- package/admin/src/pages/Settings/index.d.ts +0 -1
- package/admin/src/pages/Settings/index.js +2 -5
- package/admin/src/permissions.js +0 -1
- package/package.json +7 -8
- package/server/services/common.js +3 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/admin/src/components/Wysiwyg/EditorStylesContainer.d.ts +0 -2
- package/admin/src/components/Wysiwyg/EditorStylesContainer.js +0 -348
- package/admin/src/components/Wysiwyg/index.d.ts +0 -28
- package/admin/src/components/Wysiwyg/tests/index.test.d.ts +0 -2
- package/admin/src/components/Wysiwyg/tests/index.test.js +0 -1633
|
@@ -26,54 +26,45 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const Typography_1 = require("@strapi/design-system/Typography");
|
|
33
|
-
const Box_1 = require("@strapi/design-system/Box");
|
|
34
|
-
const Stack_1 = require("@strapi/design-system/Stack");
|
|
29
|
+
exports.Wysiwyg = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const design_system_1 = require("@strapi/design-system");
|
|
35
32
|
const helper_plugin_1 = require("@strapi/helper-plugin");
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const utils_1 = require("./utils/utils");
|
|
33
|
+
const react_intl_1 = require("react-intl");
|
|
34
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
35
|
+
const Hint_1 = require("../Hint");
|
|
36
|
+
const Editor_1 = require("./Editor");
|
|
41
37
|
const EditorLayout_1 = require("./EditorLayout");
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
`;
|
|
47
|
-
const TypographyAsterisk = (0, styled_components_1.default)(Typography_1.Typography) `
|
|
48
|
-
line-height: 0;
|
|
49
|
-
`;
|
|
50
|
-
const Wysiwyg = ({ description, disabled, error, intlLabel, labelAction, name, onChange, placeholder, value, required, }) => {
|
|
38
|
+
const utils_1 = require("./utils/utils");
|
|
39
|
+
const WysiwygFooter_1 = require("./WysiwygFooter");
|
|
40
|
+
const WysiwygNav_1 = require("./WysiwygNav");
|
|
41
|
+
const Wysiwyg = React.forwardRef(({ hint, disabled, error, intlLabel, labelAction, name, onChange, placeholder, value, required }, forwardedRef) => {
|
|
51
42
|
const { formatMessage } = (0, react_intl_1.useIntl)();
|
|
52
|
-
const textareaRef =
|
|
53
|
-
const editorRef =
|
|
54
|
-
const [isPreviewMode, setIsPreviewMode] =
|
|
55
|
-
const [mediaLibVisible, setMediaLibVisible] =
|
|
56
|
-
const [isExpandMode, setIsExpandMode] =
|
|
57
|
-
const { components } = (0, helper_plugin_1.useLibrary)();
|
|
43
|
+
const textareaRef = React.useRef(null);
|
|
44
|
+
const editorRef = React.useRef(null);
|
|
45
|
+
const [isPreviewMode, setIsPreviewMode] = React.useState(false);
|
|
46
|
+
const [mediaLibVisible, setMediaLibVisible] = React.useState(false);
|
|
47
|
+
const [isExpandMode, setIsExpandMode] = React.useState(false);
|
|
48
|
+
const { components = {} } = (0, helper_plugin_1.useLibrary)();
|
|
58
49
|
const MediaLibraryDialog = components['media-library'];
|
|
59
|
-
const handleToggleMediaLib = () => setMediaLibVisible(prev => !prev);
|
|
60
|
-
const handleTogglePreviewMode = () => setIsPreviewMode(prev => !prev);
|
|
50
|
+
const handleToggleMediaLib = () => setMediaLibVisible((prev) => !prev);
|
|
51
|
+
const handleTogglePreviewMode = () => setIsPreviewMode((prev) => !prev);
|
|
61
52
|
const handleToggleExpand = () => {
|
|
62
53
|
setIsPreviewMode(false);
|
|
63
|
-
setIsExpandMode(prev => !prev);
|
|
54
|
+
setIsExpandMode((prev) => !prev);
|
|
64
55
|
};
|
|
65
56
|
const handleActionClick = (value, currentEditorRef, togglePopover) => {
|
|
66
57
|
switch (value) {
|
|
67
58
|
case 'Link':
|
|
68
59
|
case 'Strikethrough': {
|
|
69
60
|
(0, utils_1.markdownHandler)(currentEditorRef, value);
|
|
70
|
-
togglePopover();
|
|
61
|
+
togglePopover?.();
|
|
71
62
|
break;
|
|
72
63
|
}
|
|
73
64
|
case 'Code':
|
|
74
65
|
case 'Quote': {
|
|
75
66
|
(0, utils_1.quoteAndCodeHandler)(currentEditorRef, value);
|
|
76
|
-
togglePopover();
|
|
67
|
+
togglePopover?.();
|
|
77
68
|
break;
|
|
78
69
|
}
|
|
79
70
|
case 'Bold':
|
|
@@ -85,7 +76,7 @@ const Wysiwyg = ({ description, disabled, error, intlLabel, labelAction, name, o
|
|
|
85
76
|
case 'BulletList':
|
|
86
77
|
case 'NumberList': {
|
|
87
78
|
(0, utils_1.listHandler)(currentEditorRef, value);
|
|
88
|
-
togglePopover();
|
|
79
|
+
togglePopover?.();
|
|
89
80
|
break;
|
|
90
81
|
}
|
|
91
82
|
case 'h1':
|
|
@@ -116,21 +107,29 @@ const Wysiwyg = ({ description, disabled, error, intlLabel, labelAction, name, o
|
|
|
116
107
|
const label = intlLabel.id
|
|
117
108
|
? formatMessage({ id: intlLabel.id, defaultMessage: intlLabel.defaultMessage }, { ...intlLabel.values })
|
|
118
109
|
: name;
|
|
119
|
-
return (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
110
|
+
return (React.createElement(React.Fragment, null,
|
|
111
|
+
React.createElement(design_system_1.Flex, { direction: "column", alignItems: "stretch", gap: 1 },
|
|
112
|
+
React.createElement(design_system_1.Flex, { gap: 1 },
|
|
113
|
+
React.createElement(design_system_1.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800" },
|
|
123
114
|
label,
|
|
124
|
-
required &&
|
|
125
|
-
labelAction &&
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
!isExpandMode &&
|
|
130
|
-
|
|
131
|
-
error && (
|
|
132
|
-
|
|
133
|
-
mediaLibVisible && (
|
|
134
|
-
};
|
|
135
|
-
exports.
|
|
136
|
-
|
|
115
|
+
required && React.createElement(TypographyAsterisk, { textColor: "danger600" }, "*")),
|
|
116
|
+
labelAction && React.createElement(LabelAction, { paddingLeft: 1 }, labelAction)),
|
|
117
|
+
React.createElement(EditorLayout_1.EditorLayout, { isExpandMode: isExpandMode, error: error, previewContent: value, onCollapse: handleToggleExpand },
|
|
118
|
+
React.createElement(WysiwygNav_1.WysiwygNav, { isExpandMode: isExpandMode, editorRef: editorRef, isPreviewMode: isPreviewMode, onActionClick: handleActionClick, onToggleMediaLib: handleToggleMediaLib, onTogglePreviewMode: isExpandMode ? undefined : handleTogglePreviewMode, disabled: disabled }),
|
|
119
|
+
React.createElement(Editor_1.Editor, { disabled: disabled, isExpandMode: isExpandMode, editorRef: editorRef, error: error, isPreviewMode: isPreviewMode, name: name, onChange: onChange, placeholder: formattedPlaceholder, textareaRef: textareaRef, value: value, ref: forwardedRef }),
|
|
120
|
+
!isExpandMode && React.createElement(WysiwygFooter_1.WysiwygFooter, { onToggleExpand: handleToggleExpand })),
|
|
121
|
+
React.createElement(Hint_1.Hint, { hint: hint, name: name, error: error })),
|
|
122
|
+
error && (React.createElement(design_system_1.Box, { paddingTop: 1 },
|
|
123
|
+
React.createElement(design_system_1.Typography, { variant: "pi", textColor: "danger600", "data-strapi-field-error": true }, error))),
|
|
124
|
+
mediaLibVisible && (React.createElement(MediaLibraryDialog, { onClose: handleToggleMediaLib, onSelectAssets: handleSelectAssets }))));
|
|
125
|
+
});
|
|
126
|
+
exports.Wysiwyg = Wysiwyg;
|
|
127
|
+
const LabelAction = (0, styled_components_1.default)(design_system_1.Box) `
|
|
128
|
+
svg path {
|
|
129
|
+
fill: ${({ theme }) => theme.colors.neutral500};
|
|
130
|
+
}
|
|
131
|
+
`;
|
|
132
|
+
const TypographyAsterisk = (0, styled_components_1.default)(design_system_1.Typography) `
|
|
133
|
+
line-height: 0;
|
|
134
|
+
`;
|
|
135
|
+
//# sourceMappingURL=Field.js.map
|
|
@@ -0,0 +1,191 @@
|
|
|
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.PreviewWysiwyg = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const sanitize_html_1 = __importDefault(require("sanitize-html"));
|
|
32
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
33
|
+
const mdRenderer_1 = require("./utils/mdRenderer");
|
|
34
|
+
const PreviewWysiwyg = ({ data = '' }) => {
|
|
35
|
+
const html = React.useMemo(() => (0, sanitize_html_1.default)(mdRenderer_1.md.render(data.replaceAll('\\n', '\n') || ''), {
|
|
36
|
+
...sanitize_html_1.default.defaults,
|
|
37
|
+
allowedTags: false,
|
|
38
|
+
allowedAttributes: {
|
|
39
|
+
'*': ['href', 'align', 'alt', 'center', 'width', 'height', 'type', 'controls', 'target'],
|
|
40
|
+
img: ['src', 'alt'],
|
|
41
|
+
source: ['src', 'type'],
|
|
42
|
+
},
|
|
43
|
+
}), [data]);
|
|
44
|
+
return (React.createElement(Wrapper, null,
|
|
45
|
+
React.createElement("div", { dangerouslySetInnerHTML: { __html: html } })));
|
|
46
|
+
};
|
|
47
|
+
exports.PreviewWysiwyg = PreviewWysiwyg;
|
|
48
|
+
const Wrapper = styled_components_1.default.div `
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 0;
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: 100%;
|
|
53
|
+
overflow: auto;
|
|
54
|
+
padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
|
|
55
|
+
font-size: ${14 / 16}rem;
|
|
56
|
+
background-color: ${({ theme }) => theme.colors.neutral0};
|
|
57
|
+
color: ${({ theme }) => theme.colors.neutral800};
|
|
58
|
+
line-height: ${({ theme }) => theme.lineHeights[6]};
|
|
59
|
+
|
|
60
|
+
h1,
|
|
61
|
+
h2,
|
|
62
|
+
h3,
|
|
63
|
+
h4,
|
|
64
|
+
h5,
|
|
65
|
+
h6 {
|
|
66
|
+
margin-block-start: ${({ theme }) => theme.spaces[2]};
|
|
67
|
+
margin-block-end: ${({ theme }) => theme.spaces[2]};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
p {
|
|
71
|
+
margin-bottom: ${({ theme }) => theme.spaces[2]};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
h1 {
|
|
75
|
+
font-size: ${36 / 16}rem;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
h2 {
|
|
80
|
+
font-size: ${30 / 16}rem;
|
|
81
|
+
font-weight: 500;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
h3 {
|
|
85
|
+
font-size: ${24 / 16}rem;
|
|
86
|
+
font-weight: 500;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
h4 {
|
|
90
|
+
font-size: ${20 / 16}rem;
|
|
91
|
+
font-weight: 500;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
strong {
|
|
95
|
+
font-weight: 800;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
em {
|
|
99
|
+
font-style: italic;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
blockquote {
|
|
103
|
+
margin-top: ${({ theme }) => theme.spaces[8]};
|
|
104
|
+
margin-bottom: ${({ theme }) => theme.spaces[7]};
|
|
105
|
+
font-size: ${14 / 16}rem;
|
|
106
|
+
font-weight: 400;
|
|
107
|
+
border-left: 4px solid ${({ theme }) => theme.colors.neutral150};
|
|
108
|
+
font-style: italic;
|
|
109
|
+
padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[5]};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
img {
|
|
113
|
+
max-width: 100%;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
table {
|
|
117
|
+
thead {
|
|
118
|
+
background: ${({ theme }) => theme.colors.neutral150};
|
|
119
|
+
|
|
120
|
+
th {
|
|
121
|
+
padding: ${({ theme }) => theme.spaces[4]};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
tr {
|
|
125
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
126
|
+
}
|
|
127
|
+
th,
|
|
128
|
+
td {
|
|
129
|
+
padding: ${({ theme }) => theme.spaces[4]};
|
|
130
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
131
|
+
border-bottom: 0;
|
|
132
|
+
border-top: 0;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
pre,
|
|
137
|
+
code {
|
|
138
|
+
font-size: ${14 / 16}rem;
|
|
139
|
+
border-radius: 4px;
|
|
140
|
+
/*
|
|
141
|
+
Hard coded since the color is the same between themes,
|
|
142
|
+
theme.colors.neutral800 changes between themes.
|
|
143
|
+
|
|
144
|
+
Matches the color of the JSON Input component.
|
|
145
|
+
*/
|
|
146
|
+
background-color: #32324d;
|
|
147
|
+
max-width: 100%;
|
|
148
|
+
overflow: auto;
|
|
149
|
+
padding: ${({ theme }) => theme.spaces[2]};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* Inline code */
|
|
153
|
+
p,
|
|
154
|
+
pre,
|
|
155
|
+
td {
|
|
156
|
+
> code {
|
|
157
|
+
color: #839496;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
ol {
|
|
162
|
+
list-style-type: decimal;
|
|
163
|
+
margin-block-start: ${({ theme }) => theme.spaces[4]};
|
|
164
|
+
margin-block-end: ${({ theme }) => theme.spaces[4]};
|
|
165
|
+
margin-inline-start: 0px;
|
|
166
|
+
margin-inline-end: 0px;
|
|
167
|
+
padding-inline-start: ${({ theme }) => theme.spaces[4]};
|
|
168
|
+
|
|
169
|
+
ol,
|
|
170
|
+
ul {
|
|
171
|
+
margin-block-start: 0px;
|
|
172
|
+
margin-block-end: 0px;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
ul {
|
|
177
|
+
list-style-type: disc;
|
|
178
|
+
margin-block-start: ${({ theme }) => theme.spaces[4]};
|
|
179
|
+
margin-block-end: ${({ theme }) => theme.spaces[4]};
|
|
180
|
+
margin-inline-start: 0px;
|
|
181
|
+
margin-inline-end: 0px;
|
|
182
|
+
padding-inline-start: ${({ theme }) => theme.spaces[4]};
|
|
183
|
+
|
|
184
|
+
ul,
|
|
185
|
+
ol {
|
|
186
|
+
margin-block-start: 0px;
|
|
187
|
+
margin-block-end: 0px;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
`;
|
|
191
|
+
//# sourceMappingURL=PreviewWysiwyg.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
onToggleExpand:
|
|
4
|
-
}
|
|
5
|
-
declare const WysiwygFooter:
|
|
6
|
-
export
|
|
1
|
+
import { BaseButtonProps } from '@strapi/design-system';
|
|
2
|
+
interface WysiwygFooterProps {
|
|
3
|
+
onToggleExpand: BaseButtonProps['onClick'];
|
|
4
|
+
}
|
|
5
|
+
declare const WysiwygFooter: ({ onToggleExpand }: WysiwygFooterProps) => JSX.Element;
|
|
6
|
+
export { WysiwygFooter };
|
|
7
|
+
export type { WysiwygFooterProps };
|
|
7
8
|
//# sourceMappingURL=WysiwygFooter.d.ts.map
|
|
@@ -1,25 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
26
|
+
exports.WysiwygFooter = void 0;
|
|
27
|
+
const React = __importStar(require("react"));
|
|
28
|
+
const design_system_1 = require("@strapi/design-system");
|
|
29
|
+
const icons_1 = require("@strapi/icons");
|
|
7
30
|
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
31
|
const WysiwygStyles_1 = require("./WysiwygStyles");
|
|
13
32
|
const WysiwygFooter = ({ onToggleExpand }) => {
|
|
14
33
|
const { formatMessage } = (0, react_intl_1.useIntl)();
|
|
15
|
-
return (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
34
|
+
return (React.createElement(design_system_1.Box, { padding: 2, background: "neutral100", borderRadius: `0 0 ${4 / 16}rem ${4 / 16}rem` },
|
|
35
|
+
React.createElement(design_system_1.Flex, { justifyContent: "flex-end", alignItems: "flex-end" },
|
|
36
|
+
React.createElement(WysiwygStyles_1.ExpandButton, { id: "expand", onClick: onToggleExpand },
|
|
37
|
+
React.createElement(design_system_1.Typography, null, formatMessage({
|
|
19
38
|
id: 'components.WysiwygBottomControls.fullscreen',
|
|
20
39
|
defaultMessage: 'Expand',
|
|
21
40
|
})),
|
|
22
|
-
|
|
41
|
+
React.createElement(icons_1.Expand, null)))));
|
|
23
42
|
};
|
|
24
|
-
exports.
|
|
43
|
+
exports.WysiwygFooter = WysiwygFooter;
|
|
25
44
|
//# sourceMappingURL=WysiwygFooter.js.map
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { EditorFromTextArea } from 'codemirror5';
|
|
3
|
+
interface WysiwygNavProps {
|
|
3
4
|
disabled?: boolean;
|
|
4
|
-
editorRef:
|
|
5
|
-
isExpandMode
|
|
6
|
-
isPreviewMode
|
|
7
|
-
onActionClick: (
|
|
5
|
+
editorRef: React.MutableRefObject<EditorFromTextArea>;
|
|
6
|
+
isExpandMode?: boolean;
|
|
7
|
+
isPreviewMode?: boolean;
|
|
8
|
+
onActionClick: (action: string, editorRef: React.MutableRefObject<EditorFromTextArea>, callback?: () => void) => void;
|
|
8
9
|
onToggleMediaLib: () => void;
|
|
9
|
-
onTogglePreviewMode
|
|
10
|
-
}
|
|
11
|
-
declare const WysiwygNav:
|
|
12
|
-
export
|
|
10
|
+
onTogglePreviewMode?: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const WysiwygNav: ({ disabled, editorRef, isExpandMode, isPreviewMode, onActionClick, onToggleMediaLib, onTogglePreviewMode, }: WysiwygNavProps) => JSX.Element;
|
|
13
|
+
export { WysiwygNav };
|
|
14
|
+
export type { WysiwygNavProps };
|
|
13
15
|
//# sourceMappingURL=WysiwygNav.d.ts.map
|
|
@@ -26,71 +26,89 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
|
|
29
|
+
exports.WysiwygNav = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const design_system_1 = require("@strapi/design-system");
|
|
32
|
+
const icons_1 = require("@strapi/icons");
|
|
30
33
|
const react_intl_1 = require("react-intl");
|
|
31
|
-
const
|
|
32
|
-
const Box_1 = require("@strapi/design-system/Box");
|
|
33
|
-
const Button_1 = require("@strapi/design-system/Button");
|
|
34
|
-
const IconButton_1 = require("@strapi/design-system/IconButton");
|
|
35
|
-
const Popover_1 = require("@strapi/design-system/Popover");
|
|
36
|
-
const Flex_1 = require("@strapi/design-system/Flex");
|
|
37
|
-
const Bold_1 = __importDefault(require("@strapi/icons/Bold"));
|
|
38
|
-
const Italic_1 = __importDefault(require("@strapi/icons/Italic"));
|
|
39
|
-
const Underline_1 = __importDefault(require("@strapi/icons/Underline"));
|
|
40
|
-
const StrikeThrough_1 = __importDefault(require("@strapi/icons/StrikeThrough"));
|
|
41
|
-
const BulletList_1 = __importDefault(require("@strapi/icons/BulletList"));
|
|
42
|
-
const NumberList_1 = __importDefault(require("@strapi/icons/NumberList"));
|
|
43
|
-
const Code_1 = __importDefault(require("@strapi/icons/Code"));
|
|
44
|
-
const Picture_1 = __importDefault(require("@strapi/icons/Picture"));
|
|
45
|
-
const Link_1 = __importDefault(require("@strapi/icons/Link"));
|
|
46
|
-
const Quote_1 = __importDefault(require("@strapi/icons/Quote"));
|
|
34
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
47
35
|
const WysiwygStyles_1 = require("./WysiwygStyles");
|
|
48
36
|
const WysiwygNav = ({ disabled, editorRef, isExpandMode, isPreviewMode, onActionClick, onToggleMediaLib, onTogglePreviewMode, }) => {
|
|
49
|
-
const [visiblePopover, setVisiblePopover] =
|
|
37
|
+
const [visiblePopover, setVisiblePopover] = React.useState(false);
|
|
50
38
|
const { formatMessage } = (0, react_intl_1.useIntl)();
|
|
51
|
-
const
|
|
39
|
+
const selectPlaceholder = formatMessage({
|
|
40
|
+
id: 'components.Wysiwyg.selectOptions.title',
|
|
41
|
+
defaultMessage: 'Add a title',
|
|
42
|
+
});
|
|
43
|
+
const buttonMoreRef = React.useRef(null);
|
|
52
44
|
const handleTogglePopover = () => {
|
|
53
|
-
setVisiblePopover(prev => !prev);
|
|
45
|
+
setVisiblePopover((prev) => !prev);
|
|
54
46
|
};
|
|
55
47
|
if (disabled || isPreviewMode) {
|
|
56
|
-
return (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
return (React.createElement(design_system_1.Flex, { padding: 2, background: "neutral100", justifyContent: "space-between", borderRadius: `${4 / 16}rem ${4 / 16}rem 0 0` },
|
|
49
|
+
React.createElement(StyledFlex, null,
|
|
50
|
+
React.createElement(design_system_1.SingleSelect, { disabled: true, placeholder: selectPlaceholder, size: "S", label: selectPlaceholder },
|
|
51
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h1" }, "h1"),
|
|
52
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h2" }, "h2"),
|
|
53
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h3" }, "h3"),
|
|
54
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h4" }, "h4"),
|
|
55
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h5" }, "h5"),
|
|
56
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h6" }, "h6")),
|
|
57
|
+
React.createElement(WysiwygStyles_1.MainButtons, null,
|
|
58
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { disabled: true, label: "Bold", name: "Bold", icon: React.createElement(icons_1.Bold, null) }),
|
|
59
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { disabled: true, label: "Italic", name: "Italic", icon: React.createElement(icons_1.Italic, null) }),
|
|
60
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { disabled: true, label: "Underline", name: "Underline", icon: React.createElement(icons_1.Underline, null) })),
|
|
61
|
+
React.createElement(WysiwygStyles_1.MoreButton, { disabled: true, label: "More", icon: React.createElement(icons_1.More, null) })),
|
|
62
|
+
!isExpandMode && (React.createElement(design_system_1.Button, { onClick: onTogglePreviewMode, variant: "tertiary" }, formatMessage({
|
|
63
|
+
id: 'components.Wysiwyg.ToggleMode.markdown-mode',
|
|
64
|
+
defaultMessage: 'Markdown mode',
|
|
65
|
+
})))));
|
|
67
66
|
}
|
|
68
|
-
return (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
67
|
+
return (React.createElement(design_system_1.Flex, { padding: 2, background: "neutral100", justifyContent: "space-between", borderRadius: `${4 / 16}rem ${4 / 16}rem 0 0` },
|
|
68
|
+
React.createElement(StyledFlex, null,
|
|
69
|
+
React.createElement(design_system_1.SingleSelect, { placeholder: selectPlaceholder, label: selectPlaceholder, size: "S", onChange: (value) => onActionClick(value, editorRef) },
|
|
70
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h1" }, "h1"),
|
|
71
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h2" }, "h2"),
|
|
72
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h3" }, "h3"),
|
|
73
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h4" }, "h4"),
|
|
74
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h5" }, "h5"),
|
|
75
|
+
React.createElement(design_system_1.SingleSelectOption, { value: "h6" }, "h6")),
|
|
76
|
+
React.createElement(WysiwygStyles_1.MainButtons, null,
|
|
77
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { onClick: () => onActionClick('Bold', editorRef), label: "Bold", name: "Bold", icon: React.createElement(icons_1.Bold, null) }),
|
|
78
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { onClick: () => onActionClick('Italic', editorRef), label: "Italic", name: "Italic", icon: React.createElement(icons_1.Italic, null) }),
|
|
79
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { onClick: () => onActionClick('Underline', editorRef), label: "Underline", name: "Underline", icon: React.createElement(icons_1.Underline, null) })),
|
|
80
|
+
React.createElement(WysiwygStyles_1.MoreButton, { ref: buttonMoreRef, onClick: handleTogglePopover, label: "More", icon: React.createElement(icons_1.More, null) }),
|
|
81
|
+
visiblePopover && (React.createElement(design_system_1.Popover, { onDismiss: handleTogglePopover, centered: true, source: buttonMoreRef, spacing: 4 },
|
|
82
|
+
React.createElement(design_system_1.Flex, null,
|
|
83
|
+
React.createElement(WysiwygStyles_1.IconButtonGroupMargin, null,
|
|
84
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { onClick: () => onActionClick('Strikethrough', editorRef, handleTogglePopover), label: "Strikethrough", name: "Strikethrough", icon: React.createElement(icons_1.StrikeThrough, null) }),
|
|
85
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { onClick: () => onActionClick('BulletList', editorRef, handleTogglePopover), label: "BulletList", name: "BulletList", icon: React.createElement(icons_1.BulletList, null) }),
|
|
86
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { onClick: () => onActionClick('NumberList', editorRef, handleTogglePopover), label: "NumberList", name: "NumberList", icon: React.createElement(icons_1.NumberList, null) })),
|
|
87
|
+
React.createElement(design_system_1.IconButtonGroup, null,
|
|
88
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { onClick: () => onActionClick('Code', editorRef, handleTogglePopover), label: "Code", name: "Code", icon: React.createElement(icons_1.Code, null) }),
|
|
89
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { onClick: () => {
|
|
90
|
+
handleTogglePopover();
|
|
91
|
+
onToggleMediaLib();
|
|
92
|
+
}, label: "Image", name: "Image", icon: React.createElement(icons_1.Picture, null) }),
|
|
93
|
+
React.createElement(WysiwygStyles_1.CustomLinkIconButton, { onClick: () => onActionClick('Link', editorRef, handleTogglePopover), label: "Link", name: "Link", icon: React.createElement(icons_1.Link, null) }),
|
|
94
|
+
React.createElement(WysiwygStyles_1.CustomIconButton, { onClick: () => onActionClick('Quote', editorRef, handleTogglePopover), label: "Quote", name: "Quote", icon: React.createElement(icons_1.Quote, null) })))))),
|
|
95
|
+
onTogglePreviewMode && (React.createElement(design_system_1.Button, { onClick: onTogglePreviewMode, variant: "tertiary" }, formatMessage({
|
|
96
|
+
id: 'components.Wysiwyg.ToggleMode.preview-mode',
|
|
97
|
+
defaultMessage: 'Preview mode',
|
|
98
|
+
})))));
|
|
94
99
|
};
|
|
95
|
-
exports.
|
|
100
|
+
exports.WysiwygNav = WysiwygNav;
|
|
101
|
+
const StyledFlex = (0, styled_components_1.default)(design_system_1.Flex) `
|
|
102
|
+
/* Hide the label, every input needs a label. */
|
|
103
|
+
label {
|
|
104
|
+
border: 0;
|
|
105
|
+
clip: rect(0 0 0 0);
|
|
106
|
+
height: 1px;
|
|
107
|
+
margin: -1px;
|
|
108
|
+
overflow: hidden;
|
|
109
|
+
padding: 0;
|
|
110
|
+
position: absolute;
|
|
111
|
+
width: 1px;
|
|
112
|
+
}
|
|
113
|
+
`;
|
|
96
114
|
//# sourceMappingURL=WysiwygNav.js.map
|
|
@@ -3,6 +3,5 @@ export declare const CustomLinkIconButton: import("styled-components").StyledCom
|
|
|
3
3
|
export declare const MainButtons: import("styled-components").StyledComponent<any, any, any, any>;
|
|
4
4
|
export declare const MoreButton: import("styled-components").StyledComponent<any, any, any, any>;
|
|
5
5
|
export declare const IconButtonGroupMargin: import("styled-components").StyledComponent<any, any, any, any>;
|
|
6
|
-
export declare const EditorAndPreviewWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
6
|
export declare const ExpandButton: import("styled-components").StyledComponent<any, any, any, any>;
|
|
8
7
|
//# sourceMappingURL=WysiwygStyles.d.ts.map
|