Skip to content

Commit

Permalink
Item12000: separate out hallojs from bootstrap and add a toggle button
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/Html5EditContrib@16301 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Dec 30, 2012
1 parent e5cdb0c commit 0ac9691
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
45 changes: 28 additions & 17 deletions lib/Foswiki/Contrib/Html5EditContrib/Hallojs.pm
Expand Up @@ -49,23 +49,34 @@ sub renderJS {
$text .= '?version=' . $this->{version} if ( $this->{version} =~ '$Rev$' );
$text =
"<script type='text/javascript' src='$this->{puburl}/$text'></script>\n"
. "<script type='text/javascript'>jQuery(function(){jQuery('.foswikiTopicText').hallo({
toolbar: 'halloToolbarFixed',
plugins: {
'halloformat': {},
'halloheadings': {},
'hallolists': {},
'halloreundo': {},
'hallolink': {}
}
}).bind('hallodeactivated', function(event, data){
var item = jQuery(this).data('hallo');
if (item.isModified()) {
foswiki.post('save', { text: this.innerHTML, wysiwyg_edit: 'go', web: foswiki.getPreference('WEB'), topic: foswiki.getPreference('TOPIC') });
}
}).bind('halloactivated', function(event, data){
});
})</script>\n";
. "<script type='text/javascript'>
var halloObj;
jQuery(function(){
jQuery('.foswikiHallojsEditEnabler').bind('click', function() {
jQuery('.foswikiTopicText').toggleClass('foswikiHallojsEdit');
});
jQuery('.foswikiHallojsEdit').livequery(function() {
halloObj = jQuery(this).hallo({
toolbar: 'halloToolbarFixed',
toolbarPositionAbove: true,
plugins: {
'halloformat': {},
'halloheadings': {},
'hallolists': {},
'halloreundo': {},
'hallolink': {}
}
}).bind('hallodeactivated', function(event, data){
var item = jQuery(this).data('hallo');
if (item.isModified()) {
foswiki.post('save', { text: this.innerHTML, wysiwyg_edit: 'go', web: foswiki.getPreference('WEB'), topic: foswiki.getPreference('TOPIC') });
}
}).bind('halloactivated', function(event, data){
});
});
})
</script>\n";
return $text;
}

Expand Down
2 changes: 2 additions & 0 deletions lib/Foswiki/Contrib/Html5EditContrib/MANIFEST
Expand Up @@ -5,3 +5,5 @@ lib/Foswiki/Contrib/Html5EditContrib/Hallojs.pm Perl module
lib/Foswiki/Contrib/Html5EditContrib/Config.spec 0444 Configuration
pub/System/Html5EditContrib/hallo.js
pub/System/Html5EditContrib/hallo.css
templates/foswiki.hallojs.tmpl
templates/viewtopicactionbuttons.hallojs.tmpl

0 comments on commit 0ac9691

Please sign in to comment.