Browse Source

Merge branch 'master' of spring/comment into master

AdamFu 5 years ago
parent
commit
fb5ab36d0e
3 changed files with 9 additions and 3 deletions
  1. 1
    0
      package.json
  2. 7
    3
      src/App.js
  3. 1
    0
      src/components/Editor/index.css

+ 1
- 0
package.json View File

17
     "antd": "^3.6.6",
17
     "antd": "^3.6.6",
18
     "axios": "^0.18.0",
18
     "axios": "^0.18.0",
19
     "dayjs": "^1.7.2",
19
     "dayjs": "^1.7.2",
20
+    "js-cookie": "^2.2.0",
20
     "prop-types": "^15.6.2",
21
     "prop-types": "^15.6.2",
21
     "react": "^16.4.1",
22
     "react": "^16.4.1",
22
     "react-dom": "^16.4.1",
23
     "react-dom": "^16.4.1",

+ 7
- 3
src/App.js View File

2
 import PropTypes from "prop-types";
2
 import PropTypes from "prop-types";
3
 import { message } from "antd";
3
 import { message } from "antd";
4
 import axios from "axios";
4
 import axios from "axios";
5
+import Cookies from "js-cookie";
5
 import intl from "react-intl-universal";
6
 import intl from "react-intl-universal";
6
 import { ERROR_DEFAULT, LIMIT, COMMENT_TYPE, LANGUAGE_LINK } from "./constant";
7
 import { ERROR_DEFAULT, LIMIT, COMMENT_TYPE, LANGUAGE_LINK } from "./constant";
7
 import { CommentContext } from "./Comment";
8
 import { CommentContext } from "./Comment";
65
    */
66
    */
66
   loadLocales() {
67
   loadLocales() {
67
     let { locales: currentLocale } = this.props;
68
     let { locales: currentLocale } = this.props;
69
+    const cookieLang = Cookies.get("lnk_lang");
68
     if (!currentLocale) {
70
     if (!currentLocale) {
69
-      currentLocale = intl.determineLocale({
70
-        urlLocaleKey: "lang"
71
-      });
71
+      currentLocale =
72
+        cookieLang ||
73
+        intl.determineLocale({
74
+          urlLocaleKey: "lang"
75
+        });
72
     }
76
     }
73
     currentLocale = SUPPORT_LOCALES.find(item => item.value === currentLocale)
77
     currentLocale = SUPPORT_LOCALES.find(item => item.value === currentLocale)
74
       ? currentLocale
78
       ? currentLocale

+ 1
- 0
src/components/Editor/index.css View File

62
 }
62
 }
63
 
63
 
64
 .comment-toolbar .comment-toolbar-icon {
64
 .comment-toolbar .comment-toolbar-icon {
65
+  width: 25px;
65
   font-size: 23px;
66
   font-size: 23px;
66
   cursor: pointer;
67
   cursor: pointer;
67
   transition: color 0.3s;
68
   transition: color 0.3s;