-
Notifications
You must be signed in to change notification settings - Fork 665
Fix theme persistence in exports and page reloads #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
fix all file exports to have correct theme data fix png and jpg exports to persist current selected theme
}; | ||
setValue(newValue); | ||
|
||
// Only save children and viewport to localforage, not theme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am curious that why not save theme to localforage and save it to localStorage.
I think is ok that save viewport, children, and theme to one place.
}; | ||
|
||
// Fallback theme background colors mapping | ||
const getThemeBackgroundColorFallback = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get the active themeColors data through PlaitBoard.getThemeColors(board);
.
You can encapsulate e method exactly to get the background color of the drawing board in this way.
children: data.children, | ||
viewport: data.viewport, | ||
theme: { themeColorMode: savedTheme || ThemeColorMode.default }, | ||
}); | ||
return; | ||
} | ||
const localData = localStorage.getItem(OLD_DRAWNIX_LOCAL_DATA_KEY); | ||
if (localData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to remove the feedback logic later, so you can ignore it.
}} | ||
afterInit={(board) => { | ||
console.log('board initialized'); | ||
|
||
// Ensure the saved theme is applied after board initialization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the theme could be initialized correctly, whether the logic maybe is unnecessary.
Hi @tarinagarwal ! I had reviewed this pr and there were some suggestions. You can resolve them in your free time. Btw, there is a conflict in app.tsx. |
Hey! @pubuzhixing8 |
2025-08-26.18-06-10.mp4