@trafica/editor 1.0.18 → 1.0.19
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 +22 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styles/editor.css +6 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7881,6 +7881,11 @@ function EditorCore({
|
|
|
7881
7881
|
onJSONChange(jsonSerializer.serialize(state.doc));
|
|
7882
7882
|
}
|
|
7883
7883
|
}, [state.doc]);
|
|
7884
|
+
react.useLayoutEffect(() => {
|
|
7885
|
+
const container = containerRef.current;
|
|
7886
|
+
if (!container || !state.selection) return;
|
|
7887
|
+
restoreSelection(container, state.selection);
|
|
7888
|
+
}, [state.selection]);
|
|
7884
7889
|
react.useEffect(() => {
|
|
7885
7890
|
const container = containerRef.current;
|
|
7886
7891
|
if (!container || readOnly) return;
|
|
@@ -7908,6 +7913,19 @@ function EditorCore({
|
|
|
7908
7913
|
}
|
|
7909
7914
|
}
|
|
7910
7915
|
}, [tableSelection, state.doc]);
|
|
7916
|
+
react.useEffect(() => {
|
|
7917
|
+
const container = containerRef.current;
|
|
7918
|
+
if (!container) return;
|
|
7919
|
+
container.querySelectorAll(".editor-cell-active").forEach((el) => {
|
|
7920
|
+
el.classList.remove("editor-cell-active");
|
|
7921
|
+
});
|
|
7922
|
+
if (!inTableCellPos) return;
|
|
7923
|
+
const cellPath = [...inTableCellPos.tablePath, inTableCellPos.row, inTableCellPos.col];
|
|
7924
|
+
const td = container.querySelector(
|
|
7925
|
+
`[data-block-path="${JSON.stringify(cellPath)}"]`
|
|
7926
|
+
);
|
|
7927
|
+
if (td) td.classList.add("editor-cell-active");
|
|
7928
|
+
}, [inTableCellPos, state.doc]);
|
|
7911
7929
|
react.useEffect(() => {
|
|
7912
7930
|
const onSelectionChange = () => {
|
|
7913
7931
|
if (isRenderingRef.current) return;
|
|
@@ -8018,6 +8036,9 @@ function EditorCore({
|
|
|
8018
8036
|
}
|
|
8019
8037
|
return;
|
|
8020
8038
|
}
|
|
8039
|
+
if (findCellPosition(doc, sel.anchor.path)) {
|
|
8040
|
+
e.preventDefault();
|
|
8041
|
+
}
|
|
8021
8042
|
}
|
|
8022
8043
|
}
|
|
8023
8044
|
const handled = engine.handleKeyDown(
|
|
@@ -8551,7 +8572,7 @@ function leafTextNode(el, end) {
|
|
|
8551
8572
|
function prettyPrintHTML(html) {
|
|
8552
8573
|
const blockOpen = new RegExp(`(<(?:${BLOCK_TAGS})(?:\\s[^>]*)?>)`, "gi");
|
|
8553
8574
|
const blockClose = new RegExp(`(<\\/(?:${BLOCK_TAGS})>)`, "gi");
|
|
8554
|
-
const spread = html.replace(blockOpen, "\n$1
|
|
8575
|
+
const spread = html.replace(blockOpen, "\n$1").replace(blockClose, "$1\n").replace(/<hr(\s[^>]*)?\/?>(\s*)/gi, "\n<hr />\n");
|
|
8555
8576
|
let depth = 0;
|
|
8556
8577
|
const result = [];
|
|
8557
8578
|
for (const raw of spread.split("\n")) {
|