Drafts5ã§ä½ãããèªä½ã¢ã¯ã·ã§ã³å ¥é(3)
Draftsã触ã£ã¦ããã¨ããããéåæãããã¾ããããã°ã©ãã³ã°ç¨ã®äºç´èªã«çµæ§éè¦ãªåèªã使ã£ã¦ãããTãªãã¸ã§ã¯ãã«éç´ãã¦ããTextwellã¨æ¹åæ§ãéãã
ä»æ¥ã®ããã·ã§ã³
ãã¤ã¢ãã°ããã¯ã¹ã®ä½ãæ¹ãè¦ã¦ã¿ã¾ãã
ã¯ã¼ãã«ã¦ã³ã
ãã¯ã¹ãã®æåæ°ã表示ãã¾ããå³ä¸ã«åºã¦ã¾ããã©ããç·´ç¿ã¨ãããã¨ã§ã
Counter
text = editor.getText();
p = Prompt.create();
p.title = "Counter";
p.message = text.length;
p.show();
Prompt.create() ã§ããã¯ã¹ãä½ãã¾ããããã¯ã¹ã® title 㨠message ãæå®ããshow() ã使ãã¨è¡¨ç¤ºããã¾ãããã¡ãããmessage ã«ä½ãæå®ãã¦ããã¾ãã¾ããã
ç®æ¬¡ä½æ
Markdownã®è¦åºãä¸è¦§ã表示ãã¾ãã
Index
text = editor.getText();
list = text.match(/#+\s.+/g);
p = Prompt.create();
p.title = "Index";
for(i=0; i<list.length; i++) p.addButton(list[i]);
p.show();
s = p.buttonPressed;
x = text.search(s);
editor.setSelectedRange(x,0);
editor.focus();
Action Directory ã«ãã Jump to Header ãåèã«ãã¾ããã
è¦åºãé¨åãæãåºãé
ålistã«åãã¾ããaddButton() ã§ãã¿ã³ã並㹠show() ã§ããã¯ã¹ã表示ãbuttonPressed ã§æ¼ããããã¿ã³ã調ã¹ãsearch() ã§ä½ç½®ãæ¢ãããã¨ãsetSelectedRange() ã使ãã«ã¼ã½ã«ã移åãã¾ããfocus() ã§ã¨ãã£ã¿ã«æ»ãã¦å®ç§ã
Googleæ¤ç´¢
é¸æç¯å²ãæ¤ç´¢ãã¾ãããã¼ãã¼ãã¢ã¯ã·ã§ã³ã«ç»é²ããã¨å¼ã³åºããããã
Google
p = Prompt.create();
p.title = "Google";
p.addTextField("word","Search for",editor.getSelectedText());
p.addButton("Go");
p.show();
if(p.buttonPressed=="Go"){
s = p.fieldValues["word"];
url = "http://google.co.jp/search?q="+encodeURIComponent(s);
app.openURL(url);
}
addTextField() ã§å ¥åæ¬ã追å ãã¾ãããã®ã¨ãæåã®å¼æ°ããã®æ¬ã®èå¥åã«ãªãã¾ããå ¥åãããæåãåå¾ããã«ã¯ filedValues[èå¥å] ã¨ããé åã使ãã¾ããè¤æ°è¡ãå ¥åããå ´å㯠addTextView() ã«æ¿ãã¦ãã ãããtextarea ã®ãããªæãã«ãªãã¾ãã
ã¾ã¨ã
Javascript ã® prompt ãä¹ã£åãããæãã§ãããalert() ã¯ä½¿ãããã§ãããconfirm() ã使ãã¾ãããPromptã使ã£ã¦èªåã§ä½æãããæè»æ§ãããã¾ããã©ãã¢ã¯ã·ã§ã³ãçµãã§ã¿ã¦ããµãã¹ã¯ãªãã·ã§ã³ã¯Draftsã«åãã¦ããªãã¨æãã¾ãããã¢ã¯ã·ã§ã³ãä½ãã¡ã³ãã¼ã«è² æ ãå¼·ãã¦ã¯ãã³ãã¥ããã£ãè²ã¦ãé¢ã§ãã¤ãã¹è¦å ã«ãªãã¾ãã確ãã«AppStoreãéçºè ããç»é²æãå¾´åããã·ã¹ãã ã§ã¯ããããã©ãããã¯ã¢ããªã®è²©å£²ãèªãã¦ããããã§ããããã¢ã¯ã·ã§ã³ã¯ãååãã§ã¯ããã¾ãããDraftsã®ãæ¬è³ªãã§ã¯ãªãã§ããããã