feat(editor): sync export theme with ui theme (#10903)
This commit is contained in:
@@ -595,6 +595,7 @@ const gesture: Gesture = {
|
||||
class App extends React.Component<AppProps, AppState> {
|
||||
canvas: AppClassProperties["canvas"];
|
||||
interactiveCanvas: AppClassProperties["interactiveCanvas"] = null;
|
||||
public sessionExportThemeOverride: AppState["theme"] | undefined;
|
||||
rc: RoughCanvas;
|
||||
unmounted: boolean = false;
|
||||
actionManager: ActionManager;
|
||||
@@ -710,6 +711,7 @@ class App extends React.Component<AppProps, AppState> {
|
||||
this.state = {
|
||||
...defaultAppState,
|
||||
theme,
|
||||
exportWithDarkMode: theme === THEME.DARK,
|
||||
isLoading: true,
|
||||
...this.getCanvasOffsets(),
|
||||
viewModeEnabled,
|
||||
@@ -3241,6 +3243,13 @@ class App extends React.Component<AppProps, AppState> {
|
||||
const elements = this.scene.getElementsIncludingDeleted();
|
||||
const elementsMap = this.scene.getElementsMapIncludingDeleted();
|
||||
|
||||
const shouldExportWithDarkMode =
|
||||
(this.sessionExportThemeOverride ?? this.state.theme) === THEME.DARK;
|
||||
|
||||
if (this.state.exportWithDarkMode !== shouldExportWithDarkMode) {
|
||||
this.setState({ exportWithDarkMode: shouldExportWithDarkMode });
|
||||
}
|
||||
|
||||
if (!this.state.showWelcomeScreen && !elements.length) {
|
||||
this.setState({ showWelcomeScreen: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user