@humandialog/forms.svelte 1.2.3 → 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
- show_command_palette();
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
  },
@@ -360,6 +361,23 @@ function prepareFullImagePath(url) {
360
361
  fullPath += "=" + param.value;
361
362
  }
362
363
  }
364
+ } else {
365
+ const user = $session.localDevCurrentUser;
366
+ if (user) {
367
+ if (fullPath.includes("?")) {
368
+ fullPath += "&";
369
+ } else {
370
+ fullPath += "?";
371
+ }
372
+ if (user.uid > 0)
373
+ fullPath += "x-reef-user-id=" + user.uid;
374
+ else
375
+ fullPath += "x-reef-as-user=" + user.username;
376
+ if (user.role)
377
+ fullPath += "&x-reef-access-role=" + user.role;
378
+ if (user.groupId)
379
+ fullPath += "&x-reef-group-id=" + user.groupId;
380
+ }
363
381
  }
364
382
  return fullPath;
365
383
  }
@@ -511,8 +529,8 @@ function on_palette_shown() {
511
529
  function on_palette_hidden() {
512
530
  is_command_palette_visible = false;
513
531
  }
514
- function show_command_palette() {
515
- let rect = get_selection_bbox();
532
+ function show_command_palette(cursorRect) {
533
+ let rect = cursorRect;
516
534
  let client_rect = get_window_box();
517
535
  let top_space = rect.y;
518
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 toolboxElement;
33
+ let paletteElement;
35
34
  afterUpdate(
36
35
  async () => {
37
- if (isToolbox && visible && toolboxElement) {
36
+ if (
37
+ /*isToolbox && */
38
+ visible && paletteElement
39
+ ) {
38
40
  let layoutRoot = document.getElementById("__hd_svelte_layout_root");
39
- if (!!layoutRoot && toolboxElement.parentElement != layoutRoot) {
41
+ if (!!layoutRoot && paletteElement.parentElement != layoutRoot) {
40
42
  await tick();
41
- layoutRoot.appendChild(toolboxElement);
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={toolboxElement}>
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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",