mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 03:30:25 +00: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:
parent
ea44af0929
commit
1bc756ee93
1 changed files with 10 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue