Bugzilla – Attachment 126368 Details for
Bug 29153
CodeMirror broken for news and HTML customizations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29153: Fix CodeMirror textareas to work with all languages
Bug-29153-Fix-CodeMirror-textareas-to-work-with-al.patch (text/plain), 3.44 KB, created by
Lucas Gass (lukeg)
on 2021-10-15 17:11:33 UTC
(
hide
)
Description:
Bug 29153: Fix CodeMirror textareas to work with all languages
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2021-10-15 17:11:33 UTC
Size:
3.44 KB
patch
obsolete
>From 29ca4289705bb5671e38aa1774040d63bc025fde Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 15 Oct 2021 17:05:42 +0000 >Subject: [PATCH] Bug 29153: Fix CodeMirror textareas to work with all > languages > >To test: >1. Go to Tools > HTML customizations >2. Open or create a new entry with CodeMirror. ( Edit with text editor ) >3. CodeMirror doesn't work, notice a console error. >4. Apply patch >5. Try steps 1 & 2 again. The CodeMirror editor should now load. >6. Make sure it works in both the Default and English(en) tabs. >7. BONUS: install some other language packs and look at the tabs for that language, it should still work. >--- > .../en/modules/tools/additional-contents.tt | 21 +++++++++++-------- > 1 file changed, 12 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >index 2f74dfbcfc..075025bc56 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >@@ -257,7 +257,7 @@ > </li> > <li style="list-style: none;"> > <label for="content_[% language.lang | html %]">Content: </label> >- <textarea name="content" id="content_[% language.lang | html %]" cols="75" rows="10">[% translated_contents.item(language.lang).content | html %]</textarea> >+ <textarea name="content" id="content_[% language.lang | html %]" data-lang="[% language.lang | html%]" cols="75" rows="10">[% translated_contents.item(language.lang).content | html %]</textarea> > <input type="hidden" name="lang" value="[% language.lang | html %]" /> > </li> > </ol> >@@ -268,7 +268,7 @@ > [% ELSE %] > <div id="lang_default"> > <div class="clearfix"> >- <textarea name="content" id="content_default" cols="75" rows="10">[% additional_content.content | html %]</textarea> >+ <textarea name="content" id="content_default" data-lang="[% language.lang | html %]" cols="75" rows="10">[% additional_content.content | html %]</textarea> > </div> > </div> > [% END %] >@@ -582,13 +582,16 @@ > [% 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, >+ $("textarea[name='content']").each( function(index) { >+ var this_lang = $(this).attr('data-lang'); >+ var editor = CodeMirror.fromTextArea(document.getElementById('content_' + this_lang), { >+ lineNumbers: true, >+ lineWrapping: true, >+ lint: true, >+ mode: "text/html", >+ gutters: ["CodeMirror-lint-markers"], >+ viewportMargin: Infinity, >+ }); > }); > </script> > [% ELSE %] >-- >2.20.1
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 29153
:
126368
|
126390
|
126463