@use-kona/editor 0.1.14 → 0.1.15

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.
@@ -1,4 +1,4 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useLayoutEffect, useRef, useState } from "react";
3
3
  import { createPortal } from "react-dom";
4
4
  import { useReadOnly, useSlateStatic } from "slate-react";
@@ -56,16 +56,24 @@ const Link = (props)=>{
56
56
  /*#__PURE__*/ jsx(InlineChromiumBugfix, {})
57
57
  ]
58
58
  }),
59
- isOpen && /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx("div", {
60
- contentEditable: false,
61
- className: styles_module.hint,
62
- style: style,
63
- onMouseUp: handleMenuClick,
64
- children: renderHint({
65
- getLinkElement,
66
- getUrl,
67
- getEditor
68
- })
59
+ isOpen && /*#__PURE__*/ createPortal(/*#__PURE__*/ jsxs(Fragment, {
60
+ children: [
61
+ /*#__PURE__*/ jsx("div", {
62
+ className: styles_module.backdrop,
63
+ onClick: ()=>setOpen(false)
64
+ }),
65
+ /*#__PURE__*/ jsx("div", {
66
+ contentEditable: false,
67
+ className: styles_module.hint,
68
+ style: style,
69
+ onMouseUp: handleMenuClick,
70
+ children: renderHint({
71
+ getLinkElement,
72
+ getUrl,
73
+ getEditor
74
+ })
75
+ })
76
+ ]
69
77
  }), document.body)
70
78
  ]
71
79
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-kona/editor",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
@@ -74,18 +74,21 @@ export const Link = (props: Props) => {
74
74
  </a>
75
75
  {isOpen &&
76
76
  createPortal(
77
- <div
78
- contentEditable={false}
79
- className={styles.hint}
80
- style={style}
81
- onMouseUp={handleMenuClick}
82
- >
83
- {renderHint({
84
- getLinkElement,
85
- getUrl,
86
- getEditor,
87
- })}
88
- </div>,
77
+ <>
78
+ <div className={styles.backdrop} onClick={() => setOpen(false)} />
79
+ <div
80
+ contentEditable={false}
81
+ className={styles.hint}
82
+ style={style}
83
+ onMouseUp={handleMenuClick}
84
+ >
85
+ {renderHint({
86
+ getLinkElement,
87
+ getUrl,
88
+ getEditor,
89
+ })}
90
+ </div>
91
+ </>,
89
92
  document.body,
90
93
  )}
91
94
  </Component>