mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Fix some linter issues
This commit is contained in:
committed by
Junyoung Choi
parent
7b9b4d56a7
commit
5ca6bbea11
@@ -863,7 +863,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pastedTxt = clipboard.readText()
|
const pastedTxt = clipboard.readText()
|
||||||
console.log(pastedTxt);
|
|
||||||
if (isInFencedCodeBlock(editor)) {
|
if (isInFencedCodeBlock(editor)) {
|
||||||
this.handlePasteText(editor, pastedTxt)
|
this.handlePasteText(editor, pastedTxt)
|
||||||
} else if (fetchUrlTitle && isMarkdownTitleURL(pastedTxt) && !isInLinkTag(editor)) {
|
} else if (fetchUrlTitle && isMarkdownTitleURL(pastedTxt) && !isInLinkTag(editor)) {
|
||||||
@@ -908,15 +908,15 @@ export default class CodeEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePasteUrl(editor, pastedTxt) {
|
handlePasteUrl (editor, pastedTxt) {
|
||||||
let taggedUrl = `<${pastedTxt}>`
|
let taggedUrl = `<${pastedTxt}>`
|
||||||
let urlToFetch = pastedTxt;
|
let urlToFetch = pastedTxt
|
||||||
let titleMark = '';
|
let titleMark = ''
|
||||||
|
|
||||||
if (isMarkdownTitleURL(pastedTxt)) {
|
if (isMarkdownTitleURL(pastedTxt)) {
|
||||||
const pastedTxtSplitted = pastedTxt.split(' ')
|
const pastedTxtSplitted = pastedTxt.split(' ')
|
||||||
titleMark = `${pastedTxtSplitted[0]} `;
|
titleMark = `${pastedTxtSplitted[0]} `
|
||||||
urlToFetch = pastedTxtSplitted[1];
|
urlToFetch = pastedTxtSplitted[1]
|
||||||
taggedUrl = `<${urlToFetch}>`
|
taggedUrl = `<${urlToFetch}>`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -931,7 +931,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
const replaceTaggedUrl = replacement => {
|
const replaceTaggedUrl = replacement => {
|
||||||
const value = editor.getValue()
|
const value = editor.getValue()
|
||||||
const cursor = editor.getCursor()
|
const cursor = editor.getCursor()
|
||||||
const newValue = value.replace(taggedUrl, titleMark + replacement)
|
const newValue = value.replace(taggedUrl, titleMark + replacement)
|
||||||
const newCursor = Object.assign({}, cursor, {
|
const newCursor = Object.assign({}, cursor, {
|
||||||
ch: cursor.ch + newValue.length - (value.length - titleMark.length)
|
ch: cursor.ch + newValue.length - (value.length - titleMark.length)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user