Skip to content

Conversation

TianleLin
Copy link

Manifest V3 Migration with UI Optimizations

📋 Summary

This PR completes the migration from Manifest V2 to Manifest V3 for the MarkDownload browser extension, along with significant UI optimizations and bug fixes. This builds upon the initial Manifest V3 work by adding crucial improvements to the popup interface, fixing image download functionality, and enhancing the overall user experience.

🚀 Key Changes

🔧 Manifest V3 Migration Enhancements

  • Service Worker Optimization: Improved service worker implementation with better error handling and resource management
  • Content Script Improvements: Enhanced content script injection and execution reliability
  • Permission Model Updates: Refined permission handling for better security and compatibility
  • API Modernization: Complete transition from deprecated V2 APIs to V3 equivalents

🎨 UI/UX Improvements

  • Popup Optimization: Significantly improved popup interface with better responsiveness and user experience
  • Copy Functionality: Added enhanced copy-to-clipboard functionality with visual feedback
  • Error Handling: Improved error messages and user feedback throughout the interface
  • Performance: Optimized popup loading times and reduced resource usage

🗂️ Code Organization

  • Legacy Code Cleanup: Removed obsolete Manifest V2 code and dependencies
  • File Structure: Reorganized background scripts and content scripts for better maintainability
  • Library Updates: Moved shared libraries to appropriate directories for V3 compatibility

📁 Files Changed

Core Extension Files

  • src/manifest.json - Updated to Manifest V3 specification
  • src/background/service-worker.js - New service worker implementation
  • src/contentScript/contentScript.js - Enhanced content script with V3 compatibility
  • src/popup/popup.js - Optimized popup interface
  • src/options/options.js - Updated options handling for V3

Library and Dependencies

  • src/background/ - Reorganized and updated all background libraries
  • src/browser-polyfill.min.js - Added for cross-browser compatibility
  • Removed: src/background/background.js (legacy V2 background script)
  • Removed: src/contentScript/getSelectionAndDom.js (consolidated into main content script)

🧪 Testing Performed

✅ Core Functionality Tests

  • Extension loads successfully in Chrome
  • Popup opens and displays correctly
  • Markdown conversion works for various website types
  • Download functionality works across different file types
  • Context menus appear and function properly
image

eugenesvk and others added 30 commits January 10, 2024 23:07
use formatTitle(article) instead of article.title in obsidian func
use formatTitle(article) instead of article.title in obsidian func
Detailed instructions on how to use obsidian integration.
attribute which matches removal criteria. Removal of the HTML element
causies Markdownload to fail because:
* the pageTitle is undefined
* basicUri point to chrome-extension://nghfdnngoejlhedogdpikdlkmdfoojii/_generated_background_page.html
  rather than the actual web page
* all local links are incorrect
web page's base.

Some website specify the href of the base tag as '/'.
This causes the JDOMParser to set:

* dom.baseURI = 'chrome-extension://nghfdnngoejlhedogdpikdlkmdfoojii/'
* dom.documentURI = 'chrome-extension://nghfdnngoejlhedogdpikdlkmdfoojii/_generated_background_page.html'

when it parse HTML text in the background context and subsequently Readability.js
genarates garbage for local links
… was ripped

out from its owning 'pre' and the code.innerText lost all spacings and linefeeds.
In addition a second fix was needed because all tabs where stripped in the
turndown function (bachground.js). This caused code to loose indent and look
unreadable.
…ich do not

contain a `<code>` cild element. This allows `<pre>` blocks to be rendered
as markdown fenced blocks.
Resolve Obsidian Filename Determination Issue in background.js
Prevent Readability.js from removing the <html> element if it has a class attribute with specific values
Make sure the 'href' attribute of the base tag points to the web page's base..
Make sure the document processed in background.js has a title element.
Fixed unreadable code blocks.
Readability.js component updated to version 0.5.0
add lowercase and uppercase parameterizations
Added additional parameterization options
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

Successfully merging this pull request may close these issues.

9 participants