@cyberyozh/text-editor 0.1.10 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyberyozh/text-editor",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Rich text editor library based on Tiptap for CyberYozh",
5
5
  "author": "CyberYozh",
6
6
  "license": "MIT",
@@ -26,7 +26,6 @@ export function Table({ children }: TableProps) {
26
26
  }
27
27
  }
28
28
 
29
- // Calculate widths based on container
30
29
  const definedWidths = colWidths.filter((w): w is number => w !== undefined);
31
30
  const totalDefinedWidth = definedWidths.reduce((total, width) => total + width, 0);
32
31
  const undefinedCount = colWidths.filter((w) => w === undefined).length;
@@ -34,22 +33,24 @@ export function Table({ children }: TableProps) {
34
33
  useEffect(() => {
35
34
  if (wrapperRef.current && undefinedCount > 0) {
36
35
  const containerWidth = wrapperRef.current.clientWidth;
37
- const remainingSpace = containerWidth - totalDefinedWidth;
36
+ const remainingSpace = containerWidth - totalDefinedWidth - 2;
38
37
  const calculatedWidth = Math.floor(remainingSpace / undefinedCount);
39
38
  setUndefinedColWidth(calculatedWidth > 0 ? calculatedWidth : undefined);
40
39
  }
41
40
  }, [totalDefinedWidth, undefinedCount]);
42
41
 
43
- // Calculate total table width
44
42
  const tableWidth =
45
43
  undefinedCount > 0 && undefinedColWidth
46
- ? totalDefinedWidth + (undefinedColWidth * undefinedCount)
44
+ ? totalDefinedWidth + undefinedColWidth * undefinedCount + 2
47
45
  : totalDefinedWidth > 0
48
- ? totalDefinedWidth
46
+ ? totalDefinedWidth + 2
49
47
  : undefined;
50
48
 
51
49
  return (
52
- <div ref={wrapperRef} className="tableWrapper">
50
+ <div
51
+ ref={wrapperRef}
52
+ className="tableWrapper"
53
+ >
53
54
  <table style={tableWidth ? { width: `${tableWidth}px` } : undefined}>
54
55
  {colWidths.length > 0 && (
55
56
  <colgroup>