Fixed escaped chars on paste

This commit is contained in:
Benoit Schweblin 2018-03-30 16:07:52 +01:00
parent c67f2c88b9
commit 0cf15a36c6
2 changed files with 4 additions and 1 deletions

View File

@ -14,6 +14,8 @@
<br> <br>
<a target="_blank" href="https://community.stackedit.io/">Community</a> <a target="_blank" href="https://community.stackedit.io/">Community</a>
<hr> <hr>
For commercial support and custom development, please <a href="mailto:stackedit.project@gmail.com">contact us</a>.
<hr>
<h3>FAQ</h3> <h3>FAQ</h3>
<div class="faq" v-html="faq"></div> <div class="faq" v-html="faq"></div>
<hr> <hr>

View File

@ -333,6 +333,7 @@ function cledit(contentElt, scrollEltOpt) {
}); });
const turndownService = new TurndownService(store.getters['data/computedSettings'].turndown); const turndownService = new TurndownService(store.getters['data/computedSettings'].turndown);
turndownService.escape = str => str; // Disable escaping
contentElt.addEventListener('paste', (evt) => { contentElt.addEventListener('paste', (evt) => {
undoMgr.setCurrentMode('single'); undoMgr.setCurrentMode('single');
@ -343,7 +344,7 @@ function cledit(contentElt, scrollEltOpt) {
data = clipboardData.getData('text/plain'); data = clipboardData.getData('text/plain');
try { try {
const html = clipboardData.getData('text/html'); const html = clipboardData.getData('text/html');
if (html && !clipboardData.getData('text/css')) { if (html) {
const sanitizedHtml = htmlSanitizer.sanitizeHtml(html) const sanitizedHtml = htmlSanitizer.sanitizeHtml(html)
.replace(/&#160;/g, ' '); // Replace non-breaking spaces with classic spaces .replace(/&#160;/g, ' '); // Replace non-breaking spaces with classic spaces
if (sanitizedHtml) { if (sanitizedHtml) {