1
+ /* eslint-env browser */
1
2
/* global CodeMirror, $, editor, Cookies */
2
3
import { options , Alignment , FormatType } from '@susisu/mte-kernel'
3
4
import debounce from 'lodash/debounce'
@@ -13,7 +14,7 @@ import { availableThemes } from './constants'
13
14
14
15
// Storage utility class for localStorage operations
15
16
class Storage {
16
- static get ( key , defaultValue = null ) {
17
+ static get ( key , defaultValue = null ) {
17
18
try {
18
19
const value = localStorage . getItem ( key )
19
20
return value !== null ? value : defaultValue
@@ -23,7 +24,7 @@ class Storage {
23
24
}
24
25
}
25
26
26
- static set ( key , value , options = { } ) {
27
+ static set ( key , value , options = { } ) {
27
28
try {
28
29
localStorage . setItem ( key , value )
29
30
return true
@@ -33,7 +34,7 @@ class Storage {
33
34
}
34
35
}
35
36
36
- static remove ( key ) {
37
+ static remove ( key ) {
37
38
try {
38
39
localStorage . removeItem ( key )
39
40
return true
@@ -216,13 +217,13 @@ export default class Editor {
216
217
CodeMirror . defineMode ( 'markmap' , function ( config , modeConfig ) {
217
218
return CodeMirror . overlayMode ( CodeMirror . getMode ( config , 'gfm' ) , ignoreOverlay )
218
219
} )
219
-
220
+
220
221
// Migrate preferences from cookies to localStorage
221
222
this . migratePreferences ( )
222
223
}
223
224
224
225
// Migrate preferences from cookies to localStorage
225
- migratePreferences ( ) {
226
+ migratePreferences ( ) {
226
227
// Only run migration if window and localStorage are available
227
228
if ( typeof window === 'undefined' || typeof localStorage === 'undefined' || typeof Cookies === 'undefined' ) {
228
229
return
0 commit comments