@@ -20,7 +20,7 @@ import { IconRotateClockwise } from "@tabler/icons-react";
2020import { CanvasContextMenu , ContainerContentContextMenu } from "./components/ContextMenus" ;
2121import { ContainerRenderer } from "./elements/container/ContainerRenderer" ;
2222import type { ContainerActions } from "./elements/container/containerView" ;
23- import type { ExtensionCommands } from "./extensions/headerControl " ;
23+ import type { ExtensionCommands } from "./extensions/extensionCommands " ;
2424import { ContainerMenu , type ContainerMenuActions } from "./elements/container/ContainerMenu" ;
2525import { asContainerDocumentElement } from "./elements/container/containerViewProjection" ;
2626import { ContainerJsonEditorWindow } from "./components/ContainerJsonEditorWindow" ;
@@ -308,12 +308,6 @@ const createAppMetadata = (data: AppData): AppData => ({
308308
309309type CallbackMap = Record < string , ( ...args : never [ ] ) => unknown > ;
310310
311- /** Null when no checkbox extension is installed on the card. */
312- const textCardChecked = ( card : TextCardElement ) => {
313- const checkbox = card . extensions ?. checkbox ;
314- return checkbox ? Boolean ( checkbox . checked ) : null ;
315- } ;
316-
317311const useStableCallbacks = < T extends CallbackMap > ( callbacks : T ) : T => {
318312 const callbacksRef = useRef < T | null > ( callbacks ) ;
319313 const stableCallbacksRef = useRef < T | null > ( null ) ;
@@ -6436,7 +6430,6 @@ function App({
64366430 onCancel : canvasNodeActions . cancelTextCardEdit ,
64376431 onStartMove : canvasNodeActions . startTextCardMove ,
64386432 onOpenMenu : canvasNodeActions . openTextCardMenu ,
6439- onToggleCheckbox : canvasNodeActions . toggleTextCardCheckbox ,
64406433 onSizeChange : rememberTextCardSize ,
64416434 } ) ,
64426435 [ canvasNodeActions , rememberTextCardSize ] ,
@@ -6465,8 +6458,11 @@ function App({
64656458 if ( textBlock ) action ( textBlock ) ;
64666459 } ;
64676460 const extensionCommands : ExtensionCommands = useStableCallbacks ( {
6468- toggle : ( extension : "lock" | "privacy" , elementId : string ) =>
6469- extension === "lock" ? toggleLockExtension ( elementId ) : togglePrivacyExtension ( elementId ) ,
6461+ toggle : ( extension : "lock" | "privacy" | "checkbox" , elementId : string ) => {
6462+ if ( extension === "lock" ) toggleLockExtension ( elementId ) ;
6463+ else if ( extension === "privacy" ) togglePrivacyExtension ( elementId ) ;
6464+ else toggleTextCardCheckbox ( elementId ) ;
6465+ } ,
64706466 updateAccent : ( elementId : string , accent : string ) =>
64716467 containersById . has ( elementId )
64726468 ? updateContainerAccent ( elementId , accent )
@@ -7166,9 +7162,10 @@ function App({
71667162 key = { card . id }
71677163 element = { cardElement }
71687164 actions = { textCardActions }
7165+ extensionCommands = { extensionCommands }
71697166 view = { {
71707167 layer : card . layer ?? 0 ,
7171- checked : textCardChecked ( card ) ,
7168+ extensions : card . extensions ,
71727169 editing : editingTextCardId === card . id ,
71737170 draft : editingTextCardId === card . id ? textCardDraft : "" ,
71747171 position,
@@ -7250,9 +7247,10 @@ function App({
72507247 key = { card . id }
72517248 element = { cardElement }
72527249 actions = { textCardActions }
7250+ extensionCommands = { extensionCommands }
72537251 view = { {
72547252 layer : card . layer ?? 0 ,
7255- checked : textCardChecked ( card ) ,
7253+ extensions : card . extensions ,
72567254 editing : editingTextCardId === card . id ,
72577255 draft : editingTextCardId === card . id ? textCardDraft : "" ,
72587256 position : getTextCardRenderPosition ( card ) ,
@@ -7348,9 +7346,10 @@ function App({
73487346 key = { `drag-overlay-${ id } ` }
73497347 element = { cardElement }
73507348 actions = { textCardActions }
7349+ extensionCommands = { extensionCommands }
73517350 view = { {
73527351 layer : card . layer ?? 0 ,
7353- checked : textCardChecked ( card ) ,
7352+ extensions : card . extensions ,
73547353 editing : false ,
73557354 draft : "" ,
73567355 position,
@@ -7392,9 +7391,10 @@ function App({
73927391 key = { `release-overlay-${ card . id } ` }
73937392 element = { cardElement }
73947393 actions = { textCardActions }
7394+ extensionCommands = { extensionCommands }
73957395 view = { {
73967396 layer : card . layer ?? 0 ,
7397- checked : textCardChecked ( card ) ,
7397+ extensions : card . extensions ,
73987398 editing : false ,
73997399 draft : "" ,
74007400 position : textCardInteractionSnapshot . release ?. active ? to : from ,
0 commit comments