From b6e0df57eb0dadbd889e6f164fab1494052b5c42 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Wed, 22 Jan 2020 17:32:21 +0000 Subject: [PATCH] Desktop: Fixes #2352: undefined text was being displayed on top of notes in revision viewer --- ElectronClient/app/gui/NoteRevisionViewer.jsx | 10 +++++++--- ElectronClient/app/gui/note-viewer/index.html | 8 +++++--- readme/markdown.md | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ElectronClient/app/gui/NoteRevisionViewer.jsx b/ElectronClient/app/gui/NoteRevisionViewer.jsx index 61e787475..a1e5d78d4 100644 --- a/ElectronClient/app/gui/NoteRevisionViewer.jsx +++ b/ElectronClient/app/gui/NoteRevisionViewer.jsx @@ -10,7 +10,7 @@ const urlUtils = require('lib/urlUtils'); const Setting = require('lib/models/Setting'); const RevisionService = require('lib/services/RevisionService'); const shared = require('lib/components/shared/note-screen-shared.js'); -const { MarkupToHtml } = require('joplin-renderer'); +const { MarkupToHtml, assetsToHeaders } = require('joplin-renderer'); const { time } = require('lib/time-utils.js'); const ReactTooltip = require('react-tooltip'); const { urlDecode, substrWithEllipsis } = require('lib/string-utils'); @@ -127,7 +127,11 @@ class NoteRevisionViewerComponent extends React.PureComponent { postMessageSyntax: 'ipcProxySendToHost', }); - this.viewerRef_.current.wrappedInstance.send('setHtml', result.html, { cssFiles: result.cssFiles, pluginAssets: result.pluginAssets }); + this.viewerRef_.current.wrappedInstance.send('setHtml', result.html, { + cssFiles: result.cssFiles, + pluginAssets: result.pluginAssets, + pluginAssetsHeadersHtml: assetsToHeaders(result.pluginAssets), + }); } async webview_ipcMessage(event) { @@ -196,7 +200,7 @@ class NoteRevisionViewerComponent extends React.PureComponent { ); - const viewer = ; + const viewer = ; return (
diff --git a/ElectronClient/app/gui/note-viewer/index.html b/ElectronClient/app/gui/note-viewer/index.html index 25fa2ed81..634eccd6a 100644 --- a/ElectronClient/app/gui/note-viewer/index.html +++ b/ElectronClient/app/gui/note-viewer/index.html @@ -142,9 +142,11 @@ }, 1); } - const pluginAssetsContainer = document.createElement('div'); - pluginAssetsContainer.innerHTML = event.options.pluginAssetsHeadersHtml; - document.getElementById('joplin-container-styleContainer').appendChild(pluginAssetsContainer); + if (event.options.pluginAssetsHeadersHtml) { + const pluginAssetsContainer = document.createElement('div'); + pluginAssetsContainer.innerHTML = event.options.pluginAssetsHeadersHtml; + document.getElementById('joplin-container-styleContainer').appendChild(pluginAssetsContainer); + } if (event.options.downloadResources === 'manual') { webviewLib.setupResourceManualDownload(); diff --git a/readme/markdown.md b/readme/markdown.md index 36a187d22..dee490d11 100644 --- a/readme/markdown.md +++ b/readme/markdown.md @@ -127,7 +127,7 @@ Joplin supports a number of plugins that can be toggled on top the standard Mark | [Sub](https://github.com/markdown-it/markdown-it-sub) | `X~1~` | Transforms into X1 | no | | [Sup](https://github.com/markdown-it/markdown-it-sup) | `X^2^` | Transforms into X2 | no | | [Deflist](https://github.com/markdown-it/markdown-it-deflist) | See [pandoc](http://johnmacfarlane.net/pandoc/README.html#definition-lists) page for syntax | Adds the html `
` tag accessible through markdown | no | -| [Abbr](https://github.com/markdown-it/markdown-it-abbr) | *[HTML]: Hyper Text Markup Language | Allows definition of abbreviations that can be hovered over later for a full expansion | no | +| [Abbr](https://github.com/markdown-it/markdown-it-abbr) | *[HTML]: Hyper Text Markup Language
The HTML specification | Allows definition of abbreviations that can be hovered over later for a full expansion | no | | [Emoji](https://github.com/markdown-it/markdown-it-emoji) | `:smile:` | Transforms into 😄. See [this list](https://gist.github.com/rxaviers/7360908) for more emojis | no | | [Insert](https://github.com/markdown-it/markdown-it-ins) | `++inserted++` | Transforms into `inserted` (inserted) | no | | [Multitable](https://github.com/RedBug312/markdown-it-multimd-table) | See [MultiMarkdown](https://fletcher.github.io/MultiMarkdown-6/syntax/tables.html) page | Adds more power and customization to markdown tables | no |