Ticket #37507: 37507.patch
File 37507.patch, 2.3 KB (added by , 9 years ago) |
---|
-
src/wp-includes/js/tinymce/tinymce.js
36261 36261 return null; 36262 36262 } 36263 36263 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 36264 36273 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); 36266 36278 36267 36279 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 36269 36290 return deleteContentEditableNode(toCaretPosition.getNode(true)); 36270 36291 } 36271 36292 } 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 36273 36303 return deleteContentEditableNode(fromCaretPosition.getNode()); 36274 36304 } 36275 36305 } 36276 36306 36277 textBlocks = editor.schema.getTextBlockElements();36278 fromBlock = dom.getParent(fromCaretPosition.getNode(), dom.isBlock);36279 toBlock = dom.getParent(toCaretPosition.getNode(), dom.isBlock);36280 36307 36281 36308 // 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)) { 36283 36310 return null; 36284 36311 } 36285 36312