Просмотр исходного кода

Merge pull request #2417 from weseek/feat/display-pwll-btn-with-the-plugin

switch display pukiwikiLink btn with isInstalled pukiwiki like linker…
Yuki Takei 5 лет назад
Родитель
Сommit
a214a9bd89
1 измененных файлов с 12 добавлено и 8 удалено
  1. 12 8
      src/client/js/components/PageEditor/LinkEditModal.jsx

+ 12 - 8
src/client/js/components/PageEditor/LinkEditModal.jsx

@@ -30,6 +30,8 @@ class LinkEditModal extends React.PureComponent {
       linkerType: 'mdLink',
     };
 
+    this.isApplyPukiwikiLikeLinkerPlugin = window.growiRenderer.preProcessors.some(process => process.constructor.name === 'PukiwikiLikeLinker');
+
     this.show = this.show.bind(this);
     this.hide = this.hide.bind(this);
     this.cancel = this.cancel.bind(this);
@@ -188,14 +190,16 @@ class LinkEditModal extends React.PureComponent {
                       >
                         Growi Original
                       </button>
-                      <button
-                        type="button"
-                        name="pukiwikiLink"
-                        className={`btn btn-outline-secondary w-100 ${this.state.linkerType === 'pukiwikiLink' && 'active'}`}
-                        onClick={e => this.handleSelecteLinkerType(e.target.name)}
-                      >
-                        Pukiwiki
-                      </button>
+                      {this.isApplyPukiwikiLikeLinkerPlugin && (
+                        <button
+                          type="button"
+                          name="pukiwikiLink"
+                          className={`btn btn-outline-secondary w-100 ${this.state.linkerType === 'pukiwikiLink' && 'active'}`}
+                          onClick={e => this.handleSelecteLinkerType(e.target.name)}
+                        >
+                          Pukiwiki
+                        </button>
+                      )}
                     </div>
 
                     <div className="form-group">