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

Inkdrop 5.6.0 breaks plugin #11

Open
marksweiss opened this issue Oct 30, 2023 · 3 comments
Open

Inkdrop 5.6.0 breaks plugin #11

marksweiss opened this issue Oct 30, 2023 · 3 comments

Comments

@marksweiss
Copy link

After the upgrade, this error message upon launch or re-install of plugin:

image
@marksweiss
Copy link
Author

Dug into this more. The failing line is here. The issue appears to be that app.getAppPath() returns Applications/Inkdrop.app/Contents/Resources/app.asar/... whereas the actual path where node_modules is present does not have the app.asar portion. I looked in Applications/Inkdrop.app/Contents/Resource and there is an app.asar there but it is not a directory. So this dependency on getAppPath() appears to the be issue. I don't know enough about node or Electron to identify the correct solution without more digging but hopefully this is helpful.

@Keisir
Copy link

Keisir commented Jun 11, 2024

The error (loading of codemirror addons) can be fixed with this patch.
(See Keisir/inkdrop-rulers#1)

diff --git a/lib/code-fold.js b/lib/code-fold.js
index ed1613e..409eb0b 100644
--- a/lib/code-fold.js
+++ b/lib/code-fold.js
@@ -1,5 +1,6 @@
+const path = require('node:path');
 const app = require('@electron/remote').app;
-const modulePath = app.getAppPath() + '/node_modules/'
+const modulePath = path.dirname(app.getAppPath()) + '/node_modules/'
 require(modulePath + 'codemirror/addon/fold/foldcode.js');
 require(modulePath + 'codemirror/addon/fold/foldgutter.js');
 require(modulePath + 'codemirror/addon/fold/markdown-fold.js');

With this patch I am again able to expand and collapse sections with the corresponding keybindings.
The UI (the small arrow icons) are broken. (are not displayed)

It seems like this plugin is not maintained for a while now, so I didn't create a PR as it possibly wouldn't be merged. But if anyone wants to use this, you can just apply the patch locally.

/cc @marksweiss

Edit:
I have also pushed the code to my fork. (Keisir/inkdrop-code-fold@44d834b)

@Keisir
Copy link

Keisir commented Nov 6, 2024

The code fold plugin in the inkdrop plugin registry will be updated from now on through a fork of this repo. This issue has been fixed there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants