Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/path settings #50

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 62 additions & 25 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "@logseq/libs";
import {
PageEntity,
BlockEntity,
PageEntity,
SettingSchemaDesc,
} from "@logseq/libs/dist/LSPlugin";
import React from "react";
Expand All @@ -12,7 +12,7 @@ import { getAllPublicPages, getBlocksInPage } from "./utils";

export var path = "";

const linkFormats = ["[[Logseq Format]]", "Without brackets"]
const linkFormats = ["[[Logseq Format]]", "Without brackets"];

let settings: SettingSchemaDesc[] = [
{
Expand All @@ -28,20 +28,58 @@ let settings: SettingSchemaDesc[] = [
{
key: "bulletHandling",
type: "enum",
enumChoices: ["Convert Bullets", "Remove All Bullets"],
enumChoices: ["Convert Bullets", "Remove All Bullets"],
enumPicker: "radio",
title: "How would you like Logseq's bullets to be handled",
description: "How would you like Logseq's bullets to be handled, convert to hugo's native style or remove all bullets?",
description:
"How would you like Logseq's bullets to be handled, convert to hugo's native style or remove all bullets?",
default: "Convert Bullets",
},
{
key: "exportTasks",
type: "boolean",
title: "Do you want tasks to exported to Hugo?",
description: "Yes, blocks with tasks will be exported: (TODO DOING DONE LATER NOW WAITING)",
description:
"Yes, blocks with tasks will be exported: (TODO DOING DONE LATER NOW WAITING)",
default: false,
}

},
{
key: "leafTitle",
type: "boolean",
title: "Do you want to use only the leaf title?",
description:
"Use the end of title (what is after the last / in Logseq page title) as title instead of the whole title hierarchy." +
"\nExample: for 'parent/branch/leaf', title would be 'leaf'",
default: false,
},
{
key: "tagsFromTitle",
type: "boolean",
title: "Do you want to add Logseq title hierarchy to tags?",
description: "Add title hierarchy to tags?",
default: false,
},
{
key: "assetsPath",
type: "string",
title: "Path to assets",
description: "Path of each assets will start with the following",
default: "assets",
},
{
key: "pagesPath",
type: "string",
title: "Path to pages",
description: "Path of each pages will start with the following",
default: "content/pages",
},
{
key: "journalPath",
type: "string",
title: "Path to journal pages",
description: "Path of each journal pages will start with the following",
default: "content/posts",
},
];
const main = async () => {
console.log("Logseq Schrödinger plugin loaded");
Expand All @@ -50,31 +88,31 @@ const main = async () => {
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("app")
document.getElementById("app"),
);

logseq.setMainUIInlineStyle({
position: 'fixed',
position: "fixed",
zIndex: 999,
transform: 'translateX(-50%)',
});
transform: "translateX(-50%)",
});
function createModel() {
return {
show(e:any) {
const {rect} = e
show(e: any) {
const { rect } = e;

logseq.setMainUIInlineStyle({
top: `${rect.top + 25}px`,
left: `${rect.right - 17}px`,
});

logseq.setMainUIInlineStyle({
top: `${rect.top + 25}px`,
left: `${rect.right - 17}px`,
})

logseq.toggleMainUI();
handleClosePopup()
handleClosePopup();
},

export () {
getAllPublicPages()
}
export() {
getAllPublicPages();
},
};
}

Expand All @@ -84,10 +122,9 @@ const main = async () => {
});
logseq.App.registerPageMenuItem(
"Export all public pages to hugo",
getAllPublicPages
getAllPublicPages,
);


logseq.App.registerUIItem("toolbar", {
key: "hugo-single-export",
template: `
Expand All @@ -104,7 +141,7 @@ const main = async () => {
</a>
`,
});

logseq.useSettingsSchema(settings);
path = (await logseq.App.getCurrentGraph()).path;
};
Expand Down
Loading