ep_data_tables 0.0.99 → 0.0.999

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": "ep_data_tables",
3
- "version": "0.0.99",
3
+ "version": "0.0.999",
4
4
  "description": "BETA - etherpad tables plugin, compatible with other character/line based styling and other features",
5
5
  "author": {
6
6
  "name": "DCastelone",
@@ -12,6 +12,10 @@
12
12
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
13
13
  padding: 5px 0;
14
14
  min-width: 160px;
15
+ max-width: calc(100vw - 16px);
16
+ max-height: calc(100vh - 16px);
17
+ overflow-y: auto;
18
+ overflow-x: hidden;
15
19
  }
16
20
 
17
21
  #table-context-menu ul {
@@ -49,6 +53,9 @@
49
53
  border-radius: 4px;
50
54
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
51
55
  padding: 10px;
56
+ max-width: calc(100vw - 16px);
57
+ max-height: calc(100vh - 16px);
58
+ overflow: auto;
52
59
  }
53
60
 
54
61
  #tbl_prop_create_table:after {
@@ -28,9 +28,70 @@ exports.postAceInit = (hook, ctx) => {
28
28
 
29
29
  function position(el, target, dx = 0, dy = 0) {
30
30
  // log('position: Calculating position for', el, 'relative to', target);
31
- const p = target.offset();
32
- el.css({ left: p.left + dx, top: p.top + dy });
33
- // log('position: Set position:', { left: p.left + dx, top: p.top + dy });
31
+
32
+ // Use getBoundingClientRect for more reliable positioning with zoom
33
+ const targetRect = target[0].getBoundingClientRect();
34
+
35
+ // Calculate initial desired position (viewport-relative since we use fixed positioning)
36
+ let left = targetRect.left + dx;
37
+ let top = targetRect.top + dy;
38
+
39
+ // Make element visible temporarily to measure its dimensions
40
+ const wasHidden = el.css('display') === 'none';
41
+ if (wasHidden) {
42
+ el.css({ visibility: 'hidden', display: 'block' });
43
+ }
44
+
45
+ const elWidth = el.outerWidth();
46
+ const elHeight = el.outerHeight();
47
+
48
+ if (wasHidden) {
49
+ el.css({ visibility: '', display: 'none' });
50
+ }
51
+
52
+ // Get viewport dimensions
53
+ const viewportWidth = window.innerWidth;
54
+ const viewportHeight = window.innerHeight;
55
+
56
+ // Padding from viewport edges
57
+ const edgePadding = 8;
58
+
59
+ // Check and adjust for right edge overflow
60
+ if (left + elWidth > viewportWidth - edgePadding) {
61
+ // Try positioning to the left of the target instead
62
+ const leftAlternative = targetRect.right - elWidth - dx;
63
+ if (leftAlternative >= edgePadding) {
64
+ left = leftAlternative;
65
+ } else {
66
+ // If that doesn't work either, just pin to the right edge
67
+ left = viewportWidth - elWidth - edgePadding;
68
+ }
69
+ }
70
+
71
+ // Ensure we don't go past the left edge
72
+ if (left < edgePadding) {
73
+ left = edgePadding;
74
+ }
75
+
76
+ // Check and adjust for bottom edge overflow
77
+ if (top + elHeight > viewportHeight - edgePadding) {
78
+ // Try positioning above the target instead
79
+ const topAlternative = targetRect.top - elHeight;
80
+ if (topAlternative >= edgePadding) {
81
+ top = topAlternative;
82
+ } else {
83
+ // If that doesn't work either, just pin to the bottom edge
84
+ top = viewportHeight - elHeight - edgePadding;
85
+ }
86
+ }
87
+
88
+ // Ensure we don't go past the top edge
89
+ if (top < edgePadding) {
90
+ top = edgePadding;
91
+ }
92
+
93
+ el.css({ left: left, top: top });
94
+ // log('position: Set position:', { left, top });
34
95
  }
35
96
 
36
97
  // ───────────────────── init once DOM is ready ─────────────────────