mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Electron: Resolves #679: Drag a note on a tag to associate the tag.
This commit is contained in:
parent
758562cff9
commit
35294b5f97
@ -55,6 +55,21 @@ class SideBarComponent extends React.Component {
|
||||
}
|
||||
};
|
||||
|
||||
this.onTagDrop_ = async (event) => {
|
||||
const tagId = event.currentTarget.getAttribute('tagid');
|
||||
const dt = event.dataTransfer;
|
||||
if (!dt) return;
|
||||
|
||||
if (dt.types.indexOf("text/x-jop-note-ids") >= 0) {
|
||||
event.preventDefault();
|
||||
|
||||
const noteIds = JSON.parse(dt.getData("text/x-jop-note-ids"));
|
||||
for (let i = 0; i < noteIds.length; i++) {
|
||||
await Tag.addNote(tagId, noteIds[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.onFolderToggleClick_ = async (event) => {
|
||||
const folderId = event.currentTarget.getAttribute('folderid');
|
||||
|
||||
@ -354,8 +369,10 @@ class SideBarComponent extends React.Component {
|
||||
data-id={tag.id}
|
||||
data-type={BaseModel.TYPE_TAG}
|
||||
onContextMenu={event => this.itemContextMenu(event)}
|
||||
tagid={tag.id}
|
||||
key={tag.id}
|
||||
style={style}
|
||||
onDrop={this.onTagDrop_}
|
||||
onClick={() => {
|
||||
this.tagItem_click(tag);
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user