mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Use markupToHtml everywhere
This commit is contained in:
parent
38177c7e54
commit
14fc73b388
6
CliClient/package-lock.json
generated
6
CliClient/package-lock.json
generated
@ -1702,9 +1702,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ajv": {
|
"ajv": {
|
||||||
"version": "6.10.1",
|
"version": "6.10.2",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.1.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
|
||||||
"integrity": "sha512-w1YQaVGNC6t2UCPjEawK/vo/dG8OOrVtUmhBT1uJJYxbl5kU2Tj3v6LGqBcsysN1yhuCStJCCA3GqdvKY8sqXQ==",
|
"integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"fast-deep-equal": "^2.0.1",
|
"fast-deep-equal": "^2.0.1",
|
||||||
"fast-json-stable-stringify": "^2.0.0",
|
"fast-json-stable-stringify": "^2.0.0",
|
||||||
|
@ -9,7 +9,7 @@ const Revision = require('lib/models/Revision');
|
|||||||
const Setting = require('lib/models/Setting');
|
const Setting = require('lib/models/Setting');
|
||||||
const RevisionService = require('lib/services/RevisionService');
|
const RevisionService = require('lib/services/RevisionService');
|
||||||
const shared = require('lib/components/shared/note-screen-shared.js');
|
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 { time } = require('lib/time-utils.js');
|
||||||
const ReactTooltip = require('react-tooltip');
|
const ReactTooltip = require('react-tooltip');
|
||||||
const { substrWithEllipsis } = require('lib/string-utils');
|
const { substrWithEllipsis } = require('lib/string-utils');
|
||||||
@ -92,6 +92,7 @@ class NoteRevisionViewerComponent extends React.PureComponent {
|
|||||||
|
|
||||||
async reloadNote() {
|
async reloadNote() {
|
||||||
let noteBody = '';
|
let noteBody = '';
|
||||||
|
let markupLanguage = Note.MARKUP_LANGUAGE_MARKDOWN;
|
||||||
if (!this.state.revisions.length || !this.state.currentRevId) {
|
if (!this.state.revisions.length || !this.state.currentRevId) {
|
||||||
noteBody = _('This note has no history');
|
noteBody = _('This note has no history');
|
||||||
this.setState({ note: null });
|
this.setState({ note: null });
|
||||||
@ -100,16 +101,17 @@ class NoteRevisionViewerComponent extends React.PureComponent {
|
|||||||
const note = await RevisionService.instance().revisionNote(this.state.revisions, revIndex);
|
const note = await RevisionService.instance().revisionNote(this.state.revisions, revIndex);
|
||||||
if (!note) return;
|
if (!note) return;
|
||||||
noteBody = note.body;
|
noteBody = note.body;
|
||||||
|
markupLanguage = note.markup_language;
|
||||||
this.setState({ note: note });
|
this.setState({ note: note });
|
||||||
}
|
}
|
||||||
|
|
||||||
const theme = themeStyle(this.props.theme);
|
const theme = themeStyle(this.props.theme);
|
||||||
|
|
||||||
const mdToHtml = new MdToHtml({
|
const markupToHtml = new MarkupToHtml({
|
||||||
resourceBaseUrl: 'file://' + Setting.value('resourceDir') + '/',
|
resourceBaseUrl: 'file://' + Setting.value('resourceDir') + '/',
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = mdToHtml.render(noteBody, theme, {
|
const result = markupToHtml.render(markupLanguage, noteBody, theme, {
|
||||||
codeTheme: theme.codeThemeCss,
|
codeTheme: theme.codeThemeCss,
|
||||||
userCss: this.props.customCss ? this.props.customCss : '',
|
userCss: this.props.customCss ? this.props.customCss : '',
|
||||||
resources: await shared.attachedResources(noteBody),
|
resources: await shared.attachedResources(noteBody),
|
||||||
|
@ -26,6 +26,10 @@ class MarkupToHtml {
|
|||||||
return this.renderers_[markupLanguage];
|
return this.renderers_[markupLanguage];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
injectedJavaScript() {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
render(markupLanguage, markup, theme, options) {
|
render(markupLanguage, markup, theme, options) {
|
||||||
return this.renderer(markupLanguage).render(markup, theme, options);
|
return this.renderer(markupLanguage).render(markup, theme, options);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ async function copyJs(name, filePath) {
|
|||||||
|
|
||||||
async function main(argv) {
|
async function main(argv) {
|
||||||
await fs.mkdirp(outputDir);
|
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) => {
|
main(process.argv).catch((error) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user