Make WordPress Core

Ticket #37507: 37507.patch

File 37507.patch, 2.3 KB (added by NickDuncan, 9 years ago)

Modified tinymce.js to suit the changes made in the commit on https://github.com/tinymce/tinymce/commit/68d6c78ff14c038d40c791b7940d87e731d90fc3

  • src/wp-includes/js/tinymce/tinymce.js

     
    3626136261                        return null;
    3626236262                }
    3626336263
     36264                function isTextBlock(node) {
     36265                        var textBlocks = editor.schema.getTextBlockElements();
     36266                        return node.nodeName in textBlocks;
     36267                }
     36268 
     36269                function isEmpty(elm) {
     36270                        return editor.dom.isEmpty(elm);
     36271                }
     36272
    3626436273                function mergeTextBlocks(direction, fromCaretPosition, toCaretPosition) {
    36265                         var dom = editor.dom, fromBlock, toBlock, node, textBlocks;
     36274                        var dom = editor.dom, fromBlock, toBlock, node, ceTarget;
     36275 
     36276                        fromBlock = dom.getParent(fromCaretPosition.getNode(), dom.isBlock);
     36277                        toBlock = dom.getParent(toCaretPosition.getNode(), dom.isBlock);
    3626636278
    3626736279                        if (direction === -1) {
    36268                                 if (isAfterContentEditableFalse(toCaretPosition) && isBlock(toCaretPosition.getNode(true))) {
     36280                                ceTarget = toCaretPosition.getNode(true);
     36281                                if (isAfterContentEditableFalse(toCaretPosition) && isBlock(ceTarget)) {
     36282                                        if (isTextBlock(fromBlock)) {
     36283                                                if (isEmpty(fromBlock)) {
     36284                                                        dom.remove(fromBlock);
     36285                                                }
     36286 
     36287                                                return CaretPosition.after(ceTarget).toRange();
     36288                                        }
     36289                               
    3626936290                                        return deleteContentEditableNode(toCaretPosition.getNode(true));
    3627036291                                }
    3627136292                        } else {
    36272                                 if (isBeforeContentEditableFalse(fromCaretPosition) && isBlock(fromCaretPosition.getNode())) {
     36293                                ceTarget = fromCaretPosition.getNode();
     36294                                if (isBeforeContentEditableFalse(fromCaretPosition) && isBlock(ceTarget)) {
     36295                                        if (isTextBlock(toBlock)) {
     36296                                                if (isEmpty(toBlock)) {
     36297                                                        dom.remove(toBlock);
     36298                                                }
     36299 
     36300                                                return CaretPosition.before(ceTarget).toRange();
     36301                                        }
     36302 
    3627336303                                        return deleteContentEditableNode(fromCaretPosition.getNode());
    3627436304                                }
    3627536305                        }
    3627636306
    36277                         textBlocks = editor.schema.getTextBlockElements();
    36278                         fromBlock = dom.getParent(fromCaretPosition.getNode(), dom.isBlock);
    36279                         toBlock = dom.getParent(toCaretPosition.getNode(), dom.isBlock);
    3628036307
    3628136308                        // Verify that both blocks are text blocks
    36282                         if (fromBlock === toBlock || !textBlocks[fromBlock.nodeName] || !textBlocks[toBlock.nodeName]) {
     36309                        if (fromBlock === toBlock || !isTextBlock(fromBlock) || !isTextBlock(toBlock)) {
    3628336310                                return null;
    3628436311                        }
    3628536312