mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-27 00:30:09 +02:00
retain console open state on refreshes. fixes #435
This commit is contained in:
@@ -15,6 +15,7 @@ import { Console } from './Console';
|
|||||||
import CssSettingsModal from './CssSettingsModal';
|
import CssSettingsModal from './CssSettingsModal';
|
||||||
import { PreviewDimension } from './PreviewDimension.jsx';
|
import { PreviewDimension } from './PreviewDimension.jsx';
|
||||||
import Modal from './Modal.jsx';
|
import Modal from './Modal.jsx';
|
||||||
|
import { LocalStorageKeys } from '../constants.js';
|
||||||
const minCodeWrapSize = 33;
|
const minCodeWrapSize = 33;
|
||||||
|
|
||||||
/* global htmlCodeEl
|
/* global htmlCodeEl
|
||||||
@@ -24,7 +25,9 @@ export default class ContentWrap extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
isConsoleOpen: false,
|
isConsoleOpen:
|
||||||
|
window.localStorage.getItem(LocalStorageKeys.WAS_CONSOLE_OPEN) ===
|
||||||
|
'true',
|
||||||
isCssSettingsModalOpen: false,
|
isCssSettingsModalOpen: false,
|
||||||
isPreviewNotWorkingModalVisible: false,
|
isPreviewNotWorkingModalVisible: false,
|
||||||
logs: []
|
logs: []
|
||||||
@@ -574,8 +577,10 @@ export default class ContentWrap extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggleConsole() {
|
toggleConsole() {
|
||||||
this.setState({ isConsoleOpen: !this.state.isConsoleOpen });
|
const newValue = !this.state.isConsoleOpen;
|
||||||
|
this.setState({ isConsoleOpen: newValue });
|
||||||
trackEvent('ui', 'consoleToggle');
|
trackEvent('ui', 'consoleToggle');
|
||||||
|
window.localStorage.setItem(LocalStorageKeys.WAS_CONSOLE_OPEN, newValue);
|
||||||
}
|
}
|
||||||
consoleHeaderDblClickHandler(e) {
|
consoleHeaderDblClickHandler(e) {
|
||||||
if (!e.target.classList.contains('js-console__header')) {
|
if (!e.target.classList.contains('js-console__header')) {
|
||||||
|
@@ -68,15 +68,12 @@ import {
|
|||||||
import { commandPaletteService } from '../commandPaletteService';
|
import { commandPaletteService } from '../commandPaletteService';
|
||||||
|
|
||||||
import { I18nProvider } from '@lingui/react';
|
import { I18nProvider } from '@lingui/react';
|
||||||
|
import { LocalStorageKeys } from '../constants.js';
|
||||||
|
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
require('preact/debug');
|
require('preact/debug');
|
||||||
}
|
}
|
||||||
|
|
||||||
const LocalStorageKeys = {
|
|
||||||
LOGIN_AND_SAVE_MESSAGE_SEEN: 'loginAndsaveMessageSeen',
|
|
||||||
ASKED_TO_IMPORT_CREATIONS: 'askedToImportCreations'
|
|
||||||
};
|
|
||||||
const UNSAVED_WARNING_COUNT = 15;
|
const UNSAVED_WARNING_COUNT = 15;
|
||||||
const version = '5.0.3';
|
const version = '5.0.3';
|
||||||
|
|
||||||
|
5
src/constants.js
Normal file
5
src/constants.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export const LocalStorageKeys = {
|
||||||
|
LOGIN_AND_SAVE_MESSAGE_SEEN: 'loginAndsaveMessageSeen',
|
||||||
|
ASKED_TO_IMPORT_CREATIONS: 'askedToImportCreations',
|
||||||
|
WAS_CONSOLE_OPEN: 'wasConsoleOpen'
|
||||||
|
};
|
Reference in New Issue
Block a user