Repository navigation
feat: show snippet ID in editor and add trash and export-all options - #588
Open
faisalahammad wants to merge 1 commit into
Open
faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the three improvements requested in #555: the snippet ID is shown in the editor sidebar, snippets in the Trash tab can be exported, and a new Export All button downloads every snippet in one file, including trashed ones.
Closes #555
Changes
Snippet ID in editor sidebar (new
SnippetIdInfo.tsx)Before: the ID was only visible in the page URL.
After: saved snippets show their numeric ID in the sidebar settings, next to a copy button. Hidden for unsaved snippets.
Why: users need a reliable way to reference a snippet ID without reading the URL.
Export from Trash (
useApplyBulkAction.ts,RowActions.tsx,ManageSnippetCard.tsx)Before: the Export row action, bulk action, and card menu item were all hidden in the Trash tab.
After: Export is available in the Trash tab in all three places. Table and card view behave the same.
Why: the existing export builder already writes
trashed: truefor trashed snippets and the importer ignores that field, so these exports stay import compatible and no PHP change is needed.Export All (
SnippetsTableControls.tsx)Before: no way to export all snippets at once without selecting rows in every tab.
After: a new button in the list toolbar fetches all snippets through the existing REST endpoint (no pagination, all statuses) and downloads one
snippets.code-snippets.jsonfile.Why:
get_itemswith no query parameters already returns the full set including trashed snippets, so a client-side download reuses existing behavior with no new endpoint.Exports are read only and do not modify snippet data.
Testing
Export All
snippets.code-snippets.json.Export from Trash
"trashed": trueand import successfully.Snippet ID
idquery parameter in the URL.Automated: added Playwright tests for all three flows in
tests/e2e/code-snippets-edit.spec.ts,tests/e2e/code-snippets-list.spec.ts, andtests/e2e/helpers/SnippetsTestHelper.tshelper (trashSnippet). Full lint suite and webpack build pass.