Skip to content

Commit

Permalink
Update TS
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Jun 6, 2023
1 parent 9bbf17f commit badb320
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<body>
<div id="gjs" style="height:0px; overflow:hidden"></div>
<script type="text/javascript">
setTimeout(() => {
window.onload = () => {
window.editor = grapesjs.init({
height: '100%',
noticeOnUnload: false,
Expand All @@ -27,7 +27,7 @@
'grapesjs-component-countdown': {}
}
});
});
};
</script>
</body>
</html>
9 changes: 5 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type grapesjs from 'grapesjs';
import type { Plugin, BlockProperties, ComponentDefinition } from 'grapesjs';

export type PluginOptions = {
/**
Expand All @@ -18,14 +18,14 @@ export type PluginOptions = {
* @example
* { label: 'Countdown', category: 'Extra', ... }
*/
block?: Partial<grapesjs.BlockOptions>;
block?: Partial<BlockProperties>;

/**
* Object to extend the default component properties.
* @example
* { name: 'Countdown', droppable: false, ... }
*/
props?: grapesjs.ComponentDefinition;
props?: ComponentDefinition;

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

const plugin: grapesjs.Plugin<PluginOptions> = (editor, opts = {}) => {
const plugin: Plugin<PluginOptions> = (editor, opts = {}) => {
const options: PluginOptions = {
id: 'countdown',
label: 'Countdown',
Expand Down Expand Up @@ -214,6 +214,7 @@ const plugin: grapesjs.Plugin<PluginOptions> = (editor, opts = {}) => {
name: 'endText',
changeProp: true,
}],
// @ts-ignore
components: `
<span data-js="countdown" class="${pfx}-cont">
<div class="${pfx}-block">
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "./node_modules/grapesjs-cli/src/template/tsconfig.json",
"extends": "./node_modules/grapesjs-cli/dist/template/tsconfig.json",
"include": ["src"]
}

0 comments on commit badb320

Please sign in to comment.