You've already forked joplin
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:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user