mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Adding the ability to copy the note link from the note list
This commit is contained in:
@@ -13,6 +13,7 @@ import searchFromNotes from 'browser/lib/search'
|
|||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { hashHistory } from 'react-router'
|
import { hashHistory } from 'react-router'
|
||||||
|
import copy from 'copy-to-clipboard'
|
||||||
import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig'
|
import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig'
|
||||||
|
|
||||||
const { remote } = require('electron')
|
const { remote } = require('electron')
|
||||||
@@ -70,6 +71,7 @@ class NoteList extends React.Component {
|
|||||||
this.getNoteFolder = this.getNoteFolder.bind(this)
|
this.getNoteFolder = this.getNoteFolder.bind(this)
|
||||||
this.getViewType = this.getViewType.bind(this)
|
this.getViewType = this.getViewType.bind(this)
|
||||||
this.restoreNote = this.restoreNote.bind(this)
|
this.restoreNote = this.restoreNote.bind(this)
|
||||||
|
this.copyNoteLink = this.copyNoteLink.bind(this)
|
||||||
|
|
||||||
// TODO: not Selected noteKeys but SelectedNote(for reusing)
|
// TODO: not Selected noteKeys but SelectedNote(for reusing)
|
||||||
this.state = {
|
this.state = {
|
||||||
@@ -458,6 +460,7 @@ class NoteList extends React.Component {
|
|||||||
const deleteLabel = 'Delete Note'
|
const deleteLabel = 'Delete Note'
|
||||||
const cloneNote = 'Clone Note'
|
const cloneNote = 'Clone Note'
|
||||||
const restoreNote = 'Restore Note'
|
const restoreNote = 'Restore Note'
|
||||||
|
const copyNoteLink = 'Copy Note Link'
|
||||||
|
|
||||||
const menu = new Menu()
|
const menu = new Menu()
|
||||||
if (!location.pathname.match(/\/starred|\/trash/)) {
|
if (!location.pathname.match(/\/starred|\/trash/)) {
|
||||||
@@ -482,6 +485,10 @@ class NoteList extends React.Component {
|
|||||||
label: cloneNote,
|
label: cloneNote,
|
||||||
click: this.cloneNote.bind(this)
|
click: this.cloneNote.bind(this)
|
||||||
}))
|
}))
|
||||||
|
menu.append(new MenuItem({
|
||||||
|
label: copyNoteLink,
|
||||||
|
click: this.copyNoteLink(note)
|
||||||
|
}))
|
||||||
menu.popup()
|
menu.popup()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -630,6 +637,11 @@ class NoteList extends React.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copyNoteLink (note) {
|
||||||
|
const noteLink = `[${note.title}](${note.storage}-${note.key})`
|
||||||
|
return copy(noteLink)
|
||||||
|
}
|
||||||
|
|
||||||
importFromFile () {
|
importFromFile () {
|
||||||
const options = {
|
const options = {
|
||||||
filters: [
|
filters: [
|
||||||
|
|||||||
Reference in New Issue
Block a user