Commit ec828378 by benjaoming

Merge branch 'master' of github.com:benjaoming/django-wiki

parents 5b6c4968 7a2103d8
django-wiki
===========
***News: April 23rd, 2013***
Security fix included in 0.0.19. [View commit log >](https://github.com/benjaoming/django-wiki/commits/alpha/0.0.19)
***News: March 26, 2013***
Thanks to TomLottermann for German translation and daltonmatos for Brazilian translations! French are also reported in the works. 0.0.18 is released with that plus Django 1.5 compatibility, and [a bunch of other things and fixes](https://groups.google.com/forum/#!topic/django-wiki/V-bZou8aTaI).
......
......@@ -23,6 +23,32 @@ insertAtCaret: function(myValue){
this.focus();
}
})
},
wrapSelection: function(openWrap, closeWrap){
return this.each(function(i) {
if (document.selection) {
//For browsers like Internet Explorer
this.focus();
sel = document.selection.createRange();
sel.text = openWrap + sel.text + closeWrap;
this.focus();
}
else if (this.selectionStart || this.selectionStart == '0') {
//For browsers like Firefox and Webkit based
var startPos = this.selectionStart;
var endPos = this.selectionEnd;
var scrollTop = this.scrollTop;
this.value = this.value.substring(0, startPos) + openWrap + this.value.substring(startPos,endPos) + closeWrap + this.value.substring(endPos,this.value.length);
this.focus();
this.selectionStart = startPos + openWrap.length;
this.selectionEnd = endPos + openWrap.length;
this.scrollTop = scrollTop;
} else {
this.value += openWrap + closeWrap;
this.focus();
}
})
}
});
......@@ -7,7 +7,7 @@
{% block wiki_contents %}
{% addtoblock "js" %}
<script type="text/javascript" src="{{ STATIC_URL }}admin/js/urlify.js "></script>
<script type="text/javascript" src="{{ STATIC_URL }}admin/js/urlify.js"></script>
<script type="text/javascript">
// Replacement of django's URLify that doesn't remove any words.
function URLify(s, num_chars) {
......@@ -22,6 +22,7 @@
s = s.toLowerCase(); // convert to lowercase
return s.substring(0, num_chars);// trim to first num_chars chars
}
{% if not create_form.slug.value %}
//<![CDATA[
(function($) {
$(document).ready(function (){
......@@ -38,6 +39,7 @@
});
})(jQuery);
//]]>
{% endif %}
</script>
{% endaddtoblock %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment