Skip to content

Commit

Permalink
0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-cen committed Mar 21, 2023
1 parent b502062 commit ca0aeff
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 7 deletions.
81 changes: 75 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13733,8 +13733,46 @@ var deleteTagContext = async (plugin, tag) => {
}, app.workspace["rootSplit"]);
plugin.index.deleteTag(tag);
};
var deleteSpaceContext = async (plugin, space) => {
const context = spaceContextFromSpace(plugin, spaceContextPathFromName(space));
if (getAbstractFileAtPath(app, context.dbPath)) {
await deleteFile(plugin, getAbstractFileAtPath(app, context.dbPath));
}
app.workspace.iterateLeaves((leaf) => {
if (leaf.view.getViewType() == CONTEXT_VIEW_TYPE && leaf.view.getState().contextPath == context.contextPath) {
leaf.setViewState({ type: "empty" });
}
}, app.workspace["rootSplit"]);
};
var connectContext = async (plugin, tag, source) => {
};
var renameSpaceContextFile = async (plugin, space, newSpace) => {
const context = spaceContextFromSpace(plugin, spaceContextPathFromName(space));
console.log(context.dbPath);
if (getAbstractFileAtPath(app, context.dbPath)) {
const newSpaceDBPath = newSpace + ".mdb";
if (!getAbstractFileAtPath(
app,
getAbstractFileAtPath(app, context.dbPath).parent.path + "/" + newSpaceDBPath
)) {
await renameFile(
plugin,
getAbstractFileAtPath(app, context.dbPath),
newSpaceDBPath
);
} else {
await deleteFile(plugin, getAbstractFileAtPath(app, context.dbPath));
}
}
app.workspace.iterateLeaves((leaf) => {
if (leaf.view.getViewType() == CONTEXT_VIEW_TYPE && leaf.view.getState().contextPath == context.contextPath) {
leaf.setViewState({
type: CONTEXT_VIEW_TYPE,
state: { contextPath: spaceContextPathFromName(newSpace) }
});
}
}, app.workspace["rootSplit"]);
};
var renameTagContextFile = async (plugin, tag, newTag) => {
const context = tagContextFromTag(plugin, tag);
if (getAbstractFileAtPath(app, context.dbPath)) {
Expand Down Expand Up @@ -34168,6 +34206,7 @@ var saveSpace = (plugin, space, newSpace) => {
);
plugin.saveSettings();
if (space != newSpace.name) {
renameSpaceContextFile(plugin, space, newSpace.name);
plugin.index.renameSpace(space, newSpace.name);
}
plugin.index.reloadSpace(space).then((f4) => plugin.index.initalizeFiles());
Expand All @@ -34176,6 +34215,7 @@ var removeSpace = (plugin, space) => {
const newSpaceRows = plugin.index.spacesDBCache.filter((f4) => f4.name != space);
const newSpaceItemsRows = plugin.index.spacesItemsDBCache.filter((f4) => f4.space != space);
plugin.index.saveSpacesDB({ spaces: { ...spaceSchema, rows: newSpaceRows }, spaceItems: { ...spaceItemsSchema, rows: newSpaceItemsRows } });
deleteSpaceContext(plugin, space);
plugin.index.deleteSpace(space);
};
var updateSpaceSort = (plugin, spaceName, sort) => {
Expand Down Expand Up @@ -40708,6 +40748,7 @@ var renameFile = async (plugin, file, newName) => {
const afile = tFileToAFile(file);
const folderNotePath = folderNotePathFromAFile(plugin.settings, afile);
const folderNote = getAbstractFileAtPath(app, folderNotePath);
console.log("rename", file.path, newName);
await app.fileManager.renameFile(
file,
file.parent.path == "/" ? newName : file.parent.path + "/" + newName
Expand Down Expand Up @@ -48673,10 +48714,6 @@ var MainMenu = (props2) => {
const newFile = async () => {
await createNewMarkdownFile(props2.plugin, folder, "", "");
};
const newSection = () => {
let vaultChangeModal = new EditSpaceModal(plugin, { name: "" }, "create");
vaultChangeModal.open();
};
p2(() => {
refreshLeafs();
}, []);
Expand Down Expand Up @@ -48734,11 +48771,43 @@ var MainMenu = (props2) => {
}
menu.addItem((menuItem) => {
menuItem.setIcon("plus");
menuItem.setTitle(i18n_default.menu.newSpace);
menuItem.setTitle(i18n_default.buttons.createSection);
menuItem.onClick((ev) => {
newSection();
let vaultChangeModal = new EditSpaceModal(
plugin,
{
name: "",
def: {
type: "focus",
folder: "",
filters: []
}
},
"create"
);
vaultChangeModal.open();
});
});
menu.addItem((menuItem) => {
menuItem.setIcon("plus");
menuItem.setTitle(i18n_default.buttons.createSectionSmart);
menuItem.onClick((ev) => {
let vaultChangeModal = new EditSpaceModal(
plugin,
{
name: "",
def: {
type: "smart",
folder: "",
filters: []
}
},
"create"
);
vaultChangeModal.open();
});
});
menu.addSeparator();
menu.addItem((menuItem) => {
menuItem.setIcon("sync");
menuItem.setTitle("Reload Spaces");
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "make-md",
"name": "MAKE.md",
"version": "0.7.1",
"version": "0.7.2",
"minAppVersion": "0.16.0",
"description": "Make.md brings you features that supercharges Obsidian. Sort your files in custom order and add file icons using Spaces. Edit inline embeds with Flow Editor. And style your text and add new markdown blocks without writing markdown using Maker Mode.",
"author": "MAKE.md",
Expand Down

0 comments on commit ca0aeff

Please sign in to comment.