Compare commits
2 Commits
feat/add-o
...
fix/save-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
822f7a30f5 | ||
|
|
1d66137c23 |
@@ -15,3 +15,13 @@ export const saveFile = (showToast: boolean = true) => {
|
||||
toast.success("Saved successfully", { position: "bottom-center" });
|
||||
}
|
||||
};
|
||||
|
||||
export const saveAllFiles = () => {
|
||||
const editorModels = state.editorCtx?.getModels();
|
||||
state.files.forEach(file => {
|
||||
const currentModel = editorModels?.find(model => model.uri.path.endsWith('/' + file.name))
|
||||
if (currentModel) {
|
||||
file.content = currentModel?.getValue() || '';
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Octokit } from "@octokit/core";
|
||||
import Router from "next/router";
|
||||
|
||||
import state from '../index';
|
||||
import { saveAllFiles } from "./saveFile";
|
||||
|
||||
const octokit = new Octokit();
|
||||
|
||||
@@ -12,6 +13,7 @@ export const syncToGist = async (
|
||||
session?: Session | null,
|
||||
createNewGist?: boolean
|
||||
) => {
|
||||
saveAllFiles();
|
||||
let files: Record<string, { filename: string; content: string }> = {};
|
||||
state.gistLoading = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user