The following are directions to add line wrapping functionality to version 0.9.6.
Add these to the bottom of codepress.css:
.wrap>pre{
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
Replace lines 79-81 of codepress.js
self.toggleLineNumbers = function() {
var cn = self.editor.body.className;
self.editor.body.className = (cn==''||cn=='show-line-numbers') ? 'hide-line-numbers' : 'show-line-numbers';
}
with the following:
self.toggleLineNumbers = function() {
var b=self.editor.body, c=b.className;
b.className=(c.match('hide-line-numbers'))?c.replace(/hide-line-numbers/g,''):c+' hide-line-numbers';
}
self.toggleWrap = function(){
var b=self.editor.body, c=b.className;
b.className=(c.match('wrap'))?c.replace(/wrap/g,''):c+' wrap';
}
Finally, to allow preloading on line 58 of codepress.js, below
if(self.options.match('linenumbers-off')) self.toggleLineNumbers();
add this:
if(self.options.match('wrap')) self.toggleWrap();
To enable wrapping either add the "wrap" class to the textarea you are replacing or call "codepress_id.toggleWrap();".
Edited files for this patch.
Use this on line 58 instead. The regex is more precise here.
self.toggleLineNumbers = function() {
var b=self.editor.body, c=b.className;
b.className=(c.match(/\bhide-line-numbers\b/))?c.replace(/\bhide-line-numbers\b/g,''):c+' hide-line-numbers';
}
self.toggleWrap = function(){
var b=self.editor.body, c=b.className;
b.className=(c.match(/\bwrap\b/))?c.replace(/\bwrap\b/g,''):c+' wrap';
}