From 075762000b3c3535665dc8937f1adc594f0cde83 Mon Sep 17 00:00:00 2001 From: djmaze Date: Fri, 30 Oct 2020 16:59:52 +0100 Subject: [PATCH] Resolve https://github.com/the-djmaze/snappymail/issues/32 Related https://github.com/the-djmaze/snappymail/issues/28 --- vendors/squire/build/squire-raw.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vendors/squire/build/squire-raw.js b/vendors/squire/build/squire-raw.js index f3b6faa7f..f482c05b5 100644 --- a/vendors/squire/build/squire-raw.js +++ b/vendors/squire/build/squire-raw.js @@ -46,6 +46,8 @@ const indexOf = (array, value) => Array.prototype.indexOf.call(array, value), + filterAccept = NodeFilter.FILTER_ACCEPT, + typeToBitArray = { // ELEMENT_NODE 1: 1, @@ -108,7 +110,7 @@ const isBlock = node => getNodeCategory( node ) === BLOCK, isContainer = node => getNodeCategory( node ) === CONTAINER, createTreeWalker = (root, whatToShow, filter) => doc.createTreeWalker( root, whatToShow, filter ? { - acceptNode: node => filter(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP + acceptNode: node => filter(node) ? filterAccept : NodeFilter.FILTER_SKIP } : null ), getBlockWalker = ( node, root ) => { @@ -2732,7 +2734,7 @@ proto.getSelectedText = function () { let addedTextInBlock = false; let value; - if ( !walker.filter( node ) ) { + if ( filterAccept != walker.filter.acceptNode( node ) ) { node = walker.nextNode(); } @@ -3220,7 +3222,7 @@ proto._addFormat = function ( tag, attributes, range ) { // Make sure we start with a valid node. walker.currentNode = startContainer; - if ( !walker.filter( startContainer ) ) { + if ( filterAccept != walker.filter.acceptNode( startContainer ) ) { startContainer = walker.nextNode(); startOffset = 0; }