Bugzilla – Attachment 107267 Details for
Bug 22660
Allow use of CodeMirror for editing HTML in the news editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22660: Add system pref to allow switching of editors in News Tool
Bug-22660-Add-system-pref-to-allow-switching-of-ed.patch (text/plain), 5.91 KB, created by
Owen Leonard
on 2020-07-23 18:15:27 UTC
(
hide
)
Description:
Bug 22660: Add system pref to allow switching of editors in News Tool
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-07-23 18:15:27 UTC
Size:
5.91 KB
patch
obsolete
>From 4690e6328e6559cf0dd1d5b3b560d297896f9836 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 8 May 2020 22:57:40 +0000 >Subject: [PATCH] Bug 22660: Add system pref to allow switching of editors in > News Tool > >This patch adds a system preference called 'NewsToolEditor' which allows for the choice between TinyMCE and CodeMirror in the News Feature. > >TEST PLAN: >1. Apply patch and run updatedatabase >2. Go to Tools > News and make a new entry or edit an existing News item. >3. When you initially load you should gte the TinyMCE editor (WYSIWYG) >4. Search for the NewsToolEditor system preference and switch to CodeMirror. >5. Reload your News item and now you should see the CodeMirror editor. >6. Try saving content with both and maki sure it works. >7. Try adding some different HTML tags in CodeMirror mode, saving, and making sure it looks right when you switch back to TinyMCE > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > .../bug_22660_add_NewsToolEditor_system_preference.perl | 6 ++++++ > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/tools.pref | 8 +++++++- > .../intranet-tmpl/prog/en/modules/tools/koha-news.tt | 17 +++++++++++++++++ > 4 files changed, 31 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_22660_add_NewsToolEditor_system_preference.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_22660_add_NewsToolEditor_system_preference.perl b/installer/data/mysql/atomicupdate/bug_22660_add_NewsToolEditor_system_preference.perl >new file mode 100644 >index 0000000000..88e141612d >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_22660_add_NewsToolEditor_system_preference.perl >@@ -0,0 +1,6 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do( "INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('NewsToolEditor','tinymce', 'Choose tool for editing News','tinymce|codemirror','Choice')" ); >+ >+ NewVersion( $DBversion, 22660, "Adds NewsToolEditor system preference"); >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index dbb13938ae..e73eb5a0d1 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -330,6 +330,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('minPasswordLength','8',NULL,'Specify the minimum length of a patron/staff password','free'), > ('NewItemsDefaultLocation','','','If set, all new items will have a location of the given Location Code ( Authorized Value type LOC )',''), > ('NewsAuthorDisplay','none','none|opac|staff|both','Display the author name for news items.','Choice'), >+('NewsToolEditor','tinymce','tinymce|codemirror','Choose tool for editing News.', 'Choice'), > ('noissuescharge','5','','Define maximum amount withstanding before check outs are blocked','Integer'), > ('NoIssuesChargeGuarantees','','','Define maximum amount withstanding before check outs are blocked','Integer'), > ('noItemTypeImages','0',NULL,'If ON, disables itemtype images in the staff interface','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref >index 1d4f2965ef..77a40f1529 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref >@@ -36,7 +36,13 @@ Tools: > opac: "OPAC only" > staff: "Staff client only" > both: "Both OPAC and staff client" >- - >+ - >+ - Use >+ - pref: NewsToolEditor >+ choices: >+ tinymce: "TinyMCE (WYSIWYG)" >+ codemirror: "CodeMirror" >+ - when editing News. > Upload: > - > - Automatically delete temporary uploads older than >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >index a42aea511e..80d6d68dff 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >@@ -4,6 +4,12 @@ > [% USE Branches %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] >+[% Asset.css("lib/codemirror/codemirror.css") | $raw %] >+<style> >+.CodeMirror { >+ resize: vertical; >+} >+</style> > <title>Koha › Tools › News</title> > [% INCLUDE 'doc-head-close.inc' %] > [% IF ( opac_news_count ) %] >@@ -206,6 +212,8 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'calendar.inc' %] > [% Asset.js("js/tools-menu.js") | $raw %] >+ [% Asset.js("lib/d3c3/d3.min.js") | $raw %] >+ [% Asset.js("lib/d3c3/c3.min.js") | $raw %] > [% IF ( opac_news_count ) %] > [% INCLUDE 'datatables.inc' %] > <script> >@@ -292,9 +300,17 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > }); > </script> > [% END %] >+ [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %] > [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %] > [% INCLUDE 'str/tinymce_i18n.inc' %] > <script> >+ [% IF Koha.Preference('NewsToolEditor') == 'codemirror' %] >+ var editor = CodeMirror.fromTextArea(document.getElementById('content'), { >+ lineNumbers: true, >+ mode: "text/html", >+ lineWrapping: true >+ }); >+ [% ELSE %] > tinyMCE.init({ > verify_html: false, > force_br_newlines : false, >@@ -311,6 +327,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help" > ], > }); >+ [% END %] > </script> > [% END %] > >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22660
:
104624
|
104948
|
104951
|
105129
|
105158
|
107267
|
107268
|
107269
|
107270
|
107361
|
107362
|
107363
|
107554
|
107555
|
107556
|
107557
|
107592