1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Desktop: Fixes #10061: Fix paste adds newlines in the Rich Text Editor when certain plugins are enabled (#10635)

This commit is contained in:
Henry Heino
2024-06-19 02:54:34 -07:00
committed by GitHub
parent e1abe0b4cb
commit 818f9f58d1
3 changed files with 67 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
import htmlUtils, { extractHtmlBody, htmlDocIsImageOnly } from './htmlUtils';
import htmlUtils, { extractHtmlBody, htmlDocIsImageOnly, removeWrappingParagraphAndTrailingEmptyElements } from './htmlUtils';
describe('htmlUtils', () => {
@@ -86,4 +86,14 @@ describe('htmlUtils', () => {
}
});
it.each([
['<p>Test</p><div></div>', 'Test'],
['<p>Testing</p><p>A test</p>', '<p>Testing</p><p>A test</p>'],
['<p>Testing</p><hr/>', '<p>Testing</p><hr/>'],
['<p>Testing</p><div style="border: 2px solid red;"></div>', '<p>Testing</p><div style="border: 2px solid red;"></div>'],
['<p>Testing</p><style onload=""></style>', 'Testing'],
['<p>is</p>\n<style onload="console.log(\'test\')"></style>', 'is\n'],
])('should remove empty elements (case %#)', (before, expected) => {
expect(removeWrappingParagraphAndTrailingEmptyElements(before)).toBe(expected);
});
});