itizawa hace 6 años
padre
commit
30e478a09a

+ 8 - 2
src/client/js/components/Admin/Customize/CustomizeHighlightSetting.jsx

@@ -24,8 +24,14 @@ class CustomizeHighlightSetting extends React.Component {
     this.onClickSubmit = this.onClickSubmit.bind(this);
     this.onClickSubmit = this.onClickSubmit.bind(this);
   }
   }
 
 
-  componentDidMount() {
-    // TODO GW-524 fetch highlightTheme option
+  async componentDidMount() {
+    try {
+      await this.props.adminCustomizeContainer.fetchHighLightTheme();
+    }
+    catch (err) {
+      toastError(err);
+      logger.error(err);
+    }
   }
   }
 
 
   async onClickSubmit() {
   async onClickSubmit() {

+ 9 - 0
src/client/js/services/AdminCustomizeContainer.js

@@ -34,6 +34,15 @@ export default class AdminCustomizeContainer extends Container {
     return 'AdminCustomizeContainer';
     return 'AdminCustomizeContainer';
   }
   }
 
 
+  /**
+   * Fetch highLight theme
+   */
+  async fetchHighLightTheme() {
+    const response = await this.appContainer.apiv3.get('/customize-setting/');
+    console.log(response);
+
+  }
+
   /**
   /**
    * Switch layoutType
    * Switch layoutType
    */
    */

+ 23 - 0
src/server/routes/apiv3/customize-setting.js

@@ -42,6 +42,29 @@ module.exports = (crowi) => {
     ],
     ],
   };
   };
 
 
+  // Todo swagger
+  router.get('/', loginRequiredStrictly, adminRequired, async(req, res) => {
+
+    // TODO GW-575 return others customize settings
+
+    /* eslint-disable quote-props, no-multi-spaces */
+    const highlightJsCssSelectorOptions = {
+      'github':           { name: '[Light] GitHub',         border: false },
+      'github-gist':      { name: '[Light] GitHub Gist',    border: true },
+      'atom-one-light':   { name: '[Light] Atom One Light', border: true },
+      'xcode':            { name: '[Light] Xcode',          border: true },
+      'vs':               { name: '[Light] Vs',             border: true },
+      'atom-one-dark':    { name: '[Dark] Atom One Dark',   border: false },
+      'hybrid':           { name: '[Dark] Hybrid',          border: false },
+      'monokai':          { name: '[Dark] Monokai',         border: false },
+      'tomorrow-night':   { name: '[Dark] Tomorrow Night',  border: false },
+      'vs2015':           { name: '[Dark] Vs 2015',         border: false },
+    };
+    /* eslint-enable quote-props, no-multi-spaces */
+
+    return res.apiv3({ highlightJsCssSelectorOptions });
+  });
+
   /**
   /**
    * @swagger
    * @swagger
    *
    *