@tarviks/lexical-rich-editor 1.0.2 → 1.0.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/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -6450,7 +6450,8 @@ function WordCountPlugin({ onCountChange }) {
|
|
|
6450
6450
|
function FocusEventsPlugin({
|
|
6451
6451
|
onFocus,
|
|
6452
6452
|
onBlur,
|
|
6453
|
-
setFocused
|
|
6453
|
+
setFocused,
|
|
6454
|
+
containerRef
|
|
6454
6455
|
}) {
|
|
6455
6456
|
const [editor] = useLexicalComposerContext();
|
|
6456
6457
|
useEffect(() => {
|
|
@@ -6462,7 +6463,8 @@ function FocusEventsPlugin({
|
|
|
6462
6463
|
};
|
|
6463
6464
|
const handleFocusOut = (e) => {
|
|
6464
6465
|
const next = e.relatedTarget;
|
|
6465
|
-
const
|
|
6466
|
+
const container = containerRef.current;
|
|
6467
|
+
const stillInside = !!next && (container ? container.contains(next) : root.contains(next));
|
|
6466
6468
|
if (stillInside) return;
|
|
6467
6469
|
editor.update(() => {
|
|
6468
6470
|
$setSelection(null);
|
|
@@ -6476,7 +6478,7 @@ function FocusEventsPlugin({
|
|
|
6476
6478
|
root.removeEventListener("focusin", handleFocusIn);
|
|
6477
6479
|
root.removeEventListener("focusout", handleFocusOut);
|
|
6478
6480
|
};
|
|
6479
|
-
}, [editor, onBlur, onFocus, setFocused]);
|
|
6481
|
+
}, [editor, onBlur, onFocus, setFocused, containerRef]);
|
|
6480
6482
|
return null;
|
|
6481
6483
|
}
|
|
6482
6484
|
var URL_REGEX = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/;
|
|
@@ -6596,6 +6598,7 @@ var ContentEditorComponent = forwardRef(
|
|
|
6596
6598
|
const setFocused = (focused) => {
|
|
6597
6599
|
focusedRef.current = focused;
|
|
6598
6600
|
};
|
|
6601
|
+
const containerRef = useRef(null);
|
|
6599
6602
|
const onAnchorRef = (elem) => {
|
|
6600
6603
|
if (elem) setFloatingAnchorElem(elem);
|
|
6601
6604
|
};
|
|
@@ -6681,7 +6684,7 @@ var ContentEditorComponent = forwardRef(
|
|
|
6681
6684
|
previousOverLimitRef.current = isOverLimit;
|
|
6682
6685
|
}
|
|
6683
6686
|
}, [isOverLimit, wordCount, props.wordLimit, props.onWordLimitExceeded]);
|
|
6684
|
-
return /* @__PURE__ */ jsx(FluentProvider, { theme: webLightTheme, style: { height: "100%" }, children: /* @__PURE__ */ jsx(LexicalComposer, { initialConfig, children: /* @__PURE__ */ jsxs(
|
|
6687
|
+
return /* @__PURE__ */ jsx(FluentProvider, { theme: webLightTheme, style: { height: "100%" }, children: /* @__PURE__ */ jsx(LexicalComposer, { initialConfig, children: /* @__PURE__ */ jsx("div", { ref: containerRef, style: { height: "100%" }, children: /* @__PURE__ */ jsxs(
|
|
6685
6688
|
Stack,
|
|
6686
6689
|
{
|
|
6687
6690
|
style: {
|
|
@@ -6792,7 +6795,8 @@ var ContentEditorComponent = forwardRef(
|
|
|
6792
6795
|
{
|
|
6793
6796
|
onFocus: props.onFocus,
|
|
6794
6797
|
onBlur: props.onBlur,
|
|
6795
|
-
setFocused
|
|
6798
|
+
setFocused,
|
|
6799
|
+
containerRef
|
|
6796
6800
|
}
|
|
6797
6801
|
),
|
|
6798
6802
|
props.autoFocus && !isReadOnly && /* @__PURE__ */ jsx(AutoFocusPlugin, {}),
|
|
@@ -6855,7 +6859,7 @@ var ContentEditorComponent = forwardRef(
|
|
|
6855
6859
|
)
|
|
6856
6860
|
]
|
|
6857
6861
|
}
|
|
6858
|
-
) }) });
|
|
6862
|
+
) }) }) });
|
|
6859
6863
|
}
|
|
6860
6864
|
);
|
|
6861
6865
|
|