Bug 21582: Use CodeMirror for *UserJS & *UserCSS
authorOwen Leonard <oleonard@myacpl.org>
Fri, 29 Mar 2019 19:01:19 +0000 (19:01 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 12 Apr 2019 02:28:17 +0000 (02:28 +0000)
commit698efcc0aa2ae48b879b843857e6f12316d5ba83
tree2c4265a6e90986342eff770f4bbaf89868e2742a
parenta0e61d8c3e94f2b9e990cc2b60668187047b24bb
Bug 21582: Use CodeMirror for *UserJS & *UserCSS

This patch adds CodeMirror syntax highlighting by default to JS and CSS
system preferences. HTML preferences will use CodeMirror editors if
UseWYSIWYGinSystemPreferences is disabled.

Three new CodeMirror files are added to support three new syntax
highlighting modes: XML (for HTML), CSS, and JS.

A new option is added to *.pref file configurations for textareas which
are intended for HTML, JS, or CSS: syntax. This option is passed to the
CodeMirror configuration to control syntax highlighting mode.

Textareas without a syntax option specified will not have CodeMirror
enabled.

To test, apply the patch and go to Administration -> System preferences.

Test the behavior of several preferences which use <textarea> as their
input. For example:

- OPACUserJS (JS)
- IntranetUserCSS (CSS)
- OpacHeader (HTML)
- BibtexExportAdditionalFields (no highlighting)

Text entry in each of these should have the correct syntax highlighting
applied to them. All data should be saved correctly.

Test with UseWYSIWYGinSystemPreferences both on and off.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
14 files changed:
admin/preferences.pl
koha-tmpl/intranet-tmpl/lib/codemirror/css.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/css.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/javascript.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/javascript.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/xml.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/xml.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/css/preferences.css
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js