well, that was an easy fix
This commit is contained in:
@@ -38,12 +38,14 @@ export default function Editor({
|
||||
state().markdown.textAt(0).node.textContent = ev.key;
|
||||
}
|
||||
|
||||
useEffect(() =>
|
||||
useEffect(() => {
|
||||
document.addEventListener(
|
||||
"selectionchange",
|
||||
(ev) => state().focused && onSelectionChange(ev)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
state().markdown.node = ref.current;
|
||||
}, []);
|
||||
|
||||
const onFocusChange = (focused: boolean) => {
|
||||
state().focused = focused;
|
||||
|
||||
@@ -150,7 +150,7 @@ export class Paragraph extends NodeCollection<Node> {
|
||||
export class Markdown extends NodeCollection<Paragraph> {
|
||||
public lookup: Map<globalThis.Node, Node> = new Map();
|
||||
|
||||
public constructor(element: HTMLDivElement) {
|
||||
public constructor() {
|
||||
super(0);
|
||||
this.NodeCreated.on((node) => {
|
||||
console.log("created node:", node);
|
||||
|
||||
Reference in New Issue
Block a user