Skip to content

feat: plugin header button API (acode.addHeaderButton) - #10

Merged
heyitsaadin merged 4 commits into
devfrom
feat/plugin-header-buttons
Nov 22, 2026
Merged

heyitsaadin merged 4 commits into
devfrom
feat/plugin-header-buttons

Conversation

@heyitsaadin

Copy link
Copy Markdown
Owner

Adds a small plugin API for header buttons, needed by the upcoming Acode Messages plugin (chat icon next to the pencil).

API

  • acode.addHeaderButton({ id, icon, label, onclick, order }) returns a remove function
  • acode.removeHeaderButton(id)
  • acode.require("headerButtons") exposes { add, remove }
  • Register the icon first with the existing acode.addIcon(name, src, { monochrome: true })

How it works

  • acode.js keeps a registry; main.js mounts the buttons with $header.insertBefore(...), the same way $runBtn and $editMenuToggler are placed.
  • Buttons are placed left of the edit/run buttons. Those get re-inserted before the menu button on file switch, so they stay to the right.

Not in this PR

  • The plugin itself, the Neon schema and the Vercel API (separate PRs).

Test

  • Install a plugin that calls acode.addHeaderButton and confirm the icon appears left of the pencil, persists across file switches, and disappears when the returned remove function is called.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: efd7902f-1d4c-453f-a8ff-16a5dab57eb8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added the enhancement New feature or request label Nov 22, 2026
@heyitsaadin
heyitsaadin merged commit 3ec7841 into dev Nov 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant