@themarioga/grid-editor 9.2.0 → 9.2.2
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 +18 -0
- package/dist/grideditor.bundle.min.js +2 -2
- package/dist/grideditor.esm.js +24 -7
- package/dist/grideditor.js +24 -7
- package/dist/grideditor.min.js +1 -1
- package/dist/grideditor.min.js.map +3 -3
- package/package.json +1 -1
- package/src/js/grideditor.js +29 -4
package/package.json
CHANGED
package/src/js/grideditor.js
CHANGED
|
@@ -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',
|
|
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
|
|
@@ -1797,6 +1817,12 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1797
1817
|
|
|
1798
1818
|
if (!helper) { return; }
|
|
1799
1819
|
|
|
1820
|
+
// Where it lands is read before the canvas closes up: the
|
|
1821
|
+
// marker and the opened gaps take room, and once they go the
|
|
1822
|
+
// pointer may be over another region - the bottom of a column
|
|
1823
|
+
// in a tab, say, becomes the column the tabs are in
|
|
1824
|
+
var where = dropPlaceAt(up.pageX, up.pageY);
|
|
1825
|
+
|
|
1800
1826
|
helper.remove();
|
|
1801
1827
|
dom.removeClass(canvas, 'ge-dropping');
|
|
1802
1828
|
hideDropMarker();
|
|
@@ -1814,7 +1840,6 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1814
1840
|
// nothing to swallow: the next click is a click
|
|
1815
1841
|
window.setTimeout(function() { window.removeEventListener('click', swallow, { capture: true }); }, 0);
|
|
1816
1842
|
|
|
1817
|
-
var where = dropPlaceAt(up.pageX, up.pageY);
|
|
1818
1843
|
if (where) { insertFromToolbar(button, where); }
|
|
1819
1844
|
}
|
|
1820
1845
|
|