mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Focusing the creator panel on the table wiget for charts and custom views
Summary: When a chart page/section is added and the creator panel is already open, focus is set to a "table" tab. When a custom view is added as a page/section, the same thing happens, but there is also a behavioral tooltip shown for the custom URL. Test Plan: Updated and added. Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3857
This commit is contained in:
@@ -77,6 +77,11 @@ export class BehavioralPromptsManager extends Disposable {
|
||||
this._isDisabled = true;
|
||||
}
|
||||
|
||||
public reset() {
|
||||
this._prefs.set({...this._prefs.get(), dismissedTips: [], dontShowTips: false});
|
||||
this.enable();
|
||||
}
|
||||
|
||||
private _queueTip(refElement: Element, prompt: BehavioralPrompt, options: AttachOptions) {
|
||||
if (
|
||||
this._isDisabled ||
|
||||
|
||||
@@ -513,6 +513,24 @@ export class GristDoc extends DisposableWithEvents {
|
||||
this.draftMonitor = Drafts.create(this, this);
|
||||
this.cursorMonitor = CursorMonitor.create(this, this);
|
||||
this.editorMonitor = EditorMonitor.create(this, this);
|
||||
|
||||
// When active section is changed to a chart or custom widget, change the tab in the creator
|
||||
// panel to the table.
|
||||
this.autoDispose(this.viewModel.activeSection.subscribe((section) => {
|
||||
if (section.isDisposed() || section._isDeleted.peek()) { return; }
|
||||
if ('chart' === section.parentKey.peek()) {
|
||||
commands.allCommands.viewTabFocus.run();
|
||||
} else if ('custom' === section.parentKey.peek()) {
|
||||
// Check if user has seen custom URL tooltip.
|
||||
const seenTooltip = this.behavioralPromptsManager.hasSeenTip('customURL');
|
||||
// If yes, just focus on the table if it is opened
|
||||
if (seenTooltip) {
|
||||
commands.allCommands.viewTabFocus.run();
|
||||
} else {
|
||||
commands.allCommands.viewTabOpen.run();
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,6 +73,11 @@ exports.groups = [{
|
||||
keys: [],
|
||||
desc: 'Shortcut to open view tab'
|
||||
},
|
||||
{
|
||||
name: 'viewTabFocus',
|
||||
keys: [],
|
||||
desc: 'Shortcut to focus view tab if creator panel is open'
|
||||
},
|
||||
{
|
||||
name: 'fieldTabOpen',
|
||||
keys: [],
|
||||
|
||||
Reference in New Issue
Block a user