Skip to content

Commit

Permalink
feat: Fix bugs on plugin release
Browse files Browse the repository at this point in the history
  • Loading branch information
YU000jp committed Apr 18, 2023
1 parent 664db56 commit 1ebdee4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 34 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "logseq-plugin-sticky-popup",
"description": "Plugin for showing selected text in a movable popup and positioning a block calendar.",
"name": "sticky-popup",
"description": "Plugin for showing selected text in a movable popup and positioning calendar.",
"repository": "https://github.com/YU000jp/logseq-plugin-sticky-popup.git",
"author": "YU000jp",
"license": "MIT",
Expand Down
70 changes: 38 additions & 32 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,7 @@ const main = () => {


//グラフの変更時
logseq.App.onCurrentGraphChanged(() => {
logseq.App.getCurrentGraph().then((graph) => {
if (graph) {//デモグラフの場合は返り値がnull
graphName = graph.name;

if (!logseq.settings?.currentGraph) {//設定が存在しない場合
return;
} else if (logseq.settings?.graphLock === false) {//グラフのロックを解除する場合
logseq.updateSettings({
screenUuid: "",
screenPage: "",
stickyLock: false,
});
mainStickyText(graph.name);
} else if (logseq.settings?.currentGraph === graph.name) {//作成時のグラフと一致する場合
const divSticky = parent.document.getElementById("sticky-popup--sticky") as HTMLDivElement;
if (divSticky) {
divSticky.style.visibility = "unset";
}
mainStickyText(graph.name);
} else {
const divSticky = parent.document.getElementById("sticky-popup--sticky") as HTMLDivElement;
if (divSticky) {
divSticky.style.visibility = "hidden";
}
}

}
});
});
graphChanged();

//CSS
mainCSS();
Expand Down Expand Up @@ -193,7 +164,7 @@ const main = () => {
Registered in pop-ups and automatically locked. Markdown is not reflected.
`,
},
{
{ //select ジャーナルのみ、ジャーナル以外、全てのページ
key: "stickyTextVisible",
title: "Sticky Text Visible",
type: "enum",
Expand All @@ -202,7 +173,6 @@ const main = () => {
description: "Showing Sticky Text or not",
},
{
//select ジャーナルのみ、ジャーナル以外、全てのページ
key: "stickyTextZIndex",
title: "Sticky Text Z-index",
type: "boolean",
Expand Down Expand Up @@ -265,7 +235,43 @@ const main = () => {
//end Setting changed


//graph changed
function graphChanged() {
logseq.App.onCurrentGraphChanged(() => {
logseq.App.getCurrentGraph().then((graph) => {
if (graph) { //デモグラフの場合は返り値がnull
graphName = graph.name;

if (!logseq.settings?.currentGraph) { //設定が存在しない場合
return;
} else if (logseq.settings?.graphLock === false) { //グラフのロックを解除する場合
logseq.updateSettings({
screenUuid: "",
screenPage: "",
stickyLock: false,
});
mainStickyText(graph.name);
} else if (logseq.settings?.currentGraph === graph.name) { //作成時のグラフと一致する場合
const divSticky = parent.document.getElementById("sticky-popup--sticky") as HTMLDivElement;
if (divSticky) {
divSticky.style.visibility = "unset";
}
mainStickyText(graph.name);
} else {
const divSticky = parent.document.getElementById("sticky-popup--sticky") as HTMLDivElement;
if (divSticky) {
divSticky.style.visibility = "hidden";
}
}

}
});
});
}
//end graph changed

};

//end main


Expand Down

0 comments on commit 1ebdee4

Please sign in to comment.