Bugzilla – Attachment 107362 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: (follow-up) Improve asset handling, add linting
Bug-22660-follow-up-Improve-asset-handling-add-lin.patch (text/plain), 6.10 KB, created by
ByWater Sandboxes
on 2020-07-24 16:34:41 UTC
(
hide
)
Description:
Bug 22660: (follow-up) Improve asset handling, add linting
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2020-07-24 16:34:41 UTC
Size:
6.10 KB
patch
obsolete
>From 87442cc1c523b531143b694d75b0733a378044e2 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 23 Jul 2020 17:58:22 +0000 >Subject: [PATCH] Bug 22660: (follow-up) Improve asset handling, add linting > >This patch makes some changes to the way assets are included based on >the value of the system preferece in order to minimize unnecessary >JavaScript includes. > >The patch also adds HTML syntax-highlighting and linting like we have in >the system preferences editor. > >Removed are two JS files which were not required. > >To test, apply the patch and set the NewsToolEditor preference to >"CodeMirror." > > - Edit a news item and confirm that the contents of the > editor show HTML syntax highlighting. > - Test HTML linting by adding some malformed HTML (missing closing tag, > for instance). The error should be highlighted. > - Set the NewsToolEditor to "TinyMCE" and confirm that WYSIWYG editing > still works correctly. > >https://bugs.koha-community.org/show_bug.cgi?id=22600 > >Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> >--- > .../prog/en/modules/tools/koha-news.tt | 87 +++++++++++++--------- > 1 file changed, 50 insertions(+), 37 deletions(-) > >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 80d6d68dff..9cc58f371d 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 >@@ -1,19 +1,23 @@ > [% USE raw %] > [% USE Asset %] >+[% USE Koha %] > [% USE KohaDates %] > [% 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 ) %] > [% END %] >+[% IF Koha.Preference('NewsToolEditor') == 'codemirror' %] >+ [% Asset.css("lib/codemirror/codemirror.css") | $raw %] >+ [% Asset.css("lib/codemirror/lint.min.css") | $raw %] >+ <style> >+ .CodeMirror { >+ resize: vertical; >+ } >+ </style> >+[% END %] > </head> > > <body id="tools_koha-news" class="tools"> >@@ -208,12 +212,12 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > </div> <!-- /.col-sm-2.col-sm-pull-10 --> > [% END %] > </div> <!-- /.row --> >+ </div> <!-- /.main.container-fluid --> >+ > > [% 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> >@@ -300,35 +304,44 @@ 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, >- force_p_newlines : false, >- forced_root_block : '', >- branding : false, >- relative_urls : false, >- content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css", >- menubar : "file edit view insert format tools table", >- mode : "specific_textareas", >- plugins : "autoresize table hr link image charmap lists code emoticons", >- toolbar : [ >- "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr", >- "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help" >- ], >- }); >- [% END %] >- </script> >+ [% IF Koha.Preference('NewsToolEditor') == 'codemirror' %] >+ [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %] >+ [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %] >+ [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %] >+ [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %] >+ [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %] >+ <script> >+ var editor = CodeMirror.fromTextArea(document.getElementById('content'), { >+ lineNumbers: true, >+ lineWrapping: true, >+ lint: true, >+ mode: "text/html", >+ gutters: ["CodeMirror-lint-markers"], >+ viewportMargin: Infinity, >+ }); >+ </script> >+ [% ELSE %] >+ [% INCLUDE 'str/tinymce_i18n.inc' %] >+ [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %] >+ <script> >+ tinyMCE.init({ >+ verify_html: false, >+ force_br_newlines : false, >+ force_p_newlines : false, >+ forced_root_block : '', >+ branding : false, >+ relative_urls : false, >+ content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css", >+ menubar : "file edit view insert format tools table", >+ mode : "specific_textareas", >+ plugins : "autoresize table hr link image charmap lists code emoticons", >+ toolbar : [ >+ "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr", >+ "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help" >+ ], >+ }); >+ </script> >+ [% END # /IF NewsToolEditor %] > [% END %] > > [% BLOCK lang_locations %] >-- >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