mirror of https://github.com/M66B/FairEmail.git
Added support for placeholders in snippets
This commit is contained in:
parent
68d612b30c
commit
6c1e62be65
2
FAQ.md
2
FAQ.md
|
@ -4633,8 +4633,6 @@ Templates can have the following options:
|
|||
* *Snippet*: template will be used as text fragment (since version 1.1857)
|
||||
* *Hide from menus*: template will be hidden (disabled)
|
||||
|
||||
Note that placeholders will not be filled in when using snippets.
|
||||
|
||||
<br />
|
||||
|
||||
<h2><a name="get-support"></a>Get support</h2>
|
||||
|
|
|
@ -45,6 +45,7 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat;
|
||||
|
@ -58,6 +59,9 @@ import org.jsoup.nodes.Document;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.mail.internet.AddressException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
public class EditTextCompose extends FixedEditText {
|
||||
private boolean raw = false;
|
||||
private ISelection selectionListener = null;
|
||||
|
@ -215,9 +219,18 @@ public class EditTextCompose extends FixedEditText {
|
|||
if (snippets == null)
|
||||
return false;
|
||||
|
||||
InternetAddress[] to = null;
|
||||
try {
|
||||
View root = getRootView();
|
||||
EditText etTo = (root == null ? null : root.findViewById(R.id.etTo));
|
||||
if (etTo != null)
|
||||
to = MessageHelper.parseAddresses(getContext(), etTo.getText().toString());
|
||||
} catch (AddressException ignored) {
|
||||
}
|
||||
|
||||
for (EntityAnswer snippet : snippets)
|
||||
if (snippet.id.equals(id)) {
|
||||
String html = snippet.getHtml(null);
|
||||
String html = snippet.getHtml(to);
|
||||
|
||||
executor.submit(new Runnable() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue