mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-09-28 04:32:58 +00:00
changes to removespace
This commit is contained in:
@@ -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)=>{
|
||||||
|
|||||||
Reference in New Issue
Block a user