mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Strip HTML from the note title
This commit is contained in:
@@ -20,6 +20,7 @@ import InfoPanel from './InfoPanel'
|
|||||||
import InfoPanelTrashed from './InfoPanelTrashed'
|
import InfoPanelTrashed from './InfoPanelTrashed'
|
||||||
import { formatDate } from 'browser/lib/date-formatter'
|
import { formatDate } from 'browser/lib/date-formatter'
|
||||||
import { getTodoPercentageOfCompleted } from 'browser/lib/getTodoStatus'
|
import { getTodoPercentageOfCompleted } from 'browser/lib/getTodoStatus'
|
||||||
|
import striptags from 'striptags'
|
||||||
|
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
const { remote } = electron
|
const { remote } = electron
|
||||||
@@ -76,7 +77,7 @@ class MarkdownNoteDetail extends React.Component {
|
|||||||
|
|
||||||
note.content = this.refs.content.value
|
note.content = this.refs.content.value
|
||||||
if (this.refs.tags) note.tags = this.refs.tags.value
|
if (this.refs.tags) note.tags = this.refs.tags.value
|
||||||
note.title = markdown.strip(findNoteTitle(note.content))
|
note.title = markdown.strip(striptags(findNoteTitle(note.content)))
|
||||||
note.updatedAt = new Date()
|
note.updatedAt = new Date()
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import fs from 'fs'
|
|||||||
import { hashHistory } from 'react-router'
|
import { hashHistory } from 'react-router'
|
||||||
import markdown from 'browser/lib/markdown'
|
import markdown from 'browser/lib/markdown'
|
||||||
import { findNoteTitle } from 'browser/lib/findNoteTitle'
|
import { findNoteTitle } from 'browser/lib/findNoteTitle'
|
||||||
|
import stripgtags from 'striptags'
|
||||||
|
|
||||||
const { remote } = require('electron')
|
const { remote } = require('electron')
|
||||||
const { Menu, MenuItem, dialog } = remote
|
const { Menu, MenuItem, dialog } = remote
|
||||||
@@ -363,7 +364,7 @@ class NoteList extends React.Component {
|
|||||||
const newNote = {
|
const newNote = {
|
||||||
content: content,
|
content: content,
|
||||||
folder: folderKey,
|
folder: folderKey,
|
||||||
title: markdown.strip(findNoteTitle(content)),
|
title: markdown.strip(striptags(findNoteTitle(content))),
|
||||||
type: 'MARKDOWN_NOTE'
|
type: 'MARKDOWN_NOTE'
|
||||||
}
|
}
|
||||||
dataApi.createNote(storageKey, newNote)
|
dataApi.createNote(storageKey, newNote)
|
||||||
|
|||||||
@@ -79,6 +79,7 @@
|
|||||||
"react-redux": "^4.4.5",
|
"react-redux": "^4.4.5",
|
||||||
"redux": "^3.5.2",
|
"redux": "^3.5.2",
|
||||||
"sander": "^0.5.1",
|
"sander": "^0.5.1",
|
||||||
|
"striptags": "^3.1.0",
|
||||||
"superagent": "^1.2.0",
|
"superagent": "^1.2.0",
|
||||||
"superagent-promise": "^1.0.3"
|
"superagent-promise": "^1.0.3"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6075,6 +6075,10 @@ strip-json-comments@~2.0.1:
|
|||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
|
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
|
||||||
|
|
||||||
|
striptags@^3.1.0:
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/striptags/-/striptags-3.1.0.tgz#763e534338d9cf542f004a4b1eb099e32d295e44"
|
||||||
|
|
||||||
style-loader@^0.12.4:
|
style-loader@^0.12.4:
|
||||||
version "0.12.4"
|
version "0.12.4"
|
||||||
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.12.4.tgz#ae7d0665dc4dc653daa2fe97bb90914bc1d22d9b"
|
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.12.4.tgz#ae7d0665dc4dc653daa2fe97bb90914bc1d22d9b"
|
||||||
|
|||||||
Reference in New Issue
Block a user