Selection fixes.
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 14 Sep 2021 13:19:21 +0000 (15:19 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 14 Sep 2021 13:19:21 +0000 (15:19 +0200)
src/redakcja/static/js/wiki/view_editor_wysiwyg.js

index 7b4069c..7baa00d 100644 (file)
                 var htmlView = $('#html-view');
                 htmlView.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){
 
         let selection = window.getSelection();
         var n = selection.rangeCount;
 
         let selection = window.getSelection();
         var n = selection.rangeCount;
-        if (n != 1) {
+        if (n != 1 || selection.isCollapsed) {
             window.alert("Nie zaznaczono obszaru");
             return false
         }
             window.alert("Nie zaznaczono obszaru");
             return false
         }