Skip to content

Move note between folders #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 20, 2017
Merged

Conversation

sosukesuzuki
Copy link
Member

I made it allows move note between folders by drag and drop.
move_note_between_folders 1

type: noteData.type,
updatedAt: noteData.updatedAt,
description: noteData.description,
snippets: noteData.snippets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.assign() is better in this situation. const newNoteData = Object.assign({}, noteData, { storage: storage, folder: folder.key })

e.target.style.opacity = '1'
e.target.style.backgroundColor = e.dataTransfer.getData('defaultColor')
const noteData = JSON.parse(e.dataTransfer.getData('note'))
if (folder.key !== noteData.folder) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reduce nest, I prefer to use if (folder.key === noteData.folder) return

@@ -7,6 +7,7 @@ import CreateFolderModal from 'browser/main/modals/CreateFolderModal'
import RenameFolderModal from 'browser/main/modals/RenameFolderModal'
import dataApi from 'browser/main/lib/dataApi'
import StorageItemChild from 'browser/components/StorageItem'
import ee from 'browser/main/lib/eventEmitter'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change ee to eventEmitter? We're trying to use the name in full.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for commenting. I'll change it.

query: {key: note.storage + '-' + note.key}
})
})

Copy link
Contributor

@asmsuechan asmsuechan Apr 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to handle rollback this copy process just in case it does not work. In this state, only to be copied the note without delete if something happens in copying.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks commenting @asmsuechan .I agree with your opinion. So, I changed to Deleting the folder only when the folder creation succeeds.


handleDragLeave (e) {
e.target.style.opacity = '1'
e.target.style.backgroundColor = e.dataTransfer.getData('defaultColor')
Copy link
Contributor

@asmsuechan asmsuechan Apr 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change the background-color? Because it's hard to find the target folder.

Copy link
Contributor

@asmsuechan asmsuechan May 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sosukesuzuki what do you think about this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for commenting @asmsuechan !
Even now, the background color of the folder that is hover while dragging is supposed to change. How do you want the background color to change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't confirm the color changed.

@jasondavis
Copy link

I was about to post this as a feature request as many people need this feature too. So it's nice to see you already did it here!

.then((note) => {
dataApi
.deleteNote(noteData.storage, noteData.key)
.then((data) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An unnecessary space 😎

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for commenting ! I'll fix it soon.

})
hashHistory.push({
pathname: location.pathname,
query: {key: note.storage + '-' + note.key}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use template literals like ${note.storage}-${note.key}.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for commenting. I'll fix it soon.
However, such a code is often used in Boostnote. For example, there are many other codes that use for, not forEach. We should fix it. I'll do it before long.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please!

Copy link
Contributor

@asmsuechan asmsuechan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnamed

@asmsuechan asmsuechan merged commit 3c7ff78 into master May 20, 2017
@asmsuechan asmsuechan deleted the feature_move_note_between_folder branch May 20, 2017 05:33
@kohei-takata kohei-takata mentioned this pull request Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants