@humandialog/forms.svelte 1.2.4 → 1.2.5
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.
|
@@ -133,7 +133,8 @@ const suggestion = {
|
|
|
133
133
|
if (!props.clientRect) {
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
const cursorRect = props.clientRect();
|
|
137
|
+
show_command_palette(cursorRect);
|
|
137
138
|
palette.set_current_editor_range(props.range);
|
|
138
139
|
palette.filter("");
|
|
139
140
|
},
|
|
@@ -528,8 +529,8 @@ function on_palette_shown() {
|
|
|
528
529
|
function on_palette_hidden() {
|
|
529
530
|
is_command_palette_visible = false;
|
|
530
531
|
}
|
|
531
|
-
function show_command_palette() {
|
|
532
|
-
let rect =
|
|
532
|
+
function show_command_palette(cursorRect) {
|
|
533
|
+
let rect = cursorRect;
|
|
533
534
|
let client_rect = get_window_box();
|
|
534
535
|
let top_space = rect.y;
|
|
535
536
|
let bottom_space = client_rect.height - (rect.y + rect.height);
|
|
@@ -26,19 +26,21 @@ export function showAsToolbox(rect) {
|
|
|
26
26
|
const windowWidth = window.innerWidth - 2 * margin;
|
|
27
27
|
toolboxX = margin;
|
|
28
28
|
toolboxY = rect.bottom + margin;
|
|
29
|
-
const mainContentDiv = document.getElementById("__hd_svelte_main_content_container");
|
|
30
29
|
toolboxY += window.scrollY;
|
|
31
30
|
css_style = `position: absolute; left:${toolboxX}px; top:${toolboxY}px;`;
|
|
32
31
|
dispatch("palette_shown");
|
|
33
32
|
}
|
|
34
|
-
let
|
|
33
|
+
let paletteElement;
|
|
35
34
|
afterUpdate(
|
|
36
35
|
async () => {
|
|
37
|
-
if (
|
|
36
|
+
if (
|
|
37
|
+
/*isToolbox && */
|
|
38
|
+
visible && paletteElement
|
|
39
|
+
) {
|
|
38
40
|
let layoutRoot = document.getElementById("__hd_svelte_layout_root");
|
|
39
|
-
if (!!layoutRoot &&
|
|
41
|
+
if (!!layoutRoot && paletteElement.parentElement != layoutRoot) {
|
|
40
42
|
await tick();
|
|
41
|
-
layoutRoot.appendChild(
|
|
43
|
+
layoutRoot.appendChild(paletteElement);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
}
|
|
@@ -181,7 +183,7 @@ function mouseup(e) {
|
|
|
181
183
|
on:touchstart={mousedown}
|
|
182
184
|
on:touchmove={mousemove}
|
|
183
185
|
on:touchend={mouseup}
|
|
184
|
-
bind:this={
|
|
186
|
+
bind:this={paletteElement}>
|
|
185
187
|
{#if filtered_commands && filtered_commands.length}
|
|
186
188
|
{#each filtered_commands as cmd, idx (cmd.caption)}
|
|
187
189
|
{@const id = "cpi_" + idx}
|
|
@@ -208,7 +210,8 @@ function mouseup(e) {
|
|
|
208
210
|
{:else}
|
|
209
211
|
<div class="not-prose bg-white dark:bg-stone-800 text-stone-500 dark:text-stone-400 rounded-lg border border-stone-200 dark:border-stone-700 shadow-md z-30"
|
|
210
212
|
hidden={!visible}
|
|
211
|
-
style={css_style}
|
|
213
|
+
style={css_style}
|
|
214
|
+
bind:this={paletteElement}>
|
|
212
215
|
{#if filtered_commands && filtered_commands.length}
|
|
213
216
|
{#each filtered_commands as cmd, idx (cmd.caption)}
|
|
214
217
|
{@const id = "cpi_" + idx}
|