Skip to content

Commit badb320

Browse files
committed
Update TS
1 parent 9bbf17f commit badb320

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<body>
1616
<div id="gjs" style="height:0px; overflow:hidden"></div>
1717
<script type="text/javascript">
18-
setTimeout(() => {
18+
window.onload = () => {
1919
window.editor = grapesjs.init({
2020
height: '100%',
2121
noticeOnUnload: false,
@@ -27,7 +27,7 @@
2727
'grapesjs-component-countdown': {}
2828
}
2929
});
30-
});
30+
};
3131
</script>
3232
</body>
3333
</html>

src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type grapesjs from 'grapesjs';
1+
import type { Plugin, BlockProperties, ComponentDefinition } from 'grapesjs';
22

33
export type PluginOptions = {
44
/**
@@ -18,14 +18,14 @@ export type PluginOptions = {
1818
* @example
1919
* { label: 'Countdown', category: 'Extra', ... }
2020
*/
21-
block?: Partial<grapesjs.BlockOptions>;
21+
block?: Partial<BlockProperties>;
2222

2323
/**
2424
* Object to extend the default component properties.
2525
* @example
2626
* { name: 'Countdown', droppable: false, ... }
2727
*/
28-
props?: grapesjs.ComponentDefinition;
28+
props?: ComponentDefinition;
2929

3030
/**
3131
* Custom CSS styles for the component. This will replace the default one.
@@ -95,7 +95,7 @@ declare global {
9595
interface Window { __gjsCountdownIntervals: TElement[]; }
9696
}
9797

98-
const plugin: grapesjs.Plugin<PluginOptions> = (editor, opts = {}) => {
98+
const plugin: Plugin<PluginOptions> = (editor, opts = {}) => {
9999
const options: PluginOptions = {
100100
id: 'countdown',
101101
label: 'Countdown',
@@ -214,6 +214,7 @@ const plugin: grapesjs.Plugin<PluginOptions> = (editor, opts = {}) => {
214214
name: 'endText',
215215
changeProp: true,
216216
}],
217+
// @ts-ignore
217218
components: `
218219
<span data-js="countdown" class="${pfx}-cont">
219220
<div class="${pfx}-block">

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"extends": "./node_modules/grapesjs-cli/src/template/tsconfig.json",
2+
"extends": "./node_modules/grapesjs-cli/dist/template/tsconfig.json",
33
"include": ["src"]
44
}

0 commit comments

Comments
 (0)