@refactico/pages 0.2.0 → 0.2.1

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/dist/index.cjs CHANGED
@@ -1729,13 +1729,20 @@ const CodeBlock = ({
1729
1729
  const [copied, setCopied] = react.useState(false);
1730
1730
  const textareaRef = react.useRef(null);
1731
1731
  const isDark = theme === "dark";
1732
- const handleCodeChange = (e) => {
1733
- onUpdate({ ...block, code: e.target.value });
1732
+ const resizeTextarea = () => {
1734
1733
  if (textareaRef.current) {
1735
1734
  textareaRef.current.style.height = "auto";
1736
1735
  textareaRef.current.style.height = textareaRef.current.scrollHeight + "px";
1737
1736
  }
1738
1737
  };
1738
+ react.useEffect(() => {
1739
+ if (!readOnly) {
1740
+ resizeTextarea();
1741
+ }
1742
+ }, [block.code, readOnly]);
1743
+ const handleCodeChange = (e) => {
1744
+ onUpdate({ ...block, code: e.target.value });
1745
+ };
1739
1746
  const handleLanguageChange = (e) => {
1740
1747
  onUpdate({ ...block, language: e.target.value });
1741
1748
  };
package/dist/index.js CHANGED
@@ -1725,13 +1725,20 @@ const CodeBlock = ({
1725
1725
  const [copied, setCopied] = useState(false);
1726
1726
  const textareaRef = useRef(null);
1727
1727
  const isDark = theme === "dark";
1728
- const handleCodeChange = (e) => {
1729
- onUpdate({ ...block, code: e.target.value });
1728
+ const resizeTextarea = () => {
1730
1729
  if (textareaRef.current) {
1731
1730
  textareaRef.current.style.height = "auto";
1732
1731
  textareaRef.current.style.height = textareaRef.current.scrollHeight + "px";
1733
1732
  }
1734
1733
  };
1734
+ useEffect(() => {
1735
+ if (!readOnly) {
1736
+ resizeTextarea();
1737
+ }
1738
+ }, [block.code, readOnly]);
1739
+ const handleCodeChange = (e) => {
1740
+ onUpdate({ ...block, code: e.target.value });
1741
+ };
1735
1742
  const handleLanguageChange = (e) => {
1736
1743
  onUpdate({ ...block, language: e.target.value });
1737
1744
  };
package/dist/style.css CHANGED
@@ -511,10 +511,6 @@
511
511
  margin-top: calc(var(--spacing) * 8);
512
512
  }
513
513
 
514
- .mr-auto {
515
- margin-right: auto;
516
- }
517
-
518
514
  .mb-1 {
519
515
  margin-bottom: calc(var(--spacing) * 1);
520
516
  }
@@ -527,10 +523,6 @@
527
523
  margin-bottom: calc(var(--spacing) * 4);
528
524
  }
529
525
 
530
- .ml-auto {
531
- margin-left: auto;
532
- }
533
-
534
526
  .block {
535
527
  display: block;
536
528
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@refactico/pages",
3
3
  "private": false,
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "description": "A component library for building pages with React.",
6
6
  "author": "refactico",
7
7
  "license": "MIT",