@themarioga/grid-editor 9.2.1 → 9.2.3

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
@@ -32,7 +32,7 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "version": "9.2.1",
35
+ "version": "9.2.3",
36
36
  "main": "dist/grideditor.js",
37
37
  "module": "dist/grideditor.esm.js",
38
38
  "types": "dist/grideditor.d.ts",
@@ -1408,15 +1408,35 @@ function build(instance, baseElem, optionsOrMethod) {
1408
1408
  var previewButton = dom.create('<button type="button" class="btn btn-sm btn-primary gm-preview"><i class="bi bi-eye-fill"></i></button>');
1409
1409
  previewButton.setAttribute('title', t('tool.preview'));
1410
1410
  dom.toggleClass(previewButton, 'active btn-danger', previewing);
1411
+ // The look can move the button off the pointer - a scrollbar
1412
+ // goes, the toolbar reflows - and the look put back moves it
1413
+ // under again, over and over. So it holds until the pointer
1414
+ // leaves where the button was when it came in.
1415
+ var hoverRect = null;
1416
+ function endHover(e) {
1417
+ var r = hoverRect;
1418
+ // Out of the window, nothing holds it
1419
+ var outOfWindow = e.currentTarget === document.documentElement;
1420
+ var overButton = e.type === 'pointermove' && previewButton.contains(e.target);
1421
+ if (r && !outOfWindow && (overButton || e.clientX >= r.left && e.clientX < r.right && e.clientY >= r.top && e.clientY < r.bottom)) {
1422
+ document.addEventListener('pointermove', endHover, { signal: lifetime.signal });
1423
+ document.documentElement.addEventListener('mouseleave', endHover, { signal: lifetime.signal });
1424
+ return;
1425
+ }
1426
+ hoverRect = null;
1427
+ document.removeEventListener('pointermove', endHover);
1428
+ document.documentElement.removeEventListener('mouseleave', endHover);
1429
+ if (!previewing) { dom.addClass(canvas, 'ge-editing'); }
1430
+ }
1411
1431
  previewButton.addEventListener('mouseenter', function() {
1432
+ if (hoverRect) { return; }
1433
+ hoverRect = previewButton.getBoundingClientRect();
1412
1434
  dom.removeClass(canvas, 'ge-editing');
1413
1435
  });
1414
1436
  previewButton.addEventListener('click', function() {
1415
1437
  setPreview(!previewing);
1416
1438
  });
1417
- previewButton.addEventListener('mouseleave', function() {
1418
- if (!previewing) { dom.addClass(canvas, 'ge-editing'); }
1419
- });
1439
+ previewButton.addEventListener('mouseleave', endHover);
1420
1440
  btnGroup.appendChild(previewButton);
1421
1441
 
1422
1442
  // Floated right after the source and preview buttons, so it
@@ -41,7 +41,7 @@ export function drawerflowPart(ge) {
41
41
  var node = '.ge-canvas.ge-editing [' + OUT_ATTR + '="' + room + '"]';
42
42
  sheet.appendChild(document.createTextNode(
43
43
  node + ' { border-top-width: ' + room + 'px !important; }\n' +
44
- node + ' > .ge-tools-drawer { top: -' + room + 'px; }\n'
44
+ node + ' > .ge-tools-drawer:not(.ge-code-inline) { top: -' + room + 'px; }\n'
45
45
  ));
46
46
  }
47
47
 
@@ -1555,7 +1555,9 @@ html.ge-sidebar-open {
1555
1555
  border-top-style: solid !important;
1556
1556
  border-top-color: transparent !important;
1557
1557
 
1558
- > .ge-tools-drawer {
1558
+ /* Not a block's html being edited, with the codemirror-inline plugin:
1559
+ a drawer only in name, it stands where the block was, in the flow */
1560
+ > .ge-tools-drawer:not(.ge-code-inline) {
1559
1561
  position: absolute;
1560
1562
  left: 0;
1561
1563
  right: 0;