r3f: Accept function for objRef like for setState
This commit is contained in:
parent
415e493834
commit
58f04685ad
1 changed files with 4 additions and 1 deletions
|
@ -76,7 +76,10 @@ const createEditable = <Keys extends keyof JSX.IntrinsicElements>(
|
||||||
allRegisteredObjects.add(sheetObject)
|
allRegisteredObjects.add(sheetObject)
|
||||||
setSheetObject(sheetObject)
|
setSheetObject(sheetObject)
|
||||||
|
|
||||||
if (objRef) objRef!.current = sheetObject
|
if (objRef)
|
||||||
|
typeof objRef === 'function'
|
||||||
|
? objRef(sheetObject)
|
||||||
|
: (objRef.current = sheetObject)
|
||||||
|
|
||||||
editorStore.getState().addEditable(storeKey, {
|
editorStore.getState().addEditable(storeKey, {
|
||||||
type: actualType,
|
type: actualType,
|
||||||
|
|
Loading…
Reference in a new issue