mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
151 lines
4.9 KiB
HTML
151 lines
4.9 KiB
HTML
---
|
|
layout: docs
|
|
title: DraftStore
|
|
edit_url: "https://github.com/nylas/N1/blob/master/src/flux/stores/draft-store.coffee"
|
|
---
|
|
|
|
<h2>Summary</h2>
|
|
|
|
<div class="markdown-from-sourecode">
|
|
<p><p>DraftStore responds to Actions that interact with Drafts and exposes
|
|
public getter methods to return Draft objects and sessions.</p>
|
|
<p>It also creates and queues <a href='task.html'>Task</a> objects to persist changes to the Nylas
|
|
API.</p>
|
|
<p>Remember that a "Draft" is actually just a "Message" with <code>draft: true</code>.</p>
|
|
</p>
|
|
</div>
|
|
|
|
<ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
<h3>Instance Methods</h3>
|
|
|
|
<h4 id=sessionForClientId class="function-name">
|
|
sessionForClientId(<span class="args"><span class="arg">clientId</span></span>) <a href="#sessionForClientId" class="link"></a>
|
|
</h4>
|
|
|
|
<div class="function-description markdown-from-sourecode">
|
|
<p><p>Fetch a <a href='draftstoreproxy.html'>DraftStoreProxy</a> for displaying and/or editing the
|
|
draft with <code>clientId</code>.</p>
|
|
<p>Example:</p>
|
|
<pre><code class="lang-coffee">session = <span class="hljs-type">DraftStore</span>.sessionForClientId(clientId)
|
|
session.prepare<span class="hljs-literal">()</span>.<span class="hljs-keyword">then</span> ->
|
|
# session.draft<span class="hljs-literal">()</span> is now ready
|
|
</code></pre>
|
|
</p>
|
|
</div>
|
|
|
|
<strong>Parameters</strong>
|
|
<table class="arguments">
|
|
<tr>
|
|
<th>Argument</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
<tr>
|
|
<td style="width:15%;">
|
|
<em>clientId</em>
|
|
</td>
|
|
<td class="markdown-from-sourecode">
|
|
|
|
<p>The <a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string'>String</a> clientId of the draft.</p>
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<strong>Returns</strong>
|
|
<table class="arguments">
|
|
<tr>
|
|
<th>Return Values</th>
|
|
</tr>
|
|
<tr><td class="markdown-from-sourecode"><p>Returns a <a href='https://github.com/petkaantonov/bluebird/blob/master/API.md'>Promise</a> that resolves to an <a href='draftstoreproxy.html'>DraftStoreProxy</a> for the
|
|
draft once it has been prepared:</p>
|
|
</td></tr>
|
|
</table>
|
|
<h4 id=isSendingDraft class="function-name">
|
|
isSendingDraft(<span class="args"></span>) <a href="#isSendingDraft" class="link"></a>
|
|
</h4>
|
|
|
|
<div class="function-description markdown-from-sourecode">
|
|
<p><p>Look up the sending state of the given draftClientId.
|
|
In popout windows the existance of the window is the sending state. </p>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<h4 id=extensions class="function-name">
|
|
extensions(<span class="args"></span>) <a href="#extensions" class="link"></a>
|
|
</h4>
|
|
|
|
<div class="function-description markdown-from-sourecode">
|
|
<p></p>
|
|
</div>
|
|
|
|
|
|
<strong>Returns</strong>
|
|
<table class="arguments">
|
|
<tr>
|
|
<th>Return Values</th>
|
|
</tr>
|
|
<tr><td class="markdown-from-sourecode"><p>Returns the extensions registered with the DraftStore.</p>
|
|
</td></tr>
|
|
</table>
|
|
<h4 id=registerExtension class="function-name">
|
|
registerExtension(<span class="args"><span class="arg">ext</span></span>) <a href="#registerExtension" class="link"></a>
|
|
</h4>
|
|
|
|
<div class="function-description markdown-from-sourecode">
|
|
<p><p>Registers a new extension with the DraftStore. DraftStore extensions
|
|
make it possible to extend the editor experience, modify draft contents,
|
|
display warnings before draft are sent, and more.</p>
|
|
</p>
|
|
</div>
|
|
|
|
<strong>Parameters</strong>
|
|
<table class="arguments">
|
|
<tr>
|
|
<th>Argument</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
<tr>
|
|
<td style="width:15%;">
|
|
<em>ext</em>
|
|
</td>
|
|
<td class="markdown-from-sourecode">
|
|
|
|
<p>A <a href='draftstoreextension.html'>DraftStoreExtension</a> instance.</p>
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<h4 id=unregisterExtension class="function-name">
|
|
unregisterExtension(<span class="args"><span class="arg">ext</span></span>) <a href="#unregisterExtension" class="link"></a>
|
|
</h4>
|
|
|
|
<div class="function-description markdown-from-sourecode">
|
|
<p><p>Unregisters the extension provided from the DraftStore.</p>
|
|
</p>
|
|
</div>
|
|
|
|
<strong>Parameters</strong>
|
|
<table class="arguments">
|
|
<tr>
|
|
<th>Argument</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
<tr>
|
|
<td style="width:15%;">
|
|
<em>ext</em>
|
|
</td>
|
|
<td class="markdown-from-sourecode">
|
|
|
|
<p>A <a href='draftstoreextension.html'>DraftStoreExtension</a> instance.</p>
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|