@maily-to/core 2.0.0-beta.17 → 2.0.0-beta.18

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.cjs CHANGED
@@ -4822,8 +4822,14 @@ function DragContextMenu(props) {
4822
4822
  setIsVisibilityOpen(false);
4823
4823
  onOpenChange(nextOpen);
4824
4824
  };
4825
+ const isKeyboardOnTriggerRef = (0, react.useRef)(false);
4825
4826
  const getInitialFocus = (openType) => {
4826
- return openSourceRef.current === "shortcut" || openType === "keyboard";
4827
+ const isShortcut = openSourceRef.current === "shortcut";
4828
+ isKeyboardOnTriggerRef.current = !isShortcut && openType === "keyboard";
4829
+ return isShortcut || openType === "keyboard";
4830
+ };
4831
+ const getFinalFocus = () => {
4832
+ return isKeyboardOnTriggerRef.current || editor.view.dom;
4827
4833
  };
4828
4834
  const handleItemsKeyDown = (event) => {
4829
4835
  if (!NAVIGATION_KEYS.includes(event.key)) return;
@@ -5039,7 +5045,7 @@ function DragContextMenu(props) {
5039
5045
  side: "bottom",
5040
5046
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverPopup, {
5041
5047
  "data-variant": "drag-context",
5042
- finalFocus: () => editor.view.dom,
5048
+ finalFocus: getFinalFocus,
5043
5049
  initialFocus: getInitialFocus,
5044
5050
  children: [
5045
5051
  isFontStyleOpen && nodeType ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FontStyleConfig, {
package/dist/index.mjs CHANGED
@@ -4833,8 +4833,14 @@ function DragContextMenu(props) {
4833
4833
  setIsVisibilityOpen(false);
4834
4834
  onOpenChange(nextOpen);
4835
4835
  };
4836
+ const isKeyboardOnTriggerRef = useRef(false);
4836
4837
  const getInitialFocus = (openType) => {
4837
- return openSourceRef.current === "shortcut" || openType === "keyboard";
4838
+ const isShortcut = openSourceRef.current === "shortcut";
4839
+ isKeyboardOnTriggerRef.current = !isShortcut && openType === "keyboard";
4840
+ return isShortcut || openType === "keyboard";
4841
+ };
4842
+ const getFinalFocus = () => {
4843
+ return isKeyboardOnTriggerRef.current || editor.view.dom;
4838
4844
  };
4839
4845
  const handleItemsKeyDown = (event) => {
4840
4846
  if (!NAVIGATION_KEYS.includes(event.key)) return;
@@ -5050,7 +5056,7 @@ function DragContextMenu(props) {
5050
5056
  side: "bottom",
5051
5057
  children: /* @__PURE__ */ jsxs(PopoverPopup, {
5052
5058
  "data-variant": "drag-context",
5053
- finalFocus: () => editor.view.dom,
5059
+ finalFocus: getFinalFocus,
5054
5060
  initialFocus: getInitialFocus,
5055
5061
  children: [
5056
5062
  isFontStyleOpen && nodeType ? /* @__PURE__ */ jsx(FontStyleConfig, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maily-to/core",
3
- "version": "2.0.0-beta.17",
3
+ "version": "2.0.0-beta.18",
4
4
  "private": false,
5
5
  "description": "Powerful editor for creating beautiful, pre-designed, mobile-ready emails.",
6
6
  "keywords": [
@@ -87,7 +87,7 @@
87
87
  "lucide-react": "^1.28.0",
88
88
  "unit-field": "^0.0.3",
89
89
  "zustand": "^5.0.14",
90
- "@maily-to/shared": "2.0.0-beta.17"
90
+ "@maily-to/shared": "2.0.0-beta.18"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@react-email/components": "^1.0.12",
@@ -110,7 +110,7 @@
110
110
  "@maily-to/extension-ai-actions": "0.0.1",
111
111
  "@maily-to/extension-inline-suggestion": "0.0.1",
112
112
  "@maily-to/extension-variable": "0.0.1",
113
- "@maily-to/render": "2.0.0-beta.17",
113
+ "@maily-to/render": "2.0.0-beta.18",
114
114
  "@maily-to/tsconfig": "0.0.0"
115
115
  },
116
116
  "peerDependencies": {