File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
core/src/fields/inputFields/fields/ImageListSuggester Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 59
59
onclick : () => {
60
60
const imagePath = value [index ];
61
61
62
+ // in this case, using `.then()` is nicer than `await` and a try-catch block
62
63
navigator .clipboard
63
64
.writeText (imagePath )
64
65
.then (() => {
65
66
props .plugin .internal .showNotice (' Image path copied to clipboard' );
66
67
})
67
68
.catch (() => {
68
- props .plugin .internal .showNotice (' Failed to copy image to clipboard' );
69
+ props .plugin .internal .showNotice (' Failed to copy image path to clipboard' );
69
70
});
70
71
},
71
72
});
Original file line number Diff line number Diff line change 1
1
import type { API as JsEngineAPI } from 'jsEngine/api/API' ;
2
+ import type JsEnginePlugin from 'jsEngine/main' ;
3
+ import type { Plugin } from 'obsidian' ;
2
4
import type { DataviewApi } from 'obsidian-dataview' ;
3
5
import type { Templater , TemplaterPlugin } from 'packages/obsidian/extraTypes/Templater' ;
4
6
import type MetaBindPlugin from 'packages/obsidian/src/main' ;
5
7
6
8
export function getDataViewPluginAPI ( plugin : MetaBindPlugin ) : DataviewApi {
7
9
/* eslint-disable */
8
10
const dataViewPlugin = plugin . dependencyManager . checkDependency ( 'dataview' ) ;
9
- return ( dataViewPlugin as any ) . api as DataviewApi ;
11
+ return ( dataViewPlugin as Plugin & { api : DataviewApi } ) . api ;
10
12
}
11
13
12
14
export function getJsEnginePluginAPI ( plugin : MetaBindPlugin ) : JsEngineAPI {
13
15
/* eslint-disable */
14
16
const jsEnginePlugin = plugin . dependencyManager . checkDependency ( 'js-engine' ) ;
15
- return ( jsEnginePlugin as any ) . api as JsEngineAPI ;
17
+ return ( jsEnginePlugin as JsEnginePlugin ) . api ;
16
18
}
17
19
18
20
export enum Templater_RunMode {
You can’t perform that action at this time.
0 commit comments