Skip to content

Commit

Permalink
fix: patch git exec command (#50)
Browse files Browse the repository at this point in the history
* update: logseq sdk version

* fix: patch for the `#git_execCommand` method not found

* fix: incorrectness for the `logseq.UI.queryElementRect`
  • Loading branch information
xyhp915 committed Dec 28, 2023
1 parent 743a4ae commit b4a4229
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"preview": "vite preview"
},
"dependencies": {
"@logseq/libs": "^0.0.15",
"antd": "^5.7.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"@logseq/libs": "^0.0.16",
"antd": "^4.18.9",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@semantic-release/changelog": "^6.0.1",
Expand Down
3 changes: 3 additions & 0 deletions src/helper/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { SettingSchemaDesc } from "@logseq/libs/dist/LSPlugin.user";

export const COMMON_STYLE = `
.ui-items-container[data-type=toolbar] > .list-wrap {
overflow: visible;
}
#injected-ui-item-git-logseq-git {
position: relative;
}
Expand Down
2 changes: 1 addition & 1 deletion src/helper/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const getPluginStyle = () => pluginStyle;

export const showPopup = () => {
const _style = getPluginStyle();
logseq.App.queryElementRect("#logseq-git--git").then((triggerIconRect) => {
logseq.UI.queryElementRect("#logseq-git--git").then((triggerIconRect) => {
console.log("[faiz:] === triggerIconRect", triggerIconRect);
if (!triggerIconRect) return;
const popupWidth = 120 + 10 * 2;
Expand Down
15 changes: 14 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,20 @@ import {
} from "./helper/util";
import "./index.css";

const isDevelopment = import.meta.env.DEV;
// TODO: patch logseq Git command for the temporary fix solution
// https://github.com/haydenull/logseq-plugin-git/issues/48
try {
// @ts-ignore
top.logseq.sdk.git.exec_command(['status'])
} catch (e) {
// @ts-ignore
logseq.Git['execCommand'] = async function (args: string[]) {
const ret = await logseq.App.execGitCommand(args)
return {exitCode: ret == undefined ? 1 : 0, stdout: ret}
}
}

const isDevelopment = import.meta.env.DEV

if (isDevelopment) {
renderApp("browser");
Expand Down
22 changes: 14 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,14 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@logseq/libs@^0.0.15":
version "0.0.15"
resolved "https://registry.yarnpkg.com/@logseq/libs/-/libs-0.0.15.tgz#03b8b81a0a1557e3f022d68c978ddcb501cd4421"
integrity sha512-Z4YrYGfu8Y3s9LTqVnPGkxlO+KZtP1YalH/A63zYgxP61cV5QtKlnHWNcjsKxsD5CkaSL4MlSN4mf7wNx/Fm0A==
"@logseq/libs@^0.0.16":
version "0.0.16"
resolved "https://registry.yarnpkg.com/@logseq/libs/-/libs-0.0.16.tgz#52d542fa2ab4f2c6c6961209108962fecf925aba"
integrity sha512-lsiwpBtZd/j6n02hp2ytP+LZZOoZxmqBj0MpULT4CajrH51pnI65Bzcb4+Ne/lJW6IzMbIinYmMm0Zoi3nL65g==
dependencies:
csstype "3.1.0"
debug "4.3.4"
deepmerge "4.3.1"
dompurify "2.3.8"
eventemitter3 "4.0.7"
fast-deep-equal "3.1.3"
Expand Down Expand Up @@ -652,10 +653,10 @@
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==

"@types/node@^18.15.12":
version "18.17.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.17.0.tgz#35d44267a33dd46b49ee0f73d31b05fd7407e290"
integrity sha512-GXZxEtOxYGFchyUzxvKI14iff9KZ2DI+A6a37o6EQevtg6uO9t+aUZKcaC1Te5Ng1OnLM7K9NVVj+FbecD9cJg==
"@types/node@^17.0.9":
version "17.0.9"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.9.tgz#0b7f161afb5b1cc12518d29b2cdc7175d5490628"
integrity sha512-5dNBXu/FOER+EXnyah7rn8xlNrfMOQb/qXnw4NQgLkCygKBKhdmF/CA5oXVOKZLBEahw8s2WP9LxIcN/oDDRgQ==

"@types/normalize-package-data@^2.4.0":
version "2.4.1"
Expand Down Expand Up @@ -1334,6 +1335,11 @@ deep-extend@^0.6.0:
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==

deepmerge@4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a"
integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==

defaults@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d"
Expand Down

0 comments on commit b4a4229

Please sign in to comment.