diff --git a/CliClient/package-lock.json b/CliClient/package-lock.json index 62dc0c167..e1881491c 100644 --- a/CliClient/package-lock.json +++ b/CliClient/package-lock.json @@ -1702,9 +1702,9 @@ }, "dependencies": { "ajv": { - "version": "6.10.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.1.tgz", - "integrity": "sha512-w1YQaVGNC6t2UCPjEawK/vo/dG8OOrVtUmhBT1uJJYxbl5kU2Tj3v6LGqBcsysN1yhuCStJCCA3GqdvKY8sqXQ==", + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", "requires": { "fast-deep-equal": "^2.0.1", "fast-json-stable-stringify": "^2.0.0", diff --git a/ElectronClient/app/gui/NoteRevisionViewer.jsx b/ElectronClient/app/gui/NoteRevisionViewer.jsx index 02617ec28..f2f1d9908 100644 --- a/ElectronClient/app/gui/NoteRevisionViewer.jsx +++ b/ElectronClient/app/gui/NoteRevisionViewer.jsx @@ -9,7 +9,7 @@ const Revision = require('lib/models/Revision'); const Setting = require('lib/models/Setting'); const RevisionService = require('lib/services/RevisionService'); const shared = require('lib/components/shared/note-screen-shared.js'); -const MdToHtml = require('lib/renderers/MdToHtml'); +const MarkupToHtml = require('lib/renderers/MarkupToHtml'); const { time } = require('lib/time-utils.js'); const ReactTooltip = require('react-tooltip'); const { substrWithEllipsis } = require('lib/string-utils'); @@ -92,6 +92,7 @@ class NoteRevisionViewerComponent extends React.PureComponent { async reloadNote() { let noteBody = ''; + let markupLanguage = Note.MARKUP_LANGUAGE_MARKDOWN; if (!this.state.revisions.length || !this.state.currentRevId) { noteBody = _('This note has no history'); this.setState({ note: null }); @@ -100,16 +101,17 @@ class NoteRevisionViewerComponent extends React.PureComponent { const note = await RevisionService.instance().revisionNote(this.state.revisions, revIndex); if (!note) return; noteBody = note.body; + markupLanguage = note.markup_language; this.setState({ note: note }); } const theme = themeStyle(this.props.theme); - const mdToHtml = new MdToHtml({ + const markupToHtml = new MarkupToHtml({ resourceBaseUrl: 'file://' + Setting.value('resourceDir') + '/', }); - const result = mdToHtml.render(noteBody, theme, { + const result = markupToHtml.render(markupLanguage, noteBody, theme, { codeTheme: theme.codeThemeCss, userCss: this.props.customCss ? this.props.customCss : '', resources: await shared.attachedResources(noteBody), diff --git a/ReactNativeClient/lib/renderers/MarkupToHtml.js b/ReactNativeClient/lib/renderers/MarkupToHtml.js index 7e2800332..771daba58 100644 --- a/ReactNativeClient/lib/renderers/MarkupToHtml.js +++ b/ReactNativeClient/lib/renderers/MarkupToHtml.js @@ -26,6 +26,10 @@ class MarkupToHtml { return this.renderers_[markupLanguage]; } + injectedJavaScript() { + return ''; + } + render(markupLanguage, markup, theme, options) { return this.renderer(markupLanguage).render(markup, theme, options); } diff --git a/Tools/buildReactNativeInjectedJs.js b/Tools/buildReactNativeInjectedJs.js index 21dfc2d8a..972967411 100644 --- a/Tools/buildReactNativeInjectedJs.js +++ b/Tools/buildReactNativeInjectedJs.js @@ -18,7 +18,7 @@ async function copyJs(name, filePath) { async function main(argv) { await fs.mkdirp(outputDir); - await copyJs('webviewLib', rnDir + '/lib/renderers/MdToHtml/webviewLib.js'); + await copyJs('webviewLib', rnDir + '/lib/renderers/webviewLib.js'); } main(process.argv).catch((error) => {