Created
October 20, 2014 23:57
-
-
Save rohinomiya/e98a801f357a21cae2cd to your computer and use it in GitHub Desktop.
Textwell_expandselection.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var next_action = null; | |
// next_action = 'tweet'; | |
var text = T.text; | |
var pattern = '\n'; | |
var j = text.indexOf(pattern, T.range.loc + T.range.len ); | |
var i = text.lastIndexOf(pattern, T.range.loc - 1); | |
i = (i === -1) ? 0 : i + pattern.length; | |
j = (j === -1) ? text.length : j + 1; | |
T('replaceRange', { | |
text: text, | |
replacingRange: { | |
loc: 0, | |
len: text.length | |
}, | |
selectingRange: { | |
loc: i, | |
len: j - i | |
}, | |
nextAction: next_action | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment