Skip to content

Commit

Permalink
Desktop: Fixes laurent22#2352: undefined text was being displayed on …
Browse files Browse the repository at this point in the history
…top of notes in revision viewer
  • Loading branch information
laurent22 committed Jan 22, 2020
1 parent be21023 commit b6e0df5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
10 changes: 7 additions & 3 deletions ElectronClient/app/gui/NoteRevisionViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -196,7 +200,7 @@ class NoteRevisionViewerComponent extends React.PureComponent {
</div>
);

const viewer = <NoteTextViewer viewerStyle={{ display: 'flex', flex: 1 }} ref={this.viewerRef_} onDomReady={this.viewer_domReady} onIpcMessage={this.webview_ipcMessage} />;
const viewer = <NoteTextViewer viewerStyle={{ display: 'flex', flex: 1, borderLeft: 'none' }} ref={this.viewerRef_} onDomReady={this.viewer_domReady} onIpcMessage={this.webview_ipcMessage} />;

return (
<div style={style.root}>
Expand Down
8 changes: 5 additions & 3 deletions ElectronClient/app/gui/note-viewer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion readme/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 X<sub>1</sub> | no |
| [Sup](https://github.com/markdown-it/markdown-it-sup) | `X^2^` | Transforms into X<sup>2</sup> | 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 `<dl>` 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<br/>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 `<ins>inserted</ins>` (<ins>inserted</ins>) | 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 |
Expand Down

0 comments on commit b6e0df5

Please sign in to comment.