diff options
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/forms/markdown-textarea.component.scss | 3 | ||||
-rw-r--r-- | client/src/app/shared/misc/peertube-web-storage.ts | 42 |
2 files changed, 26 insertions, 19 deletions
diff --git a/client/src/app/shared/forms/markdown-textarea.component.scss b/client/src/app/shared/forms/markdown-textarea.component.scss index 8e5739e45..16f319587 100644 --- a/client/src/app/shared/forms/markdown-textarea.component.scss +++ b/client/src/app/shared/forms/markdown-textarea.component.scss | |||
@@ -14,7 +14,8 @@ $input-border-radius: 3px; | |||
14 | textarea { | 14 | textarea { |
15 | @include peertube-textarea(100%, 150px); | 15 | @include peertube-textarea(100%, 150px); |
16 | 16 | ||
17 | background-color: var(--textareaBackgroundColor); | 17 | background-color: var(--markdownTextareaBackgroundColor); |
18 | |||
18 | font-family: monospace; | 19 | font-family: monospace; |
19 | font-size: 13px; | 20 | font-size: 13px; |
20 | border-bottom: none; | 21 | border-bottom: none; |
diff --git a/client/src/app/shared/misc/peertube-web-storage.ts b/client/src/app/shared/misc/peertube-web-storage.ts index fff209678..6a152dd98 100644 --- a/client/src/app/shared/misc/peertube-web-storage.ts +++ b/client/src/app/shared/misc/peertube-web-storage.ts | |||
@@ -47,26 +47,32 @@ try { | |||
47 | peertubeLocalStorage = localStorage | 47 | peertubeLocalStorage = localStorage |
48 | peertubeSessionStorage = sessionStorage | 48 | peertubeSessionStorage = sessionStorage |
49 | } catch (err) { | 49 | } catch (err) { |
50 | const instance = new MemoryStorage() | 50 | const instanceLocalStorage = new MemoryStorage() |
51 | const instanceSessionStorage = new MemoryStorage() | ||
51 | 52 | ||
52 | peertubeLocalStorage = sessionStorage = new Proxy(instance, { | 53 | function proxify (instance: MemoryStorage) { |
53 | set: function (obj, prop: string | number, value) { | 54 | return new Proxy(instance, { |
54 | if (MemoryStorage.prototype.hasOwnProperty(prop)) { | 55 | set: function (obj, prop: string | number, value) { |
55 | instance[prop] = value | 56 | if (MemoryStorage.prototype.hasOwnProperty(prop)) { |
56 | } else { | 57 | instance[prop] = value |
57 | instance.setItem(prop, value) | 58 | } else { |
59 | instance.setItem(prop, value) | ||
60 | } | ||
61 | return true | ||
62 | }, | ||
63 | get: function (target, name: string | number) { | ||
64 | if (MemoryStorage.prototype.hasOwnProperty(name)) { | ||
65 | return instance[name] | ||
66 | } | ||
67 | if (valuesMap.has(name)) { | ||
68 | return instance.getItem(name) | ||
69 | } | ||
58 | } | 70 | } |
59 | return true | 71 | }) |
60 | }, | 72 | } |
61 | get: function (target, name: string | number) { | 73 | |
62 | if (MemoryStorage.prototype.hasOwnProperty(name)) { | 74 | peertubeLocalStorage = proxify(instanceLocalStorage) |
63 | return instance[name] | 75 | peertubeSessionStorage = proxify(instanceSessionStorage) |
64 | } | ||
65 | if (valuesMap.has(name)) { | ||
66 | return instance.getItem(name) | ||
67 | } | ||
68 | } | ||
69 | }) | ||
70 | } | 76 | } |
71 | 77 | ||
72 | export { | 78 | export { |