From b9cab0dae813edd23b6c25333d9a479e443976ea Mon Sep 17 00:00:00 2001 From: Yu-Hung Ou Date: Fri, 16 Mar 2018 23:33:40 +1100 Subject: [PATCH] Init markdown lib only when it's needed when posting a note to blog --- browser/main/NoteList/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 2e31a5d7..d8632da6 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -21,7 +21,6 @@ import Markdown from '../../lib/markdown' const { remote } = require('electron') const { Menu, MenuItem, dialog } = remote const WP_POST_PATH = '/wp/v2/posts' -const markdown = new Markdown() function sortByCreatedAt (a, b) { return new Date(b.createdAt) - new Date(a.createdAt) @@ -710,6 +709,7 @@ class NoteList extends React.Component { authToken = `Bearer ${token}` } const contentToRender = firstNote.content.replace(`# ${firstNote.title}`, '') + const markdown = new Markdown() const data = { title: firstNote.title, content: markdown.render(contentToRender),