tiptap-markdown-react 1.6.0 → 1.6.1

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/dist/index.js CHANGED
@@ -4237,6 +4237,30 @@ const ESCAPE_GUARDS = [
4237
4237
  '[role="listbox"]',
4238
4238
  '[role="menu"]'
4239
4239
  ].join(",");
4240
+ const POPUP_MENU_ROOT = "[data-radix-popper-content-wrapper], .ant-menu-submenu-popup, .ant-dropdown, .ant-select-dropdown, .ant-cascader-menus, .ant-picker-dropdown, .ant-popover";
4241
+ function isShown(el) {
4242
+ let current = el;
4243
+ while (current && current !== document.documentElement) {
4244
+ if (!(current instanceof HTMLElement)) return false;
4245
+ if (current.hidden || current.getAttribute("aria-hidden") === "true") return false;
4246
+ const style = window.getComputedStyle(current);
4247
+ if (style.display === "none" || style.visibility === "hidden") return false;
4248
+ current = current.parentElement;
4249
+ }
4250
+ return true;
4251
+ }
4252
+ function isEscapeLayer(node) {
4253
+ if (!isShown(node)) return false;
4254
+ if (node.getAttribute("role") !== "menu") return true;
4255
+ if (node.closest(POPUP_MENU_ROOT)) return true;
4256
+ if (node.classList.contains("ant-menu-root") || node.closest('nav, [role="navigation"], aside, .ant-layout-sider')) {
4257
+ return false;
4258
+ }
4259
+ return true;
4260
+ }
4261
+ function escapeLayerOpen() {
4262
+ return [...document.querySelectorAll(ESCAPE_GUARDS)].some(isEscapeLayer);
4263
+ }
4240
4264
  let savedBodyOverflow = null;
4241
4265
  function readExplicitTarget(target) {
4242
4266
  if (typeof target === "function") return target();
@@ -4318,7 +4342,7 @@ function useToolbarFullscreen({
4318
4342
  if (!fullscreen) return;
4319
4343
  const onKey = (event) => {
4320
4344
  if (event.key !== "Escape" || isComposingKeyEvent(event)) return;
4321
- if (document.querySelector(ESCAPE_GUARDS)) return;
4345
+ if (escapeLayerOpen()) return;
4322
4346
  if (!editor.isDestroyed && editor.view.dom.classList.contains("tmr-format-painter")) {
4323
4347
  return;
4324
4348
  }