Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: fix Enter key not working on some keyboards in Android

Abdullah Attaacb384c901c0
diff --git a/packages/editor/src/extensions/text-direction/text-direction.ts b/packages/editor/src/extensions/text-direction/text-direction.ts
index cd2cbdac1..09a4a33ec 100644
--- a/packages/editor/src/extensions/text-direction/text-direction.ts
+++ b/packages/editor/src/extensions/text-direction/text-direction.ts
@@ -68,9 +68,11 @@ export function getTextDirection(editor: Editor): TextDirections {
export const TextDirection = Extension.create<TextDirectionOptions>({
name: "textDirection",
- defaultOptions: {
- types: TEXT_DIRECTION_TYPES,
- defaultDirection: undefined
+ addOptions() {
+ return {
+ types: TEXT_DIRECTION_TYPES,
+ defaultDirection: undefined
+ };
},
addGlobalAttributes() {
@@ -79,7 +81,9 @@ export const TextDirection = Extension.create<TextDirectionOptions>({
types: this.options.types,
attributes: {
textDirection: {
- default: this.options.defaultDirection,
+ // NOTE: for some reason setting this to undefined breaks enter behaviour
+ // on Android for some keyboards (GBoard etc.). Empty string works fine.
+ default: this.options.defaultDirection || "",
parseHTML: (element) => element.dir,
renderHTML: (attributes) => {
if (!attributes.textDirection) {