changes to removespace

This commit is contained in:
Víctor Losada Hernández
2026-09-27 23:01:27 +02:00
parent 12c8bdf5cd
commit a87f5428da
@@ -170,15 +170,14 @@ const makeSpace = (view)=>forEachSelection(view, (state, range)=>{
}); });
const removeSpace = (view)=>forEachSelection(view, (state, range)=>{ const removeSpace = (view)=>forEachSelection(view, (state, range)=>{
const { from, to } = view.state.selection.main; const { from, to } = range;
const selected = view.state.doc.sliceString(from, to); const selected = state.doc.sliceString(from, to);
const match = selected.match(/^{{width:(\d+)% }}$/); const match = selected.match(/^{{width:(\d+)% }}$/);
if(match) { if(match) {
const percent = parseInt(match[1], 10) - 10; const percent = parseInt(match[1], 10) - 10;
const newText = percent > 0 ? `{{width:${percent}% }}` : ''; const insert = percent > 0 ? `{{width:${percent}% }}` : '';
return { changes: { from, to, insert: newText } }; return { changes: { from, to, insert: insert } };
} }
return true;
}); });
const makeLink = (view)=>{ const makeLink = (view)=>{