File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 3
3
/// <reference lib="dom" />
4
4
5
5
import { encodeTitleURI } from "../../title.ts" ;
6
+ import {
7
+ PageTransitionContext ,
8
+ pushPageTransition ,
9
+ } from "./pushPageTransition.ts" ;
6
10
import type { Scrapbox } from "../../deps/scrapbox.ts" ;
7
11
declare const scrapbox : Scrapbox ;
8
12
@@ -24,6 +28,9 @@ export interface OpenOptions {
24
28
* @default 同じprojectの場合は再読み込みせず、違うprojectの場合は再読込する
25
29
*/
26
30
reload ?: boolean ;
31
+
32
+ /** リンク先へスクロールする機能を使うために必要な情報 */
33
+ context ?: Omit < PageTransitionContext , "to" > ;
27
34
}
28
35
29
36
/** ページを開く
@@ -41,6 +48,12 @@ export const open = (
41
48
if ( options ?. body ) url . search = `?body=${ encodeURIComponent ( options . body ) } ` ;
42
49
if ( options ?. id ) url . hash = `#${ options . id } ` ;
43
50
51
+ if ( options ?. context ) {
52
+ pushPageTransition (
53
+ { ...options ?. context , to : { project, title } } as PageTransitionContext ,
54
+ ) ;
55
+ }
56
+
44
57
if (
45
58
options ?. newTab !== false &&
46
59
( options ?. newTab === true || project !== scrapbox . Project . name )
You can’t perform that action at this time.
0 commit comments