I found another strange thing.
When I focus node and then try to choose something else or just click on any place focus listener fires. Why focus? I expect blur
Thanks.
It works fine when I click on a diagram, But if I click outside diagram it repeats again. blur than focus. Also, Texteditor doesn’t hide when I click outside diagram.
Is it proper behavior? What should I do if I want to hide TextEditor by clicking outside a diagram?
That’s the expected behavior. You can modify the custom text editor code more to get the behavior you want by making sure that the tool is stopped if the user clicks outside the Diagram.
You could write something like this to replace the old blur:
// stop the tool on blur
textarea.addEventListener('blur', function(e) {
// debugger
console.log('blur');
var tool = TextEditor.tool;
if (!tool || tool.currentTextEditor === null) return;
tool.stopTool();
}, false);
Normally, clicking outside the diagram does not stop in-place text editing because GoJS does not modify the behavior of any element outside the diagram.