update tldraw functions
This commit is contained in:
parent
8385e30d25
commit
808b37425a
|
|
@ -223,7 +223,7 @@ export class Drawing extends StateNode {
|
|||
size: "xl",
|
||||
text: gesture.name,
|
||||
color: score_color,
|
||||
},
|
||||
} as any,
|
||||
}
|
||||
if (SHOW_LABELS) {
|
||||
this.editor.createShape(labelShape)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export function Inbox() {
|
|||
text: messageText,
|
||||
align: "start",
|
||||
verticalAlign: "start",
|
||||
},
|
||||
} as any,
|
||||
meta: {
|
||||
id: messageId,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ export class PromptShape extends BaseBoxShapeUtil<IPrompt> {
|
|||
if (isShapeOfType<TLGeoShape>(sourceShape, "geo")) {
|
||||
processedPrompt = processedPrompt.replace(
|
||||
pattern,
|
||||
sourceShape.props.text,
|
||||
(sourceShape.props as any).text,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export function CustomContextMenu(props: TLUiContextMenuProps) {
|
|||
const editor = useEditor()
|
||||
const helpers = useDefaultHelpers()
|
||||
const tools = overrides.tools?.(editor, {}, helpers) ?? {}
|
||||
const customActions = getCustomActions(editor)
|
||||
const customActions = getCustomActions(editor) as any
|
||||
const [selectedShapes, setSelectedShapes] = useState<TLShape[]>([])
|
||||
const [selectedIds, setSelectedIds] = useState<string[]>([])
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export function CustomMainMenu() {
|
|||
};
|
||||
const exportJSON = (editor: Editor) => {
|
||||
const exportName = `props-${Math.round(+new Date() / 1000).toString().slice(5)}`
|
||||
exportAs(Array.from(editor.getCurrentPageShapeIds()), 'json', exportName)
|
||||
exportAs(Array.from(editor.getCurrentPageShapeIds()), 'json' as any, exportName)
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ export const overrides: TLUiOverrides = {
|
|||
const sourceShape = editor.getShape(edge.from)
|
||||
const sourceText =
|
||||
sourceShape && sourceShape.type === "geo"
|
||||
? (sourceShape as TLGeoShape).props.text
|
||||
? ((sourceShape as TLGeoShape).props as any).text
|
||||
: ""
|
||||
|
||||
|
||||
|
|
@ -372,7 +372,7 @@ export const overrides: TLUiOverrides = {
|
|||
props: {
|
||||
...(editor.getShape(edge.to) as TLGeoShape).props,
|
||||
text: partialResponse,
|
||||
},
|
||||
} as any,
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export const multiplayerAssetStore: TLAssetStore = {
|
|||
throw new Error(`Failed to upload asset: ${response.statusText}`)
|
||||
}
|
||||
|
||||
return url
|
||||
return { src: url }
|
||||
},
|
||||
|
||||
resolve(asset) {
|
||||
|
|
|
|||
|
|
@ -200,48 +200,48 @@ const router = AutoRouter<IRequest, [env: Environment, ctx: ExecutionContext]>({
|
|||
})
|
||||
})
|
||||
|
||||
// Automerge routes - these will be used when we switch to Automerge sync
|
||||
.get("/automerge/connect/:roomId", (request, env) => {
|
||||
// Check if this is a WebSocket upgrade request
|
||||
const upgradeHeader = request.headers.get("Upgrade")
|
||||
if (upgradeHeader === "websocket") {
|
||||
const id = env.AUTOMERGE_DURABLE_OBJECT.idFromName(request.params.roomId)
|
||||
const room = env.AUTOMERGE_DURABLE_OBJECT.get(id)
|
||||
return room.fetch(request.url, {
|
||||
headers: request.headers,
|
||||
body: request.body,
|
||||
method: request.method,
|
||||
})
|
||||
}
|
||||
// Automerge routes - disabled for now
|
||||
// .get("/automerge/connect/:roomId", (request, env) => {
|
||||
// // Check if this is a WebSocket upgrade request
|
||||
// const upgradeHeader = request.headers.get("Upgrade")
|
||||
// if (upgradeHeader === "websocket") {
|
||||
// const id = env.AUTOMERGE_DURABLE_OBJECT.idFromName(request.params.roomId)
|
||||
// const room = env.AUTOMERGE_DURABLE_OBJECT.get(id)
|
||||
// return room.fetch(request.url, {
|
||||
// headers: request.headers,
|
||||
// body: request.body,
|
||||
// method: request.method,
|
||||
// })
|
||||
// }
|
||||
//
|
||||
// // Handle regular GET requests
|
||||
// const id = env.AUTOMERGE_DURABLE_OBJECT.idFromName(request.params.roomId)
|
||||
// const room = env.AUTOMERGE_DURABLE_OBJECT.get(id)
|
||||
// return room.fetch(request.url, {
|
||||
// headers: request.headers,
|
||||
// body: request.body,
|
||||
// method: request.method,
|
||||
// })
|
||||
// })
|
||||
|
||||
// Handle regular GET requests
|
||||
const id = env.AUTOMERGE_DURABLE_OBJECT.idFromName(request.params.roomId)
|
||||
const room = env.AUTOMERGE_DURABLE_OBJECT.get(id)
|
||||
return room.fetch(request.url, {
|
||||
headers: request.headers,
|
||||
body: request.body,
|
||||
method: request.method,
|
||||
})
|
||||
})
|
||||
// .get("/automerge/room/:roomId", (request, env) => {
|
||||
// const id = env.AUTOMERGE_DURABLE_OBJECT.idFromName(request.params.roomId)
|
||||
// const room = env.AUTOMERGE_DURABLE_OBJECT.get(id)
|
||||
// return room.fetch(request.url, {
|
||||
// headers: request.headers,
|
||||
// body: request.body,
|
||||
// method: request.method,
|
||||
// })
|
||||
// })
|
||||
|
||||
.get("/automerge/room/:roomId", (request, env) => {
|
||||
const id = env.AUTOMERGE_DURABLE_OBJECT.idFromName(request.params.roomId)
|
||||
const room = env.AUTOMERGE_DURABLE_OBJECT.get(id)
|
||||
return room.fetch(request.url, {
|
||||
headers: request.headers,
|
||||
body: request.body,
|
||||
method: request.method,
|
||||
})
|
||||
})
|
||||
|
||||
.post("/automerge/room/:roomId", async (request, env) => {
|
||||
const id = env.AUTOMERGE_DURABLE_OBJECT.idFromName(request.params.roomId)
|
||||
const room = env.AUTOMERGE_DURABLE_OBJECT.get(id)
|
||||
return room.fetch(request.url, {
|
||||
method: "POST",
|
||||
body: request.body,
|
||||
})
|
||||
})
|
||||
// .post("/automerge/room/:roomId", async (request, env) => {
|
||||
// const id = env.AUTOMERGE_DURABLE_OBJECT.idFromName(request.params.roomId)
|
||||
// const room = env.AUTOMERGE_DURABLE_OBJECT.get(id)
|
||||
// return room.fetch(request.url, {
|
||||
// method: "POST",
|
||||
// body: request.body,
|
||||
// })
|
||||
// })
|
||||
|
||||
.post("/daily/rooms", async (req) => {
|
||||
const apiKey = req.headers.get('Authorization')?.split('Bearer ')[1]
|
||||
|
|
|
|||
Loading…
Reference in New Issue