0x6b / copy-selection-as-markdown

Firefox add-on to copy selection as Markdown
https://addons.mozilla.org/en-US/firefox/addon/copy-selection-as-markdown/
MIT License
190 stars 14 forks source link

fix extension loading error in chrome extension #97

Open allenyllee opened 3 years ago

allenyllee commented 3 years ago

Hi @0x6b , very thank you for developing this extension, I used it a lot in Firefox. But after I switch to Brave browser (chrome-based), it's a long waited for its chrome version. So when I see #50 closed, this extension has been ported to chrome, I can't wait to build it by myself. Follow #95's instruction, I've built it successfully, but I met some error when I loading this extension. So I try to fix these errors and now it worked perfectly!

This pull request fix these errors, which almost all are path issue, except the last one, which is permission issue.

In order to dynamically remove hosts permission, we need to create "optional_permissions" key and move "" into that key. see: https://developer.chrome.com/docs/extensions/reference/permissions/#step-2-declare-optional-permissions-in-the-manifest

0x6b commented 3 years ago

@allenyllee thank you for your time for the PR. Can you please check the following steps before loading locally-built extension?

  1. Clone the repository
  2. Install dependencies (npm i)
  3. Build core and extensions (npm run build)
  4. Load packages/chromium/dist/manifest.json as unpacked extensions to your browser

I guess you loaded packages/chromium/manifest.json at step 4 thus failed to load .js files due to wrong path. Permission change (64ae6ed) could be valuable but other two commits may not be needed I'm afraid. Sorry for lack of the build instruction for Chromium based browsers. Please get back to me how the steps above work for you. Thanks!

allenyllee commented 3 years ago

OK, I see... Previously, I copy the whole packages/chromium/ folder and load it, didn't aware that it just need to copy packages/chromium/dist/ folder.