Skip to content

Commit b40e69d

Browse files
author
Ajit Kumar
committed
feat(open graph support for plugins)
1 parent c008e10 commit b40e69d

File tree

4 files changed

+35
-15
lines changed

4 files changed

+35
-15
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"onloadeend",
5757
"onloaderror",
5858
"onnavigate",
59+
"onok",
5960
"onref",
6061
"onrename",
6162
"onrun",

client/components/dialogs/alert.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
import DialogBox from './dialogBox';
22

3-
export default function alert(title, message, onok) {
3+
/**
4+
* Alert dialog
5+
* @param {string} title
6+
* @param {string} message
7+
* @param {()=>void} [onok]
8+
* @param {boolean} [keep]
9+
*/
10+
export default function alert(title, message, onok, keep) {
411
const dialog = <DialogBox
512
onhide={onok}
613
title={title}
714
message={message}
815
onok={(hide) => hide()}
16+
keep={keep}
917
/>;
1018

1119
document.body.append(dialog);

client/components/dialogs/dialogBox.js

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
1-
import Router from 'lib/Router';
21
import './style.scss';
2+
import Router from 'lib/Router';
33

44
/**
55
* @typedef {(hide: ()=>void, $box: HTMLElement) => void} DialogBoxCallback
66
*/
77

88
/**
99
*
10-
* @param {object} param0
11-
* @param {HTMLElement} [param0.body]
12-
* @param {string} [param0.title]
13-
* @param {DialogBoxCallback} [param0.onok]
14-
* @param {DialogBoxCallback} [param0.oncancel]
15-
* @param {(i: number, hide: () => void) => void} [param0.onselect]
16-
* @param {() => void} [param0.onhide]
17-
* @param {string} [param0.options]
18-
* @param {string} [param0.message]
19-
* @param {string} [param0.body]
10+
* @param {object} props
11+
* @param {HTMLElement} [props.body]
12+
* @param {string} [props.title]
13+
* @param {DialogBoxCallback} [props.onok]
14+
* @param {DialogBoxCallback} [props.oncancel]
15+
* @param {(i: number, hide: () => void) => void} [props.onselect]
16+
* @param {() => void} [props.onhide]
17+
* @param {string} [props.options]
18+
* @param {string} [props.message]
19+
* @param {string} [props.body]
20+
* @param {boolean} [props.keep]
2021
* @param {HTMLElement[]} [children]
2122
* @returns
2223
*/
2324
export default function DialogBox({
24-
title = '', onhide, onok, oncancel, onselect, options, message, body,
25+
title = '',
26+
onhide,
27+
onok,
28+
oncancel,
29+
onselect,
30+
options,
31+
message,
32+
body,
33+
keep = false,
2534
}, children) {
2635
const buttons = [];
2736
let $box;
@@ -53,7 +62,9 @@ export default function DialogBox({
5362
</div>
5463
</div>;
5564

56-
Router.on('navigate', hide);
65+
if (!keep) {
66+
Router.on('navigate', hide);
67+
}
5768

5869
function hide(callOnhide = true) {
5970
if (typeof onhide === 'function' && callOnhide) {

client/pages/publishPlugin/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export default async function PublishPlugin({ mode = 'publish', id }) {
108108
return;
109109
}
110110

111-
alert('Success', 'Plugin published successfully.');
111+
alert('Success', 'Plugin published successfully.', null, true);
112112
Router.loadUrl(`/plugin/${pluginId.value}`);
113113
}
114114

0 commit comments

Comments
 (0)