@@ -11,42 +11,71 @@ import type { EventEmitter } from "./deps/events.ts";
1111export type { EventEmitter , Layout , ParsedLine , PartialLayout , StringLc } ;
1212export * from "./pageMenu.ts" ;
1313
14+ /** Type definition of `window.scrapbox` */
1415export type Scrapbox =
1516 & EventEmitter
1617 & {
1718 PageMenu : {
19+ /** get a particular Page Menu
20+ *
21+ * @param menuName Page Menu name to get. If it is set to "default" or undefined, return the default page Menu
22+ */
1823 ( menuName ?: string ) : PageMenu ;
24+ /** Add a new Page Menu button
25+ *
26+ * @param init information used for a Page Menu button
27+ */
1928 addMenu : ( init : AddMenuInit ) => void ;
20- /** Add a menu item to a particular Page Menu button
29+ /** Add a menu item to the default Page Menu button
2130 *
2231 * @param item information used for a menu item
2332 */
2433 addItem : ( item : Item ) => void ;
25- /** Add a separator to a particular Page Menu button */
34+ /** Add a separator to the default Page Menu button */
2635 addSeparater : ( ) => void ;
36+ /** remove all custom items from the default Page Menu button */
2737 removeAllItems : ( ) => void ;
2838 } ;
2939 PopupMenu : {
40+ /** Add a popup button
41+ *
42+ * @param button button settings
43+ */
3044 addButton : ( button : {
45+ /** ボタンのタイトル
46+ *
47+ * 関数を設定して、選択範囲が変わるたびにタイトルを変更させる事もできる
48+ */
3149 title : string | ( ( text : string ) => ( string | undefined ) ) ;
50+ /** ボタンをクリックしたときに実行する処理
51+ *
52+ * @return ここで返した文字列で選択範囲を置換し、popupを閉じる。`undefined`を返した場合は何もしない。popupも閉じない
53+ */
3254 onClick : ( text : string ) => ( string | undefined ) ;
3355 } ) => void ;
3456 } ;
3557 TimeStamp : TimeStamp ;
3658 Project : {
59+ /** get the current project name */
3760 get name ( ) : string ;
61+ /** get the dictionary used for comupletion */
3862 get pages ( ) : PageBrief [ ] ;
3963 } ;
4064 }
4165 & (
4266 {
67+ /** the current page layout */
4368 Layout : "page" ;
4469 Page : {
70+ /** get the current page lines data */
4571 get lines ( ) : ParsedLine [ ] ;
72+ /** get the current page title */
4673 get title ( ) : string ;
74+ /** get the current page id */
4775 get id ( ) : string ;
4876 } ;
4977 } | {
78+ /** the current page layout */
5079 Layout : PartialLayout ;
5180 Page : {
5281 get lines ( ) : null ;
@@ -56,12 +85,13 @@ export type Scrapbox =
5685 }
5786 ) ;
5887
88+ /** 入力補完に使われる辞書 */
5989export interface PageBrief {
6090 /** true when the page has contents */ exists : boolean ;
6191 /** whether the page contains any image */ hasIcon ?: boolean ;
6292 /** the page id */ id : string ;
6393 /** the page title */ title : string ;
64- titleLc : StringLc ;
94+ /** lower case style of the page title */ titleLc : StringLc ;
6595 /** updated time */ updated : number ;
6696}
6797
0 commit comments