@nuasite/cms 0.7.0 → 0.7.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/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/astro-cms"
15
15
  },
16
16
  "license": "Apache-2.0",
17
- "version": "0.7.0",
17
+ "version": "0.7.1",
18
18
  "module": "src/index.ts",
19
19
  "types": "src/index.ts",
20
20
  "type": "module",
@@ -79,33 +79,46 @@ export function BlockEditor({
79
79
 
80
80
  const updatePosition = () => {
81
81
  const editorWidth = LAYOUT.BLOCK_EDITOR_WIDTH
82
+ const editorHeight = LAYOUT.BLOCK_EDITOR_HEIGHT
82
83
  const padding = LAYOUT.VIEWPORT_PADDING
83
84
  const viewportWidth = window.innerWidth
84
85
  const viewportHeight = window.innerHeight
85
86
 
86
87
  let top: number
87
88
  let left: number
89
+ let maxHeight: number
88
90
 
89
91
  if (cursor) {
90
- top = cursor.y
91
92
  left = cursor.x
92
93
 
93
- // Keep within viewport bounds
94
+ // Keep within viewport bounds horizontally
94
95
  if (left + editorWidth > viewportWidth - padding) {
95
96
  left = viewportWidth - editorWidth - padding
96
97
  }
97
98
  if (left < padding) {
98
99
  left = padding
99
100
  }
101
+
102
+ const spaceBelow = viewportHeight - cursor.y - padding
103
+ const spaceAbove = cursor.y - padding
104
+
105
+ if (spaceBelow >= editorHeight || spaceBelow >= spaceAbove) {
106
+ // Open below cursor
107
+ top = Math.max(padding, Math.min(cursor.y, viewportHeight - padding - 100))
108
+ maxHeight = viewportHeight - top - padding
109
+ } else {
110
+ // Open above cursor — anchor bottom of panel to cursor position
111
+ const panelHeight = Math.min(spaceAbove, editorHeight)
112
+ top = cursor.y - panelHeight
113
+ top = Math.max(padding, top)
114
+ maxHeight = cursor.y - top
115
+ }
100
116
  } else {
101
117
  top = viewportHeight / 2
102
118
  left = (viewportWidth - editorWidth) / 2
119
+ maxHeight = viewportHeight - top - padding
103
120
  }
104
121
 
105
- // Clamp top so the panel never extends past the viewport bottom
106
- top = Math.max(padding, Math.min(top, viewportHeight - padding - 100))
107
- const maxHeight = viewportHeight - top - padding
108
-
109
122
  setEditorPosition({ top, left, maxHeight })
110
123
  }
111
124
 
@@ -121,7 +121,7 @@ export function Outline(
121
121
  .element-toolbar::before {
122
122
  content: '';
123
123
  position: absolute;
124
- top: -25px;
124
+ top: -13px;
125
125
  left: -50px;
126
126
  right: -50px;
127
127
  bottom: 0;