From e18d501186fa201d8dc60dc648fa9a19b7331250 Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Tue, 14 Nov 2023 14:02:55 +0200
Subject: [PATCH] fix enter in caption

---
 .../src/config/defaultServices/ShortCutsService/ShortCuts.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/wax-prosemirror-core/src/config/defaultServices/ShortCutsService/ShortCuts.js b/wax-prosemirror-core/src/config/defaultServices/ShortCutsService/ShortCuts.js
index 5d052fa26..4c98df4ce 100644
--- a/wax-prosemirror-core/src/config/defaultServices/ShortCutsService/ShortCuts.js
+++ b/wax-prosemirror-core/src/config/defaultServices/ShortCutsService/ShortCuts.js
@@ -59,6 +59,10 @@ const backSpaceShortCut = (state, dispatch, view) => {
 };
 
 const pressEnter = (state, dispatch) => {
+  // Images
+  if (state.selection.$head.parent.type.name === 'figcaption') {
+    return true;
+  }
   if (state.selection.node && state.selection.node.type.name === 'image') {
     const { $from, to } = state.selection;
 
@@ -68,6 +72,7 @@ const pressEnter = (state, dispatch) => {
     dispatch(state.tr.setSelection(NodeSelection.create(state.doc, pos)));
     return true;
   }
+
   // LISTS
   if (splitListItem(state.schema.nodes.list_item)(state)) {
     splitListItem(state.schema.nodes.list_item)(state, dispatch);
-- 
GitLab