mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-16 05:48:45 +00:00
simplify removespace
This commit is contained in:
@@ -131,8 +131,7 @@ const removeSpace = (view)=>forEachSelection(view, (state, from, to, selected)=>
|
|||||||
if(match) {
|
if(match) {
|
||||||
const percent = parseInt(match[1], 10) - 10;
|
const percent = parseInt(match[1], 10) - 10;
|
||||||
const insert = percent > 0 ? `{{width:${percent}% }}` : '';
|
const insert = percent > 0 ? `{{width:${percent}% }}` : '';
|
||||||
if(insert.length === 0) return { changes: { from, to, insert: insert }, range: EditorSelection.cursor(from) };
|
return { changes: { from, to, insert: insert }, range: EditorSelection.range(from, from + insert.length) };
|
||||||
else return { changes: { from, to, insert: insert }, range };
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user