@selfcommunity/react-ui 0.10.4-alpha.6 → 0.10.4-alpha.7

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.
@@ -272,21 +272,22 @@ function Composer(inProps) {
272
272
  */
273
273
  dialogRef.current.addEventListener('touchstart', handleTouchStart);
274
274
  dialogRef.current.addEventListener('touchmove', handleTouchmove);
275
- (0, body_scroll_lock_1.disableBodyScroll)(dialogRef.current, {
276
- allowTouchMove: (el) => {
277
- while (el && el !== document.body) {
278
- if (el.getAttribute('class') !== null && el.getAttribute('class').includes('SCComposer-content')) {
279
- return true;
275
+ dialogRef.current &&
276
+ (0, body_scroll_lock_1.disableBodyScroll)(dialogRef.current, {
277
+ allowTouchMove: (el) => {
278
+ while (el && el !== document.body) {
279
+ if (el.getAttribute('class') !== null && el.getAttribute('class').includes('SCComposer-content')) {
280
+ return true;
281
+ }
282
+ el = el.parentElement;
280
283
  }
281
- el = el.parentElement;
282
284
  }
283
- }
284
- });
285
+ });
285
286
  return () => {
286
287
  var _a, _b;
287
288
  (_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', handleTouchStart);
288
289
  (_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchmove', handleTouchmove);
289
- (0, body_scroll_lock_1.enableBodyScroll)(dialogRef.current);
290
+ dialogRef.current && (0, body_scroll_lock_1.enableBodyScroll)(dialogRef.current);
290
291
  };
291
292
  }, [dialogRef.current, isIOS]);
292
293
  /* Handlers */
@@ -491,6 +492,8 @@ function Composer(inProps) {
491
492
  }, [scUserContext.user, feedObjectType, id, type, title, html, categories, event, group, addressing, audience, medias, poll, location, hasPoll]);
492
493
  //edited here
493
494
  const handleClose = (0, react_1.useCallback)((e, reason) => {
495
+ console.log(e);
496
+ console.log(reason);
494
497
  if (unloadRef.current) {
495
498
  window.onbeforeunload = null;
496
499
  }
@@ -580,7 +583,7 @@ function Composer(inProps) {
580
583
  if (!scUserContext.user && !(scUserContext.loading && open)) {
581
584
  return null;
582
585
  }
583
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ ref: dialogRef, TransitionComponent: DialogTransition, BackdropComponent: BackdropScrollDisabled_1.default, keepMounted: true, onClose: handleClose }, rest, { className: (0, classnames_1.default)(classes.root, { [classes.ios]: isIOS }), scroll: "body", fullScreen: fullScreen, tabIndex: -1 }, { children: [(0, jsx_runtime_1.jsxs)("form", Object.assign({ onSubmit: handleSubmit, method: "post" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.DialogTitle, Object.assign({ className: classes.title }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleClosePrompt }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "close" }) })), (0, jsx_runtime_1.jsx)(LoadingButton_1.default, Object.assign({ size: "small", type: "submit", color: "secondary", variant: "contained", disabled: !canSubmit, loading: isSubmitting }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.submit", defaultMessage: "ui.composer.submit" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.DialogContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(Attributes_1.default, { value: { categories, event, group, addressing, location }, className: classes.attributes, onChange: handleChangeAttributes, onClick: handleClickAttributes }), content, medias && medias.length > 0 && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.medias }, { children: mediaObjectTypes.map((mediaObjectType) => {
586
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ ref: dialogRef, TransitionComponent: DialogTransition, BackdropComponent: BackdropScrollDisabled_1.default, keepMounted: true, onClose: handleClose }, rest, { disableEscapeKeyDown: true, className: (0, classnames_1.default)(classes.root, { [classes.ios]: isIOS }), scroll: "paper", fullScreen: fullScreen, tabIndex: -1 }, { children: [(0, jsx_runtime_1.jsxs)("form", Object.assign({ onSubmit: handleSubmit, method: "post" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.DialogTitle, Object.assign({ className: classes.title }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleClosePrompt }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "close" }) })), (0, jsx_runtime_1.jsx)(LoadingButton_1.default, Object.assign({ size: "small", type: "submit", color: "secondary", variant: "contained", disabled: !canSubmit, loading: isSubmitting }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.submit", defaultMessage: "ui.composer.submit" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.DialogContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(Attributes_1.default, { value: { categories, event, group, addressing, location }, className: classes.attributes, onChange: handleChangeAttributes, onClick: handleClickAttributes }), content, medias && medias.length > 0 && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.medias }, { children: mediaObjectTypes.map((mediaObjectType) => {
584
587
  if (mediaObjectType.previewComponent) {
585
588
  return (0, jsx_runtime_1.jsx)(mediaObjectType.previewComponent, { value: medias, onChange: handleChangeMedias }, mediaObjectType.name);
586
589
  }
@@ -270,21 +270,22 @@ export default function Composer(inProps) {
270
270
  */
271
271
  dialogRef.current.addEventListener('touchstart', handleTouchStart);
272
272
  dialogRef.current.addEventListener('touchmove', handleTouchmove);
273
- disableBodyScroll(dialogRef.current, {
274
- allowTouchMove: (el) => {
275
- while (el && el !== document.body) {
276
- if (el.getAttribute('class') !== null && el.getAttribute('class').includes('SCComposer-content')) {
277
- return true;
273
+ dialogRef.current &&
274
+ disableBodyScroll(dialogRef.current, {
275
+ allowTouchMove: (el) => {
276
+ while (el && el !== document.body) {
277
+ if (el.getAttribute('class') !== null && el.getAttribute('class').includes('SCComposer-content')) {
278
+ return true;
279
+ }
280
+ el = el.parentElement;
278
281
  }
279
- el = el.parentElement;
280
282
  }
281
- }
282
- });
283
+ });
283
284
  return () => {
284
285
  var _a, _b;
285
286
  (_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', handleTouchStart);
286
287
  (_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchmove', handleTouchmove);
287
- enableBodyScroll(dialogRef.current);
288
+ dialogRef.current && enableBodyScroll(dialogRef.current);
288
289
  };
289
290
  }, [dialogRef.current, isIOS]);
290
291
  /* Handlers */
@@ -489,6 +490,8 @@ export default function Composer(inProps) {
489
490
  }, [scUserContext.user, feedObjectType, id, type, title, html, categories, event, group, addressing, audience, medias, poll, location, hasPoll]);
490
491
  //edited here
491
492
  const handleClose = useCallback((e, reason) => {
493
+ console.log(e);
494
+ console.log(reason);
492
495
  if (unloadRef.current) {
493
496
  window.onbeforeunload = null;
494
497
  }
@@ -578,7 +581,7 @@ export default function Composer(inProps) {
578
581
  if (!scUserContext.user && !(scUserContext.loading && open)) {
579
582
  return null;
580
583
  }
581
- return (_jsxs(Root, Object.assign({ ref: dialogRef, TransitionComponent: DialogTransition, BackdropComponent: BackdropScrollDisabled, keepMounted: true, onClose: handleClose }, rest, { className: classNames(classes.root, { [classes.ios]: isIOS }), scroll: "body", fullScreen: fullScreen, tabIndex: -1 }, { children: [_jsxs("form", Object.assign({ onSubmit: handleSubmit, method: "post" }, { children: [_jsxs(DialogTitle, Object.assign({ className: classes.title }, { children: [_jsx(IconButton, Object.assign({ onClick: handleClosePrompt }, { children: _jsx(Icon, { children: "close" }) })), _jsx(LoadingButton, Object.assign({ size: "small", type: "submit", color: "secondary", variant: "contained", disabled: !canSubmit, loading: isSubmitting }, { children: _jsx(FormattedMessage, { id: "ui.composer.submit", defaultMessage: "ui.composer.submit" }) }))] })), _jsxs(DialogContent, Object.assign({ className: classes.content }, { children: [_jsx(Attributes, { value: { categories, event, group, addressing, location }, className: classes.attributes, onChange: handleChangeAttributes, onClick: handleClickAttributes }), content, medias && medias.length > 0 && (_jsx(Box, Object.assign({ className: classes.medias }, { children: mediaObjectTypes.map((mediaObjectType) => {
584
+ return (_jsxs(Root, Object.assign({ ref: dialogRef, TransitionComponent: DialogTransition, BackdropComponent: BackdropScrollDisabled, keepMounted: true, onClose: handleClose }, rest, { disableEscapeKeyDown: true, className: classNames(classes.root, { [classes.ios]: isIOS }), scroll: "paper", fullScreen: fullScreen, tabIndex: -1 }, { children: [_jsxs("form", Object.assign({ onSubmit: handleSubmit, method: "post" }, { children: [_jsxs(DialogTitle, Object.assign({ className: classes.title }, { children: [_jsx(IconButton, Object.assign({ onClick: handleClosePrompt }, { children: _jsx(Icon, { children: "close" }) })), _jsx(LoadingButton, Object.assign({ size: "small", type: "submit", color: "secondary", variant: "contained", disabled: !canSubmit, loading: isSubmitting }, { children: _jsx(FormattedMessage, { id: "ui.composer.submit", defaultMessage: "ui.composer.submit" }) }))] })), _jsxs(DialogContent, Object.assign({ className: classes.content }, { children: [_jsx(Attributes, { value: { categories, event, group, addressing, location }, className: classes.attributes, onChange: handleChangeAttributes, onClick: handleClickAttributes }), content, medias && medias.length > 0 && (_jsx(Box, Object.assign({ className: classes.medias }, { children: mediaObjectTypes.map((mediaObjectType) => {
582
585
  if (mediaObjectType.previewComponent) {
583
586
  return _jsx(mediaObjectType.previewComponent, { value: medias, onChange: handleChangeMedias }, mediaObjectType.name);
584
587
  }