aboutsummaryrefslogtreecommitdiff
path: root/files/ja/jetpack/ui/selection/index.html
blob: 346679a8a68cc779adf0a42a9c2921444471eb8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
title: Selection
slug: Jetpack/UI/Selection
translation_of: Archive/Mozilla/Jetpack/UI/Selection
---
<h3 class="editable" id="About"><span><span class="mw-headline">About</span></span></h3>
<div class="editIcon">
 <a href="/en/Jetpack/UI/Selection#" style="" title="Edit section"><span class="icon"><img alt="Edit section" class="sectionedit" src="../../../../skins/common/icons/icon-trans.gif"></span></a></div>
<ul>
 <li><strong><span class="author-p-3041">Status</span></strong><span class="author-p-3041">: 開発中</span></li>
 <li><strong><span class="author-p-3041">Instantiation</span></strong><span class="author-p-3041">: </span><code>jetpack.future.import('selection')</code></li>
 <li><strong>Last Update</strong>: v0.6</li>
 <li><strong>Summary</strong>: selectionは基本的なユーザインタラクションです。Jetpackはユーザによるselectionを探すための標準メソッドを提供しています。 Jetpackのselectionの実装を使用することで、selection イベントの設定、取得をすることが可能となります。</li>
</ul>
<div id="section_2">
 <h3 class="editable" id="selectionの設定と取得"><span><span class="mw-headline">selectionの設定と取得</span></span></h3>
 <br>
 <div class="editIcon">
  <a href="/en/Jetpack/UI/Selection#" title="Edit section"><span class="icon"><img alt="Edit section" class="sectionedit" src="../../../../skins/common/icons/icon-trans.gif"></span></a></div>
 <p><code>jetpack.selection</code> の現在のバージョンは <code>.text</code><span style="font-family: monospace;"></span><code> .html</code>のフォーマットを含みます。</p>
 <p><strong>selectionの取得</strong></p>
 <div style="width: 60%;">
  <pre class="brush: js"><span class="content"><span class="block" style="margin-left: 0px ! important;"><code class="keyword">var</code> <code class="plain">textOfSel = jetpack.selection.text;</code></span></span>
<span class="content"><span class="block" style="margin-left: 0px ! important;"><code class="keyword">var</code> <code class="plain">htmlOfSel = jetpack.selection.html;</code></span></span>
</pre>
 </div>
 <pre class="js" style="display: none;">var textOfSel = jetpack.selection.text;
var htmlOfSel = jetpack.selection.html;</pre>
</div>
<p><strong>selectionの設定</strong></p>
<div style="width: 60%;">
 <pre class="brush: js">jetpack.selection.text = 'Hello';
jetpack.selection.html = '&lt;b&gt;Hello&lt;/b&gt;';
</pre>
</div>
<pre class="js" style="display: none;">jetpack.selection.text = 'Hello';
jetpack.selection.html = '&lt;b&gt;Hello&lt;/b&gt;';</pre>
<div id="section_3">
 <h3 class="editable" id="onSelection"><span><span class="mw-headline">onSelection </span></span></h3>
 <div class="editIcon">
  <a href="/en/Jetpack/UI/Selection#" style="" title="Edit section"><span class="icon"><img alt="Edit section" class="sectionedit" src="../../../../skins/common/icons/icon-trans.gif"></span></a></div>
 <p>onSelection メソッドを使用することでselectionが行われたときに、イベント関数を実行することができます。</p>
 <p><strong>Selectionイベントの追加</strong>:</p>
 <pre class="brush: js"><span class="content"><span class="block" style="margin-left: 0px ! important;"><code class="plain">jetpack.selection.onSelection( fn )<span style='font-family: "Courier New","Andale Mono",monospace;'>;</span></code></span></span>
</pre>
 <p style="margin-left: 80px;"><em>Argumants</em><br>
  <em><strong>fn</strong></em>: selectionが行われるときに実行される関数。関数は引数を受け取りません。 引数の代わりに <code>jetpack.selection.* を使用してください。</code></p>
 <p><code><span id="1256762297356E" style="display: none;"> </span></code><strong>Selection イベントの除去</strong>:</p>
 <div class="lines">
  <pre class="brush: js"><span class="content"><span class="block" style="margin-left: 0px ! important;"><code class="plain">jetpack.selection.onSelection.unbind( fn );</code></span></span></pre>
 </div>
 <p style="margin-left: 80px;"><em>Arguments</em><br>
  <em><strong>fn</strong></em>: 開放したい関数のリファレンス。A reference to a specific function you would like to unbind.</p>
 <p><strong>詳細な例:</strong></p>
 <div class="lines">
  <pre class="brush: js"><span class="content"><span class="block" style="margin-left: 0px ! important;"><code class="plain">jetpack.selection.onSelection(</code><code class="keyword">function</code><code class="plain">(){</code></span></span>
<span class="content"><code class="spaces">  </code><span class="block" style="margin-left: 14px ! important;"><code class="keyword">var</code> <code class="plain">html = jetpack.selection.html;</code></span></span>
<span class="content"><code class="spaces">  </code><span class="block" style="margin-left: 14px ! important;"><code class="plain">jetpack.selection.html = </code><code class="string">"&gt;&gt;&gt;"</code> <code class="plain">+ html + </code><code class="string">"&lt;&lt;&lt;"</code><code class="plain">;</code></span></span>
<span class="content"><span class="block" style="margin-left: 0px ! important;"><code class="plain">});</code></span></span></pre>
 </div>
</div>
<p> </p>