|
|
@@ -28,17 +28,13 @@ import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
import RevisionRenderer from './Page/RevisionRenderer';
|
|
|
import { DrawioModal } from './PageEditor/DrawioModal';
|
|
|
-// import MarkdownTable from '~/client/models/MarkdownTable';
|
|
|
-// import type { HandsontableModalProps } from './PageEditor/HandsontableModal';
|
|
|
import mdu from './PageEditor/MarkdownDrawioUtil';
|
|
|
-import mtu from './PageEditor/MarkdownTableUtil';
|
|
|
|
|
|
|
|
|
declare const globalEmitter: EventEmitter;
|
|
|
|
|
|
// const DrawioModal = dynamic(() => import('./PageEditor/DrawioModal'), { ssr: false });
|
|
|
const GridEditModal = dynamic(() => import('./PageEditor/GridEditModal'), { ssr: false });
|
|
|
-// const HandsontableModal = dynamic<HandsontableModalProps>(() => import('./PageEditor/HandsontableModal').then(mod => mod.HandsontableModal), { ssr: false });
|
|
|
const LinkEditModal = dynamic(() => import('./PageEditor/LinkEditModal'), { ssr: false });
|
|
|
|
|
|
const logger = loggerFactory('growi:Page');
|
|
|
@@ -60,8 +56,6 @@ class PageSubstance extends React.Component<PageSubstanceProps> {
|
|
|
|
|
|
linkEditModal: any;
|
|
|
|
|
|
- // handsontableModal: any;
|
|
|
-
|
|
|
drawioModal: any;
|
|
|
|
|
|
constructor(props: PageSubstanceProps) {
|
|
|
@@ -74,25 +68,11 @@ class PageSubstance extends React.Component<PageSubstanceProps> {
|
|
|
|
|
|
this.gridEditModal = React.createRef();
|
|
|
this.linkEditModal = React.createRef();
|
|
|
- // this.handsontableModal = React.createRef();
|
|
|
this.drawioModal = React.createRef();
|
|
|
|
|
|
- // this.saveHandlerForHandsontableModal = this.saveHandlerForHandsontableModal.bind(this);
|
|
|
this.saveHandlerForDrawioModal = this.saveHandlerForDrawioModal.bind(this);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * launch HandsontableModal with data specified by arguments
|
|
|
- * @param beginLineNumber
|
|
|
- * @param endLineNumber
|
|
|
- */
|
|
|
- launchHandsontableModal(beginLineNumber, endLineNumber) {
|
|
|
- // const markdown = this.props.pageContainer.state.markdown;
|
|
|
- // const tableLines = markdown.split(/\r\n|\r|\n/).slice(beginLineNumber - 1, endLineNumber).join('\n');
|
|
|
- // this.setState({ currentTargetTableArea: { beginLineNumber, endLineNumber } });
|
|
|
- // this.handsontableModal.current.show(MarkdownTable.fromMarkdownString(tableLines));
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* launch DrawioModal with data specified by arguments
|
|
|
* @param beginLineNumber
|
|
|
@@ -106,39 +86,6 @@ class PageSubstance extends React.Component<PageSubstanceProps> {
|
|
|
// this.drawioModal.current.show(drawioData);
|
|
|
}
|
|
|
|
|
|
- async saveHandlerForHandsontableModal(markdownTable) {
|
|
|
- // const {
|
|
|
- // isSlackEnabled, slackChannels, pageContainer, mutateIsEnabledUnsavedWarning, grant, grantGroupId, grantGroupName, pageTags,
|
|
|
- // } = this.props;
|
|
|
- // const optionsToSave = getOptionsToSave(isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageTags);
|
|
|
-
|
|
|
- // const newMarkdown = mtu.replaceMarkdownTableInMarkdown(
|
|
|
- // markdownTable,
|
|
|
- // this.props.pageContainer.state.markdown,
|
|
|
- // this.state.currentTargetTableArea.beginLineNumber,
|
|
|
- // this.state.currentTargetTableArea.endLineNumber,
|
|
|
- // );
|
|
|
-
|
|
|
- // try {
|
|
|
- // // disable unsaved warning
|
|
|
- // mutateIsEnabledUnsavedWarning(false);
|
|
|
-
|
|
|
- // // eslint-disable-next-line no-unused-vars
|
|
|
- // const { page, tags } = await pageContainer.save(newMarkdown, this.props.editorMode, optionsToSave);
|
|
|
- // logger.debug('success to save');
|
|
|
-
|
|
|
- // // Todo: add translation
|
|
|
- // toastSuccess(t(''));
|
|
|
- // }
|
|
|
- // catch (error) {
|
|
|
- // logger.error('failed to save', error);
|
|
|
- // toastError(error);
|
|
|
- // }
|
|
|
- // finally {
|
|
|
- // this.setState({ currentTargetTableArea: null });
|
|
|
- // }
|
|
|
- }
|
|
|
-
|
|
|
async saveHandlerForDrawioModal(drawioData) {
|
|
|
// const {
|
|
|
// isSlackEnabled, slackChannels, pageContainer, pageTags, grant, grantGroupId, grantGroupName, mutateIsEnabledUnsavedWarning,
|
|
|
@@ -190,7 +137,6 @@ class PageSubstance extends React.Component<PageSubstanceProps> {
|
|
|
<>
|
|
|
<GridEditModal ref={this.gridEditModal} />
|
|
|
<LinkEditModal ref={this.linkEditModal} />
|
|
|
- {/* <HandsontableModal ref={this.handsontableModal} onSave={this.saveHandlerForHandsontableModal} /> */}
|
|
|
{/* TODO: use global DrawioModal https://redmine.weseek.co.jp/issues/105981 */}
|
|
|
{/* <DrawioModal
|
|
|
ref={this.drawioModal}
|
|
|
@@ -246,20 +192,6 @@ export const Page = (props) => {
|
|
|
// };
|
|
|
// }, []);
|
|
|
|
|
|
- // // set handler to open HandsontableModal
|
|
|
- // useEffect(() => {
|
|
|
- // const handler = (beginLineNumber, endLineNumber) => {
|
|
|
- // if (pageRef?.current != null) {
|
|
|
- // pageRef.current.launchHandsontableModal(beginLineNumber, endLineNumber);
|
|
|
- // }
|
|
|
- // };
|
|
|
- // window.globalEmitter.on('launchHandsontableModal', handler);
|
|
|
-
|
|
|
- // return function cleanup() {
|
|
|
- // window.globalEmitter.removeListener('launchHandsontableModal', handler);
|
|
|
- // };
|
|
|
- // }, []);
|
|
|
-
|
|
|
if (currentPage == null || editorMode == null || isGuestUser == null || rendererOptions == null) {
|
|
|
const entries = Object.entries({
|
|
|
currentPage, editorMode, isGuestUser, rendererOptions,
|