@selfcommunity/react-ui 0.7.0-alpha.319 → 0.7.0-alpha.320

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.
@@ -7,12 +7,6 @@ const lexical_1 = require("lexical");
7
7
  const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
8
8
  const useLexicalNodeSelection_1 = require("@lexical/react/useLexicalNodeSelection");
9
9
  const utils_1 = require("@lexical/utils");
10
- /**
11
- * Limit the width of an image (min/max)
12
- * Used to compute the padding-bottom of the div that wrap the img
13
- */
14
- const IMAGE_MAX_WIDTH_THRESHOLD = 500;
15
- const IMAGE_MIN_WIDTH_THRESHOLD = 375;
16
10
  /**
17
11
  * Calc aspect-ratio of image
18
12
  * @param width
@@ -36,9 +30,9 @@ function useSuspenseImage(src) {
36
30
  }
37
31
  function LazyImage({ altText, className, imageRef, src, width, height }) {
38
32
  useSuspenseImage(src);
39
- const aspectRatio = getAspectRatio(width >= IMAGE_MAX_WIDTH_THRESHOLD ? width : IMAGE_MAX_WIDTH_THRESHOLD, height);
33
+ const aspectRatio = getAspectRatio(width, height);
40
34
  return (react_1.default.createElement("div", { draggable: false, className: className, style: { position: 'relative', paddingBottom: `${100 / aspectRatio}%` } },
41
- react_1.default.createElement("img", { src: src, alt: altText, ref: imageRef, style: Object.assign({ position: 'absolute' }, (width < IMAGE_MIN_WIDTH_THRESHOLD ? { paddingRight: IMAGE_MIN_WIDTH_THRESHOLD - width } : {})) })));
35
+ react_1.default.createElement("img", { src: src, alt: altText, ref: imageRef, style: { position: 'absolute', width: '100%' } })));
42
36
  }
43
37
  function ImageComponent({ src, altText, nodeKey, width, height }) {
44
38
  const imageRef = (0, react_1.useRef)(null);
@@ -458,7 +458,7 @@ function FeedObject(inProps) {
458
458
  template === feedObject_1.SCFeedObjectTemplateType.PREVIEW && (obj.comment_count > 0 || (feedObjectActivities && feedObjectActivities.length > 0)) && (react_1.default.createElement(material_1.Collapse, { in: expandedActivities, timeout: "auto", classes: { root: classes.activitiesSection } },
459
459
  react_1.default.createElement(CardContent_1.default, { className: classes.activitiesContent },
460
460
  react_1.default.createElement(Activities_1.default, Object.assign({ feedObject: obj, key: selectedActivities, feedObjectActivities: feedObjectActivities, activitiesType: selectedActivities, onSetSelectedActivities: handleSelectedActivities, comments: comments, CommentsObjectProps: {
461
- CommentComponentProps: Object.assign({ onDelete: handleDeleteComment, truncateContent: true }, CommentComponentProps),
461
+ CommentComponentProps: Object.assign({ onDelete: handleDeleteComment, truncateContent: false }, CommentComponentProps),
462
462
  CommentObjectSkeletonProps: CommentObjectSkeletonProps
463
463
  }, cacheStrategy: cacheStrategy }, ActivitiesProps))))),
464
464
  composerOpen && (react_1.default.createElement(Composer_1.default, { open: composerOpen, feedObject: obj, onClose: handleToggleEdit, onSuccess: handleEditSuccess, maxWidth: "sm", fullWidth: true, scroll: "body" })))) : (react_1.default.createElement(Skeleton_1.default, Object.assign({ template: template }, FeedObjectSkeletonProps)))));
@@ -3,12 +3,6 @@ import { $getNodeByKey, $getSelection, $isNodeSelection, $setSelection, CLICK_CO
3
3
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
4
4
  import { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection';
5
5
  import { mergeRegister } from '@lexical/utils';
6
- /**
7
- * Limit the width of an image (min/max)
8
- * Used to compute the padding-bottom of the div that wrap the img
9
- */
10
- const IMAGE_MAX_WIDTH_THRESHOLD = 500;
11
- const IMAGE_MIN_WIDTH_THRESHOLD = 375;
12
6
  /**
13
7
  * Calc aspect-ratio of image
14
8
  * @param width
@@ -32,9 +26,9 @@ function useSuspenseImage(src) {
32
26
  }
33
27
  function LazyImage({ altText, className, imageRef, src, width, height }) {
34
28
  useSuspenseImage(src);
35
- const aspectRatio = getAspectRatio(width >= IMAGE_MAX_WIDTH_THRESHOLD ? width : IMAGE_MAX_WIDTH_THRESHOLD, height);
29
+ const aspectRatio = getAspectRatio(width, height);
36
30
  return (React.createElement("div", { draggable: false, className: className, style: { position: 'relative', paddingBottom: `${100 / aspectRatio}%` } },
37
- React.createElement("img", { src: src, alt: altText, ref: imageRef, style: Object.assign({ position: 'absolute' }, (width < IMAGE_MIN_WIDTH_THRESHOLD ? { paddingRight: IMAGE_MIN_WIDTH_THRESHOLD - width } : {})) })));
31
+ React.createElement("img", { src: src, alt: altText, ref: imageRef, style: { position: 'absolute', width: '100%' } })));
38
32
  }
39
33
  function ImageComponent({ src, altText, nodeKey, width, height }) {
40
34
  const imageRef = useRef(null);
@@ -456,7 +456,7 @@ export default function FeedObject(inProps) {
456
456
  template === SCFeedObjectTemplateType.PREVIEW && (obj.comment_count > 0 || (feedObjectActivities && feedObjectActivities.length > 0)) && (React.createElement(Collapse, { in: expandedActivities, timeout: "auto", classes: { root: classes.activitiesSection } },
457
457
  React.createElement(CardContent, { className: classes.activitiesContent },
458
458
  React.createElement(Activities, Object.assign({ feedObject: obj, key: selectedActivities, feedObjectActivities: feedObjectActivities, activitiesType: selectedActivities, onSetSelectedActivities: handleSelectedActivities, comments: comments, CommentsObjectProps: {
459
- CommentComponentProps: Object.assign({ onDelete: handleDeleteComment, truncateContent: true }, CommentComponentProps),
459
+ CommentComponentProps: Object.assign({ onDelete: handleDeleteComment, truncateContent: false }, CommentComponentProps),
460
460
  CommentObjectSkeletonProps: CommentObjectSkeletonProps
461
461
  }, cacheStrategy: cacheStrategy }, ActivitiesProps))))),
462
462
  composerOpen && (React.createElement(Composer, { open: composerOpen, feedObject: obj, onClose: handleToggleEdit, onSuccess: handleEditSuccess, maxWidth: "sm", fullWidth: true, scroll: "body" })))) : (React.createElement(FeedObjectSkeleton, Object.assign({ template: template }, FeedObjectSkeletonProps)))));