1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-30 23:44:55 +02:00

Desktop: Fixes #4441: Fixed copying text from Rich Text editor

This commit is contained in:
Laurent Cozic
2021-01-30 11:08:11 +00:00
parent cb2c2160ae
commit 73314447b9
7 changed files with 36 additions and 25 deletions

View File

@ -1,7 +1,7 @@
const stringToStream = require('string-to-stream');
// const cleanHtml = require('clean-html');
const resourceUtils = require('./resourceUtils.js');
const { isSelfClosingTag } = require('./htmlUtils');
const htmlUtils = require('./htmlUtils').default;
const Entities = require('html-entities').AllHtmlEntities;
const htmlentities = new Entities().encode;
@ -126,7 +126,7 @@ function enexXmlToHtml_(stream, resources) {
const nodeAttributes = attributeToLowerCase(node);
const checkedHtml = nodeAttributes.checked && nodeAttributes.checked.toLowerCase() == 'true' ? ' checked="checked" ' : ' ';
section.lines.push(`<input${checkedHtml}type="checkbox" onclick="return false;" />`);
} else if (isSelfClosingTag(tagName)) {
} else if (htmlUtils.isSelfClosingTag(tagName)) {
section.lines.push(`<${tagName}${attributesStr}/>`);
} else {
section.lines.push(`<${tagName}${attributesStr}>`);
@ -135,7 +135,7 @@ function enexXmlToHtml_(stream, resources) {
saxStream.on('closetag', function(node) {
const tagName = node ? node.toLowerCase() : node;
if (!isSelfClosingTag(tagName)) section.lines.push(`</${tagName}>`);
if (!htmlUtils.isSelfClosingTag(tagName)) section.lines.push(`</${tagName}>`);
});
saxStream.on('attribute', function() {});