mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Improve dark mode
Summary: Enhances dark mode support for the formula editor, and adds support to the color select popup. Also fixes some bugs with dark mode. Test Plan: Tested manually. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D3847
This commit is contained in:
@@ -108,7 +108,7 @@ div:hover > .kf_tooltip {
|
||||
box-shadow: 0 1px 1px 1px rgba(0,0,0,0.15);
|
||||
line-height: 1.1rem;
|
||||
font-size: 1rem;
|
||||
color: #606060;
|
||||
color: var(--grist-theme-prompt-fg, #606060);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
|
||||
41
app/client/lib/pausableObs.ts
Normal file
41
app/client/lib/pausableObs.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import {IDisposableOwner, Observable} from 'grainjs';
|
||||
|
||||
export interface PausableObservable<T> extends Observable<T> {
|
||||
pause(shouldPause?: boolean): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an `Observable` that can be paused, effectively causing all
|
||||
* calls to `set` to become noops until unpaused, at which point the last value
|
||||
* passed to set, if any, will be applied.
|
||||
*
|
||||
* NOTE: It's only advisable to use this when there are no other alternatives; pausing
|
||||
* updates and notifications to subscribers increases the chances of introducing bugs.
|
||||
*/
|
||||
export function createPausableObs<T>(
|
||||
owner: IDisposableOwner|null,
|
||||
value: T,
|
||||
): PausableObservable<T> {
|
||||
let _isPaused = false;
|
||||
let _lastValue: T | undefined = undefined;
|
||||
const obs = Observable.create<T>(owner, value);
|
||||
const set = Symbol('set');
|
||||
return Object.assign(obs, {
|
||||
pause(shouldPause: boolean = true) {
|
||||
_isPaused = shouldPause;
|
||||
if (shouldPause) {
|
||||
_lastValue = undefined;
|
||||
} else if (_lastValue) {
|
||||
obs.set(_lastValue);
|
||||
_lastValue = undefined;
|
||||
}
|
||||
},
|
||||
[set]: obs.set,
|
||||
set(val: T) {
|
||||
_lastValue = val;
|
||||
if (_isPaused) { return; }
|
||||
|
||||
this[set](val);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user