mirror of https://github.com/laurent22/joplin.git
Clipper: Fixes #2034: Better handling of HTML minifying error with fallback to non-minified HTML
parent
3da32f007e
commit
4e72a8f3a5
|
@ -8,7 +8,7 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
#joplin-container-content {
|
||||||
/* Needs this in case the content contains elements with absolute positioning */
|
/* Needs this in case the content contains elements with absolute positioning */
|
||||||
/* Without this they would just stay at a fixed position when scrolling */
|
/* Without this they would just stay at a fixed position when scrolling */
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -36,10 +36,10 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="body">
|
<body id="joplin-container-body">
|
||||||
<div id="styleContainer"></div>
|
<div id="joplin-container-styleContainer"></div>
|
||||||
<div id="markScriptContainer"></div>
|
<div id="joplin-container-markScriptContainer"></div>
|
||||||
<div id="content" ondragstart="return false;" ondrop="return false;"></div>
|
<div id="joplin-container-content" ondragstart="return false;" ondrop="return false;"></div>
|
||||||
<script src="./lib.js"></script>
|
<script src="./lib.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const contentElement = document.getElementById('content');
|
const contentElement = document.getElementById('joplin-container-content');
|
||||||
|
|
||||||
const ipc = {};
|
const ipc = {};
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
const link = document.createElement('link');
|
const link = document.createElement('link');
|
||||||
link.rel = 'stylesheet';
|
link.rel = 'stylesheet';
|
||||||
link.href = f;
|
link.href = f;
|
||||||
document.getElementById('styleContainer').appendChild(link);
|
document.getElementById('joplin-container-styleContainer').appendChild(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@
|
||||||
// TODO: Add support for scriptType on mobile and CLI
|
// TODO: Add support for scriptType on mobile and CLI
|
||||||
|
|
||||||
if (!mark_) {
|
if (!mark_) {
|
||||||
mark_ = new Mark(document.getElementById('content'), {
|
mark_ = new Mark(document.getElementById('joplin-container-content'), {
|
||||||
exclude: ['img'],
|
exclude: ['img'],
|
||||||
acrossElements: true,
|
acrossElements: true,
|
||||||
});
|
});
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
script.src = '../../node_modules/mark.js/dist/mark.min.js';
|
script.src = '../../node_modules/mark.js/dist/mark.min.js';
|
||||||
document.getElementById('markScriptContainer').appendChild(script);
|
document.getElementById('joplin-container-markScriptContainer').appendChild(script);
|
||||||
markLoaded_ = true;
|
markLoaded_ = true;
|
||||||
} else {
|
} else {
|
||||||
setMarkers(keywords, options);
|
setMarkers(keywords, options);
|
||||||
|
@ -283,8 +283,8 @@
|
||||||
|
|
||||||
// The body element needs to have a fixed height for the content to be scrollable
|
// The body element needs to have a fixed height for the content to be scrollable
|
||||||
function updateBodyHeight() {
|
function updateBodyHeight() {
|
||||||
document.getElementById('body').style.height = window.innerHeight + 'px';
|
document.getElementById('joplin-container-body').style.height = window.innerHeight + 'px';
|
||||||
document.getElementById('content').style.height = window.innerHeight + 'px';
|
document.getElementById('joplin-container-content').style.height = window.innerHeight + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
function currentPercentScroll() {
|
function currentPercentScroll() {
|
||||||
|
|
|
@ -3289,6 +3289,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"font-awesome-filetypes": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/font-awesome-filetypes/-/font-awesome-filetypes-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-U6hi14GRjfZFIWsTNyVmCBuHyPhiizWEKVbaQqHipKQv3rA1l1PNvmKulzpqxonFnQMToty5ZhfWbc/0IjLDGA=="
|
||||||
|
},
|
||||||
"for-in": {
|
"for-in": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
|
||||||
|
@ -4403,6 +4408,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/markdown-it-abbr/-/markdown-it-abbr-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/markdown-it-abbr/-/markdown-it-abbr-1.0.4.tgz",
|
||||||
"integrity": "sha1-1mtTZFIcuz3Yqlna37ovtoZcj9g="
|
"integrity": "sha1-1mtTZFIcuz3Yqlna37ovtoZcj9g="
|
||||||
},
|
},
|
||||||
|
"markdown-it-anchor": {
|
||||||
|
"version": "5.2.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-5.2.5.tgz",
|
||||||
|
"integrity": "sha512-xLIjLQmtym3QpoY9llBgApknl7pxAcN3WDRc2d3rwpl+/YvDZHPmKscGs+L6E05xf2KrCXPBvosWt7MZukwSpQ=="
|
||||||
|
},
|
||||||
"markdown-it-deflist": {
|
"markdown-it-deflist": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/markdown-it-deflist/-/markdown-it-deflist-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/markdown-it-deflist/-/markdown-it-deflist-2.0.3.tgz",
|
||||||
|
@ -4478,6 +4488,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/markdown-it-sup/-/markdown-it-sup-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/markdown-it-sup/-/markdown-it-sup-1.0.0.tgz",
|
||||||
"integrity": "sha1-y5yf+RpSVawI8/09YyhuFd8KH8M="
|
"integrity": "sha1-y5yf+RpSVawI8/09YyhuFd8KH8M="
|
||||||
},
|
},
|
||||||
|
"markdown-it-toc-done-right": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/markdown-it-toc-done-right/-/markdown-it-toc-done-right-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-UhD2Oj6cZV3ycYPoelt4hTkwKIK3zbPP1wjjdpCq7UGtWQOFalDFDv1s2zBYV6aR2gMs/X8kpJcOYsQmUbiXDw=="
|
||||||
|
},
|
||||||
"match-at": {
|
"match-at": {
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/match-at/-/match-at-0.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/match-at/-/match-at-0.1.1.tgz",
|
||||||
|
|
|
@ -254,7 +254,7 @@ module.exports = function(style, options) {
|
||||||
border: 1px solid #CBCBCB;
|
border: 1px solid #CBCBCB;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
#joplin-container-content {
|
||||||
/* The height of the content is set dynamically by JavaScript (in updateBodyHeight) to go
|
/* The height of the content is set dynamically by JavaScript (in updateBodyHeight) to go
|
||||||
around various issues related to scrolling. However when printing we don't want this
|
around various issues related to scrolling. However when printing we don't want this
|
||||||
fixed size as that would crop the content. So we set it to auto here. "important" is
|
fixed size as that would crop the content. So we set it to auto here. "important" is
|
||||||
|
|
|
@ -482,7 +482,14 @@ class Api {
|
||||||
});
|
});
|
||||||
|
|
||||||
const styleTag = style.length ? `<style>${styleString}</style>` + '\n' : '';
|
const styleTag = style.length ? `<style>${styleString}</style>` + '\n' : '';
|
||||||
output.body = styleTag + minify(requestNote.body_html, minifyOptions);
|
let minifiedHtml = '';
|
||||||
|
try {
|
||||||
|
minifiedHtml = minify(requestNote.body_html, minifyOptions);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Could not minify HTML - using non-minified HTML instead', error);
|
||||||
|
minifiedHtml = requestNote.body_html;
|
||||||
|
}
|
||||||
|
output.body = styleTag + minifiedHtml;
|
||||||
output.body = htmlUtils.prependBaseUrl(output.body, baseUrl);
|
output.body = htmlUtils.prependBaseUrl(output.body, baseUrl);
|
||||||
output.markup_language = Note.MARKUP_LANGUAGE_HTML;
|
output.markup_language = Note.MARKUP_LANGUAGE_HTML;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue