@baasix/lexical 0.0.4 → 0.0.5
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/{ExcalidrawComponent-GZYLHNOY.js → ExcalidrawComponent-MA23PUNN.js} +113 -12
- package/dist/ExcalidrawComponent-MA23PUNN.js.map +1 -0
- package/dist/{chunk-N22RKA5D.js → chunk-RIV43XYA.js} +15 -14
- package/dist/chunk-RIV43XYA.js.map +1 -0
- package/dist/index.css +107 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +15 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/ExcalidrawComponent-GZYLHNOY.js.map +0 -1
- package/dist/chunk-N22RKA5D.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
ExcalidrawModal,
|
|
35
35
|
ExcalidrawNode,
|
|
36
36
|
Modal
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-RIV43XYA.js";
|
|
38
38
|
import {
|
|
39
39
|
$createPollNode,
|
|
40
40
|
PollNode,
|
|
@@ -15963,15 +15963,15 @@ function HtmlPlugin({
|
|
|
15963
15963
|
debounceMs = 300
|
|
15964
15964
|
}) {
|
|
15965
15965
|
const [editor] = useLexicalComposerContext46();
|
|
15966
|
-
const
|
|
15967
|
-
const
|
|
15966
|
+
const lastSyncedValue = useRef18(null);
|
|
15967
|
+
const hasUserEdited = useRef18(false);
|
|
15968
15968
|
const debounceTimer = useRef18(null);
|
|
15969
15969
|
useEffect46(() => {
|
|
15970
|
-
if (
|
|
15971
|
-
isInternalChange.current = false;
|
|
15970
|
+
if (value === lastSyncedValue.current) {
|
|
15972
15971
|
return;
|
|
15973
15972
|
}
|
|
15974
|
-
|
|
15973
|
+
lastSyncedValue.current = value;
|
|
15974
|
+
hasUserEdited.current = false;
|
|
15975
15975
|
editor.update(
|
|
15976
15976
|
() => {
|
|
15977
15977
|
$setSelection7(null);
|
|
@@ -15991,18 +15991,23 @@ function HtmlPlugin({
|
|
|
15991
15991
|
);
|
|
15992
15992
|
}, [editor, value]);
|
|
15993
15993
|
const handleChange = useCallback26(
|
|
15994
|
-
(_editorState) => {
|
|
15994
|
+
(_editorState, _editor, tags) => {
|
|
15995
|
+
if (!tags.has("historic")) {
|
|
15996
|
+
hasUserEdited.current = true;
|
|
15997
|
+
}
|
|
15995
15998
|
if (debounceTimer.current) {
|
|
15996
15999
|
clearTimeout(debounceTimer.current);
|
|
15997
16000
|
}
|
|
15998
16001
|
debounceTimer.current = setTimeout(() => {
|
|
15999
16002
|
editor.update(() => {
|
|
16000
16003
|
const html = $generateHtmlFromNodes(editor);
|
|
16001
|
-
if (html ===
|
|
16004
|
+
if (html === lastSyncedValue.current) {
|
|
16005
|
+
return;
|
|
16006
|
+
}
|
|
16007
|
+
if (!hasUserEdited.current) {
|
|
16002
16008
|
return;
|
|
16003
16009
|
}
|
|
16004
|
-
|
|
16005
|
-
lastExternalValue.current = html;
|
|
16010
|
+
lastSyncedValue.current = html;
|
|
16006
16011
|
onChange(html);
|
|
16007
16012
|
});
|
|
16008
16013
|
}, debounceMs);
|