[PATCH] codemirror: fix model when using proxy prefix issue #160

Christian Oyarzun oyarzun at gmail.com
Thu Sep 17 20:49:31 UTC 2015


# HG changeset patch
# User Christian Oyarzun <oyarzun at gmail.com>
# Date 1442522796 14400
#      Thu Sep 17 16:46:36 2015 -0400
# Node ID b10f6c0a01fce20452947caf45d661a4ed101ce5
# Parent  889ff0f436c8b57f5962e204e699cbabc6d33aac
codemirror: fix model when using proxy prefix issue #160

diff --git a/kallithea/public/js/base.js b/kallithea/public/js/base.js
--- a/kallithea/public/js/base.js
+++ b/kallithea/public/js/base.js
@@ -896,14 +896,14 @@
 };


-var initCodeMirror = function(textarea_id, resetUrl){
+var initCodeMirror = function(textarea_id, baseUrl, resetUrl){
     var myCodeMirror = CodeMirror.fromTextArea($('#' + textarea_id)[0], {
             mode: "null",
             lineNumbers: true,
             indentUnit: 4,
             autofocus: true
         });
-    CodeMirror.modeURL = "/codemirror/mode/%N/%N.js";
+    CodeMirror.modeURL = baseUrl + "/codemirror/mode/%N/%N.js";

     $('#reset').click(function(e){
             window.location=resetUrl;
diff --git a/kallithea/templates/admin/gists/edit.html
b/kallithea/templates/admin/gists/edit.html
--- a/kallithea/templates/admin/gists/edit.html
+++ b/kallithea/templates/admin/gists/edit.html
@@ -81,7 +81,7 @@

                 ## dynamic edit box.
                 <script type="text/javascript">
-                var myCodeMirror =
initCodeMirror("editor_${h.FID('f',file.path)}", '');
+                var myCodeMirror =
initCodeMirror("editor_${h.FID('f',file.path)}","${h.url('')}",'');

                 //inject new modes
                 var $modes_select = $('#mimetype_${h.FID('f',file.path)}');
diff --git a/kallithea/templates/admin/gists/new.html
b/kallithea/templates/admin/gists/new.html
--- a/kallithea/templates/admin/gists/new.html
+++ b/kallithea/templates/admin/gists/new.html
@@ -59,7 +59,7 @@
             </div>
           ${h.end_form()}
           <script type="text/javascript">
-            var myCodeMirror = initCodeMirror('editor', '');
+            var myCodeMirror = initCodeMirror('editor',"${h.url('')}",'');

             //inject new modes
             var $modes_select = $('#mimetype');
diff --git a/kallithea/templates/files/files_add.html
b/kallithea/templates/files/files_add.html
--- a/kallithea/templates/files/files_add.html
+++ b/kallithea/templates/files/files_add.html
@@ -67,7 +67,7 @@
             ${h.end_form()}
             <script type="text/javascript">
             var reset_url =
"${h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path)}";
-            var myCodeMirror = initCodeMirror('editor',reset_url);
+            var myCodeMirror =
initCodeMirror('editor',"${h.url('')}",reset_url);

             //inject new modes, based on codeMirrors modeInfo object
             $('#set_mode').each(function(){
diff --git a/kallithea/templates/files/files_edit.html
b/kallithea/templates/files/files_edit.html
--- a/kallithea/templates/files/files_edit.html
+++ b/kallithea/templates/files/files_edit.html
@@ -75,7 +75,7 @@
 <script type="text/javascript">
 $(document).ready(function(){
     var reset_url =
"${h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.file.path)}";
-    var myCodeMirror = initCodeMirror('editor',reset_url);
+    var myCodeMirror = initCodeMirror('editor',"${h.url('')}",reset_url);

    //inject new modes, based on codeMirrors modeInfo object
     $('#set_mode').each(function(){
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20150917/66de3b60/attachment.html>


More information about the kallithea-general mailing list