Fixed return key inside nested lists
authorAlexander Ebert <ebert@woltlab.com>
Fri, 1 Sep 2017 11:51:31 +0000 (13:51 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 1 Sep 2017 11:51:31 +0000 (13:51 +0200)
wcfsetup/install/files/js/3rdParty/redactor/redactor.js

index d65e5a06e6442be52732cb58b646d003f24f8dc6..7fe97816a0b946e9d5b717195f11169eff778ea7 100644 (file)
                                                                        $list.after(node);
                                                                        this.caret.setStart(node);
 
+                                                                       return false;
+                                                               }
+                                                       }
+                                                       else if (this.keydown.block.tagName === 'P' && this.keydown.block.parentNode.tagName === 'LI') {
+                                                               // check if the <p> is empty and this is the last child
+                                                               var p = this.keydown.block;
+                                                               if (p.nextElementSibling === null && this.utils.isEmpty(p.innerHTML)) {
+                                                                       var li = p.parentNode;
+                                                                       
+                                                                       // only child of this <li>
+                                                                       if (p.previousElementSibling === null) {
+                                                                               var list = li.parentNode;
+                                                                               list.removeChild(li);
+                                                                               
+                                                                               var node = $(this.opts.emptyHtml)[0];
+                                                                               list.parentNode.insertBefore(node, list.nextElementSibling);
+                                                                               this.caret.setStart(node);
+                                                                               
+                                                                               return false;
+                                                                       }
+                                                                       
+                                                                       li.removeChild(p);
+                                                                       
+                                                                       var node = $('<li>' + this.opts.emptyHtml + '</li>')[0];
+                                                                       li.parentNode.insertBefore(node, li.nextElementSibling);
+                                                                       this.caret.setStart(node.children[0]);
+                                                                       
                                                                        return false;
                                                                }
                                                        }