Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Bulychev committed Dec 26, 2023
1 parent 5d9b02c commit 9565ce5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ const STYLE_ATTRIBUTORS = [
return memo;
}, {});

let multilineParagraph = false;

class Clipboard extends Module {
constructor(quill, options) {
super(quill, options);
Expand Down Expand Up @@ -404,6 +406,7 @@ function traverse(scroll, node, elementMatchers, textMatchers, nodeMatches) {
&& ['ul', 'ol'].indexOf(nextNode.tagName.toLowerCase()) > -1;

if (childNode.nodeType === node.ELEMENT_NODE) {
multilineParagraph = childNode.tagName.toLowerCase() === 'br';
childrenDelta = elementMatchers.reduce((reducedDelta, matcher) => {
return matcher(childNode, reducedDelta, scroll);
}, childrenDelta);
Expand All @@ -417,7 +420,7 @@ function traverse(scroll, node, elementMatchers, textMatchers, nodeMatches) {

const newDelta = delta.concat(childrenDelta);

if (isNextNodeList) {
if (multilineParagraph && isNextNodeList) {
newDelta.insert('\n');
}

Expand Down

0 comments on commit 9565ce5

Please sign in to comment.