generators/wysihat/templates/javascripts/wysihat_engine.js in wysihat-engine-0.1.3 vs generators/wysihat/templates/javascripts/wysihat_engine.js in wysihat-engine-0.1.4

- old
+ new

@@ -43,31 +43,33 @@ facebox.reveal('<textarea id=\"html_editor\" style=\"width:100%; height:400px;\">' + iframe.contentWindow.document.body.innerHTML + '</textarea>', null); Event.observe('html_editor', 'change', function(event) { iframe.contentWindow.document.body.innerHTML = $('html_editor').value; }); }, - - faceboxPaste: function() - { - facebox.loading(); - new Effect.Appear($('facebox'), {duration: .3}); - iframe = this - facebox.reveal('<textarea id=\"paste_editor\" style=\"width:100%; height:400px;\"></textarea>', null); - Event.observe('paste_editor', 'change', function(event) { - iframe.contentWindow.document.body.innerHTML = iframe.contentWindow.document.body.innerHTML + $('paste_editor').value.escapeHTML(); - }); - } } WysiHat.Editor.include(WysihatHelper); Event.observe(window, 'load', function() { - $$('textarea').each(function(i){ + $$('textarea.wysihat_editor').each(function(i){ var editor = WysiHat.Editor.attach(i.id); var toolbar = new WysiHat.Toolbar(editor); toolbars[i.id] = toolbar; + + editor.outputFilter = function(text) { + return text.formatHTMLOutput().sanitize({ + tags: ['span', 'p', 'br', 'strong', 'em', 'a'], + attributes: ['id', 'href'] + }); + }; + + editor.observe("wysihat:paste", function(event) { + setTimeout(function() { + event.target.reload(); + }, 1); + }); }); - + $$('form').each().onsubmit = function(){ editor.save(); }; }); \ No newline at end of file