2
2
/// <reference lib="esnext"/>
3
3
/// <reference lib="dom" />
4
4
5
- import { BaseStore } from "../../deps/scrapbox.ts" ;
5
+ import { BaseLine , BaseStore } from "../../deps/scrapbox.ts" ;
6
6
import { Position } from "./position.ts" ;
7
+ import { Page } from "./page.d.ts" ;
7
8
8
9
export interface SetPositionOptions {
9
10
/** カーソルが画面外に移動したとき、カーソルが見える位置までページをスクロールするかどうか
@@ -16,13 +17,17 @@ export interface SetPositionOptions {
16
17
*
17
18
* コード内だと、"mouse"が指定されていた場合があった。詳細は不明
18
19
*/
19
- source ?: string ;
20
+ source ?: "mouse" ;
20
21
}
21
22
22
23
/** カーソル操作クラス */
23
- export declare class Cursor extends BaseStore {
24
+ export declare class Cursor extends BaseStore <
25
+ { source : "mouse" | undefined } | "focusTextInput" | "scroll" | undefined
26
+ > {
24
27
constructor ( ) ;
25
28
29
+ public startedWithTouch : boolean ;
30
+
26
31
/** カーソルの位置を初期化し、editorからカーソルを外す */
27
32
clear ( ) : void ;
28
33
@@ -44,9 +49,18 @@ export declare class Cursor extends BaseStore {
44
49
/** popup menuを消す */
45
50
hidePopupMenu ( ) : void ;
46
51
47
- /** #text-inputにカーソルをfocusし、同時にカーソルを表示する */
52
+ /** #text-inputにカーソルをfocusし、同時にカーソルを表示する
53
+ *
54
+ * このとき、`event: "focusTextInput"`が発行される
55
+ */
48
56
focus ( ) : void ;
49
57
58
+ /** #text-inputにfocusがあたっているか返す
59
+ *
60
+ * `this.focusTextarea`と同値
61
+ */
62
+ get hasFocus ( ) : boolean ;
63
+
50
64
/** #text-inputからfocusを外す。カーソルの表示状態は変えない */
51
65
blur ( ) : void ;
52
66
@@ -108,11 +122,11 @@ export declare class Cursor extends BaseStore {
108
122
| "go-pageup" ,
109
123
) : void ;
110
124
111
- /* `scrapbox.Page.lines`とほぼ同じ */
112
- get lines ( ) : unknown [ ] ;
125
+ /** 現在のページ本文を取得する */
126
+ get lines ( ) : BaseLine [ ] ;
113
127
114
- /* `scrapbox.Project.pages`とほぼ同じ */
115
- get pages ( ) : unknown ;
128
+ /** 現在のページデータを取得する */
129
+ get page ( ) : Page ;
116
130
117
131
private goUp ( ) : void ;
118
132
private goPageUp ( ) : void ;
@@ -143,8 +157,11 @@ export declare class Cursor extends BaseStore {
143
157
private sync ( ) : void ;
144
158
private syncNow ( ) : void ;
145
159
private updateTemporalHorizontalPoint ( ) : number ;
160
+ /** scrollされたときに発火される
161
+ *
162
+ * このとき`event: "source"`が発行される
163
+ */
146
164
private emitScroll ( ) : void ;
147
- emitChange ( event : string ) : void ;
148
165
149
166
private data : Position ;
150
167
private temporalHorizontalPoint : number ;
0 commit comments