@neo4j-cypher/react-codemirror 0.0.0-canary-20260916022708 → 0.0.0-canary-20260917023151
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/CHANGELOG.md +4 -3
- package/dist/src/editorActions.js +37 -16
- package/dist/src/editorActions.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/editorActions.ts +42 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @neo4j-cypher/react-codemirror
|
|
2
2
|
|
|
3
|
-
## 0.0.0-canary-
|
|
3
|
+
## 0.0.0-canary-20260917023151
|
|
4
4
|
|
|
5
5
|
### Major Changes
|
|
6
6
|
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
- d85c1e0: Fixes bug with auto-completions
|
|
33
33
|
- 02df611: Hide parameter errors when disconnected
|
|
34
34
|
- a3e3e50: updating themes to use needle colors
|
|
35
|
+
- b2432d3: Keep the editor action in the editor's top-right corner when an inline panel or the deleted lines of a diff render above the first line
|
|
35
36
|
- bb7e9d3: Simplify detection and handling of value prop updates
|
|
36
37
|
- 1e210cb: Moves semantic analysis to a separate worker file
|
|
37
38
|
- 8de605b: Improved history prop change detection
|
|
@@ -137,8 +138,8 @@
|
|
|
137
138
|
- Updated dependencies [704d1c5]
|
|
138
139
|
- Updated dependencies [17909e3]
|
|
139
140
|
- Updated dependencies [b38430c]
|
|
140
|
-
- @neo4j-cypher/language-support@0.0.0-canary-
|
|
141
|
-
- @neo4j-cypher/lint-worker@0.0.0-canary-
|
|
141
|
+
- @neo4j-cypher/language-support@0.0.0-canary-20260917023151
|
|
142
|
+
- @neo4j-cypher/lint-worker@0.0.0-canary-20260917023151
|
|
142
143
|
|
|
143
144
|
## 2.0.0-next.40
|
|
144
145
|
|
|
@@ -16,9 +16,21 @@ import { Decoration, EditorView, ViewPlugin, WidgetType, } from '@codemirror/vie
|
|
|
16
16
|
* `absolute` on the editor element (which does not scroll). It never moves
|
|
17
17
|
* when the document grows, when an inline panel opens above the first line,
|
|
18
18
|
* or when the content scrolls — content simply scrolls behind it.
|
|
19
|
+
*
|
|
20
|
+
* The overlay is measured against the scroller's visible box rather than
|
|
21
|
+
* against the spacer or the content: the spacer moves down the document
|
|
22
|
+
* whenever something renders above the first line (an inline panel, the
|
|
23
|
+
* deleted lines of a diff), and the content reaches past the right edge as
|
|
24
|
+
* soon as it overflows.
|
|
19
25
|
*/
|
|
20
26
|
const SPACER_BOTTOM_GAP = 2;
|
|
21
27
|
const SPACER_LEFT_GAP = 4;
|
|
28
|
+
/**
|
|
29
|
+
* Floor for the overlay's inset from the visible right edge, so it stays off
|
|
30
|
+
* the content's last pixel even if a theme zeroes `.cm-line`'s right padding
|
|
31
|
+
* (the base theme's 2px, which is what normally provides the inset).
|
|
32
|
+
*/
|
|
33
|
+
const MIN_OVERLAY_RIGHT_INSET = 2;
|
|
22
34
|
export function createEditorActionsController() {
|
|
23
35
|
const setActiveEffect = StateEffect.define();
|
|
24
36
|
let callbacksRef = null;
|
|
@@ -93,6 +105,7 @@ export function createEditorActionsController() {
|
|
|
93
105
|
view.dom.style.setProperty('--cm-editor-actions-width', `${container.offsetWidth}px`);
|
|
94
106
|
view.dom.style.setProperty('--cm-editor-actions-height', `${container.offsetHeight}px`);
|
|
95
107
|
view.dom.style.setProperty('--cm-editor-actions-content-min-height', `${container.offsetHeight + SPACER_BOTTOM_GAP}px`);
|
|
108
|
+
view.dom.style.setProperty('--cm-editor-actions-reserved-width', `${container.offsetWidth + SPACER_LEFT_GAP}px`);
|
|
96
109
|
this.align(view);
|
|
97
110
|
});
|
|
98
111
|
this.resizeObserver.observe(container);
|
|
@@ -108,23 +121,26 @@ export function createEditorActionsController() {
|
|
|
108
121
|
return null;
|
|
109
122
|
}
|
|
110
123
|
const editorRect = view.dom.getBoundingClientRect();
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
rightClient = rect.right - (parseFloat(style.paddingRight) || 0);
|
|
124
|
-
}
|
|
124
|
+
const scrollerRect = view.scrollDOM.getBoundingClientRect();
|
|
125
|
+
const style = window.getComputedStyle(view.contentDOM);
|
|
126
|
+
const visibleRight = scrollerRect.left + view.scrollDOM.clientWidth;
|
|
127
|
+
// Match the inset `.cm-line`'s right padding gives the spacer, so
|
|
128
|
+
// the overlay lands on the space the spacer reserves and stays off
|
|
129
|
+
// `contentRect.right - 1`, the pixel CodeMirror hit-tests to
|
|
130
|
+
// measure a wrapped line's selection. Cover it and the first
|
|
131
|
+
// line's highlight collapses to zero width — hence the floor.
|
|
132
|
+
const line = view.contentDOM.querySelector('.cm-line');
|
|
133
|
+
const lineRightPadding = line
|
|
134
|
+
? parseFloat(window.getComputedStyle(line).paddingRight) || 0
|
|
135
|
+
: 0;
|
|
125
136
|
return {
|
|
126
|
-
top:
|
|
127
|
-
|
|
137
|
+
top: scrollerRect.top -
|
|
138
|
+
editorRect.top +
|
|
139
|
+
(parseFloat(style.paddingTop) || 0),
|
|
140
|
+
right: editorRect.right -
|
|
141
|
+
visibleRight +
|
|
142
|
+
(parseFloat(style.paddingRight) || 0) +
|
|
143
|
+
Math.max(lineRightPadding, MIN_OVERLAY_RIGHT_INSET),
|
|
128
144
|
};
|
|
129
145
|
},
|
|
130
146
|
write: (pos) => {
|
|
@@ -149,6 +165,7 @@ export function createEditorActionsController() {
|
|
|
149
165
|
root.style.removeProperty('--cm-editor-actions-width');
|
|
150
166
|
root.style.removeProperty('--cm-editor-actions-height');
|
|
151
167
|
root.style.removeProperty('--cm-editor-actions-content-min-height');
|
|
168
|
+
root.style.removeProperty('--cm-editor-actions-reserved-width');
|
|
152
169
|
root.style.removeProperty('--cm-editor-actions-top');
|
|
153
170
|
root.style.removeProperty('--cm-editor-actions-right');
|
|
154
171
|
}
|
|
@@ -171,6 +188,10 @@ export function createEditorActionsController() {
|
|
|
171
188
|
WebkitUserSelect: 'none',
|
|
172
189
|
pointerEvents: 'none',
|
|
173
190
|
},
|
|
191
|
+
// The spacer only clears the first line, so a panel above it makes its own room.
|
|
192
|
+
'.cm-inline-panel': {
|
|
193
|
+
paddingRight: 'var(--cm-editor-actions-reserved-width, 0px)',
|
|
194
|
+
},
|
|
174
195
|
'.cm-placeholder': {
|
|
175
196
|
display: 'inline',
|
|
176
197
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editorActions.js","sourceRoot":"","sources":["../../src/editorActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAkB,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EAEV,UAAU,GACX,MAAM,kBAAkB,CAAC;AAmB1B
|
|
1
|
+
{"version":3,"file":"editorActions.js","sourceRoot":"","sources":["../../src/editorActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAkB,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EAEV,UAAU,GACX,MAAM,kBAAkB,CAAC;AAmB1B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B;;;;GAIG;AACH,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAElC,MAAM,UAAU,6BAA6B;IAC3C,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM,EAAW,CAAC;IAEtD,IAAI,YAAY,GAAkC,IAAI,CAAC;IAEvD,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAU;QAC7C,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK;QACnB,MAAM,CAAC,MAAM,EAAE,WAAW;YACxB,KAAK,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