mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2025-12-21 21:22:25 +00:00
fix: update hasUnsavedChanges logic for draft versions and improve visualization spec handling
This commit is contained in:
@@ -43,10 +43,11 @@ export class SnippetManager {
|
|||||||
snippet.content;
|
snippet.content;
|
||||||
|
|
||||||
this.editorManager.setValue(content);
|
this.editorManager.setValue(content);
|
||||||
this.hasUnsavedChanges = false;
|
// Set hasUnsavedChanges to true if we're viewing a draft version
|
||||||
|
this.hasUnsavedChanges = this.isDraftVersion;
|
||||||
this.updateReadOnlyState();
|
this.updateReadOnlyState();
|
||||||
this.uiManager.updateSaveButton(this.hasUnsavedChanges);
|
this.uiManager.updateSaveButton(this.hasUnsavedChanges);
|
||||||
this.uiManager.updateVersionSwitch(this.currentSnippetId, this.isDraftVersion, this.hasDraftChanges(this.currentSnippetId));
|
this.uiManager.updateVersionSwitch(this.currentSnippetId, this.isDraftVersion, hasChanges);
|
||||||
this.uiManager.renderSnippetList(this.snippets, this.currentSnippetId);
|
this.uiManager.renderSnippetList(this.snippets, this.currentSnippetId);
|
||||||
this.visualizationManager.updateVisualization(content);
|
this.visualizationManager.updateVisualization(content);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,13 @@ export class VisualizationManager {
|
|||||||
async updateVisualization(spec) {
|
async updateVisualization(spec) {
|
||||||
try {
|
try {
|
||||||
const parsedSpec = typeof spec === 'string' ? JSON.parse(spec) : spec;
|
const parsedSpec = typeof spec === 'string' ? JSON.parse(spec) : spec;
|
||||||
parsedSpec.width = parsedSpec.width || 'container';
|
const displaySpec = {
|
||||||
parsedSpec.height = parsedSpec.height || 'container';
|
...parsedSpec,
|
||||||
|
width: parsedSpec.width || 'container',
|
||||||
|
height: parsedSpec.height || 'container'
|
||||||
|
};
|
||||||
|
|
||||||
await vegaEmbed(`#${this.containerId}`, parsedSpec, {
|
await vegaEmbed(`#${this.containerId}`, displaySpec, {
|
||||||
actions: true,
|
actions: true,
|
||||||
theme: 'light'
|
theme: 'light'
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user