ColumnCopy
ColumnCopy copied to clipboard
Upgraded to manifest v3.
Problem
- The ColumnCopy extension cannot be installed in Google Chrome anymore.
Proposed solution
- Upgrade the extension to manifest v3.
Notes
- This PR gets the extension working again (tested in Google Chrome).
- Only minimum required changes, no code cleanups or other modifications.
- Given that Clipboard.writeText() is widely available now, I simplified the code to just use it instead of the clipboardBridge in an offscreen document.
Known issues
- Reloading the extension triggers the warnings (but seemingly not affecting the functionality) — fix suggestions welcome (might be covered by the tutorial linked below):
Unchecked runtime.lastError: Cannot create item with duplicate id copyColumn Unchecked runtime.lastError: Cannot create item with duplicate id copyTable
Resources
- https://github.com/GoogleChromeLabs/extension-manifest-converter
- https://developer.chrome.com/docs/extensions/develop/migrate
- https://developer.chrome.com/docs/extensions/develop/migrate/api-calls#replace-unsupported-apis
- https://developer.chrome.com/docs/extensions/develop/migrate/to-service-workers#move-dom-and-window (clipboard)
- https://developer.chrome.com/docs/extensions/develop/concepts/messaging
- https://developer.chrome.com/docs/extensions/reference/api/offscreen
- https://developer.chrome.com/docs/extensions/reference/manifest/content-security-policy
- https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_security_policy
Tutorials
- https://www.coditude.com/insights/chrome-extension-manifest-v3-a-migration-guide/
- https://github.com/GoogleChrome/chrome-extensions-samples/blob/main/functional-samples/cookbook.offscreen-clipboard-write/background.js
- https://github.com/GoogleChrome/chrome-extensions-samples/blob/main/api-samples/contextMenus/basic/sample.js
- https://stackoverflow.com/a/79530265/811306
Fixes #35