question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to programatically trigger Enter key in editor in v5?

See original GitHub issue

Hi,

I was able to programtically insert Enter in v4 like this:

editor.fire('keydown', {keyCode: 13});

This works as well in v5, but Typescript throws:

image

What is the correct way to trigger Enter key in v5? Should I list all ~40 properties? Wouldn’t @ts-ignore cause some errors on listeners of this event?

I’ve consulted docs, but it just refers to MDN which provides examples on listening of keydown, not dispatching. I don’t know if it is rather issue of tinymce or event dispatching generally.

Thank you.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dakurcommented, Apr 13, 2021

@dav-sap I’ve sticked with editor.fire('keydown', {keyCode: 13}) and that works. In your case I suspect rather something different. Have you tried to console.log('something') before the editor.fire() to see if it actually make its way to there? Or try to debug with debugger in devtools.

0reactions
dav-sapcommented, Apr 13, 2021

thanks anyway 😃 @dakur

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trigger a "ENTER" in programmatically - Stack Overflow
Just replace the keydown event with keypress event. ... It should have value Enter when the enter key is to be simulated.
Read more >
Fire click event on Enter key - Suite 5.0 - DHTMLX Forum
I am trying to fire Onclick event when the “enter” key is pressed in password textbox. code: myForm.getInput(“txtPassword”).onkeyup = function ( ...
Read more >
How to Handle Enter Key Navigation for Tab index - Syncfusion
I have an EditForm which contain 10 textbox and 5 combobox control.I would like to know how to Handle Enter Key Navigation for...
Read more >
Animation transitions and triggers - Angular
Use the void state to configure transitions for an element that is entering or leaving a page. See Animating entering and leaving a...
Read more >
KeyboardEvent.key - Web APIs | MDN
When key 2 is pressed, another keydown event is fired for this new key press, and the key property value for the event...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found