Editor fix
[redakcja.git] / redakcja / static / js / wiki / view_editor_wysiwyg.js
index 01deb58..4353848 100644 (file)
 
                 $('.accept-button', $overlay).click(function(){
                     save();
 
                 $('.accept-button', $overlay).click(function(){
                     save();
+                    $(document).unbind('click.blur-overlay');
                 });
 
                 $(document).bind('click.blur-overlay', function(event){
                 });
 
                 $(document).bind('click.blur-overlay', function(event){
         xml2html({
             xml: this.doc.text,
             success: function(element){
         xml2html({
             xml: this.doc.text,
             success: function(element){
-                $('#html-view').html(element);
+                var htmlView = $('#html-view');
+                htmlView.html(element);
+                htmlView.find('*[x-node]').dblclick(function(e) {
+                    if($(e.target).is('textarea'))
+                        return;
+                    var selection = window.getSelection();
+                    selection.collapseToStart();
+                    selection.modify('extend', 'forward', 'word');
+                    e.stopPropagation();
+                });
                 _finalize(success);
             },
             error: function(text, source){
                 _finalize(success);
             },
             error: function(text, source){