0.9.3: Graph from Source on main.archify works again
On a main.archify page in Source, Graph built the Graph page but the host held it back until Source closed, so nothing happened, and Model then showed the held Graph page. Switching between the model and its graph now leaves Source first, and the page forgets Source when Graph replaces it, so Model on the Graph page comes back to the model.
This commit is contained in:
1 parent
a5a9f92e75
commit
2726a66113
6 files changed
+22
-4
No files matched your search
@@ -165,6 +165,10 @@ class DiagramPreview implements vscode.Disposable {
|
||||
|
||||
/** Switches a main.archify editor between its model page and the Graph page. */
|
||||
setGraph(on: boolean, query?: string): void {
|
||||
// Leaving Source for another page: drop what it held, or that page would
|
||||
// wait for a sourceClose that never comes and show up later instead.
|
||||
this.heldHtml = undefined;
|
||||
this.source?.leave();
|
||||
this.graph = on;
|
||||
this.graphQuery = query;
|
||||
const modes = this.graphModes();
|
||||
|
||||
@@ -76,6 +76,11 @@ export class SourceSession implements vscode.Disposable {
|
||||
this.post({ type: 'setView', view: 'source' });
|
||||
}
|
||||
|
||||
/** The page is being replaced by another one (the Graph page): Source is no longer shown. */
|
||||
leave(): void {
|
||||
this.setShown(false);
|
||||
}
|
||||
|
||||
/** Handles a Source message from the page; false for any other message. */
|
||||
handle(message: { type?: string }): boolean {
|
||||
if (!isSourceMessage(message)) return false;
|
||||
|
||||
+6
-1
@@ -704,7 +704,12 @@ function bridgeScript(options: PageOptions): string {
|
||||
}
|
||||
var name = (src && src.left) || sw.left;
|
||||
var left = segment(name, name === 'View' ? 'Show the page' : 'Show the ' + name.toLowerCase(), function () { setSource(false); });
|
||||
if (sw) segment('Graph', 'Open the model as one graph, with a query box', function () { post({ type: 'showGraph', query: sw.query }); });
|
||||
if (sw) segment('Graph', 'Open the model as one graph, with a query box', function () {
|
||||
// On main.archify the Graph page replaces this one; coming back must
|
||||
// show the model, not Source. Other pages open the graph beside them.
|
||||
if (sourceOn && config.model) vscode.setState(Object.assign({}, vscode.getState() || {}, { sourceView: false }));
|
||||
post({ type: 'showGraph', query: sw.query });
|
||||
});
|
||||
var source = src ? segment('Source', 'Edit the YAML of this file, checked as you type', function () { setSource(true); }) : null;
|
||||
if (source) {
|
||||
var badge = el('span', 'archify-source-badge');
|
||||
|
||||
Reference in new issue
Block a user