@selfcommunity/react-ui 0.11.0-alpha.74 → 0.11.0-alpha.76
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/lib/cjs/components/Composer/Composer.js +4 -1
- package/lib/cjs/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +2 -2
- package/lib/cjs/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +1 -1
- package/lib/cjs/components/CustomAdv/CustomAdv.js +1 -1
- package/lib/esm/components/Composer/Composer.js +4 -1
- package/lib/esm/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +2 -2
- package/lib/esm/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +1 -1
- package/lib/esm/components/CustomAdv/CustomAdv.js +1 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +3 -3
|
@@ -484,7 +484,10 @@ function Composer(inProps) {
|
|
|
484
484
|
medias: medias.map((m) => m.id),
|
|
485
485
|
categories: _categories.filter((item, index) => _categories.indexOf(item) === index)
|
|
486
486
|
};
|
|
487
|
-
if ((preferences[react_core_1.SCPreferences.ADDONS_POLLS_ENABLED].value ||
|
|
487
|
+
if ((preferences[react_core_1.SCPreferences.ADDONS_POLLS_ENABLED].value ||
|
|
488
|
+
react_core_1.UserUtils.isStaff(scUserContext.user) ||
|
|
489
|
+
react_core_1.UserUtils.isPublisher(scUserContext.user)) &&
|
|
490
|
+
hasPoll) {
|
|
488
491
|
data.poll = poll;
|
|
489
492
|
}
|
|
490
493
|
if (preferences[react_core_1.SCPreferences.ADDONS_POST_GEOLOCATION_ENABLED].value && location) {
|
|
@@ -78,10 +78,10 @@ exports.default = (props) => {
|
|
|
78
78
|
computeEditorContentHeight();
|
|
79
79
|
}, [value, isContentSwitchButtonVisible, computeEditorContentHeight, isMobile]);
|
|
80
80
|
// RENDER
|
|
81
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [generalError && ((0, jsx_runtime_1.
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(generalError || categoriesError || addressingError) && ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.generalError }, { children: [generalError && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` }), categoriesError && categoriesError, (0, jsx_runtime_1.jsx)("br", {}), addressingError && addressingError] }))), (0, jsx_runtime_1.jsx)(material_1.TextField, { className: classes.title, ref: titleRef, placeholder: intl.formatMessage({
|
|
82
82
|
id: 'ui.composer.content.discussion.title.label',
|
|
83
83
|
defaultMessage: 'ui.composer.content.discussion.title.label'
|
|
84
84
|
}), autoFocus: true, fullWidth: true, variant: "outlined", value: value.title, onChange: handleChangeTitle, onKeyDown: handleKeyDownTitle, multiline: true, InputProps: {
|
|
85
85
|
endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: Composer_1.COMPOSER_TITLE_MAX_LENGTH - value.title.length }))
|
|
86
|
-
}, error: Boolean(titleError)
|
|
86
|
+
}, error: Boolean(titleError), helperText: titleError, disabled: disabled }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { [`& .${constants_2.PREFIX}-content`]: { maxHeight: `${editorMaxHeight} !important` } } }, { children: (0, jsx_runtime_1.jsx)(Editor_1.default, Object.assign({}, EditorProps, { editable: !disabled, className: classes.editor, onChange: handleChangeHtml, defaultValue: value.html })) }))] })));
|
|
87
87
|
};
|
|
@@ -21,7 +21,7 @@ function ComposerTypeButtonGroup(props) {
|
|
|
21
21
|
const { preferences } = (0, react_core_1.useSCPreferences)();
|
|
22
22
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
23
23
|
// MEMO
|
|
24
|
-
const hasPollType = (0, react_1.useMemo)(() => preferences[react_core_1.SCPreferences.ADDONS_POLLS_ENABLED].value || react_core_1.UserUtils.isStaff(scUserContext.user), [preferences, scUserContext.user]);
|
|
24
|
+
const hasPollType = (0, react_1.useMemo)(() => preferences[react_core_1.SCPreferences.ADDONS_POLLS_ENABLED].value || react_core_1.UserUtils.isStaff(scUserContext.user) || react_core_1.UserUtils.isPublisher(scUserContext.user), [preferences, scUserContext.user]);
|
|
25
25
|
const hasPostType = (0, react_1.useMemo)(() => preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED].value, [preferences]);
|
|
26
26
|
const hasDiscussionType = (0, react_1.useMemo)(() => preferences[react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED].value, [preferences]);
|
|
27
27
|
// PROPS
|
|
@@ -133,6 +133,6 @@ function CustomAdv(inProps) {
|
|
|
133
133
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
134
134
|
}
|
|
135
135
|
const adv = ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.wrap }, { children: [scCustomAdv.image && ((0, jsx_runtime_1.jsx)("img", { src: scCustomAdv.image, alt: scCustomAdv.title, className: (0, classnames_1.default)(classes.image, { [classes.prefixedHeight]: Boolean(prefixedHeight) }) })), scCustomAdv.embed_code && ((0, jsx_runtime_1.jsx)(material_1.Box, { ref: embedRef, className: (0, classnames_1.default)(classes.embedCode, { [classes.prefixedHeight]: Boolean(prefixedHeight) }), dangerouslySetInnerHTML: { __html: scCustomAdv.embed_code } }))] })));
|
|
136
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className), ref: ref, style: Object.assign({}, (prefixedHeight ? { paddingBottom: prefixedHeight } : { width: '100%' })) }, { children: scCustomAdv.link ? ((0, jsx_runtime_1.jsx)("a", Object.assign({ href: scCustomAdv.link, title: scCustomAdv.title }, { children: adv }))) : (adv) })));
|
|
136
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className), ref: ref, style: Object.assign({}, (prefixedHeight ? { paddingBottom: prefixedHeight } : { width: '100%' })) }, { children: scCustomAdv.link ? ((0, jsx_runtime_1.jsx)("a", Object.assign({ href: scCustomAdv.link, title: scCustomAdv.title, target: "_blank" }, { children: adv }))) : (adv) })));
|
|
137
137
|
}
|
|
138
138
|
exports.default = CustomAdv;
|
|
@@ -482,7 +482,10 @@ export default function Composer(inProps) {
|
|
|
482
482
|
medias: medias.map((m) => m.id),
|
|
483
483
|
categories: _categories.filter((item, index) => _categories.indexOf(item) === index)
|
|
484
484
|
};
|
|
485
|
-
if ((preferences[SCPreferences.ADDONS_POLLS_ENABLED].value ||
|
|
485
|
+
if ((preferences[SCPreferences.ADDONS_POLLS_ENABLED].value ||
|
|
486
|
+
UserUtils.isStaff(scUserContext.user) ||
|
|
487
|
+
UserUtils.isPublisher(scUserContext.user)) &&
|
|
488
|
+
hasPoll) {
|
|
486
489
|
data.poll = poll;
|
|
487
490
|
}
|
|
488
491
|
if (preferences[SCPreferences.ADDONS_POST_GEOLOCATION_ENABLED].value && location) {
|
|
@@ -75,10 +75,10 @@ export default (props) => {
|
|
|
75
75
|
computeEditorContentHeight();
|
|
76
76
|
}, [value, isContentSwitchButtonVisible, computeEditorContentHeight, isMobile]);
|
|
77
77
|
// RENDER
|
|
78
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [generalError && (
|
|
78
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [(generalError || categoriesError || addressingError) && (_jsxs(Typography, Object.assign({ className: classes.generalError }, { children: [generalError && _jsx(FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` }), categoriesError && categoriesError, _jsx("br", {}), addressingError && addressingError] }))), _jsx(TextField, { className: classes.title, ref: titleRef, placeholder: intl.formatMessage({
|
|
79
79
|
id: 'ui.composer.content.discussion.title.label',
|
|
80
80
|
defaultMessage: 'ui.composer.content.discussion.title.label'
|
|
81
81
|
}), autoFocus: true, fullWidth: true, variant: "outlined", value: value.title, onChange: handleChangeTitle, onKeyDown: handleKeyDownTitle, multiline: true, InputProps: {
|
|
82
82
|
endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: COMPOSER_TITLE_MAX_LENGTH - value.title.length }))
|
|
83
|
-
}, error: Boolean(titleError)
|
|
83
|
+
}, error: Boolean(titleError), helperText: titleError, disabled: disabled }), _jsx(Box, Object.assign({ sx: { [`& .${SCEDITOR_PREFIX}-content`]: { maxHeight: `${editorMaxHeight} !important` } } }, { children: _jsx(Editor, Object.assign({}, EditorProps, { editable: !disabled, className: classes.editor, onChange: handleChangeHtml, defaultValue: value.html })) }))] })));
|
|
84
84
|
};
|
|
@@ -19,7 +19,7 @@ export default function ComposerTypeButtonGroup(props) {
|
|
|
19
19
|
const { preferences } = useSCPreferences();
|
|
20
20
|
const scUserContext = useSCUser();
|
|
21
21
|
// MEMO
|
|
22
|
-
const hasPollType = useMemo(() => preferences[SCPreferences.ADDONS_POLLS_ENABLED].value || UserUtils.isStaff(scUserContext.user), [preferences, scUserContext.user]);
|
|
22
|
+
const hasPollType = useMemo(() => preferences[SCPreferences.ADDONS_POLLS_ENABLED].value || UserUtils.isStaff(scUserContext.user) || UserUtils.isPublisher(scUserContext.user), [preferences, scUserContext.user]);
|
|
23
23
|
const hasPostType = useMemo(() => preferences[SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED].value, [preferences]);
|
|
24
24
|
const hasDiscussionType = useMemo(() => preferences[SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED].value, [preferences]);
|
|
25
25
|
// PROPS
|
|
@@ -130,5 +130,5 @@ export default function CustomAdv(inProps) {
|
|
|
130
130
|
return _jsx(HiddenPlaceholder, {});
|
|
131
131
|
}
|
|
132
132
|
const adv = (_jsxs(Box, Object.assign({ className: classes.wrap }, { children: [scCustomAdv.image && (_jsx("img", { src: scCustomAdv.image, alt: scCustomAdv.title, className: classNames(classes.image, { [classes.prefixedHeight]: Boolean(prefixedHeight) }) })), scCustomAdv.embed_code && (_jsx(Box, { ref: embedRef, className: classNames(classes.embedCode, { [classes.prefixedHeight]: Boolean(prefixedHeight) }), dangerouslySetInnerHTML: { __html: scCustomAdv.embed_code } }))] })));
|
|
133
|
-
return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className), ref: ref, style: Object.assign({}, (prefixedHeight ? { paddingBottom: prefixedHeight } : { width: '100%' })) }, { children: scCustomAdv.link ? (_jsx("a", Object.assign({ href: scCustomAdv.link, title: scCustomAdv.title }, { children: adv }))) : (adv) })));
|
|
133
|
+
return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className), ref: ref, style: Object.assign({}, (prefixedHeight ? { paddingBottom: prefixedHeight } : { width: '100%' })) }, { children: scCustomAdv.link ? (_jsx("a", Object.assign({ href: scCustomAdv.link, title: scCustomAdv.title, target: "_blank" }, { children: adv }))) : (adv) })));
|
|
134
134
|
}
|