From a87f5428da1a21f9e32bced2d319da3c58207781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sun, 27 Sep 2026 23:01:27 +0200 Subject: [PATCH] changes to removespace --- client/components/codeEditor/extensions/customKeyMaps.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/client/components/codeEditor/extensions/customKeyMaps.js b/client/components/codeEditor/extensions/customKeyMaps.js index 42e97a82e..c73f974c8 100644 --- a/client/components/codeEditor/extensions/customKeyMaps.js +++ b/client/components/codeEditor/extensions/customKeyMaps.js @@ -170,15 +170,14 @@ const makeSpace = (view)=>forEachSelection(view, (state, range)=>{ }); const removeSpace = (view)=>forEachSelection(view, (state, range)=>{ - const { from, to } = view.state.selection.main; - const selected = view.state.doc.sliceString(from, to); + const { from, to } = range; + const selected = state.doc.sliceString(from, to); const match = selected.match(/^{{width:(\d+)% }}$/); if(match) { const percent = parseInt(match[1], 10) - 10; - const newText = percent > 0 ? `{{width:${percent}% }}` : ''; - return { changes: { from, to, insert: newText } }; + const insert = percent > 0 ? `{{width:${percent}% }}` : ''; + return { changes: { from, to, insert: insert } }; } - return true; }); const makeLink = (view)=>{