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;
|
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;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user