Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tab and space not working in WYSIWYG #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SekoiaTree
Copy link

@SekoiaTree SekoiaTree commented Sep 20, 2022

Disclaimer: I translated this code back and forth from typescript.

I have tested this on Legacy mode and it works, but these edits fix it for latest version. The code for legacy is essentially copied from current.

Fixes #19, fixes #25 (maybe?), fixes #37 (maybe?), fixes #47 and fixes #52

The way this works is by using this.registerDomEvent instead of CodeMirror edits. The key down event now also checks whether the current window is a markdown view, so you can't have accidental replaces in any other areas. If that's actually wanted, feel free to remove it (or make it a setting, although I haven't seen a place where the distinction would actually be relevant)

Disclaimer: I translated this code back and forth from typescript.

I have tested this on Legacy mode and it works, but these edits fix it for latest version. The code for legacy is essentially copied from current.

Fixes... a whole bunch of issues. If I remember I'll edit and list them all, can't check right now.

The way this works is by using `this.registerDomEvent` instead of CodeMirror edits. The key down event now also checks whether the current window is a markdown view, so you can't have accidental replaces in any other areas. If that's actually wanted, feel free to remove it (or make it a setting, although I haven't seen a place where the distinction would actually be relevant)
@Arax20
Copy link
Contributor

Arax20 commented Oct 4, 2022

Tested and works for me, although I wonder if registerDomEvent is the cleanest way of capturing keypresses.

I've seen advanced tables use registerEditorExtension for CM6 which might keep the behaviour localized to the editor.

@SekoiaTree
Copy link
Author

Oh yeah that'd definitely work too. I might try and do that but I'm quite busy atm so yeah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants