Yesterday I upgraded my Photoshop HTML panel editor with Linting. But noticed that the events not dispatching or I cannot catch them.
These are the new lines in my .html:
<link rel=“stylesheet” href=“node_modules/codemirror/addon/lint/lint.css”>
<script src=“node_modules/codemirror/addon/lint/lint.js”>/script>
<script src=“node_modules/codemirror/addon/lint/javascript-lint.js”>/script>
This is the .js addition:
JSHINT = require( ‘jshint’ ).JSHINT;
And this is the way I am trying to catch them:
CodeMirror.on( editor, “change”, onType )
The linting is working fine. Except this event issue. When I type something in, no event fires except if I hit backspace, cursor keys or enter.
I can’t think of anything that would cause events to stop being delivered when you enable the linter, except maybe a crash somewhere in the lint plugin, but I guess you did check the console for error messages. Try to verify that you’re really seeing what you think you’re seeing, possibly by reducing your test case to a minimal self-contained example.
Possibly this is not the right place to post this but I have found the cause of my problem:
In codemirror/addon/lint/lint.js line:228 my “change” event handler seems getting overwritten.
If I call my handler from the onChange function ( line:182), everything is working fine.