|
@@ -489,14 +489,15 @@ export const useDrawioModal = (status?: DrawioModalStatus): SWRResponse<DrawioMo
|
|
|
/*
|
|
/*
|
|
|
* HandsonTableModal
|
|
* HandsonTableModal
|
|
|
*/
|
|
*/
|
|
|
-// TODO: Define editor type
|
|
|
|
|
type HandsonTableModalSaveHandler = (table: MarkdownTable) => void;
|
|
type HandsonTableModalSaveHandler = (table: MarkdownTable) => void;
|
|
|
|
|
|
|
|
type HandsontableModalStatus = {
|
|
type HandsontableModalStatus = {
|
|
|
isOpened: boolean,
|
|
isOpened: boolean,
|
|
|
table: MarkdownTable,
|
|
table: MarkdownTable,
|
|
|
|
|
+ // TODO: Define editor type
|
|
|
editor?: any,
|
|
editor?: any,
|
|
|
autoFormatMarkdownTable?: boolean,
|
|
autoFormatMarkdownTable?: boolean,
|
|
|
|
|
+ // onSave is passed only when editing table directly from the page.
|
|
|
onSave?: HandsonTableModalSaveHandler
|
|
onSave?: HandsonTableModalSaveHandler
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -510,20 +511,20 @@ type HandsontableModalStatusUtils = {
|
|
|
close(): void
|
|
close(): void
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export const useHandsontableModal = (status?: HandsontableModalStatus): SWRResponse<HandsontableModalStatus, Error> & HandsontableModalStatusUtils => {
|
|
|
|
|
- const defaultMarkdownTable = () => {
|
|
|
|
|
- return new MarkdownTable(
|
|
|
|
|
- [
|
|
|
|
|
- ['col1', 'col2', 'col3'],
|
|
|
|
|
- ['', '', ''],
|
|
|
|
|
- ['', '', ''],
|
|
|
|
|
- ],
|
|
|
|
|
- {
|
|
|
|
|
- align: ['', '', ''],
|
|
|
|
|
- },
|
|
|
|
|
- );
|
|
|
|
|
- };
|
|
|
|
|
|
|
+const defaultMarkdownTable = () => {
|
|
|
|
|
+ return new MarkdownTable(
|
|
|
|
|
+ [
|
|
|
|
|
+ ['col1', 'col2', 'col3'],
|
|
|
|
|
+ ['', '', ''],
|
|
|
|
|
+ ['', '', ''],
|
|
|
|
|
+ ],
|
|
|
|
|
+ {
|
|
|
|
|
+ align: ['', '', ''],
|
|
|
|
|
+ },
|
|
|
|
|
+ );
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
+export const useHandsontableModal = (status?: HandsontableModalStatus): SWRResponse<HandsontableModalStatus, Error> & HandsontableModalStatusUtils => {
|
|
|
const initialData: HandsontableModalStatus = {
|
|
const initialData: HandsontableModalStatus = {
|
|
|
isOpened: false,
|
|
isOpened: false,
|
|
|
table: defaultMarkdownTable(),
|
|
table: defaultMarkdownTable(),
|