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

Merge branch 'master' into IntroduceMarkdownLint#864

This commit is contained in:
roottool
2019-01-31 12:44:07 +09:00
3 changed files with 133 additions and 81 deletions

View File

@@ -926,10 +926,7 @@ export default class CodeEditor extends React.Component {
handlePaste (editor, forceSmartPaste) {
const { storageKey, noteKey, fetchUrlTitle, enableSmartPaste } = this.props
const isURL = str => {
const matcher = /^(?:\w+:)?\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/
return matcher.test(str)
}
const isURL = str => /(?:^\w+:|^)\/\/(?:[^\s\.]+\.\S{2}|localhost[\:?\d]*)/.test(str)
const isInLinkTag = editor => {
const startCursor = editor.getCursor('start')
@@ -1002,7 +999,7 @@ export default class CodeEditor extends React.Component {
} else {
const image = clipboard.readImage()
if (!image.isEmpty()) {
attachmentManagement.handlePastNativeImage(
attachmentManagement.handlePasteNativeImage(
this,
storageKey,
noteKey,
@@ -1147,7 +1144,7 @@ export default class CodeEditor extends React.Component {
iconv.encodingExists(_charset)
? _charset
: 'utf-8'
resolve(iconv.decode(new Buffer(buff), charset).toString())
resolve(iconv.decode(Buffer.from(buff), charset).toString())
} catch (e) {
reject(e)
}