You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Adds functionality to allow for renaming of tags.
Towards #374 Signed-off-by: Abijeet <abijeetpatro@gmail.com>
This commit is contained in:
@ -145,6 +145,28 @@ class MainScreenComponent extends React.Component {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
} else if (command.name === 'renameTag') {
|
||||||
|
const tag = await Tag.load(command.id);
|
||||||
|
if(!tag) return;
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
promptOptions: {
|
||||||
|
label: _('Rename tag:'),
|
||||||
|
value: tag.title,
|
||||||
|
onClose: async (answer) => {
|
||||||
|
if (answer !== null) {
|
||||||
|
try {
|
||||||
|
tag.title = answer;
|
||||||
|
await Tag.save(tag, { fields: ['title'], userSideValidation: true });
|
||||||
|
} catch (error) {
|
||||||
|
bridge().showErrorMessageBox(error.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.setState({promptOptions: null });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
} else if (command.name === 'search') {
|
} else if (command.name === 'search') {
|
||||||
|
|
||||||
if (!this.searchId_) this.searchId_ = uuid.create();
|
if (!this.searchId_) this.searchId_ = uuid.create();
|
||||||
|
@ -250,6 +250,21 @@ class SideBarComponent extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (itemType === BaseModel.TYPE_TAG) {
|
||||||
|
menu.append(
|
||||||
|
new MenuItem({
|
||||||
|
label: _('Rename'),
|
||||||
|
click: async () => {
|
||||||
|
this.props.dispatch({
|
||||||
|
type: "WINDOW_COMMAND",
|
||||||
|
name: "renameTag",
|
||||||
|
id: itemId
|
||||||
|
});
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
menu.popup(bridge().window());
|
menu.popup(bridge().window());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user