mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Replace time zone selector with one based on the newer autocomplete.
Summary: Flaky Dates test failures related to the use of JQuery autocomplete for time zones, which wasn't working well. This diff replaces that autocomplete (as well as a similar select box in DocumentSettings) with our newer autocomplete, adding some select-box like behavior. Most of the behavior is factored out into ACSelect, which could be more generally useful. Adds an option to autocomplete to keep options ordered according to their initial order. Unrelated: fix up usage of MultiHolder in Drafts to avoid 'already disposed' warnings. Test Plan: Fixed several affected tests. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D2919
This commit is contained in:
@@ -344,7 +344,7 @@ class EditorAdapter extends Disposable implements Editor {
|
||||
public readonly activated: TypedEmitter<CellPosition> = this.autoDispose(new Emitter());
|
||||
public readonly cellCancelled: TypedEmitter<StateChanged> = this.autoDispose(new Emitter());
|
||||
|
||||
private _holder = MultiHolder.create(this);
|
||||
private _holder = Holder.create<MultiHolder>(this);
|
||||
|
||||
constructor(private _doc: GristDoc) {
|
||||
super();
|
||||
@@ -358,11 +358,11 @@ class EditorAdapter extends Disposable implements Editor {
|
||||
// when the editor is created we assume that it is visible to the user
|
||||
this.activated.emit(editor.cellPosition());
|
||||
|
||||
// auto dispose all the previous listeners
|
||||
this._holder.dispose();
|
||||
this._holder = MultiHolder.create(this);
|
||||
// Auto dispose the previous MultiHolder along with all the previous listeners, and create a
|
||||
// new MultiHolder for the new ones.
|
||||
const mholder = MultiHolder.create(this._holder);
|
||||
|
||||
this._holder.autoDispose(editor.changeEmitter.addListener((e: FieldEditorStateEvent) => {
|
||||
mholder.autoDispose(editor.changeEmitter.addListener((e: FieldEditorStateEvent) => {
|
||||
this.cellModified.emit({
|
||||
position: e.position,
|
||||
state: e.currentState,
|
||||
@@ -371,7 +371,7 @@ class EditorAdapter extends Disposable implements Editor {
|
||||
}));
|
||||
|
||||
// when user presses escape
|
||||
this._holder.autoDispose(editor.cancelEmitter.addListener((e: FieldEditorStateEvent) => {
|
||||
mholder.autoDispose(editor.cancelEmitter.addListener((e: FieldEditorStateEvent) => {
|
||||
this.cellCancelled.emit({
|
||||
position: e.position,
|
||||
state: e.currentState,
|
||||
@@ -380,7 +380,7 @@ class EditorAdapter extends Disposable implements Editor {
|
||||
}));
|
||||
|
||||
// when user presses enter to save the value
|
||||
this._holder.autoDispose(editor.saveEmitter.addListener((e: FieldEditorStateEvent) => {
|
||||
mholder.autoDispose(editor.saveEmitter.addListener((e: FieldEditorStateEvent) => {
|
||||
this.cellSaved.emit({
|
||||
position: e.position,
|
||||
state: e.currentState,
|
||||
|
||||
@@ -31,6 +31,7 @@ import {urlState} from 'app/client/models/gristUrlState';
|
||||
import {QuerySetManager} from 'app/client/models/QuerySet';
|
||||
import {App} from 'app/client/ui/App';
|
||||
import {DocHistory} from 'app/client/ui/DocHistory';
|
||||
import {showDocSettingsModal} from 'app/client/ui/DocumentSettings';
|
||||
import {IPageWidget, toPageWidget} from 'app/client/ui/PageWidgetPicker';
|
||||
import {IPageWidgetLink, linkFromId, selectBy} from 'app/client/ui/selectBy';
|
||||
import {startWelcomeTour} from 'app/client/ui/welcomeTour';
|
||||
@@ -60,8 +61,8 @@ import { Drafts } from "app/client/components/Drafts";
|
||||
|
||||
const G = getBrowserGlobals('document', 'window');
|
||||
|
||||
// Re-export DocComm to move it from main webpack bundle to the one with GristDoc.
|
||||
export {DocComm};
|
||||
// Re-export some tools to move them from main webpack bundle to the one with GristDoc.
|
||||
export {DocComm, showDocSettingsModal};
|
||||
|
||||
export interface TabContent {
|
||||
showObs?: any;
|
||||
|
||||
Reference in New Issue
Block a user