@innovastudio/contentbuilder 1.5.225 → 1.5.226

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,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@innovastudio/contentbuilder",
4
- "version": "1.5.225",
4
+ "version": "1.5.226",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "types": "index.d.ts",
@@ -21244,7 +21244,18 @@ const renderSnippetPanel = (builder, snippetOpen) => {
21244
21244
  const n = items.findIndex(el => el.offsetTop > top);
21245
21245
  return n === -1 ? items.length : n;
21246
21246
  };
21247
+
21248
+ // A press focuses the list too. Only keyboard focus picks the first thumbnail,
21249
+ // otherwise its scrollIntoView jumps the list to the top under the pointer.
21250
+ let pressed = false;
21251
+ snippetlist.addEventListener('pointerdown', () => {
21252
+ pressed = true;
21253
+ });
21254
+ snippetlist.addEventListener('blur', () => {
21255
+ pressed = false;
21256
+ });
21247
21257
  snippetlist.addEventListener('focus', () => {
21258
+ if (pressed) return;
21248
21259
  if (snippetlist.querySelector('.snippet-item[aria-selected="true"]')) return;
21249
21260
  const items = shownSnippets();
21250
21261
  if (items.length) markActive(items[0]);
@@ -31506,7 +31517,8 @@ class Image$1 {
31506
31517
  imageTool.style.display = 'flex';
31507
31518
  let _toolwidth = imageTool.offsetWidth; //to get value, element must not hidden (display:none). So set display:flex before this.
31508
31519
 
31509
- let w = elm.offsetWidth * scaleX * this.builder.opts.zoom;
31520
+ let w = elm.getBoundingClientRect().width * scaleX; // rendered width: includes a scale on the image itself, on an ancestor (e.g. an animated tile) and the editor zoom
31521
+
31510
31522
  let top = newPos.top + window.pageYOffset;
31511
31523
  let left = newPos.left + window.pageXOffset;
31512
31524
  let toolLeft = left + (w / 2 - _toolwidth / 2);
@@ -31544,12 +31556,11 @@ class Image$1 {
31544
31556
  }
31545
31557
  const newPos = util.getElementPosition(elm);
31546
31558
  let scaleX = newPos.scaleX;
31547
- let extraScaleX = this.getScale(elm).scaleX;
31548
31559
  let extraScaleY = this.getScale(elm).scaleX;
31549
31560
  imageTool.style.display = 'flex';
31550
31561
  let _toolwidth = imageTool.offsetWidth; //to get value, element must not hidden (display:none). So set display:flex before this.
31551
31562
 
31552
- let w = elm.offsetWidth * extraScaleX * scaleX * this.builder.opts.zoom;
31563
+ let w = elm.getBoundingClientRect().width * scaleX; // rendered width: includes a scale on the image itself, on an ancestor (e.g. an animated tile) and the editor zoom
31553
31564
  let h = elm.offsetHeight * extraScaleY * scaleX * this.builder.opts.zoom;
31554
31565
 
31555
31566
  // Compensate for the vertical shift caused by scaling
@@ -31631,24 +31642,21 @@ class Image$1 {
31631
31642
  }
31632
31643
  const newPos = util.getElementPosition(elm);
31633
31644
  let scaleX = newPos.scaleX;
31634
- let extraScaleX = this.getScale(elm).scaleX;
31635
31645
  let extraScaleY = this.getScale(elm).scaleX;
31636
31646
  this.renderTool();
31637
31647
  let imageTool = this.imageTool;
31638
31648
  imageTool.style.display = 'flex';
31639
31649
 
31640
- /* builder.imageToolMinimal => reduce the tool to source changes only:
31641
- hide Link (wraps the image in an anchor) and Edit (image editor).
31642
- Set per click by the caller.
31650
+ /* builder.imageToolMinimal => hide Link, which wraps the image in an
31651
+ anchor. Replace, Browse and Edit (only swaps in an edited copy of
31652
+ the picture) stay. Set per click by the caller.
31643
31653
  Must run BEFORE offsetWidth below, which centers the tool. */
31644
31654
  const minimalTool = this.builder.imageToolMinimal;
31645
31655
  const btnLinkTool = imageTool.querySelector('.image-link');
31646
- const btnEditTool = imageTool.querySelector('.image-edit');
31647
31656
  if (btnLinkTool) btnLinkTool.style.display = minimalTool ? 'none' : '';
31648
- if (btnEditTool) btnEditTool.style.display = minimalTool ? 'none' : '';
31649
31657
  let _toolwidth = imageTool.offsetWidth; //to get value, element must not hidden (display:none). So set display:flex before this.
31650
31658
 
31651
- let w = elm.offsetWidth * extraScaleX * scaleX * this.builder.opts.zoom;
31659
+ let w = elm.getBoundingClientRect().width * scaleX; // rendered width: includes a scale on the image itself, on an ancestor (e.g. an animated tile) and the editor zoom
31652
31660
  let h = elm.offsetHeight * extraScaleY * scaleX * this.builder.opts.zoom;
31653
31661
 
31654
31662
  // Compensate for the vertical shift caused by scaling