@canlooks/can-ui 0.0.130 → 0.0.131
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.
|
@@ -39,14 +39,13 @@ exports.Typography = (0, react_1.memo)(({ component: Component = 'p', color = 't
|
|
|
39
39
|
* -------------------------------------------------------------------
|
|
40
40
|
* 复制
|
|
41
41
|
*/
|
|
42
|
-
const textRef = (0, react_1.useRef)(null);
|
|
43
42
|
const [copied, setCopied] = (0, react_1.useState)(false);
|
|
44
43
|
const unmounted = (0, utils_1.useUnmounted)();
|
|
45
44
|
const copyHandler = () => {
|
|
46
45
|
if (copied) {
|
|
47
46
|
return;
|
|
48
47
|
}
|
|
49
|
-
const text =
|
|
48
|
+
const text = innerRef.current.innerText;
|
|
50
49
|
navigator.clipboard.writeText(text).then();
|
|
51
50
|
onCopy?.(text);
|
|
52
51
|
setCopied(true);
|
|
@@ -64,7 +63,7 @@ exports.Typography = (0, react_1.memo)(({ component: Component = 'p', color = 't
|
|
|
64
63
|
return editing
|
|
65
64
|
? (0, jsx_runtime_1.jsx)("div", { css: typography_style_1.editStyle, className: typography_style_1.classes.editWrap, style: { height: originHeight }, children: (0, jsx_runtime_1.jsx)(EditComponent, { ...editComponentProps, className: (0, utils_1.clsx)(typography_style_1.classes.editComponent, editComponentProps?.className), autoFocus: true, defaultValue: defaultText, onBlur: blurHandler, fullWidth: multipleRows ? true : void 0 }) })
|
|
66
65
|
: (0, jsx_runtime_1.jsxs)(Component, { "data-component": typeof Component === 'string' ? Component : '', ...props, ref: (0, utils_1.cloneRef)(innerRef, props.ref), css: style, className: (0, utils_1.clsx)(typography_style_1.classes.root, props.className), "data-ellipsis-rows": expanded ? '0' : ellipsisRows, children: [ellipsisRows > 0
|
|
67
|
-
? (0, jsx_runtime_1.jsx)("span", {
|
|
66
|
+
? (0, jsx_runtime_1.jsx)("span", { className: typography_style_1.classes.text, style: {
|
|
68
67
|
WebkitLineClamp: ellipsisRows > 1 ? ellipsisRows : void 0,
|
|
69
68
|
wordBreak
|
|
70
69
|
}, children: props.children })
|
|
@@ -36,14 +36,13 @@ export const Typography = memo(({ component: Component = 'p', color = 'text.prim
|
|
|
36
36
|
* -------------------------------------------------------------------
|
|
37
37
|
* 复制
|
|
38
38
|
*/
|
|
39
|
-
const textRef = useRef(null);
|
|
40
39
|
const [copied, setCopied] = useState(false);
|
|
41
40
|
const unmounted = useUnmounted();
|
|
42
41
|
const copyHandler = () => {
|
|
43
42
|
if (copied) {
|
|
44
43
|
return;
|
|
45
44
|
}
|
|
46
|
-
const text =
|
|
45
|
+
const text = innerRef.current.innerText;
|
|
47
46
|
navigator.clipboard.writeText(text).then();
|
|
48
47
|
onCopy?.(text);
|
|
49
48
|
setCopied(true);
|
|
@@ -61,7 +60,7 @@ export const Typography = memo(({ component: Component = 'p', color = 'text.prim
|
|
|
61
60
|
return editing
|
|
62
61
|
? _jsx("div", { css: editStyle, className: classes.editWrap, style: { height: originHeight }, children: _jsx(EditComponent, { ...editComponentProps, className: clsx(classes.editComponent, editComponentProps?.className), autoFocus: true, defaultValue: defaultText, onBlur: blurHandler, fullWidth: multipleRows ? true : void 0 }) })
|
|
63
62
|
: _jsxs(Component, { "data-component": typeof Component === 'string' ? Component : '', ...props, ref: cloneRef(innerRef, props.ref), css: style, className: clsx(classes.root, props.className), "data-ellipsis-rows": expanded ? '0' : ellipsisRows, children: [ellipsisRows > 0
|
|
64
|
-
? _jsx("span", {
|
|
63
|
+
? _jsx("span", { className: classes.text, style: {
|
|
65
64
|
WebkitLineClamp: ellipsisRows > 1 ? ellipsisRows : void 0,
|
|
66
65
|
wordBreak
|
|
67
66
|
}, children: props.children })
|