react-mention-input 1.0.16 → 1.0.17

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.
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import './ShowMessageCard.css';
3
3
  export var ShowMessageCard = function (_a) {
4
4
  var data = _a.data, _b = _a.nameKey, nameKey = _b === void 0 ? 'name' : _b, _c = _a.dateKey, dateKey = _c === void 0 ? 'date' : _c, _d = _a.commentKey, commentKey = _d === void 0 ? 'comment' : _d, _e = _a.imgSrcKey, imgSrcKey = _e === void 0 ? 'imgSrc' : _e, containerClassName = _a.containerClassName, containerStyle = _a.containerStyle, cardClassName = _a.cardClassName, cardStyle = _a.cardStyle, headerClassName = _a.headerClassName, headerStyle = _a.headerStyle, imgClassName = _a.imgClassName, imgStyle = _a.imgStyle, infoClassName = _a.infoClassName, infoStyle = _a.infoStyle, nameClassName = _a.nameClassName, nameStyle = _a.nameStyle, dateClassName = _a.dateClassName, dateStyle = _a.dateStyle, bodyClassName = _a.bodyClassName, bodyStyle = _a.bodyStyle, commentClassName = _a.commentClassName, commentStyle = _a.commentStyle, renderItem = _a.renderItem // Custom render function
@@ -20,13 +20,13 @@ export var ShowMessageCard = function (_a) {
20
20
  // </React.Fragment>
21
21
  // );
22
22
  // }
23
- // const [showInitials, setShowInitials] = useState(false);
24
- // const handleImageError = () => {
25
- // setShowInitials(true);
26
- // };
23
+ var _a = useState(false), showInitials = _a[0], setShowInitials = _a[1];
24
+ var handleImageError = function () {
25
+ setShowInitials(true);
26
+ };
27
27
  return (React.createElement("div", { key: item.id || index, className: "message-card ".concat(cardClassName || ''), style: cardStyle },
28
28
  React.createElement("div", { className: "message-card-header ".concat(headerClassName || ''), style: headerStyle },
29
- !item[imgSrcKey] ? (React.createElement("div", { className: "message-card-initials ".concat(imgClassName || ''), style: imgStyle }, getInitials(item[nameKey]))) : (React.createElement("img", { src: item[imgSrcKey], alt: item[nameKey], className: "message-card-img ".concat(imgClassName || ''), style: imgStyle })),
29
+ showInitials || !item[imgSrcKey] ? (React.createElement("div", { className: "message-card-initials ".concat(imgClassName || ''), style: imgStyle }, getInitials(item[nameKey]))) : (React.createElement("img", { src: item[imgSrcKey], alt: item[nameKey], className: "message-card-img ".concat(imgClassName || ''), style: imgStyle, onError: handleImageError })),
30
30
  React.createElement("div", { className: "message-card-info ".concat(infoClassName || ''), style: infoStyle },
31
31
  React.createElement("h3", { className: "message-card-name ".concat(nameClassName || ''), style: nameStyle }, item[nameKey]),
32
32
  React.createElement("p", { className: "message-card-date ".concat(dateClassName || ''), style: dateStyle }, item[dateKey]))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-mention-input",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -79,11 +79,11 @@ export const ShowMessageCard: React.FC<ShowMessageCardProps> = ({
79
79
  // );
80
80
  // }
81
81
 
82
- // const [showInitials, setShowInitials] = useState(false);
82
+ const [showInitials, setShowInitials] = useState(false);
83
83
 
84
- // const handleImageError = () => {
85
- // setShowInitials(true);
86
- // };
84
+ const handleImageError = () => {
85
+ setShowInitials(true);
86
+ };
87
87
 
88
88
  return (
89
89
  <div
@@ -95,8 +95,7 @@ export const ShowMessageCard: React.FC<ShowMessageCardProps> = ({
95
95
  className={`message-card-header ${headerClassName || ''}`}
96
96
  style={headerStyle}
97
97
  >
98
- {/* {showInitials || !item[imgSrcKey] ? ( */}
99
- { !item[imgSrcKey] ? (
98
+ {showInitials || !item[imgSrcKey] ? (
100
99
  <div
101
100
  className={`message-card-initials ${imgClassName || ''}`}
102
101
  style={imgStyle}
@@ -109,7 +108,7 @@ export const ShowMessageCard: React.FC<ShowMessageCardProps> = ({
109
108
  alt={item[nameKey]}
110
109
  className={`message-card-img ${imgClassName || ''}`}
111
110
  style={imgStyle}
112
- // onError={handleImageError}
111
+ onError={handleImageError}
113
112
  />
114
113
  )}
115
114
  <div