itizawa 5 tahun lalu
induk
melakukan
bf2dcba0af

+ 3 - 0
src/client/js/components/Page.jsx

@@ -9,6 +9,7 @@ import EditorContainer from '../services/EditorContainer';
 
 
 import MarkdownTable from '../models/MarkdownTable';
 import MarkdownTable from '../models/MarkdownTable';
 
 
+import LinkEditModal from './PageEditor/LinkEditModal';
 import RevisionRenderer from './Page/RevisionRenderer';
 import RevisionRenderer from './Page/RevisionRenderer';
 import HandsontableModal from './PageEditor/HandsontableModal';
 import HandsontableModal from './PageEditor/HandsontableModal';
 import DrawioModal from './PageEditor/DrawioModal';
 import DrawioModal from './PageEditor/DrawioModal';
@@ -29,6 +30,7 @@ class Page extends React.Component {
 
 
     this.growiRenderer = this.props.appContainer.getRenderer('page');
     this.growiRenderer = this.props.appContainer.getRenderer('page');
 
 
+    this.linkEditModal = React.createRef();
     this.handsontableModal = React.createRef();
     this.handsontableModal = React.createRef();
     this.drawioModal = React.createRef();
     this.drawioModal = React.createRef();
 
 
@@ -132,6 +134,7 @@ class Page extends React.Component {
     return (
     return (
       <div className={isMobile ? 'page-mobile' : ''}>
       <div className={isMobile ? 'page-mobile' : ''}>
         <RevisionRenderer growiRenderer={this.growiRenderer} markdown={markdown} />
         <RevisionRenderer growiRenderer={this.growiRenderer} markdown={markdown} />
+        <LinkEditModal ref={this.LinkEditModal} />
         <HandsontableModal ref={this.handsontableModal} onSave={this.saveHandlerForHandsontableModal} />
         <HandsontableModal ref={this.handsontableModal} onSave={this.saveHandlerForHandsontableModal} />
         <DrawioModal ref={this.drawioModal} onSave={this.saveHandlerForDrawioModal} />
         <DrawioModal ref={this.drawioModal} onSave={this.saveHandlerForDrawioModal} />
       </div>
       </div>

+ 11 - 1
src/client/js/components/PageEditor/CodeMirrorEditor.jsx

@@ -18,6 +18,7 @@ import PreventMarkdownListInterceptor from './PreventMarkdownListInterceptor';
 import MarkdownTableInterceptor from './MarkdownTableInterceptor';
 import MarkdownTableInterceptor from './MarkdownTableInterceptor';
 import mtu from './MarkdownTableUtil';
 import mtu from './MarkdownTableUtil';
 import mdu from './MarkdownDrawioUtil';
 import mdu from './MarkdownDrawioUtil';
+import LinkEditModal from './LinkEditModal';
 import HandsontableModal from './HandsontableModal';
 import HandsontableModal from './HandsontableModal';
 import EditorIcon from './EditorIcon';
 import EditorIcon from './EditorIcon';
 import DrawioModal from './DrawioModal';
 import DrawioModal from './DrawioModal';
@@ -71,6 +72,7 @@ export default class CodeMirrorEditor extends AbstractEditor {
       additionalClassSet: new Set(),
       additionalClassSet: new Set(),
     };
     };
 
 
+    this.linkEditModal = React.createRef();
     this.handsontableModal = React.createRef();
     this.handsontableModal = React.createRef();
     this.drawioModal = React.createRef();
     this.drawioModal = React.createRef();
 
 
@@ -98,6 +100,7 @@ export default class CodeMirrorEditor extends AbstractEditor {
     this.renderCheatsheetModalButton = this.renderCheatsheetModalButton.bind(this);
     this.renderCheatsheetModalButton = this.renderCheatsheetModalButton.bind(this);
 
 
     this.makeHeaderHandler = this.makeHeaderHandler.bind(this);
     this.makeHeaderHandler = this.makeHeaderHandler.bind(this);
+    this.showLinkEditHandler = this.showLinkEditHandler.bind(this);
     this.showHandsonTableHandler = this.showHandsonTableHandler.bind(this);
     this.showHandsonTableHandler = this.showHandsonTableHandler.bind(this);
     this.showDrawioHandler = this.showDrawioHandler.bind(this);
     this.showDrawioHandler = this.showDrawioHandler.bind(this);
   }
   }
@@ -649,6 +652,10 @@ export default class CodeMirrorEditor extends AbstractEditor {
     cm.focus();
     cm.focus();
   }
   }
 
 
+  showLinkEditHandler() {
+    this.linkEditModal.current.show();
+  }
+
   showHandsonTableHandler() {
   showHandsonTableHandler() {
     this.handsontableModal.current.show(mtu.getMarkdownTable(this.getCodeMirror()));
     this.handsontableModal.current.show(mtu.getMarkdownTable(this.getCodeMirror()));
   }
   }
@@ -745,7 +752,7 @@ export default class CodeMirrorEditor extends AbstractEditor {
         color={null}
         color={null}
         size="sm"
         size="sm"
         title="Link"
         title="Link"
-        onClick={this.createReplaceSelectionHandler('[', ']()')}
+        onClick={this.showLinkEditHandler}
       >
       >
         <EditorIcon icon="Link" />
         <EditorIcon icon="Link" />
       </Button>,
       </Button>,
@@ -849,6 +856,9 @@ export default class CodeMirrorEditor extends AbstractEditor {
 
 
         { this.renderCheatsheetOverlay() }
         { this.renderCheatsheetOverlay() }
 
 
+        <LinkEditModal
+          ref={this.linkEditModal}
+        />
         <HandsontableModal
         <HandsontableModal
           ref={this.handsontableModal}
           ref={this.handsontableModal}
           onSave={(table) => { return mtu.replaceFocusedMarkdownTableWithEditor(this.getCodeMirror(), table) }}
           onSave={(table) => { return mtu.replaceFocusedMarkdownTableWithEditor(this.getCodeMirror(), table) }}

+ 0 - 6
src/client/js/components/PageEditor/LinkEditModal.jsx

@@ -1,5 +1,4 @@
 import React from 'react';
 import React from 'react';
-import PropTypes from 'prop-types';
 
 
 import {
 import {
   Modal, ModalHeader, ModalBody, ModalFooter,
   Modal, ModalHeader, ModalBody, ModalFooter,
@@ -15,7 +14,6 @@ export default class LinkEditModal extends React.PureComponent {
     };
     };
 
 
     this.cancel = this.cancel.bind(this);
     this.cancel = this.cancel.bind(this);
-    this.save = this.save.bind(this);
   }
   }
 
 
   show() {
   show() {
@@ -51,7 +49,3 @@ export default class LinkEditModal extends React.PureComponent {
   }
   }
 
 
 }
 }
-
-LinkEditModal.propTypes = {
-  onSave: PropTypes.func,
-};