-
Notifications
You must be signed in to change notification settings - Fork 0
/
client-entry.tsx
37 lines (27 loc) · 944 Bytes
/
client-entry.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { wrapDataTable } from './src/DataTable';
declare const growiFacade: any;
const activate = (): void => {
if (growiFacade == null || growiFacade.markdownRenderer == null) {
return;
}
const { optionsGenerators } = growiFacade.markdownRenderer;
const originalCustomViewOptions = optionsGenerators.customGenerateViewOptions;
optionsGenerators.customGenerateViewOptions = (...args: any[]) => {
const options = originalCustomViewOptions ? originalCustomViewOptions(...args) : optionsGenerators.generateViewOptions(...args);
const Table = options.components.table;
// replace
options.components.table = wrapDataTable(Table);
return options;
};
};
const deactivate = (): void => {
};
// register activate
if ((window as any).pluginActivators == null) {
(window as any).pluginActivators = {};
}
(window as any).pluginActivators['growi-plugin-datatables'] = {
activate,
deactivate,
};
export{};