From e984acbd3013bb4013d724ea23b333195dadcce8 Mon Sep 17 00:00:00 2001 From: Judicael <46365844+judicaelandria@users.noreply.github.com> Date: Thu, 25 Aug 2022 18:22:04 +0300 Subject: [PATCH] update alert dialog text --- .../Primitives/AlertDialog/Alert.tsx | 7 ++-- packages/tldraw/src/state/TldrawApp.ts | 38 +++++-------------- packages/tldraw/src/translations/main.json | 2 +- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/packages/tldraw/src/components/Primitives/AlertDialog/Alert.tsx b/packages/tldraw/src/components/Primitives/AlertDialog/Alert.tsx index 064bce86f..4df43d188 100644 --- a/packages/tldraw/src/components/Primitives/AlertDialog/Alert.tsx +++ b/packages/tldraw/src/components/Primitives/AlertDialog/Alert.tsx @@ -32,6 +32,7 @@ const StyledDescription = styled(AlertDialogPrimitive.Description, { textAlign: 'center', minWidth: 0, alignSelf: 'center', + maxWidth: '62%', }) const AlertDialogRoot = AlertDialogPrimitive.Root @@ -53,10 +54,9 @@ export const Alert = ({ container, description, open, onClose }: AlertProps) => {description}
@@ -110,4 +110,5 @@ const Button = styled('button', { color: '$text', cursor: 'pointer', minWidth: 48, + width: 'max-content', }) diff --git a/packages/tldraw/src/state/TldrawApp.ts b/packages/tldraw/src/state/TldrawApp.ts index ec1bf94f1..dc335f2e9 100644 --- a/packages/tldraw/src/state/TldrawApp.ts +++ b/packages/tldraw/src/state/TldrawApp.ts @@ -1367,7 +1367,6 @@ export class TldrawApp extends StateManager { this.resetHistory() this.clearSelectHistory() this.session = undefined - // this set it and set it back to the default document const state = { ...TldrawApp.defaultState, @@ -1399,36 +1398,19 @@ export class TldrawApp extends StateManager { loadDocumentFromURL = (page: TDPage, pageState: Record) => { const { currentPageId } = this const pageId = page.id - const state = { - id: 'create_page', - before: { - appState: { - currentPageId, - }, - document: { - pages: { - [pageId]: undefined, - }, - pageStates: { - [pageId]: undefined, - }, - }, + const nextDocument = { + ...this.state.document, + pageStates: { + ...this.state.document.pageStates, + [pageId]: pageState, }, - after: { - appState: { - currentPageId: page.id, - }, - document: { - pages: { - [pageId]: page, - }, - pageStates: { - [pageId]: pageState, - }, - }, + pages: { + ...this.document.pages, + [pageId]: page, }, } - return this.setState(state) + this.loadDocument(nextDocument as TDDocument) + this.persist({}) } // Should we move this to the app layer? onSave, onSaveAs, etc? diff --git a/packages/tldraw/src/translations/main.json b/packages/tldraw/src/translations/main.json index cffd9441f..3f465004f 100644 --- a/packages/tldraw/src/translations/main.json +++ b/packages/tldraw/src/translations/main.json @@ -121,7 +121,7 @@ "share": "Share", "copy.current.page.link": "Copy Current Page Link", "copy.project.link": "Copy Project Link", - "data.too.big.encoded": "Data is too big to be encoded into an URL", + "data.too.big.encoded": "Data is too big to be encoded into an URL. Do not include image or video!", "dialog.save.firsttime": "Do you want to save your current project?", "dialog.save.again": "Do you want to save changes to your current project?", "dialog.cancel": "Cancel",