Action
Move cursor back by word
Move cursor position back one word at a time.
Steps
-
script
// move cursor to last word break let [st, len] = editor.getSelectedRange(); let isWhitespace = (c) => { return /\s/.test(c) } let f = () => { let newSt = st; let s = draft.content; let skipSpace = false; if (newSt == 0) { return; } if (isWhitespace(s.charAt(newSt - 1))) { skipSpace = true; } while (newSt > 0) { newSt -= 1; if (isWhitespace(s.charAt(newSt))) { if (!skipSpace) { newSt += 1; break; } } else { if (skipSpace) { skipSpace = false; } } } editor.setSelectedRange(newSt, 0); } f();
Options
-
After Success Nothing Notification Error Log Level None
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.