|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ckeditorOptions = { |
|
|
extraPlugins:"sharedspace", |
|
|
sharedSpaces:{ |
|
|
top: "#wysiwyg-editor", |
|
|
} |
|
|
}; |
|
|
|
|
|
Vvveb.WysiwygEditor = { |
|
|
|
|
|
isActive: false, |
|
|
oldValue: '', |
|
|
doc:false, |
|
|
editor:false, |
|
|
toolbar:false, |
|
|
|
|
|
init: function(doc) { |
|
|
this.doc = doc; |
|
|
|
|
|
this.toolbar = $('#wysiwyg-editor'); |
|
|
this.toolbar.removeClass("default-editor").addClass("ckeditor"); |
|
|
this.toolbar.html(''); |
|
|
}, |
|
|
|
|
|
edit: function(element) { |
|
|
this.element = element; |
|
|
this.isActive = true; |
|
|
this.oldValue = element.html(); |
|
|
Vvveb.Builder.selectPadding = 10; |
|
|
|
|
|
element.attr({'contenteditable':true, 'spellcheckker':false}); |
|
|
|
|
|
CKEDITOR.disableAutoInline = true; |
|
|
ckeditorOptions.sharedSpaces.top = this.toolbar.get(0); |
|
|
this.editor = CKEDITOR.inline( element.get(0), ckeditorOptions ); |
|
|
|
|
|
this.toolbar.show(); |
|
|
}, |
|
|
|
|
|
destroy: function(element) { |
|
|
|
|
|
element.removeAttr('contenteditable spellcheckker'); |
|
|
|
|
|
this.toolbar.hide(); |
|
|
|
|
|
node = this.element.get(0); |
|
|
Vvveb.Undo.addMutation({type:'characterData', |
|
|
target: node, |
|
|
oldValue: this.oldValue, |
|
|
newValue: node.innerHTML}); |
|
|
} |
|
|
} |
|
|
|