initial ai assistance
This commit is contained in:
1 parent
1af9ec3172
commit
2e0bf1e88e
24 files changed
+1293
-60
No files matched your search
@@ -81,6 +81,20 @@ function ActionBar({ block }: { block: Block }) {
|
||||
live = false
|
||||
}
|
||||
}, [block.id, ctrl, block.el])
|
||||
// Refresh the position after any edit settles (move, undo/redo, drag) so the arrows' disabled state tracks it.
|
||||
const busy = useEditorState((s) => s.busy)
|
||||
const rev = useEditorState((s) => `${s.canUndo}${s.canRedo}`)
|
||||
useEffect(() => {
|
||||
if (busy) return
|
||||
let live = true
|
||||
ctrl
|
||||
.position(block.id)
|
||||
.then((p) => live && setPos((o) => (o && o.index === p.index && o.count === p.count ? o : p)))
|
||||
.catch(() => {})
|
||||
return () => {
|
||||
live = false
|
||||
}
|
||||
}, [busy, rev, block.id, ctrl])
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
const away = (e: Event) => !e.composedPath().includes(menuRef.current!) && setOpen(false)
|
||||
|
||||
Reference in new issue
Block a user