1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Init markdown lib only when it's needed when posting a note to blog

This commit is contained in:
Yu-Hung Ou
2018-03-16 23:33:40 +11:00
parent 33b3299ca2
commit b9cab0dae8

View File

@@ -21,7 +21,6 @@ import Markdown from '../../lib/markdown'
const { remote } = require('electron') const { remote } = require('electron')
const { Menu, MenuItem, dialog } = remote const { Menu, MenuItem, dialog } = remote
const WP_POST_PATH = '/wp/v2/posts' const WP_POST_PATH = '/wp/v2/posts'
const markdown = new Markdown()
function sortByCreatedAt (a, b) { function sortByCreatedAt (a, b) {
return new Date(b.createdAt) - new Date(a.createdAt) return new Date(b.createdAt) - new Date(a.createdAt)
@@ -710,6 +709,7 @@ class NoteList extends React.Component {
authToken = `Bearer ${token}` authToken = `Bearer ${token}`
} }
const contentToRender = firstNote.content.replace(`# ${firstNote.title}`, '') const contentToRender = firstNote.content.replace(`# ${firstNote.title}`, '')
const markdown = new Markdown()
const data = { const data = {
title: firstNote.title, title: firstNote.title,
content: markdown.render(contentToRender), content: markdown.render(contentToRender),