Skip to content

Commit

Permalink
only get gist data when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
blurymind committed Aug 8, 2024
1 parent 5b263bb commit 55b86ba
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/public/plugins/plugin-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,25 @@ export var PluginEditor = function({
this.editor.clearSelection();
beautify.beautify(this.editor.session);

getGistPluginFiles().then(gistPluginFiles => {
const gistPluginFile = gistPluginFiles.find(
item => item.filename == fileName
);
console.log({ gistPluginFile }, this.differ.getEditors());
fileContents = this.editor.getValue();
this.differ
.getEditors()
.left.getSession()
.setValue(fileContents);
if (this.mode === 'commit') {
getGistPluginFiles().then(gistPluginFiles => {
const gistPluginFile = gistPluginFiles.find(
item => item.filename == fileName
);
console.log({ gistPluginFile }, this.differ.getEditors());
fileContents = this.editor.getValue();
this.differ
.getEditors()
.left.getSession()
.setValue(fileContents);

this.differ
.getEditors()
.right.getSession()
.setValue(gistPluginFile.content);
this.differ.getEditors().right.setReadOnly(this.mode === 'commit');
});
this.differ
.getEditors()
.right.getSession()
.setValue(gistPluginFile.content);
this.differ.getEditors().right.setReadOnly(this.mode === 'commit');
});
}
});
};

Expand Down

0 comments on commit 55b86ba

Please sign in to comment.