Bug 41452 - Add optional “Beautify” formatting for CodeMirror SQL / JS / CSS editors
Summary: Add optional “Beautify” formatting for CodeMirror SQL / JS / CSS editors
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-12-16 06:56 UTC by Saiful Amin
Modified: 2025-12-16 06:56 UTC (History)
1 user (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Saiful Amin 2025-12-16 06:56:04 UTC
Koha uses CodeMirror for editing SQL (Reports) and custom JS/CSS. While syntax highlighting is available, there is no way to format existing content.

Even a short SQL query (4–5 lines) quickly becomes hard to read and error-prone when pasted or modified over time. A simple "Beautify" action, similar to what tools like Postman provide, would significantly improve readability and maintainability.


Expected behavior:
Provide an optional, client-side “Beautify” button for CodeMirror editors that:
* Formats SQL in the Reports module
* Formats JS/CSS in relevant system preference editors
* Runs client-side only and is explicitly triggered

This would not affect query execution or validation, and would only improve editor readability.

Widely used open-source client-side formatters (e.g. Prettier for JS/CSS and sql-formatter for SQL) could be integrated and loaded only on relevant pages.