577
edits
| Line 20: | Line 20: | ||
The functions to manipulate and access the selection lives in <code>jetpack.selection</code>. | The functions to manipulate and access the selection lives in <code>jetpack.selection</code>. | ||
==== Getting and Setting ==== | ==== Getting and Setting the Selection ==== | ||
Getting and setting the selection live in a family of getters and setters, dependent on the format. | Getting and setting the selection live in a family of getters and setters, dependent on the format. For the first version of <code>.selection</code> we include to formats: text, and html. | ||
'''Setting the selection''' | '''Setting the selection''' | ||
| Line 28: | Line 28: | ||
<pre class="brush:js;toolbar:false;"> | <pre class="brush:js;toolbar:false;"> | ||
jetpack.selection.text = "Hello"; | jetpack.selection.text = "Hello"; | ||
jetpack.selection.html = "<b>Hello</b>"; | jetpack.selection.html = "<b>Hello</b>";</pre> | ||
''' Getting the selection''' | |||
jetpack.selection.html | |||
<pre class="brush:js;toolbar:false;"> | |||
var textOfSel = jetpack.selection.text; | |||
var htmlOfSel = jetpack.selection.html;</pre> | |||
Eventually, one may be able to do <code>jetpack.selection.fragment</code> which would let you manipulate the selection live. That is, however, outside the scope of JEP 12. | |||
==== onSelection ==== | |||
edits