Add version sorting for plugins

Enhance plugin dialog with semver-aware sorting
by version, enabling users to sort plugins based
on version comparisons.
This commit is contained in:
Andrew
2026-07-06 13:01:21 +08:00
parent 714fe54f77
commit a11e442f1d
5 changed files with 52 additions and 2 deletions

View File

@@ -47,7 +47,8 @@
<span>Activate</span>
<span class="sort-th" data-sort-field="name" role="button" tabindex="0"
title="Sort by name">Name<span class="sort-tri" aria-hidden="true"></span></span>
<span>Plugin Version</span>
<span class="sort-th" data-sort-field="version" role="button" tabindex="0"
title="Sort by version">Plugin Version<span class="sort-tri" aria-hidden="true"></span></span>
<span class="sort-th" data-sort-field="source" role="button" tabindex="0"
title="Sort by source">Source<span class="sort-tri" aria-hidden="true"></span></span>
<span class="sort-th" data-sort-field="status" role="button" tabindex="0"

View File

@@ -3,7 +3,7 @@
const DEFAULT_PLUGIN_SORT = { key: "none", order: "asc" };
// note: SORT_FIELDS are the clickable columns. "none" is the baseline/cleared state, not a field -
// it is special-cased in NormalizePluginSort and produced by CyclePluginSort's third click.
const SORT_FIELDS = new Set(["status", "name", "source"]);
const SORT_FIELDS = new Set(["status", "name", "source", "version"]);
let pluginSort = { ...DEFAULT_PLUGIN_SORT };
// why: C++ returns canonical sort state; guard stale or malformed values before reflecting them.