well, that was an easy fix

This commit is contained in:
2025-08-31 17:35:14 +02:00
parent c201327280
commit 14a2f0fbba
2 changed files with 6 additions and 4 deletions

View File

@@ -38,13 +38,15 @@ export default function Editor({
state().markdown.textAt(0).node.textContent = ev.key; state().markdown.textAt(0).node.textContent = ev.key;
} }
useEffect(() => useEffect(() => {
document.addEventListener( document.addEventListener(
"selectionchange", "selectionchange",
(ev) => state().focused && onSelectionChange(ev) (ev) => state().focused && onSelectionChange(ev)
)
); );
state().markdown.node = ref.current;
}, []);
const onFocusChange = (focused: boolean) => { const onFocusChange = (focused: boolean) => {
state().focused = focused; state().focused = focused;
extFocusChange(focused); extFocusChange(focused);

View File

@@ -150,7 +150,7 @@ export class Paragraph extends NodeCollection<Node> {
export class Markdown extends NodeCollection<Paragraph> { export class Markdown extends NodeCollection<Paragraph> {
public lookup: Map<globalThis.Node, Node> = new Map(); public lookup: Map<globalThis.Node, Node> = new Map();
public constructor(element: HTMLDivElement) { public constructor() {
super(0); super(0);
this.NodeCreated.on((node) => { this.NodeCreated.on((node) => {
console.log("created node:", node); console.log("created node:", node);