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