mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
* Bolding text inside a link in task title/notes. (#12178) Before: * link target opened in new tab * task edit popup opened Now: * link target opened in new tab Fixes #12178 * Handle PR comments * Added explanation * Switched to classList to improve readability
This commit is contained in:
@@ -976,10 +976,18 @@ export default {
|
||||
edit (e, task) {
|
||||
if (this.isRunningYesterdailies || !this.showEdit) return;
|
||||
|
||||
// Prevent clicking on a link from opening the edit modal
|
||||
const target = e.target || e.srcElement;
|
||||
|
||||
if (target.tagName === 'A') return; // clicked on a link
|
||||
/*
|
||||
* Prevent clicking on a link from opening the edit modal
|
||||
*
|
||||
* Ascend up the ancestors of the click target, up until the node defining the click handler.
|
||||
* If any of them is an <a> element, don't open the edit task popup.
|
||||
* Needed in case of a link, with a bold and/or italic link description
|
||||
*/
|
||||
for (let element = target; !element.classList.contains('task-clickable-area'); element = element.parentNode) {
|
||||
if (element.tagName === 'A') return; // clicked on a link
|
||||
}
|
||||
|
||||
const isDropdown = this.$refs.taskDropdown && this.$refs.taskDropdown.$el.contains(target);
|
||||
const isEditAction = this.$refs.editTaskItem && this.$refs.editTaskItem.contains(target);
|
||||
|
||||
Reference in New Issue
Block a user