diff --git a/src/ui/CustomContextMenu.tsx b/src/ui/CustomContextMenu.tsx index e6c5ab5..dc4b3b8 100644 --- a/src/ui/CustomContextMenu.tsx +++ b/src/ui/CustomContextMenu.tsx @@ -203,7 +203,7 @@ export function CustomContextMenu(props: TLUiContextMenuProps) { /> - - + {/* TODO: FIX & IMPLEMENT BROADCASTING*/} + {/* { - const otherUsers = Array.from(editor.store.allRecords()).filter( - (record) => - record.typeName === "instance_presence" && - record.id !== editor.user.getId(), - ) - otherUsers.forEach((user) => editor.startFollowingUser(user.id)) + editor.markHistoryStoppingPoint('start-broadcast') + editor.updateInstanceState({ isBroadcasting: true }) + const url = new URL(window.location.href) + url.searchParams.set("followId", editor.user.getId()) + window.history.replaceState(null, "", url.toString()) }} /> { - const otherUsers = Array.from(editor.store.allRecords()).filter( - (record) => - record.typeName === "instance_presence" && - record.id !== editor.user.getId(), - ) - otherUsers.forEach((_user) => editor.stopFollowingUser()) + editor.markHistoryStoppingPoint('stop-broadcast') + editor.updateInstanceState({ isBroadcasting: false }) + editor.stopFollowingUser() + const url = new URL(window.location.href) + url.searchParams.delete("followId") + window.history.replaceState(null, "", url.toString()) }} /> - + */} { - const shape = editor.getShapeAtPoint(info.point) - if (shape?.type === "Embed") { - // Let the Embed shape handle its own double-click behavior - const util = editor.getShapeUtil(shape) as EmbedShape - util?.onDoubleClick?.(shape as IEmbedShape) - return - } + // onDoubleClick: (info: any) => { + // const shape = editor.getShapeAtPoint(info.point) + // if (shape?.type === "Embed") { + // // Let the Embed shape handle its own double-click behavior + // const util = editor.getShapeUtil(shape) as EmbedShape + // util?.onDoubleClick?.(shape as IEmbedShape) + // return true + // } - // Handle all pointer types (mouse, touch, pen) - const point = info.point || (info.touches && info.touches[0]) || info + // // Handle all pointer types (mouse, touch, pen) + // const point = info.point || (info.touches && info.touches[0]) || info - // Zoom in at the clicked/touched point - editor.zoomIn(point, { animation: { duration: 200 } }) + // // Zoom in at the clicked/touched point + // editor.zoomIn(point, { animation: { duration: 200 } }) - // Stop event propagation and prevent default handling - info.stopPropagation?.() - return false - }, + // // Prevent default text creation + // info.preventDefault?.() + // info.stopPropagation?.() + // return true + // }, + // onDoubleClickCanvas: (info: any) => { + // // Handle all pointer types (mouse, touch, pen) + // const point = info.point || (info.touches && info.touches[0]) || info + + // // Zoom in at the clicked/touched point + // editor.zoomIn(point, { animation: { duration: 200 } }) + + // // Prevent default text creation + // info.preventDefault?.() + // info.stopPropagation?.() + // return true + // }, }, VideoChat: { id: "VideoChat", @@ -276,18 +289,17 @@ export const overrides: TLUiOverrides = { }, }, //TODO: MAKE THIS WORK, ADD USER PERMISSIONING TO JOIN BROADCAST? - broadcastView: { - id: "broadcast-view", - label: "Broadcast View", + startBroadcast: { + id: "start-broadcast", + label: "Start Broadcasting", kbd: "alt+b", readonlyOk: true, onSelect: () => { - const collaborators = editor.getCollaborators() - collaborators - .filter((user) => user.id !== editor.user.getId()) - .forEach((user) => { - editor.startFollowingUser(user.id) - }) + editor.markHistoryStoppingPoint('start-broadcast') + editor.updateInstanceState({ isBroadcasting: true }) + const url = new URL(window.location.href) + url.searchParams.set("followId", editor.user.getId()) + window.history.replaceState(null, "", url.toString()) }, }, stopBroadcast: { @@ -296,7 +308,13 @@ export const overrides: TLUiOverrides = { kbd: "alt+shift+b", readonlyOk: true, onSelect: () => { + editor.updateInstanceState({ isBroadcasting: false }) editor.stopFollowingUser() + + // Remove followId from URL + const url = new URL(window.location.href) + url.searchParams.delete("followId") + window.history.replaceState(null, "", url.toString()) }, }, searchShapes: {