Skip to content

Key shortcuts register inconsistently #6

@tucnak

Description

@tucnak

This is about our Markdown dependency carta. It provides API for registering keyboard shortcuts, however there's a bug somewhere: either in our implementation, or in carta itself. The key binds are not registering consistently. So you would hit either of the "shortcuts," and nothing would happen.

The bug is seemingly random.

<script lang="ts">
	import type { Plugin, KeyboardShortcut } from "carta-md";
	import { Carta, Markdown, MarkdownEditor } from "carta-md";

	const enter: KeyboardShortcut = {
		id: "newline",
		combination: new Set(["enter"]),
		action: (input) => {
			input.insertAt(input.getCursorXY().right, "\n");
			input.update();
		},
	};
	const shiftEnter: KeyboardShortcut = {
		id: "submit",
		combination: new Set(["shift", "enter"]),
		action: (input) => dispatch("shutter", {}),
	};
	const shortcuts = (): Plugin => {
		return {
			shortcuts: [enter, shiftEnter],
		};
	};
	const carta = new Carta({
		sanitizer: DOMPurify.sanitize,
		disablePrefixes: true,
		disableTabOuts: true,
		extensions: [shortcuts()],
	});
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions