jegasus / scene-clicker

A FoundryVTT module that changes the behavior of left clicking on Scenes and Scene Links. Left-clicking on a Scene/Scene Link "Views" the Scene instead of displaying the Scene Config Sheet.
GNU General Public License v3.0
1 stars 3 forks source link

Journal Links bug - handleSceneClicked #12

Open shemetz opened 2 years ago

shemetz commented 2 years ago

the handleSceneClicked code, at least in V10 if not also earlier, throws an error when trying to click on any journal link (including macros for example):

libWrapper-wrapper.js:669 Uncaught TypeError: Cannot read properties of undefined (reading 'documentName')
[Detected 2 packages: scene-clicker, lib-wrapper]
    at handleSceneClicked (scene-clicker.js:8:18)
    at HTMLAnchorElement.new_onClickContentLink (scene-clicker.js:136:8)
shemetz commented 2 years ago

The error in the code is around here:

function handleSceneClicked(event, document)
{
    if (document.documentName != "Scene") {
        return false;
    }

When clicking a macro journal link, the document is undefined, and the document name can be found in event.currentTarget.dataset.type.