Skip to content

Conversation

@bajrangCoder
Copy link
Member

This PR introduces a file type handler system that allows plugins to register custom handlers for specific file types. This enables plugins to provide specialized viewers or editors for different file formats (e.g., PDF viewers, image editors, etc.).

Key Features

  • Plugins can register handlers for specific file extensions
  • "Text Editor" always available as fallback option

Example Usage

acode.registerFileHandler({
  id: 'my-pdf-viewer-id',
  extensions: ['pdf'],
  async handleFile({ name, uri, fs, options }) {
    // Handler implementation
  }
});

@bajrangCoder bajrangCoder requested a review from Copilot April 15, 2025 17:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a file type handler system that allows plugins to register custom handlers for specific file types, enabling specialized viewers or editors to be used for different file formats.

  • Added new CSS file references in www/index.html
  • Integrated file type handling into openFile.js with a new fileTypeHandler module
  • Extended the Acode class to expose handler registration and unregistration methods

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
www/index.html Added new CSS file references and removed outdated ones
src/lib/openFile.js Integrated custom file handler lookup and invocation
src/lib/fileTypeHandler.js Introduced a registry class for managing custom file handlers
src/lib/acode.js Exposed API methods for registering and unregistering handlers

@bajrangCoder bajrangCoder merged commit cfbf398 into Acode-Foundation:main Apr 16, 2025
2 checks passed
@bajrangCoder bajrangCoder deleted the feature/custom-file-handlers branch May 9, 2025 16:27
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.

1 participant