[
  {
    "path": ".eslintignore",
    "content": "/config/\n/scripts/\n*.test.*\n/main.js\n*.d.ts"
  },
  {
    "path": ".eslintrc",
    "content": "{\n  \"extends\": [\"airbnb\", \"plugin:prettier/recommended\"], // eslint扩展规则\n  \"parserOptions\": {\n    \"ecmaVersion\": 7,\n    \"sourceType\": \"module\",\n    \"ecmaFeatures\": {\n      \"jsx\": true\n    }\n  },\n  \"parser\": \"babel-eslint\", // 解决ES6 improt会报错\n  \"env\": {\n    // eg如果不配置browser，window就会被eslint报undefined的错\n    \"es6\": true,\n    \"browser\": true,\n    \"node\": true\n  },\n  \"plugins\": [\"react\", \"jsx-a11y\", \"import\"],\n  \"rules\": {\n    \"quotes\": [0, \"double\"],\n    \"class-methods-use-this\": 0,\n    \"import/no-named-as-default\": 0,\n    \"react/jsx-filename-extension\": [\n      \"error\",\n      {\n        \"extensions\": [\".js\", \".jsx\"]\n      }\n    ],\n    \"react/prop-types\": 0,\n    \"react/destructuring-assignment\": 0,\n    \"react/no-array-index-key\": 0,\n    \"no-use-before-define\": 0,\n    \"no-restricted-syntax\": 0,\n    \"no-var\": 0,\n    \"vars-on-top\": 0,\n    \"no-plusplus\": 0,\n    \"no-continue\": 0,\n    \"prefer-template\": 0,\n    \"object-shorthand\": 0,\n    \"no-else-return\": 0,\n    \"no-param-reassign\": 0,\n    \"no-unused-vars\": 1,\n    \"jsx-a11y/anchor-is-valid\": 0,\n    \"react/jsx-props-no-spreading\": 0,\n    \"import/no-extraneous-dependencies\": 0,\n    \"import/order\": 0,\n    \"jsx-a11y/mouse-events-have-key-events\": 0,\n    \"no-lonely-if\": 0,\n    \"one-var\": 0,\n    \"react/prefer-stateless-function\": 0,\n    \"react/jsx-wrap-multilines\": 0,\n    \"no-unused-expressions\": 0,\n    \"react/no-danger\": 0,\n    \"no-console\": 0,\n    \"camelcase\": 0,\n    \"import/no-dynamic-require\": 1,\n    \"global-require\": 1,\n    \"react/forbid-prop-types\": 1,\n    \"jsx-a11y/accessible-emoji\": 0,\n    \"jsx-a11y/click-events-have-key-events\": 0,\n    \"jsx-a11y/no-static-element-interactions\": 0\n  }\n}\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: 提交 Bug \nabout: 提交 Bug 用于改进本项目\ntitle: ''\nlabels: bug\nassignees: guanpengchn\n\n---\n\n**运行环境：**\n\n|操作系统|浏览器|\n|---|---|\n|macOS|Chrome|\n\n**Markdown文本内容：**\n\n例如：\n\n```md\n- 默认文本1\n- 默认文本2\n- 默认文本3\n```\n\n**错误详情：**\n\n例如：块级公式转换错误，控制台报错A is undefined"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: 新特性\nabout: 有新特性的需要\ntitle: ''\nlabels: feature\nassignees: guanpengchn\n\n---\n\n**新特性描述：**"
  },
  {
    "path": ".gitignore",
    "content": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# production\n/build\n\n# misc\n.DS_Store\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\ndist\npackage-lock.json\nlib"
  },
  {
    "path": ".npmignore",
    "content": "build\nconfig\ndist\nnode_modules\npublic\nscripts\nsrc\n.eslintrc\n.gitignore\n.prettierrc\nlogo.png\nmain.js\npackage.json\npackage-lock.json\nyarn.lock\n.npmignore"
  },
  {
    "path": ".prettierrc",
    "content": "{\n  \"printWidth\": 120,\n  \"tabWidth\": 2,\n  \"useTabs\": false,\n  \"semi\": true,\n  \"singleQuote\": false,\n  \"jsxSingleQuote\": false,\n  \"trailingComma\": \"all\",\n  \"bracketSpacing\": false,\n  \"jsxBracketSameLine\": false,\n  \"arrowParens\": \"always\"\n}"
  },
  {
    "path": ".storybook/.babelrc",
    "content": "{\n  \"presets\": [\n    \"@babel/env\",\n    \"@babel/preset-react\"\n  ]\n}\n"
  },
  {
    "path": ".storybook/config.js",
    "content": "import { configure } from '@storybook/react';\n\nfunction loadStories() {\n  require('../stories/index.js');\n  // You can require as many stories as you need.\n}\n\nconfigure(loadStories, module);"
  },
  {
    "path": "CHANGELOG.md",
    "content": "v1.8.22 发布日期：2020-09-29\n\n- 控制编辑器字数\n- 渲染节流\n- gitee 和 github 图床进行 encodeURI 转码\n\nv1.8.21 发布日期：2020-09-26\n\n- 多级引用样式 bug\n\nv1.8.20 发布日期：2020-09-25\n\n- 增加多级引用示例和教程\n\nv1.8.19 发布日期：2020-09-24\n\n- 增加多级引用的样式支持\n- 增加示例文本\n\nv1.8.17 发布日期：2020-09-09\n\n- 移除微信代码块，太丑了，还要做一堆兼容操作，拒绝\n- 恢复稀土掘金支持，增加超过 60000 字符判断\n- 增加 Markdown 语法教程\n\nv1.8.15 发布日期：2020-08-26\n\n- 新增 GitHub 图床支持\n\nv1.8.14 发布日期：2020-08-25\n\n- 解决 Gitee 图片粘贴名字重复问题\n- 提示大小超过 1 MB\n\nv1.8.13 发布日期：2020-08-24\n\n- 新增 Gitee 图床支持\n\nv1.8.12 发布日期：2020-08-08\n\n- 切换图片为七牛云\n\nv1.8.11 发布日期：2020-08-02\n\n- 修复组件 bug\n\nv1.8.10 发布日期：2020-08-02\n\n- 加入 token 用于用户验证，移除 user 组件\n- 因为掘金图床暂时无法自动转换，暂时移除掘金支持\n\nv1.8.9 发布日期：2020-08-02\n\n- 加入 style 相关监听函数\n- 修改 content.md\n\nv1.8.8 发布日期：2020-08-01\n\n- 替换掉全部图壳图片\n\nv1.8.7 发布日期：2020-08-01\n\n- 支持 onBlur 和 onFocus\n\nv1.8.6 发布日期：2020-07-02\n\n- 新增表格外部容器，增加默认宽度，表格可滑动\n- 支持图片链接\n\nv1.8.5 发布日期：2020-06-15\n\n- 增加默认代码块语言 bash\n\nv1.8.4 发布日期：2020-06-06\n\n- 修改 navbar 背景色\n\nv1.8.2 发布日期：2020-06-04\n\n- 更换文档地址\n\nv1.8.1 发布日期：2020-05-17\n\n- 加入账户系统\n\nv1.7.11 发布日期：2020-05-15\n\n- 导出 pdf 时底部 bar 隐藏\n\nv1.7.10 发布日期：2020-05-09\n\n- 修复掘金代码块 bug\n\nv1.7.9 发布日期：2020-04-30\n\n- 修复掘金代码块 bug\n\nv1.7.7 发布日期：2020-04-30\n\n- 修复掘金代码块粘贴后复制变为 1 行的情况\n\nv1.7.6 发布日期：2020-04-26\n\n- 修复掘金标题 padding 不为 0\n\nv1.7.5 发布日期：2020-04-25\n\n- 修复 bug\n\nv1.7.4 发布日期：2020-04-19\n\n- 增加底部栏\n- 增加富文本转换 markdown 提示\n\nv1.7.3 发布日期：2020-04-13\n\n- 修复提示\n\nv1.7.2 发布日期：2020-04-12\n\n- 支持图片调整大小\n- 滑动块添加下方注释\n\nv1.7.1 发布日期：2020-04-05\n\n- 对接主题系统\n\nv1.6.12 发布日期：2020-04-03\n\n- 修复代码换行和空格问题\n\nv1.6.10 发布日期：2020-03-22\n\n- 新增 Mac 代码风格主题\n\nv1.6.9 发布日期：2020-03-21\n\n- 新增我要提问\n- 新增全栈蓝主题\n\nv1.6.8 发布日期：2020-03-19\n\n- 标题自定义能力无限增强\n- 修复基础主题，调节头部空隙过大问题\n\nv1.6.7 发布日期：2020-03-16\n\n- 加入 id\n- 修复 em strong\n\nv1.6.5 发布日期：2020-03-08\n\n- 修复主题\n\nv1.6.4 发布日期：2020-03-07\n\n- 回退 antd 版本\n\nv1.6.3 发布日期：2020-03-07\n\n- 新增稀土掘金支持\n- 新增萌绿主题，作者 koala🐨\n\nv1.6.2 发布日期：2020-03-01\n\n- 修改微信 logo\n- 修改主题图片自适应\n- 修改蔷薇紫主题\n- 更改 TOC 语法为[TOC]\n- 升级 antd 3 至 antd 4\n- 修复快捷键\n\nv1.6.1 发布日期：2020-02-17\n\n- 解决 build 内存溢出的问题。\n\nv1.6.0 发布日期：2020-02-15\n\n- 转发文章重排版，坐立不安？请 SitDown - html 转 markdown 神器（请在功能中查看）\n\nv1.5.9 发布日期：2020-02-15\n\n- 修复 mathjax 升级至 3.0.1 后的知乎死循环 bug\n- 插件更新\n\nv1.5.8 发布日期：2020-02-15\n\n- 修复 mathjax 升级至 3.0.1 后的 bug\n\nv1.5.7 发布日期：2020-02-15\n\n- 优化主题\n- 公式 Tex 保留，mathjax 升级至 3.0.1\n\nv1.5.6 发布日期：2020-02-09\n\n- 优化代码\n- 浏览器插件草稿版，https://docs.mdnice.com/#/beta\n\nv1.5.5 发布日期：2020-02-05\n\n- 修复第一次进入后无默认图床问题\n\nv1.5.4 发布日期：2020-01-30\n\n- 修复微信外链转脚注问题\n\nv1.5.3 发布日期：2020-01-30\n\n- 新增搜索替换功能\n- 新增导出 PDF\n- 新增查看菜单\n\nv1.5.2 发布日期：2020-01-21\n\n- 临时恢复格式化\n- 新增右键菜单\n- 调整知乎复制提示\n- 修复衬线字体\n\nv1.5.1 发布日期：2020-01-20\n\n- 整体视觉改版\n- 新增蔷薇紫主题\n- 本地历史优化\n- 公式节流渲染\n- 仅保留图壳图床\n- 新增文件导入导出\n\nv1.5.0 发布日期：2020-01-03\n\n- 修复代码块换行问题\n- 改动了本地历史和当前内容的对比界面\n\nv1.4.9 发布日期：2019-12-28\n\n- 修改 README\n- 修复同步滚动和图片包含名称问题\n\nv1.4.8 发布日期：2019-12-25\n\n- 增加本地历史功能，浏览器刷新后以前版本不丢失\n\nv1.4.7 发布日期：2019-12-21\n\n- 修复代码块换行问题\n- 新增 storybook 组件开发支持\n- 新增 markdown 文件 wepack 和 babel 支持\n- 新增上传时包含图片名选项\n- 修复公式\\tag 不居中的 bug\n\nv1.4.6 发布日期：2019-12-08\n\n- 新增「图壳」免费图床，可以长期存储并且排版成功率高！\n- 下一个版本将移除其他图床的支持！仅提供组件配置项\n\nv1.4.5 发布日期：2019-11-27\n\n- 新增同步滚动开关（左上角设置按钮内）\n- 新增组件自定义图床参数（详情见开发者文档）\n\nv1.4.4 发布日期：2019-11-16\n\n- 将内联 CSS 改为类选择器\n- 新增全屏沉浸式编辑（点击全屏按钮可查看）\n\nv1.4.3 发布日期：2019-11-13\n\n- 修复知乎公式问题\n- 修复横屏幻灯片渲染问题\n\nv1.4.2 发布日期：2019-11-09\n\n- 新增幻灯片横屏滑动语法，重置后查看\n- 修改表格样式污染问题\n- 新增拷贝到知乎，支持公式\n- 新增 api: getWeChatHtml 和 getZhihuHtml\n\nv1.4.1 发布日期：2019-11-04\n\n- 补充 chalk 包\n- 修改主题自定义编辑的提示\n- 修改文档地址\n- 新增表格添加功能\n\nv1.4.0 发布日期：2019-11-02\n\n- 新增 ref 函数 getHtml 获取富文本\n- 新增 id 选择器 nice，防止全局 CSS 污染，break change！请将所有的自定义标签前面加上 #nice，否则将失效，可参考其他主题！\n- “参考资料”四个字支持自定义修改内容\n- 调整阅读文档\n- 修复 Safari 无法复制问题\n- 新增主题「极客黑」、「简」\n- 修改主题「蓝山」为「前端之巅同款」\n- 新增快捷键\n\nv1.3.1 发布日期：2019-10-28\n\n- 修复公式 bug\n- 新增主题「蓝山」，请重置看查看效果\n\nv1.3.0 发布日期：2019-10-27\n\n- 组件化\n- 新增预览模式\n- 修改导航栏布局，关于和登录\n\nv1.2.9 发布日期：2019-10-24\n\n- 修复 PWA 中的 mdnice 图床 https 问题\n- 添加图片拖拽提示\n\nv1.2.8 发布日期：2019-10-23\n\n- 支持 PWA\n- 图片 svg 示例\n\nv1.2.7 发布日期：2019-10-20\n\n- 修复行内公式空格问题\n- 代码滚动手感增强\n- 修复微信代码行号\n\nv1.2.6 发布日期：2019-10-18\n\n- li 标签内加入 section 标签用于解决列表被微信重新渲染问题\n- 新增自定义标签 ul 、ol 和 li section\n- mathjax 公式支持全部\n- 修复所有现有主题的 li\n- 加入新主题山吹\n\nv1.2.5 发布日期：2019-10-15\n\n- 添加 a 标签提示\n- 添加 CSS 编写错误提示\n- 修改 README 说明\n- 解决公式问题\n\nv1.2.4 发布日期：2019-10-14\n\n- 行间公式过长后可拉伸，开放公式配置 CSS\n\nv1.2.3 发布日期：2019-10-13\n\n- 修复公式 bug\n\nv1.2.2 发布日期：2019-10-11\n\n- 公式编写渲染为 svg，彻底解决微信公众号不支持公式的问题\n- 组建钉钉用户群\n- 解决阿里云图床中文多编码一次的问题\n\nv1.2.1 发布日期：2019-10-07\n\n- 支持图片粘贴和拖拽上传，格式化由用户手动操作\n\nv1.1.11 发布日期：2019-10-06\n\n- 新增蓝蓝、科技蓝、兰青主题\n\nv1.1.10 发布日期：2019-10-02\n\n- 新增复制时排版检测功能，规范排版格式\n\nv1.1.9 发布日期：2019-09-24\n\n- 修复行内公式存在除号问题，增加行内公式报错提示\n\nv1.1.8 发布日期：2019-09-22\n\n- 修复 sup 标签行高，减小应用体积\n\nv1.1.7 发布日期：2019-09-21\n\n- 新增七牛云图床配置文档\n\nv1.1.6 发布日期：2019-09-19\n\n- 自定义七牛云图床新增自定义域名和命名空间字段\n- 新增 mdnice 用户群\n\nv1.1.5 发布日期：2019-09-01\n\n- 支持自定义「七牛云」做图床\n- 提供 mdnice 自建免费图床，仅支持临时使用，一天后删除\n- 示例请重置后查看「第 10 条」\n\nv1.1.4 发布日期：2019-08-31\n\n- 解决公式处理 bug\n- 添加移动端提示页\n- 支持注音符号\n\nv1.1.3 发布日期：2019-08-27\n\n- 解决微信代码不对齐问题\n\nv1.1.2 发布日期：2019-08-26\n\n- 完整支持公式处理，示例请重置后查看「第 16 条」\n\nv1.1.1 发布日期：2019-08-24\n\n- 新增主题「红绯」\n\nv1.1.0 发布日期：2019-08-23\n\n- 支持自定义「阿里云 OSS」做图床，示例请重置后查看「第 10 条」\n\nv1.0.2 发布日期：2019-08-13\n\n- 支持 TOC，示例请重置后查看「第 17 条」\n\nv1.0.1 发布日期：2019-08-12\n\n- 新增粘贴时语法检测功能\n- 粘贴时转换微信外链\n\nv1.0.0 发布日期：2019-08-07\n\n- 稳定使用\n- 新增主题「绿意」\n- 新增主题「wechat-format」\n\nv0.1.0 发布日期：2019-05-08\n\n- 线上发布\n\nv0.0.1 发布日期：2019-02-02\n\n- 第一次提交\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>."
  },
  {
    "path": "README.md",
    "content": "<div align=\"center\">\n<a href=\"https://mdnice.com\">\n<img width=\"500\" src=\"https://files.mdnice.com/logo.svg\"/>\n</a>\n</div>\n<h1 align=\"center\">Markdown Nice</h1>\n\n## 简介\n\n- 支持自定义样式的 Markdown 编辑器\n- 支持微信公众号、知乎和稀土掘金\n- 欢迎[在线使用](https://mdnice.com/)\n- 有疑问请参考 [如何有效的解决 mdnice 相关问题？](https://github.com/mdnice/markdown-nice/issues/163)\n\n## 主题\n\n[Markdown Nice 主题列表](https://product.mdnice.com/themes/)\n\n> 欢迎提交主题，提供更多文章示例~~\n\n## 关于\n\n`mdnice`组建了**推文群**，欢迎反馈意见和公众号大佬们一起交流，关注公众号回复「排版」拉你入群。\n\n| 入群码                                                                                           |\n| ------------------------------------------------------------------------------------------------ |\n| <img width=\"360px\" src=\"https://files.mdnice.com/pic/cd3ca20c-896f-4cfc-9bdd-c4c58e69ba26.jpg\"/> |\n\n## 友情链接\n\n- [BlogHelper](https://github.com/ystcode/BlogHelper)：一键发布本地文章到主流博客平台的托盘助手\n- [qrbtf](https://github.com/ciaochaos/qrbtf)：艺术二维码生成器\n- [编程如画](https://draw.mdnice.com/)：「编程如画」博客\n"
  },
  {
    "path": "config/env.js",
    "content": "'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst paths = require('./paths');\n\n// Make sure that including paths.js after env.js will read .env variables.\ndelete require.cache[require.resolve('./paths')];\n\nconst NODE_ENV = process.env.NODE_ENV;\nif (!NODE_ENV) {\n  throw new Error(\n    'The NODE_ENV environment variable is required but was not specified.'\n  );\n}\n\n// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use\nvar dotenvFiles = [\n  `${paths.dotenv}.${NODE_ENV}.local`,\n  `${paths.dotenv}.${NODE_ENV}`,\n  // Don't include `.env.local` for `test` environment\n  // since normally you expect tests to produce the same\n  // results for everyone\n  NODE_ENV !== 'test' && `${paths.dotenv}.local`,\n  paths.dotenv,\n].filter(Boolean);\n\n// Load environment variables from .env* files. Suppress warnings using silent\n// if this file is missing. dotenv will never modify any environment variables\n// that have already been set.  Variable expansion is supported in .env files.\n// https://github.com/motdotla/dotenv\n// https://github.com/motdotla/dotenv-expand\ndotenvFiles.forEach(dotenvFile => {\n  if (fs.existsSync(dotenvFile)) {\n    require('dotenv-expand')(\n      require('dotenv').config({\n        path: dotenvFile,\n      })\n    );\n  }\n});\n\n// We support resolving modules according to `NODE_PATH`.\n// This lets you use absolute paths in imports inside large monorepos:\n// https://github.com/facebook/create-react-app/issues/253.\n// It works similar to `NODE_PATH` in Node itself:\n// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders\n// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.\n// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.\n// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421\n// We also resolve them to make sure all tools using them work consistently.\nconst appDirectory = fs.realpathSync(process.cwd());\nprocess.env.NODE_PATH = (process.env.NODE_PATH || '')\n  .split(path.delimiter)\n  .filter(folder => folder && !path.isAbsolute(folder))\n  .map(folder => path.resolve(appDirectory, folder))\n  .join(path.delimiter);\n\n// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be\n// injected into the application via DefinePlugin in Webpack configuration.\nconst REACT_APP = /^REACT_APP_/i;\n\nfunction getClientEnvironment(publicUrl) {\n  const raw = Object.keys(process.env)\n    .filter(key => REACT_APP.test(key))\n    .reduce(\n      (env, key) => {\n        env[key] = process.env[key];\n        return env;\n      },\n      {\n        // Useful for determining whether we’re running in production mode.\n        // Most importantly, it switches React into the correct mode.\n        NODE_ENV: process.env.NODE_ENV || 'development',\n        // Useful for resolving the correct path to static assets in `public`.\n        // For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.\n        // This should only be used as an escape hatch. Normally you would put\n        // images into the `src` and `import` them in code to get their paths.\n        PUBLIC_URL: publicUrl,\n      }\n    );\n  // Stringify all values so we can feed into Webpack DefinePlugin\n  const stringified = {\n    'process.env': Object.keys(raw).reduce((env, key) => {\n      env[key] = JSON.stringify(raw[key]);\n      return env;\n    }, {}),\n  };\n\n  return { raw, stringified };\n}\n\nmodule.exports = getClientEnvironment;\n"
  },
  {
    "path": "config/jest/cssTransform.js",
    "content": "'use strict';\n\n// This is a custom Jest transformer turning style imports into empty objects.\n// http://facebook.github.io/jest/docs/en/webpack.html\n\nmodule.exports = {\n  process() {\n    return 'module.exports = {};';\n  },\n  getCacheKey() {\n    // The output is always the same.\n    return 'cssTransform';\n  },\n};\n"
  },
  {
    "path": "config/jest/fileTransform.js",
    "content": "'use strict';\n\nconst path = require('path');\n\n// This is a custom Jest transformer turning file imports into filenames.\n// http://facebook.github.io/jest/docs/en/webpack.html\n\nmodule.exports = {\n  process(src, filename) {\n    const assetFilename = JSON.stringify(path.basename(filename));\n\n    if (filename.match(/\\.svg$/)) {\n      return `module.exports = {\n        __esModule: true,\n        default: ${assetFilename},\n        ReactComponent: (props) => ({\n          $$typeof: Symbol.for('react.element'),\n          type: 'svg',\n          ref: null,\n          key: null,\n          props: Object.assign({}, props, {\n            children: ${assetFilename}\n          })\n        }),\n      };`;\n    }\n\n    return `module.exports = ${assetFilename};`;\n  },\n};\n"
  },
  {
    "path": "config/paths.js",
    "content": "\"use strict\";\n\nconst path = require(\"path\");\nconst fs = require(\"fs\");\nconst url = require(\"url\");\n\n// Make sure any symlinks in the project folder are resolved:\n// https://github.com/facebook/create-react-app/issues/637\nconst appDirectory = fs.realpathSync(process.cwd());\nconst resolveApp = (relativePath) => path.resolve(appDirectory, relativePath);\n\nconst envPublicUrl = process.env.PUBLIC_URL;\n\nfunction ensureSlash(inputPath, needsSlash) {\n  const hasSlash = inputPath.endsWith(\"/\");\n  if (hasSlash && !needsSlash) {\n    return inputPath.substr(0, inputPath.length - 1);\n  } else if (!hasSlash && needsSlash) {\n    return `${inputPath}/`;\n  } else {\n    return inputPath;\n  }\n}\n\nconst getPublicUrl = (appPackageJson) => envPublicUrl || require(appPackageJson).homepage;\n\n// We use `PUBLIC_URL` environment variable or \"homepage\" field to infer\n// \"public path\" at which the app is served.\n// Webpack needs to know it to put the right <script> hrefs into HTML even in\n// single-page apps that may serve index.html for nested URLs like /todos/42.\n// We can't use a relative path in HTML because we don't want to load something\n// like /todos/42/static/js/bundle.7289d.js. We have to know the root.\nfunction getServedPath(appPackageJson) {\n  const publicUrl = getPublicUrl(appPackageJson);\n  const servedUrl = envPublicUrl || (publicUrl ? url.parse(publicUrl).pathname : \"/\");\n  return ensureSlash(servedUrl, true);\n}\n\nconst moduleFileExtensions = [\n  \"web.mjs\",\n  \"mjs\",\n  \"web.js\",\n  \"js\",\n  \"web.ts\",\n  \"ts\",\n  \"web.tsx\",\n  \"tsx\",\n  \"json\",\n  \"web.jsx\",\n  \"jsx\",\n];\n\n// Resolve file paths in the same order as webpack\nconst resolveModule = (resolveFn, filePath) => {\n  const extension = moduleFileExtensions.find((extension) => fs.existsSync(resolveFn(`${filePath}.${extension}`)));\n\n  if (extension) {\n    return resolveFn(`${filePath}.${extension}`);\n  }\n\n  return resolveFn(`${filePath}.js`);\n};\n\n// config after eject: we're in ./config/\nmodule.exports = {\n  dotenv: resolveApp(\".env\"),\n  appPath: resolveApp(\".\"),\n  appBuild: resolveApp(\"build\"),\n  appPublic: resolveApp(\"public\"),\n  appHtml: resolveApp(\"public/index.html\"),\n  appIndexJs: resolveModule(resolveApp, \"src/index\"),\n  appLib: resolveModule(resolveApp, \"src/Lib\"),\n  appPackageJson: resolveApp(\"package.json\"),\n  appSrc: resolveApp(\"src\"),\n  appTsConfig: resolveApp(\"tsconfig.json\"),\n  yarnLockFile: resolveApp(\"yarn.lock\"),\n  testsSetup: resolveModule(resolveApp, \"src/setupTests\"),\n  proxySetup: resolveApp(\"src/setupProxy.js\"),\n  appNodeModules: resolveApp(\"node_modules\"),\n  publicUrl: getPublicUrl(resolveApp(\"package.json\")),\n  servedPath: getServedPath(resolveApp(\"package.json\")),\n};\n\nmodule.exports.moduleFileExtensions = moduleFileExtensions;\n"
  },
  {
    "path": "config/webpack.config.js",
    "content": "\"use strict\";\n\nconst fs = require(\"fs\");\nconst path = require(\"path\");\nconst webpack = require(\"webpack\");\nconst resolve = require(\"resolve\");\nconst PnpWebpackPlugin = require(\"pnp-webpack-plugin\");\nconst HtmlWebpackPlugin = require(\"html-webpack-plugin\");\nconst CaseSensitivePathsPlugin = require(\"case-sensitive-paths-webpack-plugin\");\nconst InlineChunkHtmlPlugin = require(\"react-dev-utils/InlineChunkHtmlPlugin\");\nconst TerserPlugin = require(\"terser-webpack-plugin\");\nconst MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nconst OptimizeCSSAssetsPlugin = require(\"optimize-css-assets-webpack-plugin\");\nconst safePostCssParser = require(\"postcss-safe-parser\");\nconst ManifestPlugin = require(\"webpack-manifest-plugin\");\nconst InterpolateHtmlPlugin = require(\"react-dev-utils/InterpolateHtmlPlugin\");\nconst WorkboxWebpackPlugin = require(\"workbox-webpack-plugin\");\nconst WatchMissingNodeModulesPlugin = require(\"react-dev-utils/WatchMissingNodeModulesPlugin\");\nconst ModuleScopePlugin = require(\"react-dev-utils/ModuleScopePlugin\");\nconst getCSSModuleLocalIdent = require(\"react-dev-utils/getCSSModuleLocalIdent\");\nconst paths = require(\"./paths\");\nconst getClientEnvironment = require(\"./env\");\nconst ModuleNotFoundPlugin = require(\"react-dev-utils/ModuleNotFoundPlugin\");\nconst ForkTsCheckerWebpackPlugin = require(\"fork-ts-checker-webpack-plugin-alt\");\nconst typescriptFormatter = require(\"react-dev-utils/typescriptFormatter\");\n\n// Source maps are resource heavy and can cause out of memory issue for large source files.\nconst shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== \"false\";\n// Some apps do not need the benefits of saving a web request, so not inlining the chunk\n// makes for a smoother build process.\nconst shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== \"false\";\n\n// Check if TypeScript is setup\nconst useTypeScript = fs.existsSync(paths.appTsConfig);\n\n// style files regexes\nconst cssRegex = /\\.css$/;\nconst cssModuleRegex = /\\.module\\.css$/;\nconst sassRegex = /\\.(scss|sass)$/;\nconst sassModuleRegex = /\\.module\\.(scss|sass)$/;\n\n// This is the production and development configuration.\n// It is focused on developer experience, fast rebuilds, and a minimal bundle.\nmodule.exports = function(webpackEnv) {\n  const isEnvDevelopment = webpackEnv === \"development\";\n  const isEnvProduction = webpackEnv === \"production\";\n\n  // Webpack uses `publicPath` to determine where the app is being served from.\n  // It requires a trailing slash, or the file assets will get an incorrect path.\n  // In development, we always serve from the root. This makes config easier.\n  const publicPath = isEnvProduction ? paths.servedPath : isEnvDevelopment && \"/\";\n  // Some apps do not use client-side routing with pushState.\n  // For these, \"homepage\" can be set to \".\" to enable relative asset paths.\n  const shouldUseRelativeAssetPaths = publicPath === \"./\";\n\n  // `publicUrl` is just like `publicPath`, but we will provide it to our app\n  // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.\n  // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.\n  const publicUrl = isEnvProduction ? publicPath.slice(0, -1) : isEnvDevelopment && \"\";\n  // Get environment variables to inject into our app.\n  const env = getClientEnvironment(publicUrl);\n\n  // common function to get style loaders\n  const getStyleLoaders = (cssOptions, preProcessor) => {\n    const loaders = [\n      isEnvDevelopment && require.resolve(\"style-loader\"),\n      isEnvProduction && {\n        loader: MiniCssExtractPlugin.loader,\n        options: Object.assign({}, shouldUseRelativeAssetPaths ? {publicPath: \"../../\"} : undefined),\n      },\n      {\n        loader: require.resolve(\"css-loader\"),\n        options: cssOptions,\n      },\n      {\n        // Options for PostCSS as we reference these options twice\n        // Adds vendor prefixing based on your specified browser support in\n        // package.json\n        loader: require.resolve(\"postcss-loader\"),\n        options: {\n          // Necessary for external CSS imports to work\n          // https://github.com/facebook/create-react-app/issues/2677\n          ident: \"postcss\",\n          plugins: () => [\n            require(\"postcss-flexbugs-fixes\"),\n            require(\"postcss-preset-env\")({\n              autoprefixer: {\n                flexbox: \"no-2009\",\n              },\n              stage: 3,\n            }),\n          ],\n          sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n        },\n      },\n    ].filter(Boolean);\n    if (preProcessor) {\n      loaders.push({\n        loader: require.resolve(preProcessor),\n        options: {\n          sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n        },\n      });\n    }\n    return loaders;\n  };\n\n  return {\n    mode: isEnvProduction ? \"production\" : isEnvDevelopment && \"development\",\n    // Stop compilation early in production\n    bail: isEnvProduction,\n    devtool: isEnvProduction ? (shouldUseSourceMap ? \"source-map\" : false) : isEnvDevelopment && \"eval-source-map\",\n    // These are the \"entry points\" to our application.\n    // This means they will be the \"root\" imports that are included in JS bundle.\n    entry: [\n      // Include an alternative client for WebpackDevServer. A client's job is to\n      // connect to WebpackDevServer by a socket and get notified about changes.\n      // When you save a file, the client will either apply hot updates (in case\n      // of CSS changes), or refresh the page (in case of JS changes). When you\n      // make a syntax error, this client will display a syntax error overlay.\n      // Note: instead of the default WebpackDevServer client, we use a custom one\n      // to bring better experience for Create React App users. You can replace\n      // the line below with these two lines if you prefer the stock client:\n      // require.resolve('webpack-dev-server/client') + '?/',\n      // require.resolve('webpack/hot/dev-server'),\n      isEnvDevelopment && require.resolve(\"react-dev-utils/webpackHotDevClient\"),\n      // Finally, this is your app's code:\n      paths.appIndexJs,\n      // We include the app code last so that if there is a runtime error during\n      // initialization, it doesn't blow up the WebpackDevServer client, and\n      // changing JS code would still trigger a refresh.\n    ].filter(Boolean),\n    output: {\n      // The build folder.\n      path: isEnvProduction ? paths.appBuild : undefined,\n      // Add /* filename */ comments to generated require()s in the output.\n      pathinfo: isEnvDevelopment,\n      // There will be one main bundle, and one file per asynchronous chunk.\n      // In development, it does not produce real files.\n      filename: isEnvProduction ? \"static/js/[name].[chunkhash:8].js\" : isEnvDevelopment && \"static/js/bundle.js\",\n      // There are also additional JS chunk files if you use code splitting.\n      chunkFilename: isEnvProduction\n        ? \"static/js/[name].[chunkhash:8].chunk.js\"\n        : isEnvDevelopment && \"static/js/[name].chunk.js\",\n      // We inferred the \"public path\" (such as / or /my-project) from homepage.\n      // We use \"/\" in development.\n      publicPath: publicPath,\n      // Point sourcemap entries to original disk location (format as URL on Windows)\n      devtoolModuleFilenameTemplate: isEnvProduction\n        ? (info) => path.relative(paths.appSrc, info.absoluteResourcePath).replace(/\\\\/g, \"/\")\n        : isEnvDevelopment && ((info) => path.resolve(info.absoluteResourcePath).replace(/\\\\/g, \"/\")),\n    },\n    optimization: {\n      minimize: isEnvProduction,\n      minimizer: [\n        // This is only used in production mode\n        new TerserPlugin({\n          terserOptions: {\n            parse: {\n              // we want terser to parse ecma 8 code. However, we don't want it\n              // to apply any minfication steps that turns valid ecma 5 code\n              // into invalid ecma 5 code. This is why the 'compress' and 'output'\n              // sections only apply transformations that are ecma 5 safe\n              // https://github.com/facebook/create-react-app/pull/4234\n              ecma: 8,\n            },\n            compress: {\n              ecma: 5,\n              warnings: false,\n              // Disabled because of an issue with Uglify breaking seemingly valid code:\n              // https://github.com/facebook/create-react-app/issues/2376\n              // Pending further investigation:\n              // https://github.com/mishoo/UglifyJS2/issues/2011\n              comparisons: false,\n              // Disabled because of an issue with Terser breaking valid code:\n              // https://github.com/facebook/create-react-app/issues/5250\n              // Pending futher investigation:\n              // https://github.com/terser-js/terser/issues/120\n              inline: 2,\n            },\n            mangle: {\n              safari10: true,\n            },\n            output: {\n              ecma: 5,\n              comments: false,\n              // Turned on because emoji and regex is not minified properly using default\n              // https://github.com/facebook/create-react-app/issues/2488\n              ascii_only: true,\n            },\n          },\n          // Use multi-process parallel running to improve the build speed\n          // Default number of concurrent runs: os.cpus().length - 1\n          parallel: true,\n          // Enable file caching\n          cache: true,\n          sourceMap: shouldUseSourceMap,\n        }),\n        // This is only used in production mode\n        new OptimizeCSSAssetsPlugin({\n          cssProcessorOptions: {\n            parser: safePostCssParser,\n            map: shouldUseSourceMap\n              ? {\n                  // `inline: false` forces the sourcemap to be output into a\n                  // separate file\n                  inline: false,\n                  // `annotation: true` appends the sourceMappingURL to the end of\n                  // the css file, helping the browser find the sourcemap\n                  annotation: true,\n                }\n              : false,\n          },\n        }),\n      ],\n      // Automatically split vendor and commons\n      // https://twitter.com/wSokra/status/969633336732905474\n      // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366\n      splitChunks: {\n        chunks: \"all\",\n        name: false,\n      },\n      // Keep the runtime chunk separated to enable long term caching\n      // https://twitter.com/wSokra/status/969679223278505985\n      runtimeChunk: true,\n    },\n    resolve: {\n      // This allows you to set a fallback for where Webpack should look for modules.\n      // We placed these paths second because we want `node_modules` to \"win\"\n      // if there are any conflicts. This matches Node resolution mechanism.\n      // https://github.com/facebook/create-react-app/issues/253\n      modules: [\"node_modules\"].concat(\n        // It is guaranteed to exist because we tweak it in `env.js`\n        process.env.NODE_PATH.split(path.delimiter).filter(Boolean),\n      ),\n      // These are the reasonable defaults supported by the Node ecosystem.\n      // We also include JSX as a common component filename extension to support\n      // some tools, although we do not recommend using it, see:\n      // https://github.com/facebook/create-react-app/issues/290\n      // `web` extension prefixes have been added for better support\n      // for React Native Web.\n      extensions: paths.moduleFileExtensions\n        .map((ext) => `.${ext}`)\n        .filter((ext) => useTypeScript || !ext.includes(\"ts\")),\n      alias: {\n        // Support React Native Web\n        // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/\n        \"react-native\": \"react-native-web\",\n      },\n      plugins: [\n        // Adds support for installing with Plug'n'Play, leading to faster installs and adding\n        // guards against forgotten dependencies and such.\n        PnpWebpackPlugin,\n        // Prevents users from importing files from outside of src/ (or node_modules/).\n        // This often causes confusion because we only process files within src/ with babel.\n        // To fix this, we prevent you from importing files out of src/ -- if you'd like to,\n        // please link the files into your node_modules/ and let module-resolution kick in.\n        // Make sure your source files are compiled, as they will not be processed in any way.\n        new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),\n      ],\n    },\n    resolveLoader: {\n      plugins: [\n        // Also related to Plug'n'Play, but this time it tells Webpack to load its loaders\n        // from the current package.\n        PnpWebpackPlugin.moduleLoader(module),\n      ],\n    },\n    module: {\n      strictExportPresence: true,\n      rules: [\n        // Disable require.ensure as it's not a standard language feature.\n        {parser: {requireEnsure: false}},\n        {\n          // \"oneOf\" will traverse all following loaders until one will\n          // match the requirements. When no loader matches it will fall\n          // back to the \"file\" loader at the end of the loader list.\n          oneOf: [\n            // \"url\" loader works like \"file\" loader except that it embeds assets\n            // smaller than specified limit in bytes as data URLs to avoid requests.\n            // A missing `test` is equivalent to a match.\n            {\n              test: [/\\.bmp$/, /\\.gif$/, /\\.jpe?g$/, /\\.png$/],\n              loader: require.resolve(\"url-loader\"),\n              options: {\n                limit: 10000,\n                name: \"static/media/[name].[hash:8].[ext]\",\n              },\n            },\n            // Process application JS with Babel.\n            // The preset includes JSX, Flow, TypeScript, and some ESnext features.\n            {\n              test: /\\.(js|mjs|jsx|ts|tsx)$/,\n              include: paths.appSrc,\n              loader: require.resolve(\"babel-loader\"),\n              options: {\n                customize: require.resolve(\"babel-preset-react-app/webpack-overrides\"),\n\n                plugins: [\n                  [\n                    require.resolve(\"babel-plugin-named-asset-import\"),\n                    {\n                      loaderMap: {\n                        svg: {\n                          ReactComponent: \"@svgr/webpack?-svgo![path]\",\n                        },\n                      },\n                    },\n                  ],\n                ],\n                // This is a feature of `babel-loader` for webpack (not Babel itself).\n                // It enables caching results in ./node_modules/.cache/babel-loader/\n                // directory for faster rebuilds.\n                cacheDirectory: true,\n                cacheCompression: isEnvProduction,\n                compact: isEnvProduction,\n              },\n            },\n            // Process any JS outside of the app with Babel.\n            // Unlike the application JS, we only compile the standard ES features.\n            {\n              test: /\\.(js|mjs)$/,\n              exclude: /@babel(?:\\/|\\\\{1,2})runtime/,\n              loader: require.resolve(\"babel-loader\"),\n              options: {\n                babelrc: false,\n                configFile: false,\n                compact: false,\n                presets: [[require.resolve(\"babel-preset-react-app/dependencies\"), {helpers: true}]],\n                cacheDirectory: true,\n                cacheCompression: isEnvProduction,\n\n                // If an error happens in a package, it's possible to be\n                // because it was compiled. Thus, we don't want the browser\n                // debugger to show the original code. Instead, the code\n                // being evaluated would be much more helpful.\n                sourceMaps: false,\n              },\n            },\n            // \"postcss\" loader applies autoprefixer to our CSS.\n            // \"css\" loader resolves paths in CSS and adds assets as dependencies.\n            // \"style\" loader turns CSS into JS modules that inject <style> tags.\n            // In production, we use MiniCSSExtractPlugin to extract that CSS\n            // to a file, but in development \"style\" loader enables hot editing\n            // of CSS.\n            // By default we support CSS Modules with the extension .module.css\n            {\n              test: cssRegex,\n              exclude: cssModuleRegex,\n              use: getStyleLoaders({\n                importLoaders: 1,\n                sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n              }),\n              // Don't consider CSS imports dead code even if the\n              // containing package claims to have no side effects.\n              // Remove this when webpack adds a warning or an error for this.\n              // See https://github.com/webpack/webpack/issues/6571\n              sideEffects: true,\n            },\n            // Adds support for CSS Modules (https://github.com/css-modules/css-modules)\n            // using the extension .module.css\n            {\n              test: cssModuleRegex,\n              use: getStyleLoaders({\n                importLoaders: 1,\n                sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n                modules: true,\n                getLocalIdent: getCSSModuleLocalIdent,\n              }),\n            },\n            // Opt-in support for SASS (using .scss or .sass extensions).\n            // By default we support SASS Modules with the\n            // extensions .module.scss or .module.sass\n            {\n              test: sassRegex,\n              exclude: sassModuleRegex,\n              use: getStyleLoaders(\n                {\n                  importLoaders: 2,\n                  sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n                },\n                \"sass-loader\",\n              ),\n              // Don't consider CSS imports dead code even if the\n              // containing package claims to have no side effects.\n              // Remove this when webpack adds a warning or an error for this.\n              // See https://github.com/webpack/webpack/issues/6571\n              sideEffects: true,\n            },\n            // Adds support for CSS Modules, but using SASS\n            // using the extension .module.scss or .module.sass\n            {\n              test: sassModuleRegex,\n              use: getStyleLoaders(\n                {\n                  importLoaders: 2,\n                  sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n                  modules: true,\n                  getLocalIdent: getCSSModuleLocalIdent,\n                },\n                \"sass-loader\",\n              ),\n            },\n            // \"file\" loader makes sure those assets get served by WebpackDevServer.\n            // When you `import` an asset, you get its (virtual) filename.\n            // In production, they would get copied to the `build` folder.\n            // This loader doesn't use a \"test\" so it will catch all modules\n            // that fall through the other loaders.\n            {\n              loader: require.resolve(\"file-loader\"),\n              // Exclude `js` files to keep \"css\" loader working as it injects\n              // its runtime that would otherwise be processed through \"file\" loader.\n              // Also exclude `html` and `json` extensions so they get processed\n              // by webpacks internal loaders.\n              exclude: [/\\.(js|mjs|jsx|ts|tsx|md)$/, /\\.html$/, /\\.json$/],\n              options: {\n                name: \"static/media/[name].[hash:8].[ext]\",\n              },\n            },\n\n            // ** STOP ** Are you adding a new loader?\n            // Make sure to add the new loader(s) before the \"file\" loader.\n\n            {\n              loader: require.resolve(\"raw-loader\"),\n              test: /\\.md/i,\n              include: path.resolve('./src/template')\n            },\n          ],\n        },\n      ],\n    },\n    plugins: [\n      // Generates an `index.html` file with the <script> injected.\n      new HtmlWebpackPlugin(\n        Object.assign(\n          {},\n          {\n            inject: true,\n            template: paths.appHtml,\n          },\n          isEnvProduction\n            ? {\n                minify: {\n                  removeComments: true,\n                  collapseWhitespace: true,\n                  removeRedundantAttributes: true,\n                  useShortDoctype: true,\n                  removeEmptyAttributes: true,\n                  removeStyleLinkTypeAttributes: true,\n                  keepClosingSlash: true,\n                  minifyJS: true,\n                  minifyCSS: true,\n                  minifyURLs: true,\n                },\n              }\n            : undefined,\n        ),\n      ),\n      // Inlines the webpack runtime script. This script is too small to warrant\n      // a network request.\n      isEnvProduction && shouldInlineRuntimeChunk && new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime~.+[.]js/]),\n      // Makes some environment variables available in index.html.\n      // The public URL is available as %PUBLIC_URL% in index.html, e.g.:\n      // <link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.ico\">\n      // In production, it will be an empty string unless you specify \"homepage\"\n      // in `package.json`, in which case it will be the pathname of that URL.\n      // In development, this will be an empty string.\n      new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),\n      // This gives some necessary context to module not found errors, such as\n      // the requesting resource.\n      new ModuleNotFoundPlugin(paths.appPath),\n      // Makes some environment variables available to the JS code, for example:\n      // if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.\n      // It is absolutely essential that NODE_ENV is set to production\n      // during a production build.\n      // Otherwise React will be compiled in the very slow development mode.\n      new webpack.DefinePlugin(env.stringified),\n      // This is necessary to emit hot updates (currently CSS only):\n      isEnvDevelopment && new webpack.HotModuleReplacementPlugin(),\n      // Watcher doesn't work well if you mistype casing in a path so we use\n      // a plugin that prints an error when you attempt to do this.\n      // See https://github.com/facebook/create-react-app/issues/240\n      isEnvDevelopment && new CaseSensitivePathsPlugin(),\n      // If you require a missing module and then `npm install` it, you still have\n      // to restart the development server for Webpack to discover it. This plugin\n      // makes the discovery automatic so you don't have to restart.\n      // See https://github.com/facebook/create-react-app/issues/186\n      isEnvDevelopment && new WatchMissingNodeModulesPlugin(paths.appNodeModules),\n      isEnvProduction &&\n        new MiniCssExtractPlugin({\n          // Options similar to the same options in webpackOptions.output\n          // both options are optional\n          filename: \"static/css/[name].[contenthash:8].css\",\n          chunkFilename: \"static/css/[name].[contenthash:8].chunk.css\",\n        }),\n      // Generate a manifest file which contains a mapping of all asset filenames\n      // to their corresponding output file so that tools can pick it up without\n      // having to parse `index.html`.\n      new ManifestPlugin({\n        fileName: \"asset-manifest.json\",\n        publicPath: publicPath,\n      }),\n      // Moment.js is an extremely popular library that bundles large locale files\n      // by default due to how Webpack interprets its code. This is a practical\n      // solution that requires the user to opt into importing specific locales.\n      // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack\n      // You can remove this if you don't use Moment.js:\n      new webpack.IgnorePlugin(/^\\.\\/locale$/, /moment$/),\n      // Generate a service worker script that will precache, and keep up to date,\n      // the HTML & assets that are part of the Webpack build.\n      isEnvProduction &&\n        new WorkboxWebpackPlugin.GenerateSW({\n          clientsClaim: true,\n          skipWaiting: true,\n          exclude: [/\\.map$/, /asset-manifest\\.json$/],\n          importWorkboxFrom: 'local',\n          navigateFallback: publicUrl + '/index.html',\n          navigateFallbackBlacklist: [\n            // Exclude URLs starting with /_, as they're likely an API call\n            new RegExp(\"^/_\"),\n            // Exclude URLs containing a dot, as they're likely a resource in\n            // public/ and not a SPA route\n            new RegExp(\"/[^/]+\\\\.[^/]+$\"),\n          ],\n          runtimeCaching: [\n            // 配置路由请求缓存 对应 workbox.routing.registerRoute\n            {\n              urlPattern: /.*\\.js/, // 匹配文件\n              handler: \"networkFirst\", // 网络优先\n            },\n            {\n              urlPattern: /.*\\.css/,\n              handler: \"staleWhileRevalidate\", // 缓存优先同时后台更新\n              options: {\n                // 这里可以设置 cacheName 和添加插件\n                plugins: [\n                  {\n                    cacheableResponse: {\n                      statuses: [0, 200],\n                    },\n                  },\n                ],\n              },\n            },\n            {\n              urlPattern: /.*\\.(png|jpg|jpeg|svg|gif)/,\n              handler: \"cacheFirst\", // 缓存优先\n              options: {\n                cacheName: 'images',\n                expiration: {\n                  maxAgeSeconds: 24 * 60 * 60, // 最长缓存时间,\n                  maxEntries: 50, // 最大缓存图片数量\n                },\n              },\n            },\n            {\n              urlPattern: /.*\\.html/,\n              handler: \"networkFirst\",\n            },\n          ],\n        }),\n      // TypeScript type checking\n      useTypeScript &&\n        new ForkTsCheckerWebpackPlugin({\n          typescript: resolve.sync(\"typescript\", {\n            basedir: paths.appNodeModules,\n          }),\n          async: false,\n          checkSyntacticErrors: true,\n          tsconfig: paths.appTsConfig,\n          compilerOptions: {\n            module: \"esnext\",\n            moduleResolution: \"node\",\n            resolveJsonModule: true,\n            isolatedModules: true,\n            noEmit: true,\n            jsx: \"preserve\",\n          },\n          reportFiles: [\n            \"**\",\n            \"!**/*.json\",\n            \"!**/__tests__/**\",\n            \"!**/?(*.)(spec|test).*\",\n            \"!**/src/setupProxy.*\",\n            \"!**/src/setupTests.*\",\n          ],\n          watch: paths.appSrc,\n          silent: true,\n          formatter: typescriptFormatter,\n        }),\n    ].filter(Boolean),\n    // Some libraries import Node modules but don't use them in the browser.\n    // Tell Webpack to provide empty mocks for them so importing them works.\n    node: {\n      module: \"empty\",\n      dgram: \"empty\",\n      dns: \"mock\",\n      fs: \"empty\",\n      net: \"empty\",\n      tls: \"empty\",\n      child_process: \"empty\",\n    },\n    // Turn off performance processing because we utilize\n    // our own hints via the FileSizeReporter\n    performance: false,\n  };\n};\n"
  },
  {
    "path": "config/webpack.config.lib.js",
    "content": "\"use strict\";\n\nconst fs = require(\"fs\");\nconst path = require(\"path\");\nconst webpack = require(\"webpack\");\nconst resolve = require(\"resolve\");\nconst PnpWebpackPlugin = require(\"pnp-webpack-plugin\");\nconst CaseSensitivePathsPlugin = require(\"case-sensitive-paths-webpack-plugin\");\nconst TerserPlugin = require(\"terser-webpack-plugin\");\nconst MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nconst OptimizeCSSAssetsPlugin = require(\"optimize-css-assets-webpack-plugin\");\nconst safePostCssParser = require(\"postcss-safe-parser\");\nconst ManifestPlugin = require(\"webpack-manifest-plugin\");\nconst WorkboxWebpackPlugin = require(\"workbox-webpack-plugin\");\nconst WatchMissingNodeModulesPlugin = require(\"react-dev-utils/WatchMissingNodeModulesPlugin\");\nconst ModuleScopePlugin = require(\"react-dev-utils/ModuleScopePlugin\");\nconst getCSSModuleLocalIdent = require(\"react-dev-utils/getCSSModuleLocalIdent\");\nconst paths = require(\"./paths\");\nconst getClientEnvironment = require(\"./env\");\nconst ModuleNotFoundPlugin = require(\"react-dev-utils/ModuleNotFoundPlugin\");\nconst ForkTsCheckerWebpackPlugin = require(\"fork-ts-checker-webpack-plugin-alt\");\nconst typescriptFormatter = require(\"react-dev-utils/typescriptFormatter\");\n\n// Source maps are resource heavy and can cause out of memory issue for large source files.\nconst shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== \"false\";\n// Some apps do not need the benefits of saving a web request, so not inlining the chunk\n// makes for a smoother build process.\nconst shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== \"false\";\n\n// Check if TypeScript is setup\nconst useTypeScript = fs.existsSync(paths.appTsConfig);\n\n// style files regexes\nconst cssRegex = /\\.css$/;\nconst cssModuleRegex = /\\.module\\.css$/;\nconst sassRegex = /\\.(scss|sass)$/;\nconst sassModuleRegex = /\\.module\\.(scss|sass)$/;\n\n// This is the production and development configuration.\n// It is focused on developer experience, fast rebuilds, and a minimal bundle.\nmodule.exports = function(webpackEnv) {\n  const isEnvDevelopment = webpackEnv === \"development\";\n  const isEnvProduction = webpackEnv === \"production\";\n\n  // Webpack uses `publicPath` to determine where the app is being served from.\n  // It requires a trailing slash, or the file assets will get an incorrect path.\n  // In development, we always serve from the root. This makes config easier.\n  const publicPath = isEnvProduction ? paths.servedPath : isEnvDevelopment && \"/\";\n  // Some apps do not use client-side routing with pushState.\n  // For these, \"homepage\" can be set to \".\" to enable relative asset paths.\n  const shouldUseRelativeAssetPaths = publicPath === \"./\";\n\n  // `publicUrl` is just like `publicPath`, but we will provide it to our app\n  // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.\n  // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.\n  const publicUrl = isEnvProduction ? publicPath.slice(0, -1) : isEnvDevelopment && \"\";\n  // Get environment variables to inject into our app.\n  const env = getClientEnvironment(publicUrl);\n\n  // common function to get style loaders\n  const getStyleLoaders = (cssOptions, preProcessor) => {\n    const loaders = [\n      isEnvDevelopment && require.resolve(\"style-loader\"),\n      isEnvProduction && {\n        loader: MiniCssExtractPlugin.loader,\n        options: Object.assign({}, shouldUseRelativeAssetPaths ? {publicPath: \"../../\"} : undefined),\n      },\n      {\n        loader: require.resolve(\"css-loader\"),\n        options: cssOptions,\n      },\n      {\n        // Options for PostCSS as we reference these options twice\n        // Adds vendor prefixing based on your specified browser support in\n        // package.json\n        loader: require.resolve(\"postcss-loader\"),\n        options: {\n          // Necessary for external CSS imports to work\n          // https://github.com/facebook/create-react-app/issues/2677\n          ident: \"postcss\",\n          plugins: () => [\n            require(\"postcss-flexbugs-fixes\"),\n            require(\"postcss-preset-env\")({\n              autoprefixer: {\n                flexbox: \"no-2009\",\n              },\n              stage: 3,\n            }),\n          ],\n          sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n        },\n      },\n    ].filter(Boolean);\n    if (preProcessor) {\n      loaders.push({\n        loader: require.resolve(preProcessor),\n        options: {\n          sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n        },\n      });\n    }\n    return loaders;\n  };\n\n  return {\n    mode: isEnvProduction ? \"production\" : isEnvDevelopment && \"development\",\n    // Stop compilation early in production\n    bail: isEnvProduction,\n    devtool: isEnvProduction ? (shouldUseSourceMap ? \"source-map\" : false) : isEnvDevelopment && \"eval-source-map\",\n    // These are the \"entry points\" to our application.\n    // This means they will be the \"root\" imports that are included in JS bundle.\n    entry: [\n      // Include an alternative client for WebpackDevServer. A client's job is to\n      // connect to WebpackDevServer by a socket and get notified about changes.\n      // When you save a file, the client will either apply hot updates (in case\n      // of CSS changes), or refresh the page (in case of JS changes). When you\n      // make a syntax error, this client will display a syntax error overlay.\n      // Note: instead of the default WebpackDevServer client, we use a custom one\n      // to bring better experience for Create React App users. You can replace\n      // the line below with these two lines if you prefer the stock client:\n      // require.resolve('webpack-dev-server/client') + '?/',\n      // require.resolve('webpack/hot/dev-server'),\n      isEnvDevelopment && require.resolve(\"react-dev-utils/webpackHotDevClient\"),\n      // Finally, this is your app's code:\n      paths.appLib,\n      // We include the app code last so that if there is a runtime error during\n      // initialization, it doesn't blow up the WebpackDevServer client, and\n      // changing JS code would still trigger a refresh.\n    ].filter(Boolean),\n    output: {\n      // The build folder.\n      path: isEnvProduction ? paths.appBuild : undefined,\n      // Add /* filename */ comments to generated require()s in the output.\n      pathinfo: isEnvDevelopment,\n      // There will be one main bundle, and one file per asynchronous chunk.\n      // In development, it does not produce real files.\n      filename: isEnvProduction ? \"static/js/[name].[chunkhash:8].js\" : isEnvDevelopment && \"static/js/bundle.js\",\n      // There are also additional JS chunk files if you use code splitting.\n      chunkFilename: isEnvProduction\n        ? \"static/js/[name].[chunkhash:8].chunk.js\"\n        : isEnvDevelopment && \"static/js/[name].chunk.js\",\n      // We inferred the \"public path\" (such as / or /my-project) from homepage.\n      // We use \"/\" in development.\n      publicPath: publicPath,\n      // Point sourcemap entries to original disk location (format as URL on Windows)\n      devtoolModuleFilenameTemplate: isEnvProduction\n        ? (info) => path.relative(paths.appSrc, info.absoluteResourcePath).replace(/\\\\/g, \"/\")\n        : isEnvDevelopment && ((info) => path.resolve(info.absoluteResourcePath).replace(/\\\\/g, \"/\")),\n    },\n    optimization: {\n      minimize: isEnvProduction,\n      minimizer: [\n        // This is only used in production mode\n        new TerserPlugin({\n          terserOptions: {\n            parse: {\n              // we want terser to parse ecma 8 code. However, we don't want it\n              // to apply any minfication steps that turns valid ecma 5 code\n              // into invalid ecma 5 code. This is why the 'compress' and 'output'\n              // sections only apply transformations that are ecma 5 safe\n              // https://github.com/facebook/create-react-app/pull/4234\n              ecma: 8,\n            },\n            compress: {\n              ecma: 5,\n              warnings: false,\n              // Disabled because of an issue with Uglify breaking seemingly valid code:\n              // https://github.com/facebook/create-react-app/issues/2376\n              // Pending further investigation:\n              // https://github.com/mishoo/UglifyJS2/issues/2011\n              comparisons: false,\n              // Disabled because of an issue with Terser breaking valid code:\n              // https://github.com/facebook/create-react-app/issues/5250\n              // Pending futher investigation:\n              // https://github.com/terser-js/terser/issues/120\n              inline: 2,\n            },\n            mangle: {\n              safari10: true,\n            },\n            output: {\n              ecma: 5,\n              comments: false,\n              // Turned on because emoji and regex is not minified properly using default\n              // https://github.com/facebook/create-react-app/issues/2488\n              ascii_only: true,\n            },\n          },\n          // Use multi-process parallel running to improve the build speed\n          // Default number of concurrent runs: os.cpus().length - 1\n          parallel: true,\n          // Enable file caching\n          cache: true,\n          sourceMap: shouldUseSourceMap,\n        }),\n        // This is only used in production mode\n        new OptimizeCSSAssetsPlugin({\n          cssProcessorOptions: {\n            parser: safePostCssParser,\n            map: shouldUseSourceMap\n              ? {\n                  // `inline: false` forces the sourcemap to be output into a\n                  // separate file\n                  inline: false,\n                  // `annotation: true` appends the sourceMappingURL to the end of\n                  // the css file, helping the browser find the sourcemap\n                  annotation: true,\n                }\n              : false,\n          },\n        }),\n      ],\n      // Automatically split vendor and commons\n      // https://twitter.com/wSokra/status/969633336732905474\n      // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366\n      splitChunks: {\n        chunks: \"all\",\n        name: false,\n      },\n      // Keep the runtime chunk separated to enable long term caching\n      // https://twitter.com/wSokra/status/969679223278505985\n      runtimeChunk: true,\n    },\n    resolve: {\n      // This allows you to set a fallback for where Webpack should look for modules.\n      // We placed these paths second because we want `node_modules` to \"win\"\n      // if there are any conflicts. This matches Node resolution mechanism.\n      // https://github.com/facebook/create-react-app/issues/253\n      modules: [\"node_modules\"].concat(\n        // It is guaranteed to exist because we tweak it in `env.js`\n        process.env.NODE_PATH.split(path.delimiter).filter(Boolean),\n      ),\n      // These are the reasonable defaults supported by the Node ecosystem.\n      // We also include JSX as a common component filename extension to support\n      // some tools, although we do not recommend using it, see:\n      // https://github.com/facebook/create-react-app/issues/290\n      // `web` extension prefixes have been added for better support\n      // for React Native Web.\n      extensions: paths.moduleFileExtensions\n        .map((ext) => `.${ext}`)\n        .filter((ext) => useTypeScript || !ext.includes(\"ts\")),\n      alias: {\n        // Support React Native Web\n        // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/\n        \"react-native\": \"react-native-web\",\n      },\n      plugins: [\n        // Adds support for installing with Plug'n'Play, leading to faster installs and adding\n        // guards against forgotten dependencies and such.\n        PnpWebpackPlugin,\n        // Prevents users from importing files from outside of src/ (or node_modules/).\n        // This often causes confusion because we only process files within src/ with babel.\n        // To fix this, we prevent you from importing files out of src/ -- if you'd like to,\n        // please link the files into your node_modules/ and let module-resolution kick in.\n        // Make sure your source files are compiled, as they will not be processed in any way.\n        new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),\n      ],\n    },\n    resolveLoader: {\n      plugins: [\n        // Also related to Plug'n'Play, but this time it tells Webpack to load its loaders\n        // from the current package.\n        PnpWebpackPlugin.moduleLoader(module),\n      ],\n    },\n    module: {\n      strictExportPresence: true,\n      rules: [\n        // Disable require.ensure as it's not a standard language feature.\n        {parser: {requireEnsure: false}},\n\n        // First, run the linter.\n        // It's important to do this before Babel processes the JS.\n        {\n          // \"oneOf\" will traverse all following loaders until one will\n          // match the requirements. When no loader matches it will fall\n          // back to the \"file\" loader at the end of the loader list.\n          oneOf: [\n            // \"url\" loader works like \"file\" loader except that it embeds assets\n            // smaller than specified limit in bytes as data URLs to avoid requests.\n            // A missing `test` is equivalent to a match.\n            {\n              test: [/\\.bmp$/, /\\.gif$/, /\\.jpe?g$/, /\\.png$/],\n              loader: require.resolve(\"url-loader\"),\n              options: {\n                limit: 10000,\n                name: \"static/media/[name].[hash:8].[ext]\",\n              },\n            },\n            // Process application JS with Babel.\n            // The preset includes JSX, Flow, TypeScript, and some ESnext features.\n            {\n              test: /\\.(js|mjs|jsx|ts|tsx)$/,\n              include: paths.appSrc,\n              use: [\n                \"thread-loader\",\n                {\n                  loader: require.resolve(\"babel-loader\"),\n                  options: {\n                    customize: require.resolve(\"babel-preset-react-app/webpack-overrides\"),\n                    plugins: [\n                      [\n                        require.resolve(\"babel-plugin-named-asset-import\"),\n                        {\n                          loaderMap: {\n                            svg: {\n                              ReactComponent: \"@svgr/webpack?-svgo![path]\",\n                            },\n                          },\n                        },\n                      ],\n                    ],\n                    cacheDirectory: true,\n                    cacheCompression: isEnvProduction,\n                    compact: isEnvProduction,\n                  },\n                },\n              ],\n            },\n            // Process any JS outside of the app with Babel.\n            // Unlike the application JS, we only compile the standard ES features.\n            {\n              test: /\\.(js|mjs)$/,\n              exclude: /@babel(?:\\/|\\\\{1,2})runtime/,\n              use: [\n                \"thread-loader\",\n                {\n                  loader: require.resolve(\"babel-loader\"),\n                  options: {\n                    babelrc: false,\n                    configFile: false,\n                    compact: false,\n                    presets: [[require.resolve(\"babel-preset-react-app/dependencies\"), {helpers: true}]],\n                    cacheDirectory: true,\n                    cacheCompression: isEnvProduction,\n                    sourceMaps: false,\n                  },\n                },\n              ],\n            },\n            // \"postcss\" loader applies autoprefixer to our CSS.\n            // \"css\" loader resolves paths in CSS and adds assets as dependencies.\n            // \"style\" loader turns CSS into JS modules that inject <style> tags.\n            // In production, we use MiniCSSExtractPlugin to extract that CSS\n            // to a file, but in development \"style\" loader enables hot editing\n            // of CSS.\n            // By default we support CSS Modules with the extension .module.css\n            {\n              test: cssRegex,\n              exclude: cssModuleRegex,\n              use: getStyleLoaders({\n                importLoaders: 1,\n                sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n              }),\n              // Don't consider CSS imports dead code even if the\n              // containing package claims to have no side effects.\n              // Remove this when webpack adds a warning or an error for this.\n              // See https://github.com/webpack/webpack/issues/6571\n              sideEffects: true,\n            },\n            // Adds support for CSS Modules (https://github.com/css-modules/css-modules)\n            // using the extension .module.css\n            {\n              test: cssModuleRegex,\n              use: getStyleLoaders({\n                importLoaders: 1,\n                sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n                modules: true,\n                getLocalIdent: getCSSModuleLocalIdent,\n              }),\n            },\n            // Opt-in support for SASS (using .scss or .sass extensions).\n            // By default we support SASS Modules with the\n            // extensions .module.scss or .module.sass\n            {\n              test: sassRegex,\n              exclude: sassModuleRegex,\n              use: getStyleLoaders(\n                {\n                  importLoaders: 2,\n                  sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n                },\n                \"sass-loader\",\n              ),\n              // Don't consider CSS imports dead code even if the\n              // containing package claims to have no side effects.\n              // Remove this when webpack adds a warning or an error for this.\n              // See https://github.com/webpack/webpack/issues/6571\n              sideEffects: true,\n            },\n            // Adds support for CSS Modules, but using SASS\n            // using the extension .module.scss or .module.sass\n            {\n              test: sassModuleRegex,\n              use: getStyleLoaders(\n                {\n                  importLoaders: 2,\n                  sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,\n                  modules: true,\n                  getLocalIdent: getCSSModuleLocalIdent,\n                },\n                \"sass-loader\",\n              ),\n            },\n            // \"file\" loader makes sure those assets get served by WebpackDevServer.\n            // When you `import` an asset, you get its (virtual) filename.\n            // In production, they would get copied to the `build` folder.\n            // This loader doesn't use a \"test\" so it will catch all modules\n            // that fall through the other loaders.\n            {\n              loader: require.resolve(\"file-loader\"),\n              // Exclude `js` files to keep \"css\" loader working as it injects\n              // its runtime that would otherwise be processed through \"file\" loader.\n              // Also exclude `html` and `json` extensions so they get processed\n              // by webpacks internal loaders.\n              exclude: [/\\.(js|mjs|jsx|ts|tsx)$/, /\\.html$/, /\\.json$/],\n              options: {\n                name: \"static/media/[name].[hash:8].[ext]\",\n              },\n            },\n\n            // ** STOP ** Are you adding a new loader?\n            // Make sure to add the new loader(s) before the \"file\" loader.\n          ],\n        },\n      ],\n    },\n    plugins: [\n      // Generates an `index.html` file with the <script> injected.\n      // new HtmlWebpackPlugin(\n      //   Object.assign(\n      //     {},\n      //     {\n      //       inject: true,\n      //       template: paths.appHtml,\n      //     },\n      //     isEnvProduction\n      //       ? {\n      //           minify: {\n      //             removeComments: true,\n      //             collapseWhitespace: true,\n      //             removeRedundantAttributes: true,\n      //             useShortDoctype: true,\n      //             removeEmptyAttributes: true,\n      //             removeStyleLinkTypeAttributes: true,\n      //             keepClosingSlash: true,\n      //             minifyJS: true,\n      //             minifyCSS: true,\n      //             minifyURLs: true,\n      //           },\n      //         }\n      //       : undefined,\n      //   ),\n      // ),\n      // Inlines the webpack runtime script. This script is too small to warrant\n      // a network request.\n      // isEnvProduction && shouldInlineRuntimeChunk && new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime~.+[.]js/]),\n      // Makes some environment variables available in index.html.\n      // The public URL is available as %PUBLIC_URL% in index.html, e.g.:\n      // <link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.ico\">\n      // In production, it will be an empty string unless you specify \"homepage\"\n      // in `package.json`, in which case it will be the pathname of that URL.\n      // In development, this will be an empty string.\n      // new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),\n      // This gives some necessary context to module not found errors, such as\n      // the requesting resource.\n      new ModuleNotFoundPlugin(paths.appPath),\n      // Makes some environment variables available to the JS code, for example:\n      // if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.\n      // It is absolutely essential that NODE_ENV is set to production\n      // during a production build.\n      // Otherwise React will be compiled in the very slow development mode.\n      new webpack.DefinePlugin(env.stringified),\n      // This is necessary to emit hot updates (currently CSS only):\n      // isEnvDevelopment && new webpack.HotModuleReplacementPlugin(),\n      // Watcher doesn't work well if you mistype casing in a path so we use\n      // a plugin that prints an error when you attempt to do this.\n      // See https://github.com/facebook/create-react-app/issues/240\n      isEnvDevelopment && new CaseSensitivePathsPlugin(),\n      // If you require a missing module and then `npm install` it, you still have\n      // to restart the development server for Webpack to discover it. This plugin\n      // makes the discovery automatic so you don't have to restart.\n      // See https://github.com/facebook/create-react-app/issues/186\n      isEnvDevelopment && new WatchMissingNodeModulesPlugin(paths.appNodeModules),\n      isEnvProduction &&\n        new MiniCssExtractPlugin({\n          // Options similar to the same options in webpackOptions.output\n          // both options are optional\n          filename: \"static/css/[name].[contenthash:8].css\",\n          chunkFilename: \"static/css/[name].[contenthash:8].chunk.css\",\n        }),\n      // Generate a manifest file which contains a mapping of all asset filenames\n      // to their corresponding output file so that tools can pick it up without\n      // having to parse `index.html`.\n      new ManifestPlugin({\n        fileName: \"asset-manifest.json\",\n        publicPath: publicPath,\n      }),\n      // Moment.js is an extremely popular library that bundles large locale files\n      // by default due to how Webpack interprets its code. This is a practical\n      // solution that requires the user to opt into importing specific locales.\n      // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack\n      // You can remove this if you don't use Moment.js:\n      new webpack.IgnorePlugin(/^\\.\\/locale$/, /moment$/),\n      // Generate a service worker script that will precache, and keep up to date,\n      // the HTML & assets that are part of the Webpack build.\n      isEnvProduction &&\n        new WorkboxWebpackPlugin.GenerateSW({\n          clientsClaim: true,\n          exclude: [/\\.map$/, /asset-manifest\\.json$/],\n          importWorkboxFrom: \"cdn\",\n          navigateFallback: publicUrl + \"/index.html\",\n          navigateFallbackBlacklist: [\n            // Exclude URLs starting with /_, as they're likely an API call\n            new RegExp(\"^/_\"),\n            // Exclude URLs containing a dot, as they're likely a resource in\n            // public/ and not a SPA route\n            new RegExp(\"/[^/]+\\\\.[^/]+$\"),\n          ],\n        }),\n      // TypeScript type checking\n      useTypeScript &&\n        new ForkTsCheckerWebpackPlugin({\n          typescript: resolve.sync(\"typescript\", {\n            basedir: paths.appNodeModules,\n          }),\n          async: false,\n          checkSyntacticErrors: true,\n          tsconfig: paths.appTsConfig,\n          compilerOptions: {\n            module: \"esnext\",\n            moduleResolution: \"node\",\n            resolveJsonModule: true,\n            isolatedModules: true,\n            noEmit: true,\n            jsx: \"preserve\",\n          },\n          reportFiles: [\n            \"**\",\n            \"!**/*.json\",\n            \"!**/__tests__/**\",\n            \"!**/?(*.)(spec|test).*\",\n            \"!**/src/setupProxy.*\",\n            \"!**/src/setupTests.*\",\n          ],\n          watch: paths.appSrc,\n          silent: true,\n          formatter: typescriptFormatter,\n        }),\n    ].filter(Boolean),\n    // Some libraries import Node modules but don't use them in the browser.\n    // Tell Webpack to provide empty mocks for them so importing them works.\n    node: {\n      module: \"empty\",\n      dgram: \"empty\",\n      dns: \"mock\",\n      fs: \"empty\",\n      net: \"empty\",\n      tls: \"empty\",\n      child_process: \"empty\",\n    },\n    // Turn off performance processing because we utilize\n    // our own hints via the FileSizeReporter\n    performance: false,\n  };\n};\n"
  },
  {
    "path": "config/webpackDevServer.config.js",
    "content": "'use strict';\n\nconst errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');\nconst evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');\nconst noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');\nconst ignoredFiles = require('react-dev-utils/ignoredFiles');\nconst paths = require('./paths');\nconst fs = require('fs');\n\nconst protocol = process.env.HTTPS === 'true' ? 'https' : 'http';\nconst host = process.env.HOST || '0.0.0.0';\n\nmodule.exports = function(proxy, allowedHost) {\n  return {\n    // WebpackDevServer 2.4.3 introduced a security fix that prevents remote\n    // websites from potentially accessing local content through DNS rebinding:\n    // https://github.com/webpack/webpack-dev-server/issues/887\n    // https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a\n    // However, it made several existing use cases such as development in cloud\n    // environment or subdomains in development significantly more complicated:\n    // https://github.com/facebook/create-react-app/issues/2271\n    // https://github.com/facebook/create-react-app/issues/2233\n    // While we're investigating better solutions, for now we will take a\n    // compromise. Since our WDS configuration only serves files in the `public`\n    // folder we won't consider accessing them a vulnerability. However, if you\n    // use the `proxy` feature, it gets more dangerous because it can expose\n    // remote code execution vulnerabilities in backends like Django and Rails.\n    // So we will disable the host check normally, but enable it if you have\n    // specified the `proxy` setting. Finally, we let you override it if you\n    // really know what you're doing with a special environment variable.\n    disableHostCheck:\n      !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',\n    // Enable gzip compression of generated files.\n    compress: true,\n    // Silence WebpackDevServer's own logs since they're generally not useful.\n    // It will still show compile warnings and errors with this setting.\n    clientLogLevel: 'none',\n    // By default WebpackDevServer serves physical files from current directory\n    // in addition to all the virtual build products that it serves from memory.\n    // This is confusing because those files won’t automatically be available in\n    // production build folder unless we copy them. However, copying the whole\n    // project directory is dangerous because we may expose sensitive files.\n    // Instead, we establish a convention that only files in `public` directory\n    // get served. Our build script will copy `public` into the `build` folder.\n    // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:\n    // <link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.ico\">\n    // In JavaScript code, you can access it with `process.env.PUBLIC_URL`.\n    // Note that we only recommend to use `public` folder as an escape hatch\n    // for files like `favicon.ico`, `manifest.json`, and libraries that are\n    // for some reason broken when imported through Webpack. If you just want to\n    // use an image, put it in `src` and `import` it from JavaScript instead.\n    contentBase: paths.appPublic,\n    // By default files from `contentBase` will not trigger a page reload.\n    watchContentBase: true,\n    // Enable hot reloading server. It will provide /sockjs-node/ endpoint\n    // for the WebpackDevServer client so it can learn when the files were\n    // updated. The WebpackDevServer client is included as an entry point\n    // in the Webpack development configuration. Note that only changes\n    // to CSS are currently hot reloaded. JS changes will refresh the browser.\n    hot: true,\n    // It is important to tell WebpackDevServer to use the same \"root\" path\n    // as we specified in the config. In development, we always serve from /.\n    publicPath: '/',\n    // WebpackDevServer is noisy by default so we emit custom message instead\n    // by listening to the compiler events with `compiler.hooks[...].tap` calls above.\n    quiet: true,\n    // Reportedly, this avoids CPU overload on some systems.\n    // https://github.com/facebook/create-react-app/issues/293\n    // src/node_modules is not ignored to support absolute imports\n    // https://github.com/facebook/create-react-app/issues/1065\n    watchOptions: {\n      ignored: ignoredFiles(paths.appSrc),\n    },\n    // Enable HTTPS if the HTTPS environment variable is set to 'true'\n    https: protocol === 'https',\n    host,\n    overlay: false,\n    historyApiFallback: {\n      // Paths with dots should still use the history fallback.\n      // See https://github.com/facebook/create-react-app/issues/387.\n      disableDotRule: true,\n    },\n    public: allowedHost,\n    proxy,\n    before(app, server) {\n      if (fs.existsSync(paths.proxySetup)) {\n        // This registers user provided middleware for proxy reasons\n        require(paths.proxySetup)(app);\n      }\n\n      // This lets us fetch source contents from webpack for the error overlay\n      app.use(evalSourceMapMiddleware(server));\n      // This lets us open files from the runtime error overlay.\n      app.use(errorOverlayMiddleware());\n\n      // This service worker file is effectively a 'no-op' that will reset any\n      // previous service worker registered for the same host:port combination.\n      // We do this in development to avoid hitting the production cache if\n      // it used the same host and port.\n      // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432\n      app.use(noopServiceWorkerMiddleware());\n    },\n  };\n};\n"
  },
  {
    "path": "main.js",
    "content": "// 引入electron并创建一个Browserwindow\nconst {app, BrowserWindow} = require('electron')\nconst path = require('path')\nconst url = require('url')\n\n// 保持window对象的全局引用,避免JavaScript对象被垃圾回收时,窗口被自动关闭.\nlet mainWindow\n\nfunction createWindow () {\n//创建浏览器窗口,宽高自定义具体大小你开心就好\nmainWindow = new BrowserWindow({width: 800, height: 600})\n\n  // 加载应用----react 打包\n  mainWindow.loadURL(url.format({\n    pathname: path.join(__dirname, './build/index.html'),\n    protocol: 'file:',\n    slashes: true\n  }))\n  // 加载应用----适用于 react 开发时项目\n  // mainWindow.loadURL('http://localhost:3000/');\n  \n  // 打开开发者工具，默认不打开\n  // mainWindow.webContents.openDevTools()\n\n  // 关闭window时触发下列事件.\n  mainWindow.on('closed', function () {\n    mainWindow = null\n  })\n}\n\n// 当 Electron 完成初始化并准备创建浏览器窗口时调用此方法\napp.on('ready', createWindow)\n\n// 所有窗口关闭时退出应用.\napp.on('window-all-closed', function () {\n  // macOS中除非用户按下 `Cmd + Q` 显式退出,否则应用与菜单栏始终处于活动状态.\n  if (process.platform !== 'darwin') {\n    app.quit()\n  }\n})\n\napp.on('activate', function () {\n   // macOS中点击Dock图标时没有已打开的其余应用窗口时,则通常在应用中重建一个窗口\n  if (mainWindow === null) {\n    createWindow()\n  }\n})\n\n// 你可以在这个脚本中续写或者使用require引入独立的js文件."
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"markdown-nice\",\n  \"author\": \"mdnice\",\n  \"description\": \"a markdown editor with the function of style edition\",\n  \"version\": \"1.8.22\",\n  \"private\": false,\n  \"main\": \"lib/Lib.js\",\n  \"module\": \"lib/Lib.js\",\n  \"homepage\": \"https://www.mdnice.com\",\n  \"license\": \"GPL-3.0\",\n  \"typings\": \"./lib/index.d.ts\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/mdnice/markdown-nice\"\n  },\n  \"scripts\": {\n    \"start\": \"node scripts/start.js\",\n    \"watch\": \"node ./watch.js\",\n    \"build\": \"node --max_old_space_size=4096 scripts/build.js\",\n    \"test\": \"node scripts/test.js\",\n    \"analyze\": \"source-map-explorer build/static/js/*.js\",\n    \"lint\": \"eslint src --ext ts,tsx,js --fix\",\n    \"publish:npm\": \"cross-env NODE_ENV=production && rm -rf lib && mkdir lib && cross-env BABEL_ENV=production npx babel src --out-dir lib --copy-files\",\n    \"storybook\": \"npm run publish:npm && start-storybook -p 9001 -c .storybook\"\n  },\n  \"dependencies\": {\n    \"@sitdown/juejin\": \"^1.1.1\",\n    \"@sitdown/wechat\": \"^1.1.4\",\n    \"@sitdown/zhihu\": \"^1.1.2\",\n    \"@uiw/react-codemirror\": \"^1.0.28\",\n    \"ali-oss\": \"^6.1.1\",\n    \"antd\": \"^3.15.1\",\n    \"axios\": \"^0.18.0\",\n    \"diff-match-patch\": \"^1.0.4\",\n    \"highlight.js\": \"^9.15.6\",\n    \"juice\": \"^5.2.0\",\n    \"lodash.debounce\": \"^4.0.8\",\n    \"lodash.throttle\": \"^4.1.1\",\n    \"markdown-it\": \"^8.4.2\",\n    \"markdown-it-deflist\": \"^2.0.3\",\n    \"markdown-it-footnote\": \"^3.0.1\",\n    \"markdown-it-implicit-figures\": \"^0.9.0\",\n    \"markdown-it-imsize\": \"^2.0.1\",\n    \"markdown-it-katex\": \"^2.0.3\",\n    \"markdown-it-ruby\": \"^0.1.1\",\n    \"markdown-it-table-of-contents\": \"^0.4.4\",\n    \"mathjax\": \"^3.0.1\",\n    \"mobx\": \"^5.9.0\",\n    \"mobx-react\": \"^5.4.3\",\n    \"prettier\": \"^1.19.1\",\n    \"qiniu-js\": \"^2.5.4\",\n    \"react\": \"16.10.2\",\n    \"react-dom\": \"16.10.2\",\n    \"react-helmet\": \"^5.2.1\",\n    \"sitdown\": \"^1.1.3\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.6.2\",\n    \"@babel/core\": \"7.2.2\",\n    \"@storybook/react\": \"^4.1.11\",\n    \"@svgr/webpack\": \"^4.1.0\",\n    \"babel-core\": \"7.0.0-bridge.0\",\n    \"babel-eslint\": \"^9.0.0\",\n    \"babel-jest\": \"23.6.0\",\n    \"babel-loader\": \"8.0.5\",\n    \"babel-plugin-inline-import\": \"^3.0.0\",\n    \"babel-plugin-named-asset-import\": \"^0.3.1\",\n    \"babel-preset-react-app\": \"^7.0.1\",\n    \"bfj\": \"6.1.1\",\n    \"case-sensitive-paths-webpack-plugin\": \"2.2.0\",\n    \"chalk\": \"^2.4.2\",\n    \"chokidar\": \"^3.2.1\",\n    \"cross-env\": \"^6.0.3\",\n    \"css-loader\": \"^2.1.1\",\n    \"dotenv\": \"6.0.0\",\n    \"dotenv-expand\": \"4.2.0\",\n    \"eslint\": \"^6.5.0\",\n    \"eslint-config-airbnb\": \"^18.0.1\",\n    \"eslint-config-prettier\": \"^6.3.0\",\n    \"eslint-config-react-app\": \"^3.0.7\",\n    \"eslint-loader\": \"^2.1.1\",\n    \"eslint-plugin-babel\": \"^5.3.0\",\n    \"eslint-plugin-flowtype\": \"2.50.1\",\n    \"eslint-plugin-import\": \"^2.14.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.1.2\",\n    \"eslint-plugin-prettier\": \"^3.1.1\",\n    \"eslint-plugin-react\": \"^7.12.4\",\n    \"file-loader\": \"2.0.0\",\n    \"fork-ts-checker-webpack-plugin-alt\": \"0.4.14\",\n    \"fs-extra\": \"7.0.1\",\n    \"html-webpack-plugin\": \"4.0.0-alpha.2\",\n    \"husky\": \"^3.0.7\",\n    \"identity-obj-proxy\": \"3.0.0\",\n    \"jest\": \"23.6.0\",\n    \"jest-pnp-resolver\": \"1.0.2\",\n    \"jest-resolve\": \"23.6.0\",\n    \"jest-watch-typeahead\": \"^0.2.1\",\n    \"lint-staged\": \"^9.4.0\",\n    \"mini-css-extract-plugin\": \"0.5.0\",\n    \"optimize-css-assets-webpack-plugin\": \"5.0.1\",\n    \"pnp-webpack-plugin\": \"1.2.1\",\n    \"postcss-flexbugs-fixes\": \"4.1.0\",\n    \"postcss-loader\": \"3.0.0\",\n    \"postcss-preset-env\": \"6.5.0\",\n    \"postcss-safe-parser\": \"4.0.1\",\n    \"pretty-quick\": \"^1.11.1\",\n    \"raw-loader\": \"^4.0.0\",\n    \"react-app-polyfill\": \"^0.2.1\",\n    \"react-dev-utils\": \"^7.0.3\",\n    \"resolve\": \"1.10.0\",\n    \"sass-loader\": \"7.1.0\",\n    \"shelljs\": \"^0.8.3\",\n    \"source-map-explorer\": \"^2.0.1\",\n    \"style-loader\": \"0.23.1\",\n    \"styled-jsx\": \"^3.2.1\",\n    \"terser-webpack-plugin\": \"1.2.2\",\n    \"thread-loader\": \"^2.1.3\",\n    \"to-string-loader\": \"^1.1.5\",\n    \"url-loader\": \"1.1.2\",\n    \"webpack\": \"4.28.3\",\n    \"webpack-dev-server\": \"3.1.14\",\n    \"webpack-manifest-plugin\": \"2.0.4\",\n    \"workbox-webpack-plugin\": \"3.6.3\"\n  },\n  \"build\": {\n    \"productName\": \"Markdown Nice\",\n    \"appId\": \"com.mdnice.www\",\n    \"mac\": {\n      \"target\": [\n        \"dmg\",\n        \"zip\"\n      ]\n    },\n    \"win\": {\n      \"target\": [\n        \"nsis\",\n        \"zip\"\n      ]\n    },\n    \"files\": [\n      \"build\",\n      \"main.js\",\n      \"package.json\"\n    ]\n  },\n  \"eslintConfig\": {\n    \"extends\": \"react-app\"\n  },\n  \"browserslist\": [\n    \">0.2%\",\n    \"not dead\",\n    \"not ie <= 11\",\n    \"not op_mini all\"\n  ],\n  \"jest\": {\n    \"collectCoverageFrom\": [\n      \"src/**/*.{js,jsx,ts,tsx}\",\n      \"!src/**/*.d.ts\"\n    ],\n    \"resolver\": \"jest-pnp-resolver\",\n    \"setupFiles\": [\n      \"react-app-polyfill/jsdom\"\n    ],\n    \"testMatch\": [\n      \"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}\",\n      \"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,ts,tsx}\"\n    ],\n    \"testEnvironment\": \"jsdom\",\n    \"testURL\": \"http://localhost\",\n    \"transform\": {\n      \"^.+\\\\.(js|jsx|ts|tsx)$\": \"<rootDir>/node_modules/babel-jest\",\n      \"^.+\\\\.css$\": \"<rootDir>/config/jest/cssTransform.js\",\n      \"^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)\": \"<rootDir>/config/jest/fileTransform.js\"\n    },\n    \"transformIgnorePatterns\": [\n      \"[/\\\\\\\\]node_modules[/\\\\\\\\].+\\\\.(js|jsx|ts|tsx)$\",\n      \"^.+\\\\.module\\\\.(css|sass|scss)$\"\n    ],\n    \"moduleNameMapper\": {\n      \"^react-native$\": \"react-native-web\",\n      \"^.+\\\\.module\\\\.(css|sass|scss)$\": \"identity-obj-proxy\"\n    },\n    \"moduleFileExtensions\": [\n      \"web.js\",\n      \"js\",\n      \"web.ts\",\n      \"ts\",\n      \"web.tsx\",\n      \"tsx\",\n      \"json\",\n      \"web.jsx\",\n      \"jsx\",\n      \"node\"\n    ],\n    \"watchPlugins\": []\n  },\n  \"babel\": {\n    \"presets\": [\n      \"@babel/react\"\n    ],\n    \"plugins\": [\n      [\n        \"@babel/plugin-proposal-decorators\",\n        {\n          \"legacy\": true\n        }\n      ],\n      [\n        \"@babel/plugin-proposal-class-properties\",\n        {\n          \"loose\": true\n        }\n      ]\n    ],\n    \"env\": {\n      \"production\": {\n        \"plugins\": [\n          [\n            \"babel-plugin-inline-import\",\n            {\n              \"extensions\": [\n                \".md\"\n              ]\n            }\n          ]\n        ]\n      }\n    }\n  },\n  \"husky\": {\n    \"hooks\": {\n      \"pre-commit\": \"lint-staged\"\n    }\n  },\n  \"lint-staged\": {\n    \"src/**/*.{jsx,txs,ts,js,json}\": [\n      \"prettier --write\",\n      \"eslint --fix\",\n      \"git add\"\n    ]\n  }\n}\n"
  },
  {
    "path": "public/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.svg\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\" />\n    <meta name=\"theme-color\" content=\"#000000\" />\n    <!--\n      manifest.json provides metadata used when your web app is added to the\n      homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/\n    -->\n    <link rel=\"manifest\" href=\"%PUBLIC_URL%/manifest.json\" />\n    <!--\n      Notice the use of %PUBLIC_URL% in the tags above.\n      It will be replaced with the URL of the `public` folder during the build.\n      Only files inside the `public` folder can be referenced from the HTML.\n\n      Unlike \"/favicon.ico\" or \"favicon.ico\", \"%PUBLIC_URL%/favicon.ico\" will\n      work correctly both with client-side routing and a non-root public URL.\n      Learn how to configure a non-root public URL by running `npm run build`.\n    -->\n\n    <title>让微信排版变Nice</title>\n  </head>\n\n  <body>\n    <noscript>You need to enable JavaScript to run this app.</noscript>\n    <div id=\"root\"></div>\n\n    <!--\n      This HTML file is a template.\n      If you open it directly in the browser, you will see an empty page.\n\n      You can add webfonts, meta tags, or analytics to this file.\n      The build step will place the bundled scripts into the <body> tag.\n\n      To begin the development, run `npm start` or `yarn start`.\n      To create a production bundle, use `npm run build` or `yarn build`.\n    -->\n  </body>\n</html>\n"
  },
  {
    "path": "public/manifest.json",
    "content": "{\n  \"short_name\": \"Markdown Nice\",\n  \"name\": \"Markdown Nice\",\n  \"icons\": [\n    {\n      \"sizes\": \"128x128\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"start_url\": \"./index.html\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "scripts/build.js",
    "content": "'use strict';\n\n// Do this as the first thing so that any code reading it knows the right env.\nprocess.env.BABEL_ENV = 'production';\nprocess.env.NODE_ENV = 'production';\n\n// Makes the script crash on unhandled rejections instead of silently\n// ignoring them. In the future, promise rejections that are not handled will\n// terminate the Node.js process with a non-zero exit code.\nprocess.on('unhandledRejection', err => {\n  throw err;\n});\n\n// Ensure environment variables are read.\nrequire('../config/env');\n\n\nconst path = require('path');\nconst chalk = require('react-dev-utils/chalk');\nconst fs = require('fs-extra');\nconst webpack = require('webpack');\nconst bfj = require('bfj');\nconst configFactory = require('../config/webpack.config');\nconst paths = require('../config/paths');\nconst checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');\nconst formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');\nconst printHostingInstructions = require('react-dev-utils/printHostingInstructions');\nconst FileSizeReporter = require('react-dev-utils/FileSizeReporter');\nconst printBuildError = require('react-dev-utils/printBuildError');\n\nconst measureFileSizesBeforeBuild =\n  FileSizeReporter.measureFileSizesBeforeBuild;\nconst printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;\nconst useYarn = fs.existsSync(paths.yarnLockFile);\n\n// These sizes are pretty large. We'll warn for bundles exceeding them.\nconst WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;\nconst WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;\n\nconst isInteractive = process.stdout.isTTY;\n\n// Warn and crash if required files are missing\nif (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {\n  process.exit(1);\n}\n\n// Process CLI arguments\nconst argv = process.argv.slice(2);\nconst writeStatsJson = argv.indexOf('--stats') !== -1;\n\n// Generate configuration\nconst config = configFactory('production');\n\n// We require that you explicitly set browsers and do not fall back to\n// browserslist defaults.\nconst { checkBrowsers } = require('react-dev-utils/browsersHelper');\ncheckBrowsers(paths.appPath, isInteractive)\n  .then(() => {\n    // First, read the current file sizes in build directory.\n    // This lets us display how much they changed later.\n    return measureFileSizesBeforeBuild(paths.appBuild);\n  })\n  .then(previousFileSizes => {\n    // Remove all content but keep the directory so that\n    // if you're in it, you don't end up in Trash\n    fs.emptyDirSync(paths.appBuild);\n    // Merge with the public folder\n    copyPublicFolder();\n    // Start the webpack build\n    return build(previousFileSizes);\n  })\n  .then(\n    ({ stats, previousFileSizes, warnings }) => {\n      if (warnings.length) {\n        console.log(chalk.yellow('Compiled with warnings.\\n'));\n        console.log(warnings.join('\\n\\n'));\n        console.log(\n          '\\nSearch for the ' +\n            chalk.underline(chalk.yellow('keywords')) +\n            ' to learn more about each warning.'\n        );\n        console.log(\n          'To ignore, add ' +\n            chalk.cyan('// eslint-disable-next-line') +\n            ' to the line before.\\n'\n        );\n      } else {\n        console.log(chalk.green('Compiled successfully.\\n'));\n      }\n\n      console.log('File sizes after gzip:\\n');\n      printFileSizesAfterBuild(\n        stats,\n        previousFileSizes,\n        paths.appBuild,\n        WARN_AFTER_BUNDLE_GZIP_SIZE,\n        WARN_AFTER_CHUNK_GZIP_SIZE\n      );\n      console.log();\n\n      const appPackage = require(paths.appPackageJson);\n      const publicUrl = paths.publicUrl;\n      const publicPath = config.output.publicPath;\n      const buildFolder = path.relative(process.cwd(), paths.appBuild);\n      printHostingInstructions(\n        appPackage,\n        publicUrl,\n        publicPath,\n        buildFolder,\n        useYarn\n      );\n    },\n    err => {\n      console.log(chalk.red('Failed to compile.\\n'));\n      printBuildError(err);\n      process.exit(1);\n    }\n  )\n  .catch(err => {\n    if (err && err.message) {\n      console.log(err.message);\n    }\n    process.exit(1);\n  });\n\n// Create the production build and print the deployment instructions.\nfunction build(previousFileSizes) {\n  console.log('Creating an optimized production build...');\n\n  let compiler = webpack(config);\n  return new Promise((resolve, reject) => {\n    compiler.run((err, stats) => {\n      let messages;\n      if (err) {\n        if (!err.message) {\n          return reject(err);\n        }\n        messages = formatWebpackMessages({\n          errors: [err.message],\n          warnings: [],\n        });\n      } else {\n        messages = formatWebpackMessages(\n          stats.toJson({ all: false, warnings: true, errors: true })\n        );\n      }\n      if (messages.errors.length) {\n        // Only keep the first error. Others are often indicative\n        // of the same problem, but confuse the reader with noise.\n        if (messages.errors.length > 1) {\n          messages.errors.length = 1;\n        }\n        return reject(new Error(messages.errors.join('\\n\\n')));\n      }\n      if (\n        process.env.CI &&\n        (typeof process.env.CI !== 'string' ||\n          process.env.CI.toLowerCase() !== 'false') &&\n        messages.warnings.length\n      ) {\n        console.log(\n          chalk.yellow(\n            '\\nTreating warnings as errors because process.env.CI = true.\\n' +\n              'Most CI servers set it automatically.\\n'\n          )\n        );\n        return reject(new Error(messages.warnings.join('\\n\\n')));\n      }\n\n      const resolveArgs = {\n        stats,\n        previousFileSizes,\n        warnings: messages.warnings,\n      };\n      if (writeStatsJson) {\n        return bfj\n          .write(paths.appBuild + '/bundle-stats.json', stats.toJson())\n          .then(() => resolve(resolveArgs))\n          .catch(error => reject(new Error(error)));\n      }\n\n      return resolve(resolveArgs);\n    });\n  });\n}\n\nfunction copyPublicFolder() {\n  fs.copySync(paths.appPublic, paths.appBuild, {\n    dereference: true,\n    filter: file => file !== paths.appHtml,\n  });\n}\n"
  },
  {
    "path": "scripts/start.js",
    "content": "'use strict';\n\n// Do this as the first thing so that any code reading it knows the right env.\nprocess.env.BABEL_ENV = 'development';\nprocess.env.NODE_ENV = 'development';\n\n// Makes the script crash on unhandled rejections instead of silently\n// ignoring them. In the future, promise rejections that are not handled will\n// terminate the Node.js process with a non-zero exit code.\nprocess.on('unhandledRejection', err => {\n  throw err;\n});\n\n// Ensure environment variables are read.\nrequire('../config/env');\n\n\nconst fs = require('fs');\nconst chalk = require('react-dev-utils/chalk');\nconst webpack = require('webpack');\nconst WebpackDevServer = require('webpack-dev-server');\nconst clearConsole = require('react-dev-utils/clearConsole');\nconst checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');\nconst {\n  choosePort,\n  createCompiler,\n  prepareProxy,\n  prepareUrls,\n} = require('react-dev-utils/WebpackDevServerUtils');\nconst openBrowser = require('react-dev-utils/openBrowser');\nconst paths = require('../config/paths');\nconst configFactory = require('../config/webpack.config');\nconst createDevServerConfig = require('../config/webpackDevServer.config');\n\nconst useYarn = fs.existsSync(paths.yarnLockFile);\nconst isInteractive = process.stdout.isTTY;\n\n// Warn and crash if required files are missing\nif (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {\n  process.exit(1);\n}\n\n// Tools like Cloud9 rely on this.\nconst DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;\nconst HOST = process.env.HOST || '0.0.0.0';\n\nif (process.env.HOST) {\n  console.log(\n    chalk.cyan(\n      `Attempting to bind to HOST environment variable: ${chalk.yellow(\n        chalk.bold(process.env.HOST)\n      )}`\n    )\n  );\n  console.log(\n    `If this was unintentional, check that you haven't mistakenly set it in your shell.`\n  );\n  console.log(\n    `Learn more here: ${chalk.yellow('http://bit.ly/CRA-advanced-config')}`\n  );\n  console.log();\n}\n\n// We require that you explictly set browsers and do not fall back to\n// browserslist defaults.\nconst { checkBrowsers } = require('react-dev-utils/browsersHelper');\ncheckBrowsers(paths.appPath, isInteractive)\n  .then(() => {\n    // We attempt to use the default port but if it is busy, we offer the user to\n    // run on a different port. `choosePort()` Promise resolves to the next free port.\n    return choosePort(HOST, DEFAULT_PORT);\n  })\n  .then(port => {\n    if (port == null) {\n      // We have not found a port.\n      return;\n    }\n    const config = configFactory('development');\n    const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';\n    const appName = require(paths.appPackageJson).name;\n    const urls = prepareUrls(protocol, HOST, port);\n    // Create a webpack compiler that is configured with custom messages.\n    const compiler = createCompiler(webpack, config, appName, urls, useYarn);\n    // Load proxy config\n    const proxySetting = require(paths.appPackageJson).proxy;\n    const proxyConfig = prepareProxy(proxySetting, paths.appPublic);\n    // Serve webpack assets generated by the compiler over a web server.\n    const serverConfig = createDevServerConfig(\n      proxyConfig,\n      urls.lanUrlForConfig\n    );\n    const devServer = new WebpackDevServer(compiler, serverConfig);\n    // Launch WebpackDevServer.\n    devServer.listen(port, HOST, err => {\n      if (err) {\n        return console.log(err);\n      }\n      if (isInteractive) {\n        clearConsole();\n      }\n      console.log(chalk.cyan('Starting the development server...\\n'));\n      openBrowser(urls.localUrlForBrowser);\n    });\n\n    ['SIGINT', 'SIGTERM'].forEach(function(sig) {\n      process.on(sig, function() {\n        devServer.close();\n        process.exit();\n      });\n    });\n  })\n  .catch(err => {\n    if (err && err.message) {\n      console.log(err.message);\n    }\n    process.exit(1);\n  });\n"
  },
  {
    "path": "scripts/test.js",
    "content": "'use strict';\n\n// Do this as the first thing so that any code reading it knows the right env.\nprocess.env.BABEL_ENV = 'test';\nprocess.env.NODE_ENV = 'test';\nprocess.env.PUBLIC_URL = '';\n\n// Makes the script crash on unhandled rejections instead of silently\n// ignoring them. In the future, promise rejections that are not handled will\n// terminate the Node.js process with a non-zero exit code.\nprocess.on('unhandledRejection', err => {\n  throw err;\n});\n\n// Ensure environment variables are read.\nrequire('../config/env');\n\n\nconst jest = require('jest');\nconst execSync = require('child_process').execSync;\nlet argv = process.argv.slice(2);\n\nfunction isInGitRepository() {\n  try {\n    execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });\n    return true;\n  } catch (e) {\n    return false;\n  }\n}\n\nfunction isInMercurialRepository() {\n  try {\n    execSync('hg --cwd . root', { stdio: 'ignore' });\n    return true;\n  } catch (e) {\n    return false;\n  }\n}\n\n// Watch unless on CI, in coverage mode, explicitly adding `--no-watch`,\n// or explicitly running all tests\nif (\n  !process.env.CI &&\n  argv.indexOf('--coverage') === -1 &&\n  argv.indexOf('--no-watch') === -1 &&\n  argv.indexOf('--watchAll') === -1\n) {\n  // https://github.com/facebook/create-react-app/issues/5210\n  const hasSourceControl = isInGitRepository() || isInMercurialRepository();\n  argv.push(hasSourceControl ? '--watch' : '--watchAll');\n}\n\n// Jest doesn't have this option so we'll remove it\nif (argv.indexOf('--no-watch') !== -1) {\n  argv = argv.filter(arg => arg !== '--no-watch');\n}\n\n\njest.run(argv);\n"
  },
  {
    "path": "src/App.css",
    "content": ".nice-app {\n  height: 100vh;\n  width: 100%;\n  display: flex;\n  flex-direction: column;\n  font-family: \"PingFang SC\", BlinkMacSystemFont, Roboto, \"Helvetica Neue\", sans-serifhtml, body;\n  font-size: 16px;\n}\n\n.nice-text-container {\n  display: flex;\n  height: calc(100vh - 50px);\n  width: 100%;\n}\n\n.nice-text-container-immersive {\n  display: flex;\n  height: 100vh;\n  width: 100%;\n}\n\n.nice-md-editing-immersive {\n  padding: 0px;\n  width: 100%;\n}\n\n.nice-md-editing-immersive .CodeMirror-lines {\n  padding: 20px;\n}\n\n@media screen and (min-width: 768px) {\n  .nice-md-editing-immersive .CodeMirror-lines {\n    padding: 20px 10%;\n  }\n}\n\n@media screen and (min-width: 1024px) {\n  .nice-md-editing-immersive .CodeMirror-lines {\n    padding: 20px 15%;\n  }\n}\n\n/* 编辑器最多会被分成三份width:33.3%，当两份时根据flex-grow:1伸展 */\n.nice-md-editing,\n.nice-style-editing {\n  position: relative;\n  width: 33.3%;\n  flex-grow: 1;\n  word-wrap: break-word;\n  z-index: 1;\n}\n\n.nice-marked-text {\n  display: flex;\n  justify-content: center;\n  width: 33.3%;\n  flex-grow: 1;\n  padding: 20px;\n  word-wrap: break-word;\n  position: relative;\n}\n\n.nice-marked-text-pc {\n  padding: 0;\n}\n\n.nice-wx-box {\n  overflow-y: auto;\n  padding: 25px 20px;\n  height: 100%;\n  width: 375px;\n  box-shadow: 0 0 60px rgba(0, 0, 0, 0.1);\n}\n\n.nice-wx-box-pc {\n  width: 100%;\n  padding: 20px 35px 20px 20px;\n  box-shadow: none;\n}\n\n.nice-style-editing-hide {\n  display: none;\n}\n\n.nice-md-editing-hide {\n  display: none;\n}\n\n.nice-marked-text-hide {\n  display: none;\n}\n\n::-webkit-scrollbar {\n  width: 6px;\n  height: 6px;\n}\n::-webkit-scrollbar-track {\n  border-radius: 3px;\n  background: rgba(0, 0, 0, 0.06);\n  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.08);\n}\n::-webkit-scrollbar-thumb {\n  border-radius: 3px;\n  background: rgba(0, 0, 0, 0.12);\n  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);\n}\n\n@media print {\n  .nice-md-editing {\n    display: none;\n  }\n  .nice-navbar {\n    display: none;\n  }\n  .nice-sidebar {\n    display: none;\n  }\n  .nice-wx-box {\n    overflow: visible;\n    box-shadow: none;\n    width: 100%;\n  }\n  .nice-style-editing {\n    display: none;\n  }\n  #nice-rich-text {\n    padding: 0 !important;\n  }\n  .nice-footer-container {\n    display: none;\n  }\n}\n"
  },
  {
    "path": "src/App.js",
    "content": "import React, {Component} from \"react\";\nimport CodeMirror from \"@uiw/react-codemirror\";\nimport \"codemirror/addon/search/searchcursor\";\nimport \"codemirror/keymap/sublime\";\nimport \"antd/dist/antd.css\";\nimport {observer, inject} from \"mobx-react\";\nimport classnames from \"classnames\";\nimport throttle from \"lodash.throttle\";\n\nimport Dialog from \"./layout/Dialog\";\nimport Navbar from \"./layout/Navbar\";\nimport Footer from \"./layout/Footer\";\nimport Sidebar from \"./layout/Sidebar\";\nimport StyleEditor from \"./layout/StyleEditor\";\nimport EditorMenu from \"./layout/EditorMenu\";\nimport SearchBox from \"./component/SearchBox\";\n\nimport \"./App.css\";\nimport \"./utils/mdMirror.css\";\n\nimport {\n  LAYOUT_ID,\n  BOX_ID,\n  IMAGE_HOSTING_NAMES,\n  IMAGE_HOSTING_TYPE,\n  MJX_DATA_FORMULA,\n  MJX_DATA_FORMULA_TYPE,\n  MAX_MD_NUMBER,\n  THROTTLE_MATHJAX_TIME,\n  THROTTLE_MD_RENDER_TIME,\n} from \"./utils/constant\";\nimport {markdownParser, updateMathjax} from \"./utils/helper\";\nimport pluginCenter from \"./utils/pluginCenter\";\nimport appContext from \"./utils/appContext\";\nimport {uploadAdaptor} from \"./utils/imageHosting\";\nimport bindHotkeys, {betterTab, rightClick} from \"./utils/hotkey\";\nimport {message} from \"antd\";\n\n@inject(\"content\")\n@inject(\"navbar\")\n@inject(\"footer\")\n@inject(\"view\")\n@inject(\"dialog\")\n@inject(\"imageHosting\")\n@observer\nclass App extends Component {\n  constructor(props) {\n    super(props);\n    this.scale = 1;\n    this.handleUpdateMathjax = throttle(updateMathjax, THROTTLE_MATHJAX_TIME);\n    this.handleThrottleChange = throttle(this.handleChange, THROTTLE_MD_RENDER_TIME);\n    this.state = {\n      focus: false,\n    };\n  }\n\n  componentDidMount() {\n    document.addEventListener(\"fullscreenchange\", this.solveScreenChange);\n    document.addEventListener(\"webkitfullscreenchange\", this.solveScreenChange);\n    document.addEventListener(\"mozfullscreenchange\", this.solveScreenChange);\n    document.addEventListener(\"MSFullscreenChange\", this.solveScreenChange);\n    try {\n      window.MathJax = {\n        tex: {\n          inlineMath: [[\"$\", \"$\"]],\n          displayMath: [[\"$$\", \"$$\"]],\n          tags: \"ams\",\n        },\n        svg: {\n          fontCache: \"none\",\n        },\n        options: {\n          renderActions: {\n            addMenu: [0, \"\", \"\"],\n            addContainer: [\n              190,\n              (doc) => {\n                for (const math of doc.math) {\n                  this.addContainer(math, doc);\n                }\n              },\n              this.addContainer,\n            ],\n          },\n        },\n      };\n      // eslint-disable-next-line\n      require(\"mathjax/es5/tex-svg-full\");\n      pluginCenter.mathjax = true;\n    } catch (e) {\n      console.log(e);\n    }\n    this.setEditorContent();\n    this.setCustomImageHosting();\n  }\n\n  componentDidUpdate() {\n    if (pluginCenter.mathjax) {\n      this.handleUpdateMathjax();\n    }\n  }\n\n  componentWillUnmount() {\n    document.removeEventListener(\"fullscreenchange\", this.solveScreenChange);\n    document.removeEventListener(\"webkitfullscreenchange\", this.solveScreenChange);\n    document.removeEventListener(\"mozfullscreenchange\", this.solveScreenChange);\n    document.removeEventListener(\"MSFullscreenChange\", this.solveScreenChange);\n  }\n\n  setCustomImageHosting = () => {\n    if (this.props.useImageHosting === undefined) {\n      return;\n    }\n    const {url, name, isSmmsOpen, isQiniuyunOpen, isAliyunOpen, isGiteeOpen, isGitHubOpen} = this.props.useImageHosting;\n    if (name) {\n      this.props.imageHosting.setHostingUrl(url);\n      this.props.imageHosting.setHostingName(name);\n      this.props.imageHosting.addImageHosting(name);\n    }\n    if (isSmmsOpen) {\n      this.props.imageHosting.addImageHosting(IMAGE_HOSTING_NAMES.smms);\n    }\n    if (isAliyunOpen) {\n      this.props.imageHosting.addImageHosting(IMAGE_HOSTING_NAMES.aliyun);\n    }\n    if (isQiniuyunOpen) {\n      this.props.imageHosting.addImageHosting(IMAGE_HOSTING_NAMES.qiniuyun);\n    }\n    if (isGiteeOpen) {\n      this.props.imageHosting.addImageHosting(IMAGE_HOSTING_NAMES.gitee);\n    }\n    if (isGitHubOpen) {\n      this.props.imageHosting.addImageHosting(IMAGE_HOSTING_NAMES.github);\n    }\n\n    // 第一次进入没有默认图床时\n    if (window.localStorage.getItem(IMAGE_HOSTING_TYPE) === null) {\n      let type;\n      if (name) {\n        type = name;\n      } else if (isSmmsOpen) {\n        type = IMAGE_HOSTING_NAMES.smms;\n      } else if (isAliyunOpen) {\n        type = IMAGE_HOSTING_NAMES.aliyun;\n      } else if (isQiniuyunOpen) {\n        type = IMAGE_HOSTING_NAMES.qiniuyun;\n      } else if (isGiteeOpen) {\n        type = IMAGE_HOSTING_NAMES.isGitee;\n      }\n      this.props.imageHosting.setType(type);\n      window.localStorage.setItem(IMAGE_HOSTING_TYPE, type);\n    }\n  };\n\n  setEditorContent = () => {\n    const {defaultText} = this.props;\n    if (defaultText) {\n      this.props.content.setContent(defaultText);\n    }\n  };\n\n  setCurrentIndex(index) {\n    this.index = index;\n  }\n\n  solveScreenChange = () => {\n    const {isImmersiveEditing} = this.props.view;\n    this.props.view.setImmersiveEditing(!isImmersiveEditing);\n  };\n\n  getInstance = (instance) => {\n    instance.editor.on(\"inputRead\", function(cm, event) {\n      if (event.origin === \"paste\") {\n        var text = event.text[0]; // pasted string\n        var new_text = \"\"; // any operations here\n        cm.refresh();\n        const {length} = cm.getSelections();\n        // my first idea was\n        // note: for multiline strings may need more complex calculations\n        cm.replaceRange(new_text, event.from, {line: event.from.line, ch: event.from.ch + text.length});\n        // first solution did'nt work (before i guess to call refresh) so i tried that way, works too\n        if (length === 1) {\n          cm.execCommand(\"undo\");\n        }\n        // cm.setCursor(event.from);\n        cm.replaceSelection(new_text);\n      }\n    });\n    if (instance) {\n      this.props.content.setMarkdownEditor(instance.editor);\n    }\n  };\n\n  handleScroll = () => {\n    if (this.props.navbar.isSyncScroll) {\n      const {markdownEditor} = this.props.content;\n      const cmData = markdownEditor.getScrollInfo();\n      const editorToTop = cmData.top;\n      const editorScrollHeight = cmData.height - cmData.clientHeight;\n      this.scale = (this.previewWrap.offsetHeight - this.previewContainer.offsetHeight + 55) / editorScrollHeight;\n      if (this.index === 1) {\n        this.previewContainer.scrollTop = editorToTop * this.scale;\n      } else {\n        this.editorTop = this.previewContainer.scrollTop / this.scale;\n        markdownEditor.scrollTo(null, this.editorTop);\n      }\n    }\n  };\n\n  handleChange = (editor) => {\n    if (this.state.focus) {\n      const content = editor.getValue();\n      if (content.length > MAX_MD_NUMBER) {\n        message.error(`字符数超过 ${MAX_MD_NUMBER}`);\n        return;\n      }\n      this.props.content.setContent(content);\n      this.props.onTextChange && this.props.onTextChange(content);\n    }\n  };\n\n  handleFocus = (editor) => {\n    this.setState({\n      focus: true,\n    });\n    this.props.onTextFocus && this.props.onTextFocus(editor.getValue());\n  };\n\n  handleBlur = (editor) => {\n    this.setState({\n      focus: false,\n    });\n    this.props.onTextBlur && this.props.onTextBlur(editor.getValue());\n  };\n\n  getStyleInstance = (instance) => {\n    if (instance) {\n      this.styleEditor = instance.editor;\n      this.styleEditor.on(\"keyup\", (cm, e) => {\n        if ((e.keyCode >= 65 && e.keyCode <= 90) || e.keyCode === 189) {\n          cm.showHint(e);\n        }\n      });\n    }\n  };\n\n  handleDrop = (instance, e) => {\n    // e.preventDefault();\n    // console.log(e.dataTransfer.files[0]);\n    if (!(e.dataTransfer && e.dataTransfer.files)) {\n      return;\n    }\n    for (let i = 0; i < e.dataTransfer.files.length; i++) {\n      // console.log(e.dataTransfer.files[i]);\n      uploadAdaptor({file: e.dataTransfer.files[i], content: this.props.content});\n    }\n  };\n\n  handlePaste = (instance, e) => {\n    const cbData = e.clipboardData;\n\n    const insertPasteContent = (cm, content) => {\n      const {length} = cm.getSelections();\n      cm.replaceSelections(Array(length).fill(content));\n      this.setState(\n        {\n          focus: true,\n        },\n        () => {\n          this.handleThrottleChange(cm);\n        },\n      );\n    };\n\n    if (e.clipboardData && e.clipboardData.files) {\n      for (let i = 0; i < e.clipboardData.files.length; i++) {\n        uploadAdaptor({file: e.clipboardData.files[i], content: this.props.content});\n      }\n    }\n\n    if (cbData) {\n      const html = cbData.getData(\"text/html\");\n      const text = cbData.getData(\"TEXT\");\n      insertPasteContent(instance, text);\n      if (html) {\n        this.props.footer.setPasteHtmlChecked(true);\n        this.props.footer.setPasteHtml(html);\n        this.props.footer.setPasteText(text);\n      } else {\n        this.props.footer.setPasteHtmlChecked(false);\n      }\n    }\n  };\n\n  addContainer(math, doc) {\n    const tag = \"span\";\n    const spanClass = math.display ? \"span-block-equation\" : \"span-inline-equation\";\n    const cls = math.display ? \"block-equation\" : \"inline-equation\";\n    math.typesetRoot.className = cls;\n    math.typesetRoot.setAttribute(MJX_DATA_FORMULA, math.math);\n    math.typesetRoot.setAttribute(MJX_DATA_FORMULA_TYPE, cls);\n    math.typesetRoot = doc.adaptor.node(tag, {class: spanClass, style: \"cursor:pointer\"}, [math.typesetRoot]);\n  }\n\n  render() {\n    const {previewType} = this.props.navbar;\n    const {isEditAreaOpen, isPreviewAreaOpen, isStyleEditorOpen, isImmersiveEditing} = this.props.view;\n    const {isSearchOpen} = this.props.dialog;\n\n    const parseHtml = markdownParser.render(this.props.content.content);\n\n    const mdEditingClass = classnames({\n      \"nice-md-editing\": !isImmersiveEditing,\n      \"nice-md-editing-immersive\": isImmersiveEditing,\n      \"nice-md-editing-hide\": !isEditAreaOpen,\n    });\n\n    const styleEditingClass = classnames({\n      \"nice-style-editing\": true,\n      \"nice-style-editing-hide\": isImmersiveEditing,\n    });\n\n    const richTextClass = classnames({\n      \"nice-marked-text\": true,\n      \"nice-marked-text-pc\": previewType === \"pc\",\n      \"nice-marked-text-hide\": isImmersiveEditing || !isPreviewAreaOpen,\n    });\n\n    const richTextBoxClass = classnames({\n      \"nice-wx-box\": true,\n      \"nice-wx-box-pc\": previewType === \"pc\",\n    });\n\n    const textContainerClass = classnames({\n      \"nice-text-container\": !isImmersiveEditing,\n      \"nice-text-container-immersive\": isImmersiveEditing,\n    });\n\n    return (\n      <appContext.Consumer>\n        {({defaultTitle, onStyleChange, onStyleBlur, onStyleFocus, token}) => (\n          <div className=\"nice-app\">\n            <Navbar title={defaultTitle} token={token} />\n            <div className={textContainerClass}>\n              <div id=\"nice-md-editor\" className={mdEditingClass} onMouseOver={(e) => this.setCurrentIndex(1, e)}>\n                {isSearchOpen && <SearchBox />}\n                <CodeMirror\n                  value={this.props.content.content}\n                  options={{\n                    theme: \"md-mirror\",\n                    keyMap: \"sublime\",\n                    mode: \"markdown\",\n                    lineWrapping: true,\n                    lineNumbers: false,\n                    extraKeys: {\n                      ...bindHotkeys(this.props.content, this.props.dialog),\n                      Tab: betterTab,\n                      RightClick: rightClick,\n                    },\n                  }}\n                  onChange={this.handleThrottleChange}\n                  onScroll={this.handleScroll}\n                  onFocus={this.handleFocus}\n                  onBlur={this.handleBlur}\n                  onDrop={this.handleDrop}\n                  onPaste={this.handlePaste}\n                  ref={this.getInstance}\n                />\n              </div>\n              <div id=\"nice-rich-text\" className={richTextClass} onMouseOver={(e) => this.setCurrentIndex(2, e)}>\n                <Sidebar />\n                <div\n                  id={BOX_ID}\n                  className={richTextBoxClass}\n                  onScroll={this.handleScroll}\n                  ref={(node) => {\n                    this.previewContainer = node;\n                  }}\n                >\n                  <section\n                    id={LAYOUT_ID}\n                    data-tool=\"mdnice编辑器\"\n                    data-website=\"https://www.mdnice.com\"\n                    dangerouslySetInnerHTML={{\n                      __html: parseHtml,\n                    }}\n                    ref={(node) => {\n                      this.previewWrap = node;\n                    }}\n                  />\n                </div>\n              </div>\n\n              {isStyleEditorOpen && (\n                <div id=\"nice-style-editor\" className={styleEditingClass}>\n                  <StyleEditor onStyleChange={onStyleChange} onStyleBlur={onStyleBlur} onStyleFocus={onStyleFocus} />\n                </div>\n              )}\n\n              <Dialog />\n              <EditorMenu />\n            </div>\n            <Footer />\n          </div>\n        )}\n      </appContext.Consumer>\n    );\n  }\n}\n\nexport default App;\n"
  },
  {
    "path": "src/App.test.js",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './App';\n\nit('renders without crashing', () => {\n  const div = document.createElement('div');\n  ReactDOM.render(<App />, div);\n  ReactDOM.unmountComponentAtNode(div);\n});\n"
  },
  {
    "path": "src/Lib.js",
    "content": "import React, {Component} from \"react\";\nimport PropTypes from \"prop-types\";\nimport {Result} from \"antd\";\nimport {Provider} from \"mobx-react\";\n\nimport \"./index.css\";\n\nimport App from \"./App\";\n\nimport content from \"./store/content\";\nimport userInfo from \"./store/userInfo\";\nimport navbar from \"./store/navbar\";\nimport footer from \"./store/footer\";\nimport dialog from \"./store/dialog\";\nimport imageHosting from \"./store/imageHosting\";\nimport view from \"./store/view\";\n\nimport {isPC} from \"./utils/helper\";\nimport appContext from \"./utils/appContext\";\nimport SvgIcon from \"./icon\";\nimport {solveWeChatMath, solveZhihuMath, solveHtml} from \"./utils/converter\";\nimport {LAYOUT_ID} from \"./utils/constant\";\n\nclass Lib extends Component {\n  getWeChatHtml() {\n    const layout = document.getElementById(LAYOUT_ID); // 保护现场\n    const html = layout.innerHTML;\n    solveWeChatMath();\n    const res = solveHtml();\n    layout.innerHTML = html; // 恢复现场\n    return res;\n  }\n\n  getZhihuHtml() {\n    const layout = document.getElementById(LAYOUT_ID); // 保护现场\n    const html = layout.innerHTML;\n    solveZhihuMath();\n    const res = solveHtml();\n    layout.innerHTML = html; // 恢复现场\n    return res;\n  }\n\n  render() {\n    const {\n      defaultTitle,\n      defaultText,\n      onTextChange,\n      onTextBlur,\n      onTextFocus,\n      onStyleChange,\n      onStyleBlur,\n      onStyleFocus,\n      token,\n      useImageHosting,\n    } = this.props;\n    const appCtx = {\n      defaultTitle,\n      defaultText,\n      onTextChange,\n      onTextBlur,\n      onTextFocus,\n      onStyleChange,\n      onStyleBlur,\n      onStyleFocus,\n      token,\n      useImageHosting,\n    };\n    return (\n      <Provider\n        content={content}\n        userInfo={userInfo}\n        navbar={navbar}\n        footer={footer}\n        dialog={dialog}\n        imageHosting={imageHosting}\n        view={view}\n      >\n        {isPC() ? (\n          <appContext.Provider value={appCtx}>\n            <App\n              defaultText={defaultText}\n              onTextChange={onTextChange}\n              onTextBlur={onTextBlur}\n              onTextFocus={onTextFocus}\n              onStyleChange={onStyleChange}\n              onStyleBlur={onStyleBlur}\n              onStyleFocus={onStyleFocus}\n              useImageHosting={useImageHosting}\n              token={token}\n            />\n          </appContext.Provider>\n        ) : (\n          <Result\n            icon={<SvgIcon name=\"smile\" style={style.svgIcon} />}\n            title=\"请使用 PC 端打开排版工具\"\n            subTitle=\"更多 Markdown Nice 信息，请扫码关注公众号「编程如画」\"\n            extra={<img alt=\"\" style={{width: \"100%\"}} src=\"https://my-wechat.mdnice.com/wechat.jpg\" />}\n          />\n        )}\n      </Provider>\n    );\n  }\n}\n\nconst style = {\n  svgIcon: {\n    width: \"72px\",\n    height: \"72px\",\n  },\n};\n\nLib.defaultProps = {\n  defaultTitle: \"\",\n  defaultText: \"\",\n  onTextChange: () => {},\n  onTextBlur: () => {},\n  onTextFocus: () => {},\n  onStyleChange: () => {},\n  onStyleBlur: () => {},\n  onStyleFocus: () => {},\n  token: \"\",\n  // eslint-disable-next-line react/default-props-match-prop-types\n  useImageHosting: {\n    url: \"\",\n    name: \"\",\n    isSmmsOpen: true,\n    isQiniuyunOpen: true,\n    isAliyunOpen: true,\n    isGiteeOpen: true,\n    isGitHubOpen: true,\n  },\n};\nLib.propTypes = {\n  defaultTitle: PropTypes.string,\n  defaultText: PropTypes.string,\n  onTextChange: PropTypes.func,\n  onTextBlur: PropTypes.func,\n  onTextFocus: PropTypes.func,\n  onStyleChange: PropTypes.func,\n  onStyleBlur: PropTypes.func,\n  onStyleFocus: PropTypes.func,\n  token: PropTypes.string,\n  // eslint-disable-next-line react/require-default-props\n  useImageHosting: PropTypes.shape({\n    url: PropTypes.string,\n    name: PropTypes.string,\n    isSmmsOpen: PropTypes.bool,\n    isQiniuyunOpen: PropTypes.bool,\n    isAliyunOpen: PropTypes.bool,\n    isGiteeOpen: PropTypes.bool,\n    isGitHubOpen: PropTypes.bool,\n  }),\n};\n\nexport default Lib;\n"
  },
  {
    "path": "src/component/Dialog/AboutDialog.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Modal, Button} from \"antd\";\n\n@inject(\"dialog\")\n@observer\nclass AboutDialog extends Component {\n  handleOk = () => {\n    this.props.dialog.setAboutOpen(false);\n  };\n\n  handleCancel = () => {\n    this.props.dialog.setAboutOpen(false);\n  };\n\n  handleVersion = () => {\n    this.props.dialog.setAboutOpen(false);\n    this.props.dialog.setVersionOpen(true);\n  };\n\n  render() {\n    return (\n      <Modal\n        title=\"关于\"\n        okText=\"确认\"\n        cancelText=\"取消\"\n        visible={this.props.dialog.isAboutOpen}\n        onOk={this.handleOk}\n        onCancel={this.handleCancel}\n        footer={[\n          <Button key=\"version\" onClick={this.handleVersion}>\n            更新记录\n          </Button>,\n          <Button key=\"submit\" type=\"primary\" onClick={this.handleOk}>\n            确认\n          </Button>,\n        ]}\n        bodyStyle={{\n          paddingTop: \"5px\",\n        }}\n      >\n        <h3 style={style.headerMargin}>\n          Markdown Nice\n          <a\n            id=\"nice-about-dialog-star\"\n            rel=\"noopener noreferrer\"\n            target=\"_blank\"\n            href=\"https://github.com/mdnice/markdown-nice\"\n            style={style.noBorder}\n          >\n            <img alt=\"\" style={style.img} src=\"https://badgen.net/github/stars/mdnice/markdown-nice\" />\n          </a>\n        </h3>\n\n        <p style={style.lineHeight}>支持自定义样式的 Markdown 编辑器；</p>\n        <p style={style.lineHeight}>支持微信公众号、知乎和稀土掘金；</p>\n        <h3 style={style.headerMargin}>我们</h3>\n        <p style={style.lineHeight}>\n          如果你喜欢我们的工具，欢迎关注\n          <a\n            id=\"nice-about-dialog-github\"\n            rel=\"noopener noreferrer\"\n            target=\"_blank\"\n            href=\"https://github.com/mdnice/markdown-nice\"\n          >\n            &nbsp;GitHub&nbsp;\n          </a>\n          、\n          <a\n            id=\"nice-about-dialog-gitee\"\n            rel=\"noopener noreferrer\"\n            target=\"_blank\"\n            href=\"https://gitee.com/zhning12/markdown-nice\"\n          >\n            &nbsp;Gitee&nbsp;\n          </a>\n          和新项目\n          <a\n            id=\"nice-about-dialog-resume\"\n            style={style.a}\n            rel=\"noopener noreferrer\"\n            target=\"_blank\"\n            href=\"https://github.com/guanpengchn/markdown-resume\"\n          >\n            &nbsp;Markdown 简历\n          </a>\n          ，同时我们也组建了「\n          <strong style={style.strong}>微信群</strong>\n          」，右下角关注公众号回复「排版」拉你入群，愿意\n          <strong style={style.strong}>微信打赏</strong>\n          就更好啦。\n        </p>\n        <div style={{display: \"flex\", alignItems: \"center\"}}>\n          <img alt=\"图片描述\" style={style.leftImgWidth} src=\"https://my-wechat.mdnice.com/bonus.png\" />\n          <img alt=\"图片描述\" style={style.rightImgWidth} src=\"https://my-wechat.mdnice.com/wechat.jpg\" />\n        </div>\n      </Modal>\n    );\n  }\n}\n\nconst style = {\n  leftImgWidth: {\n    width: \"40%\",\n    height: \"100%\",\n  },\n  rightImgWidth: {\n    width: \"60%\",\n    height: \"100%\",\n  },\n  headerMargin: {\n    marginTop: \"5px\",\n    marginBottom: \"5px\",\n    color: \"black\",\n  },\n  lineHeight: {\n    lineHeight: \"26px\",\n    color: \"black\",\n    padding: 0,\n    margin: 0,\n  },\n  img: {\n    width: \"70px\",\n    marginLeft: \"10px\",\n    display: \"inline-block\",\n  },\n  noBorder: {\n    border: \"none\",\n  },\n};\n\nexport default AboutDialog;\n"
  },
  {
    "path": "src/component/Dialog/FormDialog.js",
    "content": "import React from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Modal, InputNumber, Form} from \"antd\";\n\n@inject(\"dialog\")\n@inject(\"content\")\n@observer\nclass FormDialog extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      ...initialState,\n    };\n  }\n\n  buildRow = (rowNum, columnNum) => {\n    let appendText = \"|\";\n    if (rowNum === 1) {\n      appendText += \" --- |\";\n      for (let i = 0; i < columnNum - 1; i++) {\n        appendText += \" --- |\";\n      }\n    } else {\n      appendText += \"     |\";\n      for (let i = 0; i < columnNum - 1; i++) {\n        appendText += \"     |\";\n      }\n    }\n    return appendText + (/windows|win32/i.test(navigator.userAgent) ? \"\\r\\n\" : \"\\n\");\n  };\n\n  buildFormFormat = (rowNum, columnNum) => {\n    let formFormat = \"\";\n    for (let i = 0; i < 3; i++) {\n      formFormat += this.buildRow(i, columnNum);\n    }\n    for (let i = 3; i <= rowNum; i++) {\n      formFormat += this.buildRow(i, columnNum);\n    }\n    return formFormat;\n  };\n\n  handleOk = () => {\n    const {markdownEditor} = this.props.content;\n    const cursor = markdownEditor.getCursor();\n\n    const text = this.buildFormFormat(this.state.rowNum, this.state.columnNum);\n    markdownEditor.replaceSelection(text, cursor);\n\n    const content = markdownEditor.getValue();\n    this.props.content.setContent(content);\n\n    this.handleCancel();\n    cursor.ch += 2;\n    markdownEditor.setCursor(cursor);\n    markdownEditor.focus();\n  };\n\n  handleCancel = () => {\n    this.setState(initialState);\n    this.props.dialog.setFormOpen(false);\n  };\n\n  render() {\n    return (\n      <Modal\n        title=\"添加表格\"\n        okText=\"确认\"\n        cancelText=\"取消\"\n        visible={this.props.dialog.isFormOpen}\n        onOk={this.handleOk}\n        onCancel={this.handleCancel}\n      >\n        <Form.Item label=\"行数\" labelCol={{span: 4}}>\n          <InputNumber\n            min={2}\n            max={10}\n            value={this.state.rowNum}\n            defaultValue={1}\n            onChange={(value) => this.setState({rowNum: value})}\n          />\n        </Form.Item>\n        <Form.Item label=\"列数\" labelCol={{span: 4}}>\n          <InputNumber\n            min={1}\n            max={10}\n            value={this.state.columnNum}\n            defaultValue={1}\n            onChange={(value) => this.setState({columnNum: value})}\n          />\n        </Form.Item>\n      </Modal>\n    );\n  }\n}\n\nconst initialState = {\n  columnNum: 1,\n  rowNum: 2,\n};\n\nexport default FormDialog;\n"
  },
  {
    "path": "src/component/Dialog/HistoryDialog.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Modal, Empty, message} from \"antd\";\nimport LocalHistory from \"../LocalHistory\";\nimport {AutoSaveInterval, getLocalDocuments, setLocalDocuments, setLocalDraft} from \"../LocalHistory/util\";\nimport IndexDB from \"../LocalHistory/indexdb\";\nimport debouce from \"lodash.debounce\";\n\nconst DocumentID = 1;\n\n@inject(\"dialog\")\n@inject(\"content\")\n@observer\nclass HistoryDialog extends Component {\n  timer = null;\n\n  db = null;\n\n  constructor(props) {\n    super(props);\n    this.state = {\n      documents: [],\n    };\n  }\n\n  async componentDidMount() {\n    await this.initIndexDB();\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.timer);\n  }\n\n  get editor() {\n    return this.props.content.markdownEditor;\n  }\n\n  //\n  // async UNSAFE_componentWillReceiveProps(nextProps) {\n  //   // 文档 id 变更\n  //   if (this.props.documentID !== nextProps.documentID && nextProps.documentID != null) {\n  //     if (this.db) {\n  //       await this.overrideLocalDocuments(nextProps.documentID);\n  //     }\n  //   }\n  // }\n  //\n\n  closeDialog = () => {\n    this.props.dialog.setHistoryOpen(false);\n  };\n\n  editLocalDocument = (content) => {\n    this.props.content.setContent(content);\n    message.success(\"恢复成功！\");\n    this.closeDialog();\n  };\n\n  autoSave = async (isRecent = false) => {\n    const Content = this.props.content.markdownEditor.getValue();\n    if (Content.trim() !== \"\") {\n      const document = {\n        Content,\n        DocumentID: this.props.documentID,\n        SaveTime: new Date(),\n      };\n      const setLocalDocumentMethod = isRecent && this.state.documents.length > 0 ? setLocalDraft : setLocalDocuments;\n      await setLocalDocumentMethod(this.db, this.state.documents, document);\n      await this.overrideLocalDocuments(this.props.documentID);\n    }\n  };\n\n  async initIndexDB() {\n    try {\n      const indexDB = new IndexDB({\n        name: \"mdnice-local-history\",\n        storeName: \"customers\",\n        storeOptions: {keyPath: \"id\", autoIncrement: true},\n        storeInit: (objectStore) => {\n          objectStore.createIndex(\"DocumentID\", \"DocumentID\", {unique: false});\n          objectStore.createIndex(\"SaveTime\", \"SaveTime\", {unique: false});\n        },\n      });\n      this.db = await indexDB.init();\n\n      if (this.db && this.props.documentID) {\n        await this.overrideLocalDocuments(this.props.documentID);\n      }\n      // 每隔一段时间自动保存\n      this.timer = setInterval(async () => {\n        await this.autoSave();\n      }, AutoSaveInterval);\n      // 每改变内容自动保存最近的一条\n      this.editor.on &&\n        this.editor.on(\n          \"change\",\n          debouce(async () => {\n            await this.autoSave(true);\n          }, 1000),\n        );\n    } catch (e) {\n      console.error(e);\n    }\n  }\n\n  // 刷新本地历史文档\n  async overrideLocalDocuments(documentID) {\n    const localDocuments = await getLocalDocuments(this.db, +documentID);\n    // console.log('refresh local',localDocuments);\n    this.setState({\n      documents: localDocuments,\n    });\n  }\n\n  render() {\n    return (\n      <Modal\n        className=\"nice-md-local-history\"\n        title=\"本地历史\"\n        centered\n        width={1080}\n        visible={this.props.dialog.isHistoryOpen}\n        onCancel={this.closeDialog}\n        footer={null}\n      >\n        {this.state.documents && this.state.documents.length > 0 ? (\n          <LocalHistory\n            content={this.props.content.content}\n            documents={this.state.documents}\n            documentID={this.props.documentID}\n            onEdit={this.editLocalDocument}\n            onCancel={this.closeDialog}\n          />\n        ) : (\n          <Empty style={{width: \"100%\"}} description=\"暂无本地历史\" />\n        )}\n      </Modal>\n    );\n  }\n}\n\nHistoryDialog.defaultProps = {\n  documentID: DocumentID,\n};\n\nexport default HistoryDialog;\n"
  },
  {
    "path": "src/component/Dialog/ImageDialog.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Modal, Upload, Tabs, Select} from \"antd\";\n\nimport SvgIcon from \"../../icon\";\n\nimport AliOSS from \"../ImageHosting/AliOSS\";\nimport QiniuOSS from \"../ImageHosting/QiniuOSS\";\nimport Gitee from \"../ImageHosting/Gitee\";\nimport GitHub from \"../ImageHosting/GitHub\";\n\nimport {uploadAdaptor} from \"../../utils/imageHosting\";\nimport {SM_MS_PROXY, IMAGE_HOSTING_TYPE, IMAGE_HOSTING_NAMES} from \"../../utils/constant\";\nimport appContext from \"../../utils/appContext\";\n\nconst {Dragger} = Upload;\nconst {TabPane} = Tabs;\nconst {Option} = Select;\n\n@inject(\"dialog\")\n@inject(\"content\")\n@inject(\"imageHosting\")\n@inject(\"navbar\")\n@observer\nclass ImageDialog extends Component {\n  constructor(props) {\n    super(props);\n    this.images = [];\n  }\n\n  // 确认后将内容更新到编辑器上\n  handleOk = () => {\n    let text = \"\";\n    // 成功后添加url\n    if (this.props.navbar.isContainImgName) {\n      this.images.forEach((value) => {\n        text += `![${value.filename}](${value.url})\\n`;\n      });\n    } else {\n      this.images.forEach((value) => {\n        text += `![](${value.url})\\n`;\n      });\n    }\n    // 重新初始化\n    this.images = [];\n    const {markdownEditor} = this.props.content;\n    const cursor = markdownEditor.getCursor();\n    markdownEditor.replaceSelection(text, cursor);\n    // 上传后实时更新内容\n    const content = markdownEditor.getValue();\n    this.props.content.setContent(content);\n\n    this.props.dialog.setImageOpen(false);\n    cursor.ch += 2;\n    markdownEditor.setCursor(cursor);\n    markdownEditor.focus();\n  };\n\n  handleCancel = () => {\n    this.props.dialog.setImageOpen(false);\n  };\n\n  customRequest = ({action, data, file, headers, onError, onProgress, onSuccess, withCredentials}) => {\n    const formData = new FormData();\n    const {images} = this;\n    if (data) {\n      Object.keys(data).forEach((key) => {\n        formData.append(key, data[key]);\n      });\n    }\n    // 使用阿里云图床\n    if (this.props.imageHosting.type === \"阿里云\") {\n      uploadAdaptor({file, onSuccess, onError, images});\n    }\n    // 使用七牛云图床\n    else if (this.props.imageHosting.type === \"七牛云\") {\n      uploadAdaptor({file, onSuccess, onError, onProgress, images});\n    }\n    // 使用SM.MS图床\n    else if (this.props.imageHosting.type === \"SM.MS\") {\n      uploadAdaptor({formData, file, action, onProgress, onSuccess, onError, headers, withCredentials});\n    }\n    // 使用Gitee图床\n    else if (this.props.imageHosting.type === \"Gitee\") {\n      uploadAdaptor({formData, file, action, onProgress, onSuccess, onError, headers, withCredentials, images});\n    }\n    // 使用GitHub图床\n    else if (this.props.imageHosting.type === \"GitHub\") {\n      uploadAdaptor({formData, file, action, onProgress, onSuccess, onError, headers, withCredentials, images});\n    }\n    // 使用用户提供的图床或是默认mdnice图床\n    else {\n      uploadAdaptor({formData, file, onSuccess, onError, images});\n    }\n\n    return {\n      abort() {\n        console.log(\"upload progress is aborted.\");\n      },\n    };\n  };\n\n  typeChange = (type) => {\n    this.props.imageHosting.setType(type);\n    window.localStorage.setItem(IMAGE_HOSTING_TYPE, type);\n  };\n\n  render() {\n    const {hostingList, type} = this.props.imageHosting;\n\n    const columns = hostingList.map((option, index) => (\n      <Option key={index} value={option.value}>\n        {option.label}\n      </Option>\n    ));\n\n    const imageHostingSwitch = (\n      <Select style={{width: \"90px\"}} value={type} onChange={this.typeChange}>\n        {columns}\n      </Select>\n    );\n\n    return (\n      <Modal\n        title=\"本地上传\"\n        okText=\"确认\"\n        cancelText=\"取消\"\n        visible={this.props.dialog.isImageOpen}\n        onOk={this.handleOk}\n        onCancel={this.handleCancel}\n        bodyStyle={{paddingTop: \"10px\"}}\n      >\n        <appContext.Consumer>\n          {({useImageHosting}) => (\n            <Tabs tabBarExtraContent={imageHostingSwitch} type=\"card\">\n              <TabPane tab=\"图片上传\" key=\"1\">\n                <Dragger name=\"file\" multiple action={SM_MS_PROXY} customRequest={this.customRequest}>\n                  <p className=\"ant-upload-drag-icon\">\n                    <SvgIcon name=\"inbox\" style={style.svgIcon} fill=\"#40a9ff\" />\n                  </p>\n                  <p className=\"ant-upload-text\">点击或拖拽一张或多张照片上传</p>\n                  <p className=\"ant-upload-hint\">{\"正在使用\" + type + \"图床\"}</p>\n                </Dragger>\n              </TabPane>\n              {useImageHosting.isAliyunOpen ? (\n                <TabPane tab={IMAGE_HOSTING_NAMES.aliyun} key=\"2\">\n                  <AliOSS />\n                </TabPane>\n              ) : null}\n              {useImageHosting.isQiniuyunOpen ? (\n                <TabPane tab={IMAGE_HOSTING_NAMES.qiniuyun} key=\"3\">\n                  <QiniuOSS />\n                </TabPane>\n              ) : null}\n              {useImageHosting.isGiteeOpen ? (\n                <TabPane tab={IMAGE_HOSTING_NAMES.gitee} key=\"4\">\n                  <Gitee />\n                </TabPane>\n              ) : null}\n              {useImageHosting.isGitHubOpen ? (\n                <TabPane tab={IMAGE_HOSTING_NAMES.github} key=\"5\">\n                  <GitHub />\n                </TabPane>\n              ) : null}\n            </Tabs>\n          )}\n        </appContext.Consumer>\n      </Modal>\n    );\n  }\n}\n\nconst style = {\n  svgIcon: {\n    width: \"48px\",\n    height: \"48px\",\n  },\n};\n\nexport default ImageDialog;\n"
  },
  {
    "path": "src/component/Dialog/LinkDialog.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Modal, Input, Form} from \"antd\";\n\n@inject(\"dialog\")\n@inject(\"content\")\n@observer\nclass LinkDialog extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      link: \"\",\n    };\n  }\n\n  handleOk = () => {\n    const {markdownEditor} = this.props.content;\n    const cursor = markdownEditor.getCursor();\n    const selection = markdownEditor.getSelection();\n    const text = `[${selection}](${this.state.link})`;\n    markdownEditor.replaceSelection(text, cursor);\n\n    // 上传后实时更新内容\n    const content = markdownEditor.getValue();\n    this.props.content.setContent(content);\n\n    this.setState({link: \"\"});\n    this.props.dialog.setLinkOpen(false);\n    cursor.ch += 1;\n    markdownEditor.setCursor(cursor);\n    markdownEditor.focus();\n  };\n\n  handleCancel = () => {\n    this.setState({link: \"\"});\n    this.props.dialog.setLinkOpen(false);\n  };\n\n  handleChange = (e) => {\n    this.setState({link: e.target.value});\n  };\n\n  render() {\n    return (\n      <Modal\n        title=\"添加链接\"\n        okText=\"确认\"\n        cancelText=\"取消\"\n        visible={this.props.dialog.isLinkOpen}\n        onOk={this.handleOk}\n        onCancel={this.handleCancel}\n      >\n        <Form.Item label=\"链接地址\">\n          <Input placeholder=\"请输入链接地址\" value={this.state.link} onChange={this.handleChange} />\n        </Form.Item>\n      </Modal>\n    );\n  }\n}\n\nexport default LinkDialog;\n"
  },
  {
    "path": "src/component/Dialog/SitDownDialog.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Modal, Input, Select, message} from \"antd\";\n\nimport SitDownConverter from \"../../utils/sitdownConverter\";\nimport {SITDOWN_OPTIONS} from \"../../utils/constant\";\n\nconst {Option} = Select;\nconst {TextArea} = Input;\n\n@inject(\"dialog\")\n@inject(\"content\")\n@observer\nclass SitDownDialog extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      platform: \"default\",\n      sourceCode: \"\",\n    };\n  }\n\n  handleOk = () => {\n    try {\n      const {platform, sourceCode} = this.state;\n\n      const domParser = new DOMParser();\n      const sourceCodeDom = domParser.parseFromString(sourceCode, \"text/html\");\n\n      let content = \"\";\n\n      if (platform === \"csdn\") {\n        const articleDom = sourceCodeDom.getElementById(\"content_views\");\n        content = SitDownConverter.CSDN(articleDom);\n      } else if (platform === \"juejin\") {\n        const articleDom = sourceCodeDom.getElementsByClassName(\"article-content\");\n        content = SitDownConverter.Juejin(articleDom[0]);\n      } else if (platform === \"zhihu\") {\n        const articleDom = sourceCodeDom.getElementsByClassName(\"Post-RichText\");\n        content = SitDownConverter.Zhihu(articleDom[0]);\n      } else if (platform === \"wechat\") {\n        const articleDom = sourceCodeDom.getElementById(\"js_content\");\n        content = SitDownConverter.Wechat(articleDom);\n      } else {\n        content = SitDownConverter.GFM(sourceCodeDom);\n      }\n\n      this.props.content.setContent(content);\n\n      this.props.dialog.setSitDownOpen(false);\n\n      const {markdownEditor} = this.props.content;\n      // const cursor = markdownEditor.getCursor();\n      // cursor.ch += 1;\n      // markdownEditor.setCursor(cursor);\n      markdownEditor.focus();\n    } catch (e) {\n      message.error(\"源代码与已选平台的文章域名不符\");\n    }\n  };\n\n  handleCancel = () => {\n    this.props.dialog.setSitDownOpen(false);\n  };\n\n  handlePlatform = (value) => {\n    this.setState({platform: value});\n  };\n\n  handleSourceCode = (e) => {\n    this.setState({sourceCode: e.target.value});\n  };\n\n  render() {\n    const {sourceCode, platform} = this.state;\n    return (\n      <Modal\n        title=\"SitDown：html 转 markdown 神器\"\n        okText=\"转换\"\n        cancelText=\"取消\"\n        visible={this.props.dialog.isSitDownOpen}\n        onOk={this.handleOk}\n        onCancel={this.handleCancel}\n      >\n        <Select value={platform} style={{width: 300, marginBottom: \"20px\"}} onChange={this.handlePlatform}>\n          {SITDOWN_OPTIONS.map((option) => (\n            <Option key={option.key} value={option.key}>\n              {option.value}\n            </Option>\n          ))}\n        </Select>\n\n        <TextArea\n          rows={4}\n          style={{marginBottom: \"5px\"}}\n          value={sourceCode}\n          onChange={this.handleSourceCode}\n          placeholder=\"请放入网页源代码\"\n        />\n        <span>提示：右键-&gt;显示网页源代码-&gt;全选-&gt;复制粘贴。</span>\n        <a\n          id=\"nice-sitdown-dialog-doc\"\n          rel=\"noopener noreferrer\"\n          target=\"_blank\"\n          href=\"https://preview.mdnice.com/article/user/sitdown/\"\n        >\n          详细文档\n        </a>\n      </Modal>\n    );\n  }\n}\n\nexport default SitDownDialog;\n"
  },
  {
    "path": "src/component/Dialog/TutorialDialog.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Modal, Button, message} from \"antd\";\n\n@inject(\"dialog\")\n@observer\nclass TutorialDialog extends Component {\n  handleOk = () => {\n    this.props.dialog.setTutorialOpen(false);\n    const {tutorialContent} = this.props.dialog;\n    // 复制触发\n    document.addEventListener(\"copy\", function copyCall(e) {\n      e.preventDefault();\n      e.clipboardData.setData(\"text/html\", tutorialContent);\n      e.clipboardData.setData(\"text/plain\", tutorialContent);\n      document.removeEventListener(\"copy\", copyCall);\n    });\n    document.execCommand(\"copy\");\n    message.success(\"拷贝成功，请在左侧编辑器粘贴\");\n  };\n\n  handleCancel = () => {\n    this.props.dialog.setTutorialOpen(false);\n  };\n\n  render() {\n    return (\n      <Modal\n        title={this.props.dialog.tutorialTitle}\n        okText=\"确认\"\n        cancelText=\"取消\"\n        visible={this.props.dialog.isTutorialOpen}\n        onOk={this.handleOk}\n        onCancel={this.handleCancel}\n        footer={[\n          <Button key=\"submit\" type=\"primary\" onClick={this.handleOk}>\n            拷贝 Markdown 并在编辑器中实验\n          </Button>,\n        ]}\n        bodyStyle={{\n          paddingTop: \"5px\",\n        }}\n      >\n        <p style={style.lineHeight}>左侧为 Markdown 可编辑文本，右侧为渲染效果</p>\n        <div style={{display: \"flex\", alignItems: \"center\"}}>\n          <img alt=\"图片描述\" style={style.imgWidth} src={this.props.dialog.tutorialPicture} />\n        </div>\n      </Modal>\n    );\n  }\n}\n\nconst style = {\n  imgWidth: {\n    width: \"100%\",\n    height: \"100%\",\n  },\n  lineHeight: {\n    lineHeight: \"40px\",\n    color: \"black\",\n    padding: 0,\n    marginBottom: 10,\n  },\n};\n\nexport default TutorialDialog;\n"
  },
  {
    "path": "src/component/Dialog/VersionDialog.css",
    "content": ".specialInfo > * {\n  width: 100%;\n}"
  },
  {
    "path": "src/component/Dialog/VersionDialog.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Modal, Timeline, Button} from \"antd\";\nimport axios from \"axios\";\nimport {NEWEST_VERSION} from \"../../utils/constant\";\nimport SvgIcon from \"../../icon\";\n\nimport \"./VersionDialog.css\";\n\n@inject(\"dialog\")\n@observer\nclass VersionDialog extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      // eslint-disable-next-line react/no-unused-state\n      versionNumber: 0,\n      versionTimeline: [],\n      recommend: null,\n      specialInfo: \"\",\n    };\n  }\n\n  handleOk = () => {\n    this.props.dialog.setVersionOpen(false);\n  };\n\n  handleCancel = () => {\n    this.props.dialog.setVersionOpen(false);\n  };\n\n  handleMore = () => {\n    const w = window.open(\"about:blank\");\n    w.location.href = \"https://github.com/mdnice/markdown-nice/blob/master/CHANGELOG.md\";\n  };\n\n  handleDocs = () => {\n    const w = window.open(\"about:blank\");\n    w.location.href = \"https://preview.mdnice.com/articles/\";\n  };\n\n  componentDidMount = async () => {\n    try {\n      const {\n        data: response,\n        data: {data},\n      } = await axios.get(\"https://api.mdnice.com/versions/newest\");\n      if (!response.success) {\n        throw new Error();\n      }\n      const newestVersion = localStorage.getItem(NEWEST_VERSION);\n      if (data.versionNumber !== newestVersion) {\n        this.props.dialog.setVersionOpen(true);\n        localStorage.setItem(NEWEST_VERSION, data.versionNumber);\n      }\n      this.setState({...data});\n    } catch (err) {\n      console.error(\"读取最新Mdnice版本信息错误\");\n    }\n  };\n\n  render() {\n    return (\n      <Modal\n        title=\"版本更新\"\n        visible={this.props.dialog.isVersionOpen}\n        onOk={this.handleOk}\n        onCancel={this.handleCancel}\n        footer={[\n          <Button key=\"submit\" type=\"primary\" onClick={this.handleOk}>\n            确认\n          </Button>,\n        ]}\n        destroyOnClose\n      >\n        <Timeline>\n          {this.state.versionTimeline.map((version, index) => {\n            if (index === 0) {\n              return (\n                <Timeline.Item key={index} dot={<SvgIcon name=\"environment\" style={style.svgIcon} />}>\n                  <strong>{version}</strong>\n                </Timeline.Item>\n              );\n            } else {\n              return <Timeline.Item key={index}>{version}</Timeline.Item>;\n            }\n          })}\n          <Timeline.Item>\n            了解更多，请查看\n            <a\n              id=\"nice-version-dialog-doc\"\n              style={{fontWeight: \"bold\"}}\n              alt=\"\"\n              href=\"https://preview.mdnice.com/articles/\"\n              rel=\"noopener noreferrer\"\n              target=\"_blank\"\n            >\n              用户与开发者文档\n            </a>\n          </Timeline.Item>\n          {this.state.recommend && (\n            <Timeline.Item dot={<SvgIcon name=\"more\" style={style.svgIcon} />}>\n              <a\n                id=\"nice-version-dialog-recommend\"\n                style={{fontWeight: \"bold\", borderBottom: \"double\"}}\n                alt=\"\"\n                href={this.state.recommend.link}\n                rel=\"noopener noreferrer\"\n                target=\"_blank\"\n              >\n                {this.state.recommend.mainInfo}\n              </a>\n            </Timeline.Item>\n          )}\n        </Timeline>\n        {this.state.specialInfo && (\n          <div\n            id=\"nice-version-dialog-special\"\n            dangerouslySetInnerHTML={{__html: this.state.specialInfo}}\n            className=\"specialInfo\"\n          />\n        )}\n      </Modal>\n    );\n  }\n}\n\nconst style = {\n  svgIcon: {\n    width: \"16px\",\n    height: \"16px\",\n  },\n};\n\nexport default VersionDialog;\n"
  },
  {
    "path": "src/component/ImageHosting/AliOSS.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Input, Form} from \"antd\";\nimport {ALIOSS_IMAGE_HOSTING} from \"../../utils/constant\";\n\nconst formItemLayout = {\n  labelCol: {\n    xs: {span: 6},\n  },\n  wrapperCol: {\n    xs: {span: 16},\n  },\n};\n\n@inject(\"imageHosting\")\n@observer\nclass AliOSS extends Component {\n  constructor(props) {\n    super(props);\n    // 从localstorage里面读取\n    const imageHosting = JSON.parse(localStorage.getItem(ALIOSS_IMAGE_HOSTING));\n    this.state = {\n      imageHosting,\n    };\n  }\n\n  regionChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.region = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(ALIOSS_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  accessKeyIdChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.accessKeyId = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(ALIOSS_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  accessKeySecretChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.accessKeySecret = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(ALIOSS_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  bucketChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.bucket = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(ALIOSS_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  render() {\n    const {region, accessKeyId, accessKeySecret, bucket} = this.state.imageHosting;\n    return (\n      <Form {...formItemLayout}>\n        <Form.Item label=\"Bucket\" style={style.formItem}>\n          <Input value={bucket} onChange={this.bucketChange} placeholder=\"例如：my-wechat\" />\n        </Form.Item>\n        <Form.Item label=\"Region\" style={style.formItem}>\n          <Input value={region} onChange={this.regionChange} placeholder=\"例如：oss-cn-hangzhou\" />\n        </Form.Item>\n        <Form.Item label=\"AccessKey ID\" style={style.formItem}>\n          <Input value={accessKeyId} onChange={this.accessKeyIdChange} placeholder=\"例如：qweASDF1234zxcvb\" />\n        </Form.Item>\n        <Form.Item label=\"AccessKey Secret\" style={style.formItem}>\n          <Input\n            value={accessKeySecret}\n            onChange={this.accessKeySecretChange}\n            placeholder=\"例如：qweASDF1234zxcvbqweASD\"\n          />\n        </Form.Item>\n        <Form.Item label=\"提示\" style={style.formItem}>\n          <span>配置后请在右上角进行切换，</span>\n          <a\n            rel=\"noopener noreferrer\"\n            target=\"_blank\"\n            href=\"https://preview.mdnice.com/article/developer/aliyun-image-hosting/\"\n          >\n            阿里云图床配置文档\n          </a>\n        </Form.Item>\n      </Form>\n    );\n  }\n}\n\nconst style = {\n  formItem: {\n    marginBottom: \"10px\",\n  },\n};\n\nexport default AliOSS;\n"
  },
  {
    "path": "src/component/ImageHosting/GitHub.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Input, Form, Checkbox} from \"antd\";\nimport {GITHUB_IMAGE_HOSTING} from \"../../utils/constant\";\n\nconst formItemLayout = {\n  labelCol: {\n    xs: {span: 6},\n  },\n  wrapperCol: {\n    xs: {span: 16},\n  },\n};\n\n@inject(\"imageHosting\")\n@observer\nclass Gitee extends Component {\n  constructor(props) {\n    super(props);\n    // 从localstorage里面读取\n    const imageHosting = JSON.parse(localStorage.getItem(GITHUB_IMAGE_HOSTING));\n    this.state = {\n      imageHosting,\n    };\n  }\n\n  usernameChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.username = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(GITHUB_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  repoChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.repo = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(GITHUB_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  tokenChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.token = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(GITHUB_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  jsdelivrChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.jsdelivr = e.target.checked ? \"true\" : \"false\";\n    console.log(imageHosting);\n    this.setState({imageHosting});\n    localStorage.setItem(GITHUB_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  render() {\n    const {username, repo, token, jsdelivr} = this.state.imageHosting;\n    return (\n      <Form {...formItemLayout}>\n        <Form.Item label=\"用户名\" style={style.formItem}>\n          <Input value={username} onChange={this.usernameChange} placeholder=\"例如：mdnice\" />\n        </Form.Item>\n        <Form.Item label=\"仓库名\" style={style.formItem}>\n          <Input value={repo} onChange={this.repoChange} placeholder=\"例如：picture\" />\n        </Form.Item>\n        <Form.Item label=\"token\" style={style.formItem}>\n          <Input value={token} onChange={this.tokenChange} placeholder=\"例如：qweASDF1234zxcvb\" />\n        </Form.Item>\n        <Form.Item label=\"jsDelivr CDN\" style={style.formItem}>\n          <Checkbox checked={jsdelivr === \"true\"} onChange={this.jsdelivrChange}>\n            （强烈建议开启，加速图片）\n          </Checkbox>\n        </Form.Item>\n        <Form.Item label=\"提示\" style={style.formItem}>\n          <span>配置后请在右上角进行切换，</span>\n          <a\n            rel=\"noopener noreferrer\"\n            target=\"_blank\"\n            href=\"https://preview.mdnice.com/article/developer/github-image-hosting/\"\n          >\n            GitHub图床配置文档\n          </a>\n        </Form.Item>\n      </Form>\n    );\n  }\n}\n\nconst style = {\n  formItem: {\n    marginBottom: \"10px\",\n  },\n};\n\nexport default Gitee;\n"
  },
  {
    "path": "src/component/ImageHosting/Gitee.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Input, Form} from \"antd\";\nimport {GITEE_IMAGE_HOSTING} from \"../../utils/constant\";\n\nconst formItemLayout = {\n  labelCol: {\n    xs: {span: 6},\n  },\n  wrapperCol: {\n    xs: {span: 16},\n  },\n};\n\n@inject(\"imageHosting\")\n@observer\nclass Gitee extends Component {\n  constructor(props) {\n    super(props);\n    // 从localstorage里面读取\n    const imageHosting = JSON.parse(localStorage.getItem(GITEE_IMAGE_HOSTING));\n    this.state = {\n      imageHosting,\n    };\n  }\n\n  usernameChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.username = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(GITEE_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  repoChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.repo = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(GITEE_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  tokenChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.token = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(GITEE_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  render() {\n    const {username, repo, token} = this.state.imageHosting;\n    return (\n      <Form {...formItemLayout}>\n        <Form.Item label=\"用户名\" style={style.formItem}>\n          <Input value={username} onChange={this.usernameChange} placeholder=\"例如：mdnice\" />\n        </Form.Item>\n        <Form.Item label=\"仓库名\" style={style.formItem}>\n          <Input value={repo} onChange={this.repoChange} placeholder=\"例如：picture\" />\n        </Form.Item>\n        <Form.Item label=\"token\" style={style.formItem}>\n          <Input value={token} onChange={this.tokenChange} placeholder=\"例如：qweASDF1234zxcvb\" />\n        </Form.Item>\n        <Form.Item label=\"提示\" style={style.formItem}>\n          <span>配置后请在右上角进行切换，</span>\n          <a\n            rel=\"noopener noreferrer\"\n            target=\"_blank\"\n            href=\"https://preview.mdnice.com/article/developer/gitee-image-hosting/\"\n          >\n            Gitee 图床配置文档\n          </a>\n        </Form.Item>\n      </Form>\n    );\n  }\n}\n\nconst style = {\n  formItem: {\n    marginBottom: \"10px\",\n  },\n};\n\nexport default Gitee;\n"
  },
  {
    "path": "src/component/ImageHosting/QiniuOSS.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Input, Select, Form} from \"antd\";\nimport {QINIUOSS_IMAGE_HOSTING} from \"../../utils/constant\";\n\nconst {Option} = Select;\nconst formItemLayout = {\n  labelCol: {\n    xs: {span: 6},\n  },\n  wrapperCol: {\n    xs: {span: 16},\n  },\n};\n\n@inject(\"imageHosting\")\n@observer\nclass QiniuOSS extends Component {\n  constructor(props) {\n    super(props);\n    // 从localstorage里面读取\n    const imageHosting = JSON.parse(localStorage.getItem(QINIUOSS_IMAGE_HOSTING));\n    const link = imageHosting.domain.split(\"://\")[1];\n    this.state = {\n      imageHosting,\n      link,\n    };\n  }\n\n  regionChange = (value) => {\n    const {imageHosting} = this.state;\n    imageHosting.region = value;\n    this.setState({imageHosting});\n    localStorage.setItem(QINIUOSS_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  accessKeyChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.accessKey = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(QINIUOSS_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  secretKeyChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.secretKey = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(QINIUOSS_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  bucketChange = (e) => {\n    const {imageHosting} = this.state;\n    imageHosting.bucket = e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(QINIUOSS_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  linkChange = (e) => {\n    this.setState({link: e.target.value});\n\n    const {imageHosting} = this.state;\n    imageHosting.domain = \"https://\" + e.target.value;\n    this.setState({imageHosting});\n    localStorage.setItem(QINIUOSS_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  namespaceChange = ({target: {value}}) => {\n    const {imageHosting} = this.state;\n    imageHosting.namespace = value;\n    this.setState({imageHosting});\n    localStorage.setItem(QINIUOSS_IMAGE_HOSTING, JSON.stringify(imageHosting));\n  };\n\n  render() {\n    const {region, accessKey, secretKey, bucket, namespace} = this.state.imageHosting;\n    const {link} = this.state;\n    return (\n      <Form {...formItemLayout}>\n        <Form.Item label=\"存储空间名称\" style={style.formItem}>\n          <Input value={bucket} onChange={this.bucketChange} placeholder=\"例如：my-wechat\" />\n        </Form.Item>\n        <Form.Item label=\"存储区域\" style={style.formItem}>\n          <Select value={region} onChange={this.regionChange} placeholder=\"例如：qiniu.region.z2\">\n            <Option value=\"z0\">华东</Option>\n            <Option value=\"z1\">华北</Option>\n            <Option value=\"z2\">华南</Option>\n            <Option value=\"na0\">北美</Option>\n            <Option value=\"as0\">东南亚</Option>\n          </Select>\n        </Form.Item>\n        <Form.Item label=\"AccessKey\" style={style.formItem}>\n          <Input value={accessKey} onChange={this.accessKeyChange} placeholder=\"例如：qweASDF1234zxcvb\" />\n        </Form.Item>\n        <Form.Item label=\"SecretKey\" style={style.formItem}>\n          <Input value={secretKey} onChange={this.secretKeyChange} placeholder=\"例如：qweASDF1234zxcvbqweASD\" />\n        </Form.Item>\n        <Form.Item label=\"自定义域名\" style={style.formItem}>\n          <Input value={link} onChange={this.linkChange} addonBefore=\"https://\" placeholder=\"例如：qiniu.mdnice.com\" />\n        </Form.Item>\n        <Form.Item label=\"自定义命名空间\" style={style.formItem}>\n          <Input value={namespace} onChange={this.namespaceChange} placeholder=\"例如：image/\" />\n        </Form.Item>\n        <Form.Item label=\"提示\" style={style.formItem}>\n          <span>配置后请在右上角进行切换，</span>\n          <a\n            rel=\"noopener noreferrer\"\n            target=\"_blank\"\n            href=\"https://preview.mdnice.com/article/developer/qiniu-image-hosting/\"\n          >\n            七牛云图床配置文档\n          </a>\n        </Form.Item>\n      </Form>\n    );\n  }\n}\n\nconst style = {\n  formItem: {\n    marginBottom: \"10px\",\n  },\n};\n\nexport default QiniuOSS;\n"
  },
  {
    "path": "src/component/LocalHistory/index.js",
    "content": "import * as React from \"react\";\nimport {Menu, Button, Radio} from \"antd\";\nimport CodeMirror from \"@uiw/react-codemirror\";\nimport {diff_match_patch as DiffMatchPath} from \"diff-match-patch\";\n\nimport \"./localHistory.css\";\n\nconst NOOP = () => {};\nconst prefix = \"nice-md-local-history\";\n\nconst diff = new DiffMatchPath();\n\nclass LocalHistory extends React.Component {\n  constructor(props) {\n    super(props);\n    const {documents} = this.props;\n    this.state = {\n      content: documents[0].Content,\n      selectedKeys: String(documents[0].id),\n      mode: \"all\",\n    };\n  }\n\n  getDiffHtml = () => {\n    // eslint-disable-next-line no-underscore-dangle\n    var a = diff.diff_linesToChars_(this.state.content, this.props.content);\n    var lineText1 = a.chars1;\n    var lineText2 = a.chars2;\n    var diffs = diff.diff_main(lineText1, lineText2, false);\n    // eslint-disable-next-line no-underscore-dangle\n    diff.diff_charsToLines_(diffs, a.lineArray);\n    const html = diff\n      .diff_prettyHtml(diffs)\n      .replace(/&para;/g, \"\")\n      .replace(/<br>/g, \"&#8203;<br>&#8203;\");\n    return html;\n  };\n\n  selectNav = ({selectedKeys}) => {\n    const {Content: content} = this.props.documents.find((doc) => String(doc.id) === String(selectedKeys[0])) || {};\n    this.setState({\n      content,\n      selectedKeys,\n    });\n  };\n\n  handleModeChange = (e) => {\n    this.setState({\n      mode: e.target.value,\n    });\n  };\n\n  render() {\n    const {documents} = this.props;\n\n    return (\n      <>\n        <Menu className={`${prefix}-nav`} onSelect={this.selectNav} selectedKeys={this.state.selectedKeys}>\n          {documents.map((d) => (\n            <Menu.Item key={d.id}>{d.SaveTime.toLocaleString()}</Menu.Item>\n          ))}\n        </Menu>\n        {this.state.content && (\n          <div className={`${prefix}-preview`}>\n            {this.state.mode === \"all\" ? (\n              <CodeMirror\n                key=\"local-history\"\n                value={this.state.content}\n                height=\"calc(100% - 56px)\"\n                options={{\n                  readOnly: true,\n                  theme: \"md-mirror\",\n                  mode: \"markdown\",\n                  lineWrapping: true,\n                  lineNumbers: false,\n                }}\n              />\n            ) : (\n              <div dangerouslySetInnerHTML={{__html: this.getDiffHtml()}} className={`${prefix}-diff-content`} />\n            )}\n            <div className={`${prefix}-btn-group`}>\n              <Radio.Group onChange={this.handleModeChange} value={this.state.mode}>\n                <Radio value=\"all\">全文</Radio>\n                <Radio value=\"diff\">和当前内容对比</Radio>\n              </Radio.Group>\n              <div>\n                <Button onClick={this.props.onCancel}>取消</Button>\n                <Button\n                  id=\"nice-local-history-review\"\n                  type=\"primary\"\n                  onClick={() => {\n                    this.props.onEdit(this.state.content);\n                  }}\n                >\n                  恢复此版本\n                </Button>\n              </div>\n            </div>\n          </div>\n        )}\n      </>\n    );\n  }\n}\n\nLocalHistory.defaultProps = {\n  visible: false,\n  document: [{}],\n  onEdit: NOOP,\n  onCancel: NOOP,\n};\n\nexport default LocalHistory;\n"
  },
  {
    "path": "src/component/LocalHistory/indexdb.js",
    "content": "import {message} from \"antd\";\n\n// In the following line, you should include the prefixes of implementations you want to test.\nconst indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;\n// DON'T use \"var indexedDB = ...\" if you're not in a function.\n// Moreover, you may need references to some window.IDB* objects:\n// const IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction;\n// const IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;\n\n// (Mozilla has never prefixed these objects, so we don't need window.mozIDB*)\n\nexport default class IndexDB {\n  constructor(options = {}) {\n    this.options = options;\n  }\n\n  async init() {\n    if (!indexedDB) {\n      message.error(\"初始化 indexdb 失败！浏览器不支持\");\n      throw Error(\"浏览器不支持 indexdb\");\n    }\n\n    const {name, storeName = \"\", storeOptions = {}, storeInit = () => {}} = this.options;\n\n    this.storeName = storeName;\n    this.storeOptions = storeOptions;\n    this.storeInit = storeInit;\n\n    const request = indexedDB.open(name);\n    const result = await this.initEvent(request);\n    return result;\n  }\n\n  initEvent(request) {\n    return new Promise((resolve, reject) => {\n      request.onerror = (event) => {\n        // Do something with request.errorCode!\n        message.error(\"初始化数据库失败！\", event.target.errorCode);\n        reject(new Error(\"初始化数据库失败！\"));\n      };\n\n      request.onsuccess = (event) => {\n        const db = event.target.result;\n        console.log(\"成功初始化数据库\");\n        // this.db = db;\n        resolve(db);\n      };\n\n      // 该事件仅在较新的浏览器中被实现\n      request.onupgradeneeded = (event) => {\n        // 更新对象存储空间和索引 ....\n        const db = event.target.result;\n        this.initStore(db, this.storeName, this.storeOptions, this.storeInit);\n      };\n    });\n  }\n\n  initStore(db, name, options, func) {\n    // 创建一个对象存储空间来持有信息。\n    const objectStore = db.createObjectStore(name, options);\n    if (func) func(objectStore);\n  }\n}\n"
  },
  {
    "path": "src/component/LocalHistory/localHistory.css",
    "content": ".nice-md-local-history .ant-modal-body {\n    display: flex;\n    height: calc(100vh - 112px);\n}\n\n.nice-md-local-history .CodeMirror-merge,\n.nice-md-local-history .CodeMirror-merge .CodeMirror {\n    height: calc(100vh - 216px);\n}\n\n.nice-md-local-history .CodeMirror-merge-copy {\n    display: none;\n}\n\n.nice-md-local-history-preview {\n    width: 100%;\n    max-width: 776px;\n}\n\n.nice-md-local-history-btn-group {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    margin-left: 20px;\n}\n.nice-md-local-history-btn-group button {\n    margin: 25px 10px;\n}\n\n.nice-md-local-history-btn-group button:last-child {\n    margin-right: 0;\n}\n\n.nice-md-local-history-nav {\n    width: 256px;\n    flex: 0 0 auto;\n    background: #fff;\n    border-radius: 4px 0 0 4px;\n    position: relative;\n    overflow-y: auto;\n}\n\n.nice-md-local-history-nav .ant-list-item {\n    border-bottom: 0;\n    padding: 17px 24px;\n}\n\n.nice-md-local-history-diff-content {\n    width: inherit;\n    background-color: rgba(245, 245, 245, 1);\n    overflow-y: scroll;\n    padding: 24px;\n    height: calc(100% - 56px);\n    color: #202020;\n    border-radius: 5px;\n    font-size: 16px;\n    font-family: 'source-code-pro', Menlo, 'Courier New', Consolas, monospace, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';\n    font-variant-caps: normal;\n    font-variant-east-asian: normal;\n    font-variant-ligatures: contextual;\n    line-height: 25px;\n    font-weight: 400;\n    font-variant-numeric: tabular-nums;\n    font-feature-settings: \"calt\";\n    -webkit-font-smoothing: antialiased;\n}"
  },
  {
    "path": "src/component/LocalHistory/util.js",
    "content": "import {message} from \"antd\";\n\nfunction saveTimeSort(a, b) {\n  return new Date(b.SaveTime).getTime() - new Date(a.SaveTime).getTime();\n}\n\nexport const MaxLocalDocumentLength = 30;\n\n// export const AutoSaveInterval = 10 * 60 * 1000;\nexport const AutoSaveInterval = 60 * 1000;\n\nexport const getLocalDocuments = (db, DocumentID) => {\n  try {\n    const transaction = db.transaction([\"customers\"], \"readonly\");\n    const store = transaction.objectStore(\"customers\");\n    const keyRange = IDBKeyRange.only(DocumentID);\n    const index = store.index(\"DocumentID\");\n    const req = index.openCursor(keyRange);\n\n    return new Promise((resolve, reject) => {\n      const result = [];\n      req.onsuccess = (event) => {\n        const cursor = event.target.result;\n        if (cursor) {\n          // Do something with the matches.\n          result.push(cursor.value);\n          cursor.continue();\n        } else {\n          // console.log('获取成功 ');\n          result.sort(saveTimeSort);\n          resolve(result);\n        }\n      };\n      req.onerror = (event) => {\n        console.error(\"获取失败\");\n        reject(event);\n      };\n    });\n  } catch (e) {\n    console.log(\"未知错误\", DocumentID);\n    return Promise.reject(e);\n  }\n};\n\nexport const setLocalDocuments = (db, localDocuments, document = {}) => {\n  const draftIndex = 0;\n  if (localDocuments[draftIndex + 1] && localDocuments[draftIndex + 1].Content === localDocuments[draftIndex].Content) {\n    // console.log(\"内容未更新，不进行本地保存。\");\n    return Promise.resolve();\n  }\n\n  return new Promise((resolve, reject) => {\n    const transaction = db.transaction([\"customers\"], \"readwrite\");\n    const store = transaction.objectStore(\"customers\");\n    let req = {};\n\n    // Info: 长度超过用 put，没超过用 add\n    if (localDocuments.length >= MaxLocalDocumentLength) {\n      const {id} = localDocuments.sort(saveTimeSort)[localDocuments.length - 1];\n      req = store.put({\n        ...document,\n        id,\n      });\n    } else {\n      req = store.add(document);\n    }\n\n    req.onsuccess = () => {\n      // console.log(\"自动保存成功\");\n      resolve();\n    };\n    req.onerror = (event) => {\n      message.error(\"自动保存失败\");\n      reject(event);\n    };\n  });\n};\n\nexport const setLocalDraft = (db, localDocuments, document = {}) => {\n  const draft = localDocuments[0];\n  if (draft && document.Content === draft.Content) {\n    console.log(\"草稿未更新，不进行本地保存。\");\n    return Promise.resolve();\n  }\n\n  return new Promise((resolve, reject) => {\n    const transaction = db.transaction([\"customers\"], \"readwrite\");\n    const store = transaction.objectStore(\"customers\");\n\n    // Info: 更新草稿\n    const {id} = draft;\n    const req = store.put({\n      ...document,\n      id,\n    });\n\n    req.onsuccess = () => {\n      // console.log(\"自动保存草稿成功\");\n      resolve();\n    };\n    req.onerror = (event) => {\n      message.error(\"自动保存草稿失败\");\n      reject(event);\n    };\n  });\n};\n"
  },
  {
    "path": "src/component/MenuLeft/CodeTheme.css",
    "content": ".nice-codetheme-item {\n  display: flex;\n  justify-content: space-between;\n  padding: 5px 12px 5px 6px;\n}\n.nice-codetheme-item-name {\n  margin-right: 10px;\n}\n.nice-codetheme-item-flag {\n  display: inline-block;\n  width: 16px;\n}"
  },
  {
    "path": "src/component/MenuLeft/CodeTheme.js",
    "content": "import React from \"react\";\nimport {Menu, Dropdown} from \"antd\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {CODE_OPTIONS, RIGHT_SYMBOL, IS_MAC_CODE} from \"../../utils/constant\";\nimport \"./CodeTheme.css\";\n\n@inject(\"navbar\")\n@observer\nclass CodeTheme extends React.Component {\n  changeCodeTheme = (item) => {\n    // 是否为 Mac 风格代码\n    if (item.key === IS_MAC_CODE) {\n      const {isMacCode, codeNum} = this.props.navbar;\n      if (isMacCode) {\n        this.props.navbar.setMacCode(false);\n        this.props.navbar.setCodeNum(codeNum, false);\n      } else {\n        this.props.navbar.setMacCode(true);\n        this.props.navbar.setCodeNum(codeNum, true);\n      }\n    } else {\n      const {isMacCode} = this.props.navbar;\n      const codeNum = parseInt(item.key, 10);\n      this.props.navbar.setCodeNum(codeNum, isMacCode);\n    }\n  };\n\n  render() {\n    const {codeNum, isMacCode} = this.props.navbar;\n\n    const codeMenu = (\n      <Menu onClick={this.changeCodeTheme}>\n        {CODE_OPTIONS.map((option, index) => (\n          <Menu.Item key={index}>\n            <div id={`nice-menu-codetheme-${option.id}`} className=\"nice-codetheme-item\">\n              <span>\n                <span className=\"nice-codetheme-item-flag\">{codeNum === index && <span>{RIGHT_SYMBOL}</span>}</span>\n                <span className=\"nice-codetheme-item-name\">{option.name}</span>\n              </span>\n            </div>\n          </Menu.Item>\n        ))}\n        <Menu.Divider />\n        <Menu.Item key={IS_MAC_CODE}>\n          <div id=\"nice-menu-codetheme-apple\" className=\"nice-codetheme-item\">\n            <span>\n              <span className=\"nice-codetheme-item-flag\">{isMacCode && <span>{RIGHT_SYMBOL}</span>}</span>\n              <span className=\"nice-codetheme-item-name\">Mac 风格</span>\n            </span>\n          </div>\n        </Menu.Item>\n      </Menu>\n    );\n\n    return (\n      <Dropdown overlay={codeMenu} trigger={[\"click\"]} overlayClassName=\"nice-overlay\">\n        <a id=\"nice-menu-codetheme\" className=\"nice-menu-link\" href=\"#\">\n          代码主题\n        </a>\n      </Dropdown>\n    );\n  }\n}\n\nexport default CodeTheme;\n"
  },
  {
    "path": "src/component/MenuLeft/File/ExportMarkdown.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {message} from \"antd\";\n\nimport {download, dateFormat} from \"../../../utils/helper\";\nimport {EXPORT_FILENAME_SUFFIX} from \"../../../utils/constant\";\nimport \"../common.css\";\n\n@inject(\"content\")\n@observer\nclass ExportMarkdown extends Component {\n  handleClick = () => {\n    const {markdownEditor} = this.props.content;\n    const content = markdownEditor.getValue();\n    if (\"download\" in document.createElement(\"a\")) {\n      download(content, dateFormat(new Date(), \"yyyy-MM-dd\") + EXPORT_FILENAME_SUFFIX);\n    } else {\n      message.warn(\"浏览器不支持\");\n    }\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-export-markdown\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">导出 Markdown</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default ExportMarkdown;\n"
  },
  {
    "path": "src/component/MenuLeft/File/ExportPdf.js",
    "content": "import React, {Component} from \"react\";\n\nimport \"../common.css\";\n\nclass ExportPdf extends Component {\n  handleClick = () => {\n    setTimeout(() => {\n      window.print();\n    }, 500);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-export-pdf\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">导出 PDF</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default ExportPdf;\n"
  },
  {
    "path": "src/component/MenuLeft/File/ImportFile.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport \"../common.css\";\nimport {message} from \"antd\";\n\n@inject(\"content\")\n@observer\nclass ImportFile extends Component {\n  handleChange = (e) => {\n    const file = e.target.files[0];\n    const reader = new FileReader();\n    reader.onload = (event) => {\n      this.props.content.setContent(event.target.result);\n      message.success(\"导入文件成功！\");\n    };\n    reader.readAsText(file);\n  };\n\n  render() {\n    return (\n      <label id=\"nice-menu-import-file\" className=\"nice-menu-item\" htmlFor=\"importFile\">\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">导入</span>\n          <input\n            style={{display: \"none\"}}\n            type=\"file\"\n            id=\"importFile\"\n            accept=\".txt,.md\"\n            hidden=\"\"\n            onChange={this.handleChange}\n          />\n        </span>\n      </label>\n    );\n  }\n}\n\nexport default ImportFile;\n"
  },
  {
    "path": "src/component/MenuLeft/File.js",
    "content": "import React, {Component} from \"react\";\nimport {Menu, Dropdown} from \"antd\";\n\nimport ExportMarkdown from \"./File/ExportMarkdown\";\nimport ExportPdf from \"./File/ExportPdf\";\nimport ImportFile from \"./File/ImportFile\";\nimport \"./common.css\";\n\nconst menu = (\n  <Menu>\n    <Menu.Item>\n      <ExportMarkdown />\n    </Menu.Item>\n    <Menu.Item>\n      <ExportPdf />\n    </Menu.Item>\n    <Menu.Item>\n      <ImportFile />\n    </Menu.Item>\n  </Menu>\n);\n\nclass File extends Component {\n  render() {\n    return (\n      <Dropdown overlay={menu} trigger={[\"click\"]} overlayClassName=\"nice-overlay\">\n        <a id=\"nice-menu-file\" className=\"nice-menu-link\" href=\"#\">\n          文件\n        </a>\n      </Dropdown>\n    );\n  }\n}\n\nexport default File;\n"
  },
  {
    "path": "src/component/MenuLeft/Function/History.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport \"../common.css\";\n\n@inject(\"dialog\")\n@observer\nclass History extends Component {\n  handleClick = () => {\n    this.props.dialog.setHistoryOpen(true);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-history\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">本地历史</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default History;\n"
  },
  {
    "path": "src/component/MenuLeft/Function/Reset.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Modal, message} from \"antd\";\n\nimport TEMPLATE from \"../../../template/index\";\nimport \"../common.css\";\n\n@inject(\"content\")\n@inject(\"navbar\")\n@observer\nclass Reset extends Component {\n  showConfirm = () => {\n    Modal.confirm({\n      title: \"确认重置么?\",\n      content: \"重置后将丢失本地保存的文本和自定义样式\",\n      okText: \"确定\",\n      okType: \"danger\",\n      cancelText: \"取消\",\n      onOk: () => {\n        this.props.content.setContent(TEMPLATE.content);\n        this.props.content.setStyle(TEMPLATE.normal);\n        this.props.content.setCustomStyle(TEMPLATE.custom);\n        this.props.navbar.setTemplateNum(0);\n        message.success(\"重置成功！\");\n      },\n      onCancel() {},\n    });\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-reset\" className=\"nice-menu-item\" onClick={this.showConfirm}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">重置</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default Reset;\n"
  },
  {
    "path": "src/component/MenuLeft/Function/Search.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {hotKeys} from \"../../../utils/hotkey\";\n\nimport \"../common.css\";\n\n@inject(\"dialog\")\n@observer\nclass Search extends Component {\n  handleClick = () => {\n    this.props.dialog.setSearchOpen(!this.props.dialog.isSearchOpen);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-search\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">查找</span>\n        </span>\n        <span className=\"nice-menu-shortcut\">{hotKeys.search}</span>\n      </div>\n    );\n  }\n}\n\nexport default Search;\n"
  },
  {
    "path": "src/component/MenuLeft/Function/SitDown.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport \"../common.css\";\n\n@inject(\"dialog\")\n@observer\nclass SitDownFunction extends Component {\n  handleClick = () => {\n    this.props.dialog.setSitDownOpen(true);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-sitdown\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">SitDown</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default SitDownFunction;\n"
  },
  {
    "path": "src/component/MenuLeft/Function.js",
    "content": "import React, {Component} from \"react\";\nimport {Menu, Dropdown} from \"antd\";\n\nimport Reset from \"./Function/Reset\";\nimport Search from \"./Function/Search\";\nimport History from \"./Function/History\";\nimport SitDown from \"./Function/SitDown\";\n\nimport \"./common.css\";\n\nconst menu = (\n  <Menu>\n    <Menu.Item>\n      <Reset />\n    </Menu.Item>\n    <Menu.Item>\n      <Search />\n    </Menu.Item>\n\n    <Menu.Divider />\n\n    <Menu.Item>\n      <History />\n    </Menu.Item>\n    <Menu.Item>\n      <SitDown />\n    </Menu.Item>\n  </Menu>\n);\n\nclass Function extends Component {\n  render() {\n    return (\n      <Dropdown overlay={menu} trigger={[\"click\"]} overlayClassName=\"nice-overlay\">\n        <a id=\"nice-menu-function\" className=\"nice-menu-link\" href=\"#\">\n          功能\n        </a>\n      </Dropdown>\n    );\n  }\n}\n\nexport default Function;\n"
  },
  {
    "path": "src/component/MenuLeft/Help/About.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport \"../common.css\";\n\n@inject(\"dialog\")\n@observer\nclass About extends Component {\n  handleClick = () => {\n    this.props.dialog.setAboutOpen(true);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-about\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">关于</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default About;\n"
  },
  {
    "path": "src/component/MenuLeft/Help/Document.js",
    "content": "import React, {Component} from \"react\";\n\nimport \"../common.css\";\n\nclass Document extends Component {\n  handleClick = () => {\n    const w = window.open(\"about:blank\");\n    w.location.href = \"https://preview.mdnice.com/articles/\";\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-document\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">更多文档</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default Document;\n"
  },
  {
    "path": "src/component/MenuLeft/Help/Question.js",
    "content": "import React, {Component} from \"react\";\n\nimport \"../common.css\";\n\nclass Question extends Component {\n  handleClick = () => {\n    const w = window.open(\"about:blank\");\n    w.location.href = \"https://preview.mdnice.com/article/user/solve/\";\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-question\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">我要提问</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default Question;\n"
  },
  {
    "path": "src/component/MenuLeft/Help/Version.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport \"../common.css\";\n\n@inject(\"dialog\")\n@observer\nclass Version extends Component {\n  handleClick = () => {\n    this.props.dialog.setVersionOpen(true);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-version\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">版本信息</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default Version;\n"
  },
  {
    "path": "src/component/MenuLeft/Help.js",
    "content": "import React, {Component} from \"react\";\nimport {Menu, Dropdown} from \"antd\";\n\nimport About from \"./Help/About\";\nimport Version from \"./Help/Version\";\nimport Document from \"./Help/Document\";\nimport Question from \"./Help/Question\";\n\nimport \"./common.css\";\n\nconst menu = (\n  <Menu>\n    <Menu.Item>\n      <About />\n    </Menu.Item>\n    <Menu.Item>\n      <Version />\n    </Menu.Item>\n    <Menu.Item>\n      <Document />\n    </Menu.Item>\n    <Menu.Item>\n      <Question />\n    </Menu.Item>\n  </Menu>\n);\n\nclass Help extends Component {\n  render() {\n    return (\n      <Dropdown overlay={menu} trigger={[\"click\"]} overlayClassName=\"nice-overlay\">\n        <a id=\"nice-menu-help\" className=\"nice-menu-link\" href=\"#\">\n          帮助\n        </a>\n      </Dropdown>\n    );\n  }\n}\n\nexport default Help;\n"
  },
  {
    "path": "src/component/MenuLeft/LogIn.js",
    "content": "import React from \"react\";\nimport {Tooltip, Button} from \"antd\";\nimport {observer, inject} from \"mobx-react\";\nimport axios from \"axios\";\n\nimport {CLIENT_ID, CLIENT_SECRET, PROXY, ACCESS_TOKEN, ENTER_DELAY, LEAVE_DELAY} from \"../../utils/constant\";\nimport {queryParse, axiosJSON, axiosGithub} from \"../../utils/helper\";\nimport SvgIcon from \"../../icon\";\n\n@inject(\"userInfo\")\n@observer\nclass LogIn extends React.Component {\n  constructor(props) {\n    super(props);\n    this.code = queryParse().code;\n    if (this.code) {\n      this.loginBack();\n    }\n    const TOKEN = localStorage.getItem(ACCESS_TOKEN);\n    if (TOKEN) {\n      axios.defaults.headers.common.Authorization = `token ${TOKEN}`;\n      this.getUserInfo();\n    }\n  }\n\n  login = () => {\n    window.location.href = `https://github.com/login/oauth/authorize?client_id=${CLIENT_ID}&scope=public_repo`;\n  };\n\n  loginBack = async () => {\n    const res = await axiosJSON.post(PROXY, {\n      code: this.code,\n      client_id: CLIENT_ID,\n      client_secret: CLIENT_SECRET,\n    });\n    localStorage.setItem(ACCESS_TOKEN, res.data.access_token);\n    window.location.href = \"/\";\n  };\n\n  getUserInfo = async () => {\n    try {\n      const res = await axiosGithub.get(`/user`);\n      this.props.userInfo.setUserInfo(res.data);\n    } catch (error) {\n      console.log(error);\n    }\n  };\n\n  render() {\n    return (\n      <Tooltip placement=\"bottom\" mouseEnterDelay={ENTER_DELAY} mouseLeaveDelay={LEAVE_DELAY} title=\"登录\">\n        <Button shape=\"circle\" className=\"nice-btn-login\" onClick={this.login}>\n          <SvgIcon name=\"github\" className=\"nice-btn-login-icon\" />\n        </Button>\n      </Tooltip>\n    );\n  }\n}\n\nexport default LogIn;\n"
  },
  {
    "path": "src/component/MenuLeft/Login.css",
    "content": ".nice-btn-login {\n  border: none;\n  width: 24px;\n  height: 24px;\n}\n\n.nice-btn-login-icon {\n  width: 24px;\n  height: 24px;\n}"
  },
  {
    "path": "src/component/MenuLeft/Paragraph.js",
    "content": "import React, {Component} from \"react\";\nimport {Menu, Dropdown} from \"antd\";\n\nimport \"./common.css\";\n\nconst menu = (\n  <Menu>\n    <Menu.Item>\n      <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"#\">\n        导出\n      </a>\n    </Menu.Item>\n    <Menu.Item>\n      <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"#\">\n        导入\n      </a>\n    </Menu.Item>\n    <Menu.Item>\n      <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"#\">\n        打印\n      </a>\n    </Menu.Item>\n  </Menu>\n);\n\nclass Paragraph extends Component {\n  render() {\n    return (\n      <Dropdown overlay={menu} trigger={[\"click\"]} overlayClassName=\"nice-overlay\">\n        <a className=\"nice-menu-link\" href=\"#\">\n          段落\n        </a>\n      </Dropdown>\n    );\n  }\n}\n\nexport default Paragraph;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern/Bold.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {bold} from \"../../../utils/editorKeyEvents\";\nimport {hotKeys} from \"../../../utils/hotkey\";\n\nimport \"../common.css\";\n\n@inject(\"content\")\n@observer\nclass Bold extends Component {\n  handleClick = () => {\n    const {markdownEditor} = this.props.content;\n    const selection = markdownEditor.getSelection();\n    bold(markdownEditor, selection);\n\n    // 上传后实时更新内容\n    const content = markdownEditor.getValue();\n    this.props.content.setContent(content);\n    markdownEditor.focus();\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-bold\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">加粗</span>\n        </span>\n\n        <span className=\"nice-menu-shortcut\">{hotKeys.bold}</span>\n      </div>\n    );\n  }\n}\n\nexport default Bold;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern/Code.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {code} from \"../../../utils/editorKeyEvents\";\nimport {hotKeys} from \"../../../utils/hotkey\";\n\nimport \"../common.css\";\n\n@inject(\"content\")\n@observer\nclass Code extends Component {\n  handleClick = () => {\n    const {markdownEditor} = this.props.content;\n    const selection = markdownEditor.getSelection();\n    code(markdownEditor, selection);\n\n    // 上传后实时更新内容\n    const content = markdownEditor.getValue();\n    this.props.content.setContent(content);\n    markdownEditor.focus();\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-code\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">代码</span>\n        </span>\n        <span className=\"nice-menu-shortcut\">{hotKeys.code}</span>\n      </div>\n    );\n  }\n}\n\nexport default Code;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern/Del.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {del} from \"../../../utils/editorKeyEvents\";\nimport {hotKeys} from \"../../../utils/hotkey\";\n\nimport \"../common.css\";\n\n@inject(\"content\")\n@observer\nclass Del extends Component {\n  handleClick = () => {\n    const {markdownEditor} = this.props.content;\n    const selection = markdownEditor.getSelection();\n    del(markdownEditor, selection);\n\n    // 上传后实时更新内容\n    const content = markdownEditor.getValue();\n    this.props.content.setContent(content);\n    markdownEditor.focus();\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-del\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">删除线</span>\n        </span>\n        <span className=\"nice-menu-shortcut\">{hotKeys.del}</span>\n      </div>\n    );\n  }\n}\n\nexport default Del;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern/Font.js",
    "content": "import React, {Component} from \"react\";\nimport {message} from \"antd\";\n\nimport {FONT_THEME_ID, RIGHT_SYMBOL} from \"../../../utils/constant\";\nimport {replaceStyle} from \"../../../utils/helper\";\nimport \"../common.css\";\n\nclass Font extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      isSerif: false,\n    };\n  }\n\n  // 衬线字体 和 非衬线字体 切换\n  toggleFont = () => {\n    const {isSerif} = this.state;\n    const serif = `#nice { \n      font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;\n    }`;\n    const sansSerif = `#nice { \n      font-family: Roboto, Oxygen, Ubuntu, Cantarell, PingFangSC-light, PingFangTC-light, 'Open Sans', 'Helvetica Neue', sans-serif;\n    }`;\n    const choosen = isSerif ? serif : sansSerif;\n    replaceStyle(FONT_THEME_ID, choosen);\n    message.success(\"字体切换成功！\");\n    this.setState({isSerif: !isSerif});\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-font\" className=\"nice-menu-item\" onClick={this.toggleFont}>\n        <span>\n          <span className=\"nice-menu-flag\">{!this.state.isSerif && <span>{RIGHT_SYMBOL}</span>}</span>\n          <span className=\"nice-menu-name\">衬线字体</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default Font;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern/Form.js",
    "content": "import React, {Component} from \"react\";\nimport {inject, observer} from \"mobx-react\";\n\nimport {hotKeys} from \"../../../utils/hotkey\";\n\nimport \"../common.css\";\n\n@inject(\"dialog\")\n@observer\nclass Form extends Component {\n  showModal = () => {\n    this.props.dialog.setFormOpen(true);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-form\" className=\"nice-menu-item\" onClick={this.showModal}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">表格</span>\n        </span>\n        <span className=\"nice-menu-shortcut\">{hotKeys.form}</span>\n      </div>\n    );\n  }\n}\n\nexport default Form;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern/Format.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {formatDoc} from \"../../../utils/editorKeyEvents\";\nimport {hotKeys} from \"../../../utils/hotkey\";\n\nimport \"../common.css\";\n\n@inject(\"content\")\n@observer\nclass Format extends Component {\n  handleFormat = () => {\n    const {content} = this.props.content;\n    formatDoc(content, this.props.content);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-format\" className=\"nice-menu-item\" onClick={this.handleFormat}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">格式化文档</span>\n        </span>\n        <span className=\"nice-menu-shortcut\">{hotKeys.format}</span>\n      </div>\n    );\n  }\n}\n\nexport default Format;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern/Image.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {hotKeys} from \"../../../utils/hotkey\";\n\nimport \"../common.css\";\n\n@inject(\"dialog\")\n@observer\nclass Image extends Component {\n  showModal = () => {\n    this.props.dialog.setImageOpen(true);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-image\" className=\"nice-menu-item\" onClick={this.showModal}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">图片</span>\n        </span>\n        <span className=\"nice-menu-shortcut\">{hotKeys.image}</span>\n      </div>\n    );\n  }\n}\n\nexport default Image;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern/InlineCode.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {inlineCode} from \"../../../utils/editorKeyEvents\";\nimport {hotKeys} from \"../../../utils/hotkey\";\n\nimport \"../common.css\";\n\n@inject(\"content\")\n@observer\nclass InlineCode extends Component {\n  handleClick = () => {\n    const {markdownEditor} = this.props.content;\n    const selection = markdownEditor.getSelection();\n    inlineCode(markdownEditor, selection);\n\n    // 上传后实时更新内容\n    const content = markdownEditor.getValue();\n    this.props.content.setContent(content);\n    markdownEditor.focus();\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-inline-code\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">行内代码</span>\n        </span>\n        <span className=\"nice-menu-shortcut\">{hotKeys.inlineCode}</span>\n      </div>\n    );\n  }\n}\n\nexport default InlineCode;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern/Italic.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {italic} from \"../../../utils/editorKeyEvents\";\nimport {hotKeys} from \"../../../utils/hotkey\";\n\nimport \"../common.css\";\n\n@inject(\"content\")\n@observer\nclass Italic extends Component {\n  handleClick = () => {\n    const {markdownEditor} = this.props.content;\n    const selection = markdownEditor.getSelection();\n    italic(markdownEditor, selection);\n\n    // 上传后实时更新内容\n    const content = markdownEditor.getValue();\n    this.props.content.setContent(content);\n    markdownEditor.focus();\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-italic\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">倾斜</span>\n        </span>\n        <span className=\"nice-menu-shortcut\">{hotKeys.italic}</span>\n      </div>\n    );\n  }\n}\n\nexport default Italic;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern/Link.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {hotKeys} from \"../../../utils/hotkey\";\n\nimport \"../common.css\";\n\n@inject(\"dialog\")\n@observer\nclass Link extends Component {\n  showModal = () => {\n    this.props.dialog.setLinkOpen(true);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-link\" className=\"nice-menu-item\" onClick={this.showModal}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">链接</span>\n        </span>\n        <span className=\"nice-menu-shortcut\">{hotKeys.link}</span>\n      </div>\n    );\n  }\n}\n\nexport default Link;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern/LinkToFoot.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {parseLinkToFoot} from \"../../../utils/editorKeyEvents\";\nimport {hotKeys} from \"../../../utils/hotkey\";\n\nimport \"../common.css\";\n\n@inject(\"content\")\n@observer\nclass Format extends Component {\n  handleFormat = () => {\n    const {content} = this.props.content;\n    parseLinkToFoot(content, this.props.content);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-link-to-foot\" className=\"nice-menu-item\" onClick={this.handleFormat}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">微信外链转脚注</span>\n        </span>\n        <span className=\"nice-menu-shortcut\">{hotKeys.linkToFoot}</span>\n      </div>\n    );\n  }\n}\n\nexport default Format;\n"
  },
  {
    "path": "src/component/MenuLeft/Pattern.js",
    "content": "import React, {Component} from \"react\";\nimport {Menu, Dropdown} from \"antd\";\n\nimport Bold from \"./Pattern/Bold\";\nimport Code from \"./Pattern/Code\";\nimport Del from \"./Pattern/Del\";\nimport Italic from \"./Pattern/Italic\";\nimport Link from \"./Pattern/Link\";\nimport Form from \"./Pattern/Form\";\nimport Image from \"./Pattern/Image\";\nimport Format from \"./Pattern/Format\";\nimport LinkToFoot from \"./Pattern/LinkToFoot\";\nimport Font from \"./Pattern/Font\";\nimport InlineCode from \"./Pattern/InlineCode\";\n\nimport \"./common.css\";\n\nconst menu = (\n  <Menu>\n    <Menu.Item>\n      <Del />\n    </Menu.Item>\n    <Menu.Item>\n      <Bold />\n    </Menu.Item>\n    <Menu.Item>\n      <Italic />\n    </Menu.Item>\n    <Menu.Item>\n      <Code />\n    </Menu.Item>\n    <Menu.Item>\n      <InlineCode />\n    </Menu.Item>\n\n    <Menu.Divider />\n\n    <Menu.Item>\n      <Link />\n    </Menu.Item>\n    <Menu.Item>\n      <Form />\n    </Menu.Item>\n    <Menu.Item>\n      <Image />\n    </Menu.Item>\n    <Menu.Item>\n      <Font />\n    </Menu.Item>\n\n    <Menu.Divider />\n\n    <Menu.Item>\n      <LinkToFoot />\n    </Menu.Item>\n    <Menu.Item>\n      <Format />\n    </Menu.Item>\n  </Menu>\n);\n\nclass Pattern extends Component {\n  render() {\n    return (\n      <Dropdown overlay={menu} trigger={[\"click\"]} overlayClassName=\"nice-overlay\">\n        <a id=\"nice-menu-pattern\" className=\"nice-menu-link\" href=\"#\">\n          格式\n        </a>\n      </Dropdown>\n    );\n  }\n}\n\nexport default Pattern;\n"
  },
  {
    "path": "src/component/MenuLeft/Setting/ContainImgName.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {RIGHT_SYMBOL} from \"../../../utils/constant\";\nimport \"../common.css\";\n\n@inject(\"navbar\")\n@observer\nclass SyncScroll extends Component {\n  handleClick = () => {\n    const {isContainImgName} = this.props.navbar;\n    this.props.navbar.setContainImgName(!isContainImgName);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-contain-img-name\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\">{this.props.navbar.isContainImgName && <span>{RIGHT_SYMBOL}</span>}</span>\n          <span className=\"nice-menu-name\">上传图片时包含名称</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default SyncScroll;\n"
  },
  {
    "path": "src/component/MenuLeft/Setting/SyncScroll.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {RIGHT_SYMBOL} from \"../../../utils/constant\";\nimport \"../common.css\";\n\n@inject(\"navbar\")\n@observer\nclass SyncScroll extends Component {\n  handleClick = () => {\n    const {isSyncScroll} = this.props.navbar;\n    this.props.navbar.setSyncScroll(!isSyncScroll);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-sync-scroll\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\">{this.props.navbar.isSyncScroll && <span>{RIGHT_SYMBOL}</span>}</span>\n          <span className=\"nice-menu-name\">同步滚动</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default SyncScroll;\n"
  },
  {
    "path": "src/component/MenuLeft/Setting.js",
    "content": "import React, {Component} from \"react\";\nimport {Menu, Dropdown} from \"antd\";\n\nimport SyncScroll from \"./Setting/SyncScroll\";\nimport ContainImgName from \"./Setting/ContainImgName\";\n\nimport \"./common.css\";\n\nconst menu = (\n  <Menu>\n    <Menu.Item>\n      <SyncScroll />\n    </Menu.Item>\n    <Menu.Item>\n      <ContainImgName />\n    </Menu.Item>\n  </Menu>\n);\n\nclass Setting extends Component {\n  render() {\n    return (\n      <Dropdown overlay={menu} trigger={[\"click\"]} overlayClassName=\"nice-overlay\">\n        <a id=\"nice-menu-setting\" className=\"nice-menu-link\" href=\"#\">\n          设置\n        </a>\n      </Dropdown>\n    );\n  }\n}\n\nexport default Setting;\n"
  },
  {
    "path": "src/component/MenuLeft/Theme.css",
    "content": ".nice-themeselect-md-cutom-menu {\n  margin-left: 8px;\n  border: 1px dashed #1890ff;\n}\n.nice-themeselect-md-menu {\n  margin-left: 8px;\n}\n.nice-themeselect-code-menu {\n  margin-left: 8px;\n  margin-right: 8px;\n}\n.nice-themeselect-theme-item {\n  display: flex;\n  justify-content: space-between;\n  padding: 5px 12px 5px 6px;\n}\n.nice-themeselect-theme-item-author {\n  color: gray;\n}\n.nice-themeselect-theme-item-name {\n  margin-right: 10px;\n}\n.nice-themeselect-theme-item-new {\n  border-radius: 3px;\n  font-size: 12px;\n  color: #1890ff;\n  background: rgb(230, 247, 255);\n  padding: 0px 5px;\n  margin-left: -5px;\n  line-height: 18px;\n}\n.nice-themeselect-theme-item-flag {\n  display: inline-block;\n  width: 16px;\n}\n.nice-themeselect-icon {\n  width: 18px;\n  height: 18px;\n}\n.nice-themeselect-menu-item {\n  clear: both;\n  margin: 0;\n  color: rgba(0, 0, 0, 0.65);\n  font-weight: normal;\n  font-size: 14px;\n  line-height: 22px;\n  white-space: nowrap;\n  cursor: pointer;\n}\n\n.nice-menu-subscribe-more {\n  font-weight: bold;\n}"
  },
  {
    "path": "src/component/MenuLeft/Theme.js",
    "content": "import React from \"react\";\nimport {Menu, Dropdown} from \"antd\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {RIGHT_SYMBOL, TEMPLATE_NUM, MARKDOWN_THEME_ID, THEME_LIST, STYLE, THEME_API, TOKEN} from \"../../utils/constant\";\nimport {replaceStyle} from \"../../utils/helper\";\nimport TEMPLATE from \"../../template/index\";\nimport \"./Theme.css\";\nimport axios from \"axios\";\n\n@inject(\"content\")\n@inject(\"navbar\")\n@inject(\"view\")\n@observer\nclass Theme extends React.Component {\n  changeTemplate = (item) => {\n    const index = parseInt(item.key, 10);\n    const {themeId, css} = this.props.content.themeList[index];\n    this.props.navbar.setTemplateNum(index);\n\n    // 更新style编辑器\n    if (themeId === \"custom\") {\n      this.props.content.setCustomStyle();\n      // 切换自定义自动打开css编辑\n      this.props.view.setStyleEditorOpen(true);\n    } else {\n      this.props.content.setStyle(css);\n    }\n  };\n\n  toggleStyleEditor = () => {\n    const {isStyleEditorOpen} = this.props.view;\n    this.props.view.setStyleEditorOpen(!isStyleEditorOpen);\n  };\n\n  subscribeMore = () => {\n    const w = window.open(\"about:blank\");\n    w.location.href = \"https://preview.mdnice.com/themes\";\n  };\n\n  componentDidMount = async () => {\n    let themeList = null;\n    try {\n      const {token} = this.props;\n      let response;\n      let remoteThemelist;\n      if (token) {\n        // 如果处于登录状态，则读取订阅的主题\n        response = await axios.get(`https://api.mdnice.com/themes/editor`, {\n          headers: {\n            Authorization: `Bearer ${token}`,\n          },\n        });\n        if (!response.data.success) {\n          throw new Error();\n        }\n        remoteThemelist = response.data.data;\n      } else {\n        // 否则默认主题\n        response = await axios.get(THEME_API());\n        if (!response.data.success) {\n          throw new Error();\n        }\n        remoteThemelist = response.data.data.themeList;\n      }\n\n      themeList = [\n        {themeId: \"normal\", name: \"默认主题\", css: TEMPLATE.normal},\n        ...remoteThemelist,\n        {themeId: \"custom\", name: \"自定义\", css: TEMPLATE.custom},\n      ];\n      this.props.content.setThemeList(themeList);\n    } catch (err) {\n      console.error(\"读取最新主题信息错误\");\n      // 降级方案：使用本地的值\n      themeList = JSON.parse(window.localStorage.getItem(THEME_LIST));\n      this.props.content.setThemeList(themeList);\n    }\n\n    const templateNum = parseInt(window.localStorage.getItem(TEMPLATE_NUM), 10);\n\n    // 主题样式初始化，属于自定义主题则从localstorage中读数据\n    let style = \"\";\n    if (templateNum === themeList.length - 1) {\n      style = window.localStorage.getItem(STYLE);\n    } else {\n      if (templateNum) {\n        const {css} = themeList[templateNum];\n        style = css;\n      } else {\n        style = TEMPLATE.normal;\n      }\n    }\n    this.props.content.setStyle(style);\n    replaceStyle(MARKDOWN_THEME_ID, style);\n  };\n\n  render() {\n    const {templateNum} = this.props.navbar;\n    const {themeList} = this.props.content;\n\n    const mdMenu = (\n      <Menu onClick={this.changeTemplate}>\n        {themeList.map((option, index) => (\n          <Menu.Item key={index}>\n            <div id={`nice-menu-theme-${option.themeId}`} className=\"nice-themeselect-theme-item\">\n              <span>\n                <span className=\"nice-themeselect-theme-item-flag\">\n                  {templateNum === index && <span>{RIGHT_SYMBOL}</span>}\n                </span>\n                <span className=\"nice-themeselect-theme-item-name\">{option.name}</span>\n                {option.isNew && <span className=\"nice-themeselect-theme-item-new\">new</span>}\n              </span>\n              <span className=\"nice-themeselect-theme-item-author\">{option.authorName}</span>\n            </div>\n          </Menu.Item>\n        ))}\n        <Menu.Divider />\n        <li className=\"nice-themeselect-menu-item\">\n          <div id=\"nice-menu-subscribe-more\" className=\"nice-themeselect-theme-item\" onClick={this.subscribeMore}>\n            <span>\n              <span className=\"nice-themeselect-theme-item-flag\" />\n              <span className=\"nice-themeselect-theme-item-name nice-menu-subscribe-more\">订阅更多主题</span>\n            </span>\n          </div>\n        </li>\n        <Menu.Divider />\n\n        <li className=\"nice-themeselect-menu-item\">\n          <div id=\"nice-menu-view-css\" className=\"nice-themeselect-theme-item\" onClick={this.toggleStyleEditor}>\n            <span>\n              <span className=\"nice-themeselect-theme-item-flag\">\n                {this.props.view.isStyleEditorOpen && <span>{RIGHT_SYMBOL}</span>}\n              </span>\n              <span className=\"nice-themeselect-theme-item-name\">查看主题 CSS</span>\n            </span>\n          </div>\n        </li>\n      </Menu>\n    );\n    return (\n      <Dropdown overlay={mdMenu} trigger={[\"click\"]} overlayClassName=\"nice-overlay\">\n        <a id=\"nice-menu-theme\" className=\"nice-menu-link\" href=\"#\">\n          主题\n        </a>\n      </Dropdown>\n    );\n  }\n}\n\nexport default Theme;\n"
  },
  {
    "path": "src/component/MenuLeft/Tutorial.js",
    "content": "import React, {Component} from \"react\";\nimport {Menu, Dropdown} from \"antd\";\nimport {observer, inject} from \"mobx-react\";\n\nimport \"./common.css\";\nimport {TUTORIALS} from \"../../utils/constant\";\n\n@inject(\"dialog\")\n@observer\nclass Tutorial extends Component {\n  handleClick = (e, item) => {\n    this.props.dialog.setTutorialOpen(true);\n    this.props.dialog.setTutorialTitle(item.title);\n    this.props.dialog.setTutorialContent(item.content);\n    this.props.dialog.setTutorialPicture(item.picture);\n  };\n\n  render() {\n    const menu = (\n      <Menu>\n        {TUTORIALS.map((item, index) => (\n          <Menu.Item key={index}>\n            <div\n              id={\"nice-menu-tutorial-\" + index}\n              className=\"nice-menu-item\"\n              onClick={(e) => {\n                this.handleClick(e, item);\n              }}\n            >\n              <span>\n                <span className=\"nice-menu-flag\" />\n                <span className=\"nice-menu-name\">{item.title}</span>\n              </span>\n            </div>\n          </Menu.Item>\n        ))}\n      </Menu>\n    );\n    return (\n      <Dropdown overlay={menu} trigger={[\"click\"]} overlayClassName=\"nice-overlay\">\n        <a id=\"nice-menu-tutorial\" className=\"nice-menu-link\" href=\"#\">\n          教程\n        </a>\n      </Dropdown>\n    );\n  }\n}\n\nexport default Tutorial;\n"
  },
  {
    "path": "src/component/MenuLeft/View/EditArea.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {RIGHT_SYMBOL} from \"../../../utils/constant\";\nimport \"../common.css\";\n\n@inject(\"view\")\n@observer\nclass EditArea extends Component {\n  handleClick = () => {\n    const {isEditAreaOpen} = this.props.view;\n    this.props.view.setEditAreaOpen(!isEditAreaOpen);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-edit-area\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\">{this.props.view.isEditAreaOpen && <span>{RIGHT_SYMBOL}</span>}</span>\n          <span className=\"nice-menu-name\">编辑区域</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default EditArea;\n"
  },
  {
    "path": "src/component/MenuLeft/View/FullScreen.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport \"../common.css\";\n\n@inject(\"navbar\")\n@observer\nclass FullScreen extends Component {\n  // fullScreen or !fullScreen\n  toggleFullScreen = () => {\n    const doc = window.document;\n    const docEl = doc.documentElement;\n\n    const requestFullScreen =\n      docEl.requestFullscreen ||\n      docEl.mozRequestFullScreen ||\n      docEl.webkitRequestFullScreen ||\n      docEl.msRequestFullscreen;\n    const cancelFullScreen =\n      doc.exitFullscreen || doc.mozCancelFullScreen || doc.webkitExitFullscreen || doc.msExitFullscreen;\n\n    if (\n      !doc.fullscreenElement &&\n      !doc.mozFullScreenElement &&\n      !doc.webkitFullscreenElement &&\n      !doc.msFullscreenElement\n    ) {\n      requestFullScreen.call(docEl);\n    } else {\n      cancelFullScreen.call(doc);\n    }\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-full-screen\" className=\"nice-menu-item\" onClick={this.toggleFullScreen}>\n        <span>\n          <span className=\"nice-menu-flag\" />\n          <span className=\"nice-menu-name\">全屏</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default FullScreen;\n"
  },
  {
    "path": "src/component/MenuLeft/View/PreviewArea.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {RIGHT_SYMBOL} from \"../../../utils/constant\";\nimport \"../common.css\";\n\n@inject(\"view\")\n@observer\nclass PreviewArea extends Component {\n  handleClick = () => {\n    const {isPreviewAreaOpen} = this.props.view;\n    this.props.view.setPreviewAreaOpen(!isPreviewAreaOpen);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-preview-area\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\">{this.props.view.isPreviewAreaOpen && <span>{RIGHT_SYMBOL}</span>}</span>\n          <span className=\"nice-menu-name\">预览区域</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default PreviewArea;\n"
  },
  {
    "path": "src/component/MenuLeft/View/ThemeArea.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\n\nimport {RIGHT_SYMBOL} from \"../../../utils/constant\";\nimport \"../common.css\";\n\n@inject(\"view\")\n@observer\nclass ThemeArea extends Component {\n  handleClick = () => {\n    const {isStyleEditorOpen} = this.props.view;\n    this.props.view.setStyleEditorOpen(!isStyleEditorOpen);\n  };\n\n  render() {\n    return (\n      <div id=\"nice-menu-theme-area\" className=\"nice-menu-item\" onClick={this.handleClick}>\n        <span>\n          <span className=\"nice-menu-flag\">{this.props.view.isStyleEditorOpen && <span>{RIGHT_SYMBOL}</span>}</span>\n          <span className=\"nice-menu-name\">主题CSS区域</span>\n        </span>\n      </div>\n    );\n  }\n}\n\nexport default ThemeArea;\n"
  },
  {
    "path": "src/component/MenuLeft/View.js",
    "content": "import React, {Component} from \"react\";\nimport {Menu, Dropdown} from \"antd\";\n\nimport FullScreen from \"./View/FullScreen\";\nimport EditArea from \"./View/EditArea\";\nimport PreviewArea from \"./View/PreviewArea\";\nimport ThemeArea from \"./View/ThemeArea\";\n\nimport \"./common.css\";\n\nconst menu = (\n  <Menu>\n    <Menu.Item>\n      <FullScreen />\n    </Menu.Item>\n\n    <Menu.Divider />\n\n    <Menu.Item>\n      <EditArea />\n    </Menu.Item>\n    <Menu.Item>\n      <PreviewArea />\n    </Menu.Item>\n    <Menu.Item>\n      <ThemeArea />\n    </Menu.Item>\n  </Menu>\n);\n\nclass View extends Component {\n  render() {\n    return (\n      <Dropdown overlay={menu} trigger={[\"click\"]} overlayClassName=\"nice-overlay\">\n        <a id=\"nice-menu-view\" className=\"nice-menu-link\" href=\"#\">\n          查看\n        </a>\n      </Dropdown>\n    );\n  }\n}\n\nexport default View;\n"
  },
  {
    "path": "src/component/MenuLeft/common.css",
    "content": ".nice-menu-item {\n  display: flex;\n  justify-content: space-between;\n  width: 100%;\n  padding: 5px 12px 5px 6px;\n}\n\n.nice-menu-shortcut {\n  color: gray;\n}\n\n.nice-menu-name {\n  margin-right: 10px;\n}\n\n.nice-menu-flag {\n  display: inline-block;\n  width: 16px;\n}\n\n.nice-menu-link {\n  color: #333;\n  font-size: 14px;\n  padding: 8px 10px;\n}\n\n.nice-menu-link:hover {\n  color: #333;\n}\n\n.nice-menu-link:focus {\n  color: #333;\n  background: #e6f7ff;\n}\n\n.nice-overlay {\n  top: 30px !important;\n}\n\n.nice-overlay ul {\n  border-radius: 0px 0px 4px 4px;\n}\n\n.nice-overlay ul .ant-dropdown-menu-item {\n  clear: both;\n  margin: 0;\n  padding: 0;\n  color: rgba(0, 0, 0, 0.65);\n  font-weight: normal;\n  font-size: 14px;\n  line-height: 22px;\n  white-space: nowrap;\n  cursor: pointer;\n}\n\n.nice-overlay ul label {\n  cursor: pointer;\n}"
  },
  {
    "path": "src/component/SearchBox/SearchBox.css",
    "content": ".mdnice-searchbox {\n  position: absolute;\n  right: 20px;\n  top: 20px;\n  z-index: 20;\n  transition: all 0.15s ease-in-out;\n  padding: 8px;\n  max-width: calc(100% - 40px);\n  background-color: white;\n  height: 72px;\n  box-shadow: 0px 5px 12px rgba(0, 0, 0, 0.05);\n  border-radius: 4px;\n  overflow: hidden;\n}\n\n.mdnice-searchbox-replace {\n  margin-top: 8px;\n  margin-left: 27px;\n}\n\n.mdnice-searchbox > div {\n  display: flex;\n  align-items: center;\n}\n\n.mdnice-searchbox div>:not(:last-child ) {\n  margin-right: 3px;\n}\n\n.mdnice-searchbox div input {\n  width: 160px;\n}\n\n.mdnice-searchbox .searchbox-button {\n  background-color: white;\n  outline: none;\n  padding: 0px;\n  border: none;\n  border-radius: 4px;\n  height: 24px;\n  width: 24px;\n}\n\n.mdnice-searchbox .searchbox-button:active{\n  background-color: #e6f7ff;\n}\n\n.searchbox-icon {\n  display: block;\n  margin: auto;\n  height: 24px;\n  width: 24px;\n  background-color: transparent;\n}\n\n.searchbox-icon-casefold {\n  width: 18px;\n}\n\n.searchbox-icon-prev {\n  transform: rotate(180deg);\n}\n\n.searchbox-icon-replace {\n  width: 16px;\n}\n\n.searchbox-icon-fold {\n  transform: rotate(-90deg);\n  transition: all 0.2s ease-in-out;\n}\n\n.mdnice-searchbox[data-replace=\"true\"]  .searchbox-icon-fold{\n  transform: unset;\n}\n\n.searchbox-text-highlight {\n  background-color: #91d5ff;\n  line-height: 16px;\n  padding: 3px 0px;\n}\n\n/* .mdnice-searchbox[data-active=\"false\"] {\n  max-height: 0px !important;\n  padding-top: 0px;\n  padding-bottom: 0px;\n} */\n\n.mdnice-searchbox[data-replace=\"false\"] {\n  height: 40px;\n}\n\n.mdnice-searchbox[data-replace=\"false\"] .mdnice-searchbox-replace {\n  visibility: hidden;\n}\n/* \n.mdnice-searchbox ~ div .CodeMirror-sizer {\n  transition: all 0.15s ease-in-out;\n} */\n\n.mdnice-searchbox ~ div .CodeMirror-sizer {\n  top: 40px;  \n}\n\n.mdnice-searchbox[data-replace=\"true\"] ~ div .CodeMirror-sizer {\n  top: 72px;\n}\n\n\n"
  },
  {
    "path": "src/component/SearchBox/index.js",
    "content": "/* eslint-disable react/no-did-update-set-state */\n/* eslint-disable react/no-unused-state */\nimport React, {createRef} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Input, Tooltip} from \"antd\";\n\nimport {ENTER_DELAY, LEAVE_DELAY} from \"../../utils/constant\";\n\nimport SvgIcon from \"../../icon\";\n\nimport \"./SearchBox.css\";\n\nfunction WrappedButton(props) {\n  const className = props.className === undefined ? \"\" : props.className;\n  return (\n    <Tooltip placement=\"bottom\" mouseEnterDelay={ENTER_DELAY} mouseLeaveDelay={LEAVE_DELAY} title={props.tipText}>\n      <button className=\"searchbox-button\" type=\"button\" onClick={props.onClick}>\n        <SvgIcon name={props.icon} className={`searchbox-icon ${className}`} fill={props.fill} />\n      </button>\n    </Tooltip>\n  );\n}\n\n@inject(\"content\")\n@inject(\"dialog\")\n@observer\nclass SearchBox extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      replaceText: \"\",\n      searchText: \"\",\n      isReplaceOpen: false,\n      cursor: null,\n      caseFold: true,\n    };\n    this.searchRef = createRef();\n  }\n\n  /** false means next, true means previous */\n  posChange = (direction) => {\n    this.clearMarks();\n    if (typeof direction !== \"boolean\") {\n      return;\n    }\n    const {cursor, searchText} = this.state;\n    if (searchText && cursor) {\n      cursor.find(direction);\n      if (cursor.atOccurrence) {\n        this.highlight();\n      } else {\n        while (cursor.find(!direction)) {\n          //  从头开始寻找\n        }\n        cursor.find(direction);\n        this.highlight();\n      }\n    }\n  };\n\n  handleCaseFold = () => {\n    const {markdownEditor} = this.props.content;\n    this.clearMarks();\n    this.setState(\n      (prevState) => {\n        const caseFold = !prevState.caseFold;\n        const cursor = prevState.searchText\n          ? markdownEditor.getSearchCursor(prevState.searchText, null, {caseFold: caseFold})\n          : null;\n        return {caseFold, cursor};\n      },\n      () => this.posChange(false),\n    );\n  };\n\n  handleScroll = (offset) => {\n    const {markdownEditor} = this.props.content;\n    const {top} = markdownEditor.getScrollInfo(offset);\n    console.log(offset);\n    markdownEditor.scrollTo(null, top + offset);\n  };\n\n  componentWillUnmount = () => {\n    this.handleScroll(this.state.isReplaceOpen ? -72 : -40);\n  };\n\n  componentDidMount = () => {\n    this.searchRef.current.focus();\n    this.handleScroll(40);\n  };\n\n  clearMarks = () => {\n    const {markdownEditor} = this.props.content;\n    // const markers = markdownEditor.getAllMarks();\n    // markers.forEach((marker) => marker.clear());\n    const cursor = markdownEditor.getCursor();\n    markdownEditor.setSelection(cursor);\n  };\n\n  findContent = (value) => {\n    const {markdownEditor} = this.props.content;\n    this.setState(\n      (prevState) => {\n        const cursor = value ? markdownEditor.getSearchCursor(value, null, {caseFold: prevState.caseFold}) : null;\n        return {searchText: value, cursor};\n      },\n      () => this.posChange(false),\n    );\n  };\n\n  highlight = () => {\n    // 高亮前需检测是否有匹配\n    if (this.state.cursor.atOccurrence) {\n      const {markdownEditor} = this.props.content;\n      const from = this.state.cursor.from();\n      const to = this.state.cursor.to();\n\n      // markdownEditor.markText(from, to, {\n      //   className: \"searchbox-text-highlight\",\n      // });\n      markdownEditor.setSelection(from, to);\n      // 防止搜索框挡住文字\n      markdownEditor.scrollIntoView(from, 200);\n    }\n  };\n\n  replace = () => {\n    const {markdownEditor} = this.props.content;\n    const selection = markdownEditor.getSelection();\n    if (selection) {\n      // 未选中不进行替换\n      markdownEditor.replaceSelection(this.state.replaceText);\n\n      const content = markdownEditor.getValue();\n      this.props.content.setContent(content);\n      this.posChange(false);\n    }\n  };\n\n  replaceAll = () => {\n    const {markdownEditor} = this.props.content;\n    const selection = markdownEditor.getSelection();\n    if (selection && this.state.searchText) {\n      const content = markdownEditor.getValue();\n      const searchReg = new RegExp(this.state.searchText, \"g\");\n      const replaced = content.replace(searchReg, this.state.replaceText);\n\n      this.props.content.setContent(replaced);\n    }\n  };\n\n  handelFoldClick = () => {\n    this.setState((prevState) => {\n      const {isReplaceOpen} = prevState;\n      this.handleScroll(isReplaceOpen ? -32 : 32);\n      return {isReplaceOpen: !isReplaceOpen};\n    });\n  };\n\n  handleClose = () => {\n    this.props.dialog.setSearchOpen(false);\n    this.clearMarks();\n  };\n\n  render() {\n    const {isReplaceOpen} = this.state;\n\n    return (\n      <div data-replace={isReplaceOpen} className=\"mdnice-searchbox\">\n        <div>\n          <WrappedButton icon=\"down\" tipText=\"展开\" onClick={this.handelFoldClick} className=\"searchbox-icon-fold\" />\n          <Input\n            size=\"small\"\n            value={this.state.searchText}\n            placeholder=\"按Enter进行查找\"\n            onChange={(e) => this.findContent(e.target.value)}\n            onPressEnter={() => this.posChange(false)}\n            ref={this.searchRef}\n          />\n          <WrappedButton\n            icon=\"fontCase\"\n            onClick={this.handleCaseFold}\n            tipText=\"忽略大小写\"\n            className=\"searchbox-icon-casefold\"\n            fill={this.state.caseFold ? \"#40a9ff\" : undefined}\n          />\n          <WrappedButton\n            icon=\"down\"\n            className=\"searchbox-icon-prev\"\n            onClick={() => this.posChange(true)}\n            tipText=\"上一个\"\n          />\n          <WrappedButton icon=\"down\" onClick={() => this.posChange(false)} tipText=\"下一个\" />\n          <WrappedButton icon=\"close\" onClick={this.handleClose} tipText=\"关闭\" />\n        </div>\n        <div className=\"mdnice-searchbox-replace\">\n          <Input\n            size=\"small\"\n            value={this.state.replaceText}\n            placeholder=\"按Enter进行替换\"\n            onChange={(e) => {\n              this.setState({replaceText: e.target.value});\n            }}\n            onPressEnter={this.replace}\n          />\n          <WrappedButton icon=\"replace\" className=\"searchbox-icon-replace\" onClick={this.replace} tipText=\"替换\" />\n          <WrappedButton\n            icon=\"replaceAll\"\n            className=\"searchbox-icon-replace\"\n            onClick={this.replaceAll}\n            tipText=\"替换所有\"\n          />\n        </div>\n      </div>\n    );\n  }\n}\n\nexport default SearchBox;\n"
  },
  {
    "path": "src/component/Sidebar/Juejin.css",
    "content": ".nice-btn-juejin {\n  padding: 0;\n  margin-bottom: 10px;\n}\n\n.nice-btn-juejin-icon {\n  padding: 5px 5px 5px 2px;\n  width: 30px;\n  height: 28px;\n}\n"
  },
  {
    "path": "src/component/Sidebar/Juejin.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {message, Tooltip} from \"antd\";\n\nimport {solveHtml, solveJuejinMath, solveJuejinCode, addJuejinSuffix, copySafari} from \"../../utils/converter\";\nimport {LAYOUT_ID, ENTER_DELAY, LEAVE_DELAY} from \"../../utils/constant\";\nimport SvgIcon from \"../../icon\";\nimport \"./Juejin.css\";\n\n@inject(\"content\")\n@inject(\"navbar\")\n@inject(\"imageHosting\")\n@inject(\"dialog\")\n@observer\nclass Juejin extends Component {\n  constructor(props) {\n    super(props);\n    this.html = \"\";\n  }\n\n  copyJuejin = () => {\n    const layout = document.getElementById(LAYOUT_ID); // 保护现场\n    const html = layout.innerHTML;\n    solveJuejinMath();\n    addJuejinSuffix();\n    this.html = solveHtml();\n    this.html = solveJuejinCode(this.html);\n    copySafari(this.html);\n    if (this.html.length > 60000) {\n      message.error(\"超过 60000 字符，无法上传稀土掘金\");\n    } else {\n      message.success(\"已复制且添加 mdnice 排版后缀，感谢宣传，请到稀土掘金粘贴\");\n    }\n    layout.innerHTML = html; // 恢复现场\n  };\n\n  render() {\n    return (\n      <Tooltip placement=\"left\" mouseEnterDelay={ENTER_DELAY} mouseLeaveDelay={LEAVE_DELAY} title=\"复制到稀土掘金\">\n        <a id=\"nice-sidebar-juejin\" className=\"nice-btn-juejin\" onClick={this.copyJuejin}>\n          <SvgIcon name=\"juejin\" className=\"nice-btn-juejin-icon\" />\n        </a>\n      </Tooltip>\n    );\n  }\n}\n\nexport default Juejin;\n"
  },
  {
    "path": "src/component/Sidebar/PreviewType.css",
    "content": ".nice-btn-previewtype {\n  padding: 0;\n  margin-bottom: 10px;\n}\n\n.nice-btn-previewtype-icon {\n  padding: 7px;\n  width: 30px;\n  height: 30px;\n}\n"
  },
  {
    "path": "src/component/Sidebar/PreviewType.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {Tooltip} from \"antd\";\n\nimport {ENTER_DELAY, LEAVE_DELAY} from \"../../utils/constant\";\nimport SvgIcon from \"../../icon\";\nimport \"./PreviewType.css\";\n\n@inject(\"navbar\")\n@observer\nclass PreviewType extends Component {\n  handleClick = (key) => {\n    this.props.navbar.setPreviewType(key);\n  };\n\n  render() {\n    const targetType = this.props.navbar.previewType === \"pc\" ? \"mobile\" : \"pc\";\n\n    return (\n      <Tooltip placement=\"left\" mouseEnterDelay={ENTER_DELAY} mouseLeaveDelay={LEAVE_DELAY} title=\"预览模式\">\n        <a id=\"nice-sidebar-preview-type\" className=\"nice-btn-previewtype\" onClick={() => this.handleClick(targetType)}>\n          <SvgIcon name={targetType} className=\"nice-btn-previewtype-icon\" />\n        </a>\n      </Tooltip>\n    );\n  }\n}\n\nexport default PreviewType;\n"
  },
  {
    "path": "src/component/Sidebar/Wechat.css",
    "content": ".nice-btn-wechat {\n  padding: 0;\n  margin-bottom: 10px;\n}\n\n.nice-btn-wechat-icon {\n  padding: 6px;\n  width: 30px;\n  height: 30px;\n}\n"
  },
  {
    "path": "src/component/Sidebar/Wechat.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {message, Tooltip} from \"antd\";\n\nimport {solveWeChatMath, solveHtml, copySafari} from \"../../utils/converter\";\nimport {LAYOUT_ID, ENTER_DELAY, LEAVE_DELAY} from \"../../utils/constant\";\nimport SvgIcon from \"../../icon\";\nimport \"./Wechat.css\";\n\n@inject(\"content\")\n@inject(\"navbar\")\n@inject(\"imageHosting\")\n@inject(\"dialog\")\n@observer\nclass Wechat extends Component {\n  constructor(props) {\n    super(props);\n    this.html = \"\";\n  }\n\n  copyWechat = () => {\n    const layout = document.getElementById(LAYOUT_ID); // 保护现场\n    const html = layout.innerHTML;\n    solveWeChatMath();\n    this.html = solveHtml();\n    copySafari(this.html);\n    message.success(\"已复制，请到微信公众平台粘贴\");\n    layout.innerHTML = html; // 恢复现场\n  };\n\n  render() {\n    return (\n      <Tooltip placement=\"left\" mouseEnterDelay={ENTER_DELAY} mouseLeaveDelay={LEAVE_DELAY} title=\"复制到公众号\">\n        <a id=\"nice-sidebar-wechat\" className=\"nice-btn-wechat\" onClick={this.copyWechat}>\n          <SvgIcon name=\"wechat\" className=\"nice-btn-wechat-icon\" />\n        </a>\n      </Tooltip>\n    );\n  }\n}\n\nexport default Wechat;\n"
  },
  {
    "path": "src/component/Sidebar/Zhihu.css",
    "content": ".nice-btn-zhihu {\n  padding: 0;\n  margin-bottom: 10px;\n}\n\n.nice-btn-zhihu-icon {\n  padding: 5px;\n  width: 30px;\n  height: 30px;\n}\n"
  },
  {
    "path": "src/component/Sidebar/Zhihu.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport {message, Tooltip} from \"antd\";\n\nimport {solveHtml, solveZhihuMath, copySafari} from \"../../utils/converter\";\nimport {LAYOUT_ID, ENTER_DELAY, LEAVE_DELAY} from \"../../utils/constant\";\nimport SvgIcon from \"../../icon\";\nimport \"./Zhihu.css\";\n\n@inject(\"content\")\n@inject(\"navbar\")\n@inject(\"imageHosting\")\n@inject(\"dialog\")\n@observer\nclass Zhihu extends Component {\n  constructor(props) {\n    super(props);\n    this.html = \"\";\n  }\n\n  copyZhihu = () => {\n    const layout = document.getElementById(LAYOUT_ID); // 保护现场\n    const html = layout.innerHTML;\n    solveZhihuMath();\n    this.html = solveHtml();\n    copySafari(this.html);\n    message.success(\"已复制，请到知乎粘贴\");\n    layout.innerHTML = html; // 恢复现场\n  };\n\n  render() {\n    return (\n      <Tooltip placement=\"left\" mouseEnterDelay={ENTER_DELAY} mouseLeaveDelay={LEAVE_DELAY} title=\"复制到知乎\">\n        <a id=\"nice-sidebar-zhihu\" className=\"nice-btn-zhihu\" onClick={this.copyZhihu}>\n          <SvgIcon name=\"zhihu\" className=\"nice-btn-zhihu-icon\" />\n        </a>\n      </Tooltip>\n    );\n  }\n}\n\nexport default Zhihu;\n"
  },
  {
    "path": "src/icon/Close.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path\n      d=\"M552.220444 512l201.159112 201.159111a28.444444 28.444444 0 0 1-40.220445 40.220445L512 552.220444l-201.159111 201.159112a28.444444 28.444444 0 0 1-40.220445-40.220445L471.779556 512 270.620444 310.840889a28.444444 28.444444 0 1 1 40.220445-40.220445L512 471.779556l201.159111-201.159112a28.444444 28.444444 0 0 1 40.220445 40.220445L552.220444 512z\"\n      fill=\"#5A6677\"\n      p-id=\"2215\"\n    />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/Copy.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path\n      d=\"M248.087 206.383h289.187c62.79 0 112.314 15.034 147.689 45.102 32.721 28.3 49.524 66.327 49.524 114.083 0 35.375-8.843 65.443-25.646 90.205-16.803 22.994-40.681 39.796-72.518 52.178 41.565 7.959 72.518 24.762 93.742 50.408 20.34 24.762 30.953 59.253 30.953 101.702 0 63.674-22.109 110.546-65.443 140.614-37.143 24.762-90.205 37.143-157.416 37.143H248.087V206.383z m103.47 84.898v180.41H509.86c44.218 0 75.17-7.959 93.742-22.108 17.688-15.035 27.416-38.912 27.416-71.634 0-30.068-9.728-52.177-27.416-65.443-19.456-14.15-49.524-21.225-91.973-21.225h-160.07z m0 265.31v196.328h171.567c38.912 0 69.865-6.19 91.974-18.571 28.3-15.919 42.45-40.681 42.45-76.056 0-36.259-10.613-61.905-30.953-77.824-21.225-15.918-54.83-23.877-100.818-23.877h-174.22z\"\n      p-id=\"4399\"\n    />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/Down.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill=\"currentColor\"\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path d=\"M773.632 389.12l-236.416 302.592a32 32 0 0 1-50.432-39.424l236.416-302.592a32 32 0 0 1 50.432 39.424z\" />\n    <path d=\"M300.8 349.696l236.416 302.592a32 32 0 0 1-50.432 39.424L250.368 389.12A32 32 0 0 1 300.8 349.696z\" />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/Environment.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"#1890ff\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path d=\"M903.542857 257.257143a414.274286 414.274286 0 0 0-91.314286-132.228572 423.805714 423.805714 0 0 0-135.085714-88.914285C624.8 14.4 569.257143 3.428571 512 3.428571c-57.257143 0-112.8 10.971429-165.142857 32.571429-50.628571 20.914286-96 50.857143-135.085714 88.914286A415.542857 415.542857 0 0 0 120.457143 257.142857c-22.285714 51.428571-33.6 106.057143-33.6 162.285714 0 80.685714 19.314286 161.028571 57.257143 238.514286 30.514286 62.285714 73.142857 122.971429 126.857143 180.685714 91.771429 98.514286 188 158.742857 215.314285 174.857143a50.171429 50.171429 0 0 0 25.6 6.971429c8.914286 0 17.714286-2.285714 25.6-6.971429 27.314286-16.114286 123.542857-76.342857 215.314286-174.857143 53.714286-57.6 96.342857-118.4 126.857143-180.685714C917.828571 580.571429 937.142857 500.342857 937.142857 419.542857c0-56.228571-11.314286-110.857143-33.6-162.285714zM512 932.8c-75.314286-47.885714-342.857143-237.485714-342.857143-513.257143 0-89.028571 35.542857-172.685714 100.114286-235.771428C334.057143 120.571429 420.228571 85.714286 512 85.714286s177.942857 34.857143 242.742857 98.171428C819.314286 246.857143 854.857143 330.514286 854.857143 419.542857c0 275.771429-267.542857 465.371429-342.857143 513.257143z m0-705.371429c-111.085714 0-201.142857 90.057143-201.142857 201.142858s90.057143 201.142857 201.142857 201.142857 201.142857-90.057143 201.142857-201.142857-90.057143-201.142857-201.142857-201.142858z m90.514286 291.657143A127.542857 127.542857 0 0 1 512 556.571429c-34.171429 0-66.285714-13.371429-90.514286-37.485715A127.542857 127.542857 0 0 1 384 428.571429c0-34.171429 13.371429-66.285714 37.485714-90.514286C445.714286 313.828571 477.828571 300.571429 512 300.571429c34.171429 0 66.285714 13.257143 90.514286 37.485714C626.742857 362.285714 640 394.4 640 428.571429c0 34.171429-13.257143 66.285714-37.485714 90.514285z\" />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/FontCase.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path\n      d=\"M479.829333 640H202.837333l-85.333333 213.333333H25.6L298.666667 170.666667h85.333333l273.066667 682.666666h-91.904l-85.333334-213.333333z m-34.133333-85.333333L341.333333 293.76 236.970667 554.666667h208.725333zM896 534.826667V512h85.333333v341.333333h-85.333333v-22.826666a170.666667 170.666667 0 1 1 0-295.68zM810.666667 768a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z\"\n      p-id=\"2586\"\n    />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/GitHub.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path d=\"M512 0c-282.784 0-512 229.216-512 512s229.216 512 512 512 512-229.216 512-512-229.216-512-512-512zM816.064 816.064c-39.52 39.52-85.504 70.528-136.704 92.192-12.992 5.504-26.208 10.336-39.616 14.496l0-76.736c0-40.32-13.824-70.016-41.504-88.992 17.344-1.664 33.248-4 47.744-7.008s29.824-7.328 46.016-12.992 30.656-12.416 43.488-20.256 25.152-18.016 36.992-30.496 21.76-26.656 29.76-42.496 14.336-34.848 19.008-56.992 7.008-46.592 7.008-73.248c0-51.68-16.832-95.68-50.496-132 15.328-40 13.664-83.488-4.992-130.496l-12.512-1.504c-8.672-0.992-24.256 2.656-46.752 11.008s-47.744 22.016-75.744 40.992c-39.68-11.008-80.832-16.512-123.488-16.512-43.008 0-84 5.504-123.008 16.512-17.664-12-34.4-21.92-50.24-29.76s-28.512-13.152-38.016-16-18.336-4.576-26.496-5.248-13.408-0.832-15.744-0.512-4 0.672-4.992 0.992c-18.656 47.328-20.32 90.848-4.992 130.496-33.664 36.32-50.496 80.32-50.496 132 0 26.656 2.336 51.072 7.008 73.248s11.008 41.152 19.008 56.992 17.92 30.016 29.76 42.496 24.16 22.656 36.992 30.496 27.328 14.592 43.488 20.256 31.488 10.016 46.016 12.992 30.4 5.344 47.744 7.008c-27.328 18.656-40.992 48.32-40.992 88.992l0 78.24c-15.104-4.48-29.984-9.792-44.608-16-51.2-21.664-97.184-52.672-136.704-92.192s-70.528-85.504-92.192-136.704c-22.4-52.96-33.76-109.248-33.76-167.36s11.36-114.4 33.76-167.36c21.664-51.2 52.672-97.184 92.192-136.704s85.504-70.528 136.704-92.192c52.96-22.4 109.28-33.76 167.36-33.76s114.4 11.36 167.36 33.76c51.2 21.664 97.184 52.672 136.704 92.192s70.528 85.504 92.192 136.704c22.4 52.96 33.76 109.28 33.76 167.36s-11.36 114.4-33.76 167.36c-21.664 51.2-52.672 97.184-92.192 136.704z\" />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/Inbox.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path d=\"M936.228571 438.857143L804.571429 109.714286c0-7.314286-7.314286-14.628571-14.628572-21.942857-7.314286-7.314286-14.628571-7.314286-29.257143-7.314286h-512c-7.314286 0-21.942857 0-29.257143 7.314286-7.314286 7.314286-7.314286 14.628571-14.628571 21.942857L87.771429 431.542857V877.714286c0 21.942857 7.314286 36.571429 21.942857 51.2 14.628571 14.628571 29.257143 21.942857 51.2 21.942857H877.714286c21.942857 0 36.571429-7.314286 51.2-21.942857 14.628571-14.628571 21.942857-29.257143 21.942857-51.2V460.8v-7.314286l-14.628572-14.628571z m-336.457142-51.2v14.628571c0 29.257143-7.314286 43.885714-21.942858 65.828572s-36.571429 21.942857-65.828571 21.942857-43.885714-7.314286-65.828571-21.942857c-14.628571-14.628571-21.942857-36.571429-21.942858-65.828572v-14.628571H190.171429l87.771428-219.428572H731.428571l95.085715 219.428572H599.771429zM168.228571 475.428571h182.857143c14.628571 29.257143 36.571429 58.514286 65.828572 73.142858 29.257143 21.942857 58.514286 29.257143 95.085714 29.257142s73.142857-7.314286 102.4-29.257142c29.257143-14.628571 43.885714-43.885714 58.514286-73.142858h182.857143v380.342858H168.228571V475.428571z\" />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/Juejin.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path\n      d=\"M729.64116345 165.27693991L634.32650881 90.125l-99.5625 78.52693991-5.17887981 4.16056009 104.74137981 83.50215546 105.09051682-83.50215546-9.77586218-7.53556009z m361.21228445 291.47198236l-456.78879245 360.19396555-456.49784537-359.99030128L110.125 511.12715547l523.93965546 413.11745671 524.23060335-413.35021555-67.44181091-54.14547436z m-456.78879245 29.21120673L385.4784479 290.00646554 318.06573237 344.12284454l315.96982771 249.16810336 316.28987101-249.40086136-67.41271555-54.14547436-248.84806008 196.21551682z\"\n      fill=\"#006cff\"\n      p-id=\"1966\"\n    />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/Mobile.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path d=\"M736 0l-448 0c-52.8 0-96 43.2-96 96l0 832c0 52.8 43.2 96 96 96l448 0c52.8 0 96-43.2 96-96l0-832c0-52.8-43.2-96-96-96zM384 48l256 0 0 32-256 0 0-32zM512 960c-35.346 0-64-28.654-64-64s28.654-64 64-64 64 28.654 64 64-28.654 64-64 64zM768 768l-512 0 0-640 512 0 0 640z\" />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/More.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"#1890ff\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path d=\"M509.49688889 792.91733333c51.76888889 0.11377778 93.52533333 41.87022222 93.41155556 93.75288889-0.11377778 51.65511111-42.09777778 93.63911111-93.86666667 93.52533333-51.54133333 0-93.52533333-42.21155554-93.41155556-93.98044444 0.11377778-51.65511111 41.984-93.29777778 93.86666667-93.29777778z m-93.75288889-656.49777778c0-51.76888889 41.87022222-93.86666667 93.52533333-93.86666665 51.65511111-0.11377778 93.75288889 41.87022222 93.75288889 93.63911111 0 51.88266667-41.64266667 93.75288889-93.52533333 93.75288889s-93.75288889-41.64266667-93.75288889-93.52533335zM603.02222222 511.54488889c0 51.65511111-42.43911111 93.98044445-93.75288889 93.75288889-51.76888889-0.34133333-93.52533333-42.21155554-93.52533333-93.98044445 0-51.65511111 42.21155554-93.86666667 93.75288889-93.63911111 51.65511111 0.11377778 93.52533333 42.09777778 93.52533333 93.86666667z\" />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/PC.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path d=\"M904 120H120c-30.9 0-56 25.1-56 56v560c0 30.9 25.1 56 56 56h280v56h-84c-15.5 0-28 12.5-28 28s12.5 28 28 28h392c15.5 0 28-12.5 28-28s-12.5-28-28-28h-84v-56h280c30.9 0 56-25.1 56-56V176c0-30.9-25.1-56-56-56zM568 848H456v-56h112v56z m336-112H120v-56h784v56zM120 624V176h784v448H120z\" />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/Rabbit.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"#333333\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path d=\"M225.749559 387.566843l7.946385-44.066314C244.893122 281.37425 274.872663 240.55873 292.571429 216.358377l0.361199-0.722398c38.648325-49.484303 76.93545-76.93545 113.777778-82.353439 45.87231-6.140388 76.93545 24.200353 80.908642 47.317107v0.3612c7.223986 46.955908-32.507937 74.045855-61.40388 93.550617-10.47478 6.862787-20.22716 13.725573-26.367549 19.865961-5.417989 5.05679-15.53157 16.615168-34.313933 41.537919l-5.417989 7.223986-8.668783 2.167196c-42.621517 10.835979-58.153086 16.253968-84.159436 26.006349l-41.537919 16.253968z m107.276191-140.867725c-10.835979 14.809171-25.64515 34.675132-36.842328 61.40388 9.752381-2.889594 20.58836-5.779189 33.952733-9.391181 14.086772-18.782363 25.283951-32.146737 33.952734-40.454321 9.752381-9.391182 21.671958-17.698765 33.230335-25.64515 24.200353-16.615168 40.454321-28.534744 40.454321-41.537919-1.805996-2.528395-9.029982-9.391182-24.200353-7.585185-13.003175 2.167196-40.81552 12.641975-80.547442 63.209876z\" />\n    <path d=\"M753.822928 891.07866c-19.143563 0-34.313933-11.197178-42.621517-22.394357l-22.755556-21.310758c-6.140388-5.05679-22.394356-16.976367-35.39753-22.394356-158.205291-33.591534-269.815873-75.129453-317.49418-92.828219-9.029982-3.250794-18.421164-6.862787-20.58836-7.585185-8.668783-1.805996-11.558377-1.805996-12.280776-1.805997l-2.167196 1.083598-2.528395 0.722399c-92.10582 27.089947-173.375661 14.086772-196.492416-13.364374s5.779189-60.320282 28.173545-81.269841c-67.905467-74.045855-19.865961-172.292063-17.698766-176.626455l0.722399-1.444798c65.015873-111.249383 167.596473-147.008113 241.642328-157.482892l64.293474-9.029982-40.81552 50.567901c-5.417989 6.501587-8.668783 10.47478-11.558377 14.447972 3.250794-0.361199 9.029982-1.805996 18.421164-5.05679 17.337566-6.501587 28.534744-11.197178 39.370723-15.170371 17.698765-6.862787 33.230335-13.003175 70.433862-27.089947l6.501588-2.528395 6.862786 1.083598c11.197178 2.167196 19.504762 3.250794 19.504762 3.250794l2.528395 0.361199c153.870899 36.481129 236.224339 127.142152 244.170723 136.172134l0.361199 0.361199c28.534744-10.47478 52.735097-11.919577 73.323457-4.334391 35.397531 12.641975 51.651499 47.678307 67.544268 81.63104 2.167196 5.05679 4.695591 9.752381 7.223986 14.809171 11.558377 24.200353 8.307584 43.705115 3.250794 55.624692-13.364374 32.146737-50.929101 48.039506-73.684656 56.34709 8.668783 44.066314 3.973192 102.941799-12.641976 156.038095l-1.083597 2.528395c-23.839153 55.985891-50.206702 84.159436-80.186244 86.687831h-4.334391z m-2.528395-52.735097c0.722399 0.722399 1.805996 1.805996 2.528395 2.167195 1.805996-0.722399 16.253968-6.501587 37.203527-54.902292 13.725573-45.87231 18.059965-97.52381 10.11358-132.921341 0 0 0-0.361199-0.361199-0.361199-10.47478-24.200353 1.444797-37.925926 9.752381-44.066314 4.334392-3.250794 8.668783-4.695591 16.976367-7.585185 12.280776-4.334392 44.788713-15.53157 50.567901-30.340741 0.722399-1.444797 2.167196-5.417989-2.167196-14.447972-2.528395-5.05679-5.05679-10.47478-7.223986-15.531569-12.641975-26.728748-23.477954-49.845503-39.009523-55.624692-11.558377-4.334392-29.618342-0.722399-53.818695 10.835979l-18.782364 8.668783-22.394356-29.979541c-6.501587-7.223986-80.186243-87.04903-216.358377-119.556967-2.167196-0.361199-6.862787-1.083598-13.364374-2.167196-32.507937 12.280776-46.955908 18.059965-63.571076 24.561552-10.835979 4.334392-22.394356 8.668783-39.731922 15.53157h-0.3612c-52.735097 19.504762-72.962257 3.611993-88.855026-28.173545l-3.973192-7.585185c-53.096296 16.976367-111.610582 51.2903-152.426103 120.279365-3.611993 7.946384-33.952734 76.93545 14.447972 123.891358 6.862787 5.779189 17.337566 16.976367 17.337566 31.424339 0 8.668783-3.250794 16.615168-9.752381 22.394356-0.722399 0.361199-1.444797 1.444797-2.889594 2.528395-14.447972 12.280776-22.394356 20.58836-26.728748 26.006349 19.865961 6.501587 66.821869 13.003175 132.198942-5.779188 15.17037-6.862787 29.618342-4.695591 44.427513-1.444798 4.695591 1.083598 10.835979 3.250794 27.451146 9.391182 46.955908 17.337566 156.399295 58.153086 312.43739 91.022222l1.805997 0.3612 1.805996 0.722398c23.477954 9.029982 48.761905 29.257143 51.651499 31.785538l1.083598 1.083598 27.812346 26.367548 2.167196 1.444798z\" />\n    <path d=\"M361.921693 400.570018c-10.835979 0-20.22716-2.167196-27.451146-6.862787-7.946384-5.05679-11.919577-11.197178-14.086773-16.253968l-15.531569-29.257143 8.668783-12.641975c0.361199-0.722399 13.003175-18.782363 36.119929-43.705115 32.146737-34.313933 85.604233-81.99224 157.482893-114.138977l1.805996-0.722399c22.394356-8.307584 72.601058-12.641975 110.888183 10.113581 24.922751 14.809171 40.454321 38.287125 44.788713 67.905467l0.722399 4.695591-1.083598 4.334391c-3.611993 25.64515-18.782363 51.651499-163.98448 88.855027-31.424339 7.946384-54.902293 19.504762-74.045855 28.534744-13.364374 6.501587-24.561552 11.919577-35.758731 14.809171-10.47478 2.889594-20.22716 4.334392-28.534744 4.334392z m164.706878-176.265256c-63.932275 28.895944-111.610582 71.51746-140.506525 102.2194-8.307584 9.029982-15.17037 16.976367-20.227161 23.116755 2.889594-0.361199 6.862787-1.083598 11.558378-2.167196 6.140388-1.444797 15.53157-6.140388 26.006349-11.197178 19.865961-9.752381 46.955908-22.755556 83.437037-32.146737 97.52381-24.922751 120.640564-41.537919 125.697355-46.594709-2.889594-11.919577-9.029982-20.58836-19.504762-27.089947-21.310758-13.003175-53.818695-10.47478-66.460671-6.140388z\" />\n    <path d=\"M277.401058 450.77672m-28.534744 0a28.534744 28.534744 0 1 0 57.069488 0 28.534744 28.534744 0 1 0-57.069488 0Z\" />\n    <path d=\"M277.401058 493.759436c-23.839153 0-42.982716-19.504762-42.982716-42.982716s19.504762-42.982716 42.982716-42.982716 42.982716 19.504762 42.982716 42.982716-19.504762 42.982716-42.982716 42.982716z m0-57.430688c-7.946384 0-14.086772 6.501587-14.086772 14.086772s6.501587 14.086772 14.086772 14.086773 14.086772-6.501587 14.086773-14.086773-6.501587-14.086772-14.086773-14.086772z\" />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/Replace.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path\n      d=\"M468.476145 981.886592a36.654263 36.654263 0 0 0 0-5.459146 38.993897 38.993897 0 0 0 0-7.798779 38.993897 38.993897 0 0 0 0-7.798779l-77.987793-155.975587a38.993897 38.993897 0 0 0-69.409136 35.094507l46.792676 94.36523A325.988975 325.988975 0 0 1 78.53718 585.708603a38.993897 38.993897 0 0 0-77.987793 0A408.656036 408.656036 0 0 0 434.161516 1014.641465a38.214019 38.214019 0 0 0 16.377437 0h4.679267l7.018902-5.459146 6.239023-12.478047a37.434141 37.434141 0 0 0 0-7.018901 38.214019 38.214019 0 0 0 0-7.798779zM650.967581 84.247093a325.988975 325.988975 0 0 1 290.11459 346.265802 38.993897 38.993897 0 0 0 77.987793 0A408.656036 408.656036 0 0 0 585.457835 0.800155h-15.597559l-6.239023 7.798779-7.018902 4.679268-3.899389 6.239023A37.434141 37.434141 0 0 0 546.463938 26.536126a38.214019 38.214019 0 0 0 0 7.79878 36.654263 36.654263 0 0 0 0 5.459145 38.993897 38.993897 0 0 0 0 7.79878 38.993897 38.993897 0 0 0 0 7.798779l77.987793 155.975586a38.993897 38.993897 0 0 0 69.409136-35.094507zM200.198137 390.73912a193.409727 193.409727 0 0 0 116.98169-39.773774 38.993897 38.993897 0 0 0 77.987793 0v-311.951173a38.993897 38.993897 0 0 0-77.987793 0A193.409727 193.409727 0 0 0 200.198137 0.800155a194.969483 194.969483 0 0 0 0 389.938965z m0-311.951172a116.98169 116.98169 0 1 1-116.98169 116.981689A116.98169 116.98169 0 0 1 200.198137 78.787948zM863.094378 702.690292a155.975586 155.975586 0 0 0-77.987793 21.836583V586.488481a38.993897 38.993897 0 0 0-77.987793 0v389.938965a38.993897 38.993897 0 0 0 77.987793 15.597559 155.975586 155.975586 0 0 0 77.987793 23.396338 155.975586 155.975586 0 0 0 0-311.951173z m0 233.96338a77.987793 77.987793 0 1 1 77.987793-77.987793 77.987793 77.987793 0 0 1-77.987793 77.987793z\"\n      p-id=\"1461\"\n    />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/ReplaceAll.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path\n      d=\"M468.476145 981.886592a36.654263 36.654263 0 0 0 0-5.459146 38.993897 38.993897 0 0 0 0-7.798779 38.993897 38.993897 0 0 0 0-7.798779l-77.987793-155.975587a38.993897 38.993897 0 0 0-69.409136 35.094507l46.792676 94.36523A325.988975 325.988975 0 0 1 78.53718 585.708603a38.993897 38.993897 0 0 0-77.987793 0A408.656036 408.656036 0 0 0 434.161516 1014.641465a38.214019 38.214019 0 0 0 16.377437 0h4.679267l7.018902-5.459146 6.239023-12.478047a37.434141 37.434141 0 0 0 0-7.018901 38.214019 38.214019 0 0 0 0-7.798779zM650.967581 84.247093a325.988975 325.988975 0 0 1 290.11459 346.265802 38.993897 38.993897 0 0 0 77.987793 0A408.656036 408.656036 0 0 0 585.457835 0.800155h-15.597559l-6.239023 7.798779-7.018902 4.679268-3.899389 6.239023A37.434141 37.434141 0 0 0 546.463938 26.536126a38.214019 38.214019 0 0 0 0 7.79878 36.654263 36.654263 0 0 0 0 5.459145 38.993897 38.993897 0 0 0 0 7.79878 38.993897 38.993897 0 0 0 0 7.798779l77.987793 155.975586a38.993897 38.993897 0 0 0 69.409136-35.094507zM863.094378 702.690292a155.975586 155.975586 0 0 0-77.987793 21.836583V586.488481a38.993897 38.993897 0 0 0-77.987793 0v389.938965a38.993897 38.993897 0 0 0 77.987793 15.597559 155.975586 155.975586 0 0 0 77.987793 23.396338 155.975586 155.975586 0 0 0 0-311.951173z m0 233.96338a77.987793 77.987793 0 1 1 77.987793-77.987793 77.987793 77.987793 0 0 1-77.987793 77.987793zM44.222551 78.787948h311.951172a38.993897 38.993897 0 0 0 0-77.987793h-311.951172a38.993897 38.993897 0 0 0 0 77.987793zM44.222551 234.763534h311.951172a38.993897 38.993897 0 0 0 0-77.987793h-311.951172a38.993897 38.993897 0 0 0 0 77.987793zM44.222551 390.73912h233.963379a38.993897 38.993897 0 0 0 0-77.987793h-233.963379a38.993897 38.993897 0 0 0 0 77.987793z\"\n      fill={fill}\n      p-id=\"578\"\n    />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/Smile.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path d=\"M288 421a48 48 0 1 0 96 0 48 48 0 1 0-96 0zM640 421a48 48 0 1 0 96 0 48 48 0 1 0-96 0z\" fill=\"#29A1F7\" />\n    <path\n      d=\"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64z m263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2-44.3-18.7-84.1-45.6-118.3-79.8-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8c18.7-44.3 45.6-84.1 79.8-118.3 34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2 44.3 18.7 84.1 45.6 118.3 79.8 34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8c-18.7 44.3-45.6 84.1-79.8 118.2z\"\n      fill=\"#29A1F7\"\n    />\n    <path\n      d=\"M664 533h-48.1c-4.2 0-7.8 3.2-8.1 7.4C604 589.9 562.5 629 512 629s-92.1-39.1-95.8-88.6c-0.3-4.2-3.9-7.4-8.1-7.4H360c-4.6 0-8.2 3.8-8 8.4 4.4 84.3 74.5 151.6 160 151.6s155.6-67.3 160-151.6c0.2-4.6-3.4-8.4-8-8.4z\"\n      fill=\"#29A1F7\"\n    />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/User.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path\n      d=\"M512 16C238 16 16 238 16 512s222 496 496 496 496-222 496-496S786 16 512 16z m256 843.2c-71.8 53-160.2 84.8-256 84.8s-184.2-31.8-256-84.8V832c0-70.6 57.4-128 128-128 22.2 0 55 22.8 128 22.8 73.2 0 105.6-22.8 128-22.8 70.6 0 128 57.4 128 128v27.2z m61.2-55c-13.6-92.8-92.6-164.2-189.2-164.2-41 0-60.8 22.8-128 22.8S425.2 640 384 640c-96.6 0-175.6 71.4-189.2 164.2C123.8 727.2 80 624.8 80 512c0-238.2 193.8-432 432-432s432 193.8 432 432c0 112.8-43.8 215.2-114.8 292.2zM512 240c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176z m0 288c-61.8 0-112-50.2-112-112s50.2-112 112-112 112 50.2 112 112-50.2 112-112 112z\"\n      p-id=\"5538\"\n    />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/Wechat.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 40 40\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <g>\n      <g>\n        <g>\n          <path\n            fill=\"#07C060\"\n            d=\"M38.7,15.3c-3.7-4.9-10.2-6.2-16.1-4.1c0.2,0.1,0.4,0.1,0.6,0.2c8.7,2.9,13.3,12.3,10.4,21\n\t\t\t\tc-0.8,2.3-2,4.3-3.5,6c1.9-0.5,3.8-1.3,5.4-2.5C42.1,30.8,43.4,21.4,38.7,15.3z\"\n          />\n        </g>\n        <g>\n          <path\n            fill=\"#07C060\"\n            d=\"M17,10.4L17,10.4C17,10.4,17,10.4,17,10.4c0.4-0.3,0.7-0.5,1.1-0.8c0,0,0,0,0.1,0c0.4-0.2,0.8-0.4,1.1-0.7\n\t\t\t\tc0,0,0.1,0,0.1-0.1c0.8-0.4,1.6-0.7,2.4-1c0.1,0,0.1,0,0.2-0.1c0.4-0.1,0.8-0.3,1.2-0.4c0,0,0.1,0,0.1,0c0.4-0.1,0.8-0.2,1.2-0.2\n\t\t\t\tc0.1,0,0.1,0,0.2,0C25.3,7,25.7,7,26.1,7c0.1,0,0.2,0,0.3,0c0.4,0,0.9-0.1,1.3-0.1c0.5,0,1,0,1.5,0.1c0.1,0,0.1,0,0.2,0\n\t\t\t\tc0.5,0,0.9,0.1,1.4,0.2c0.1,0,0.2,0,0.2,0c0.5,0.1,0.9,0.2,1.3,0.3c0.1,0,0.1,0,0.2,0.1C33,7.7,33.5,7.8,33.9,8\n\t\t\t\tc-0.2-0.4-0.4-0.7-0.4-0.7C30.6,2.7,25.8,0,20.6,0c-3.1,0-7.9,1.1-11.5,5.4c-2.4,2.9-3.2,6.3-2.7,9.7c0.3,2.3,1.6,5.4,3.5,7.3\n\t\t\t\tC10.6,17.5,13.2,13.2,17,10.4z\"\n          />\n        </g>\n        <g>\n          <path\n            fill=\"#07C060\"\n            d=\"M20.6,30.9c-1.3,0-2.6-0.2-3.8-0.4c-0.1,0-0.3,0-0.5,0c-0.4,0-0.7,0.1-1,0.3l-4,2.6\n\t\t\t\tc-0.1,0.1-0.2,0.1-0.4,0.1c-0.3,0-0.6-0.3-0.7-0.6c0-0.2,0-0.3,0.1-0.5c0-0.1,0.4-2,0.7-3.2c0-0.1,0.1-0.3,0-0.4\n\t\t\t\tc0-0.4-0.2-0.8-0.6-1c-4.3-2.9-7.2-7.5-7.8-12.2c-1.1,1.7-1.6,3-2.2,5c-2.1,7.3,2.5,16,9.9,18.4c8.6,2.8,16.7-0.3,19.5-7.6\n\t\t\t\tc0.3-0.9,0.7-2.4,0.8-3.6C27.7,29.9,24.6,30.9,20.6,30.9z\"\n          />\n        </g>\n      </g>\n    </g>\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/Zhihu.js",
    "content": "import React from \"react\";\nimport \"./index.css\";\n\nexport default ({fill = \"rgba(0,0,0,0.65)\", style = {}, className = \"icon\", viewBox = \"0 0 1024 1024\"}) => (\n  <svg\n    style={style}\n    viewBox={viewBox}\n    className={className}\n    fill={fill}\n    xmlns=\"http://www.w3.org/2000/svg\"\n    xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n  >\n    <path\n      d=\"M564.7 230.1V803h60l25.2 71.4L756.3 803h131.5V230.1H564.7z m247.7 497h-59.9l-75.1 50.4-17.8-50.4h-18V308.3h170.7v418.8zM526.1 486.9H393.3c2.1-44.9 4.3-104.3 6.6-172.9h130.9l-0.1-8.1c0-0.6-0.2-14.7-2.3-29.1-2.1-15-6.6-34.9-21-34.9H287.8c4.4-20.6 15.7-69.7 29.4-93.8l6.4-11.2-12.9-0.7c-0.8 0-19.6-0.9-41.4 10.6-35.7 19-51.7 56.4-58.7 84.4-18.4 73.1-44.6 123.9-55.7 145.6-3.3 6.4-5.3 10.2-6.2 12.8-1.8 4.9-0.8 9.8 2.8 13 10.5 9.5 38.2-2.9 38.5-3 0.6-0.3 1.3-0.6 2.2-1 13.9-6.3 55.1-25 69.8-84.5h56.7c0.7 32.2 3.1 138.4 2.9 172.9h-141l-2.1 1.5c-23.1 16.9-30.5 63.2-30.8 65.2l-1.4 9.2h167c-12.3 78.3-26.5 113.4-34 127.4-3.7 7-7.3 14-10.7 20.8-21.3 42.2-43.4 85.8-126.3 153.6-3.6 2.8-7 8-4.8 13.7 2.4 6.3 9.3 9.1 24.6 9.1 5.4 0 11.8-0.3 19.4-1 49.9-4.4 100.8-18 135.1-87.6 17-35.1 31.7-71.7 43.9-108.9L497 850l5-12c0.8-1.9 19-46.3 5.1-95.9l-0.5-1.8-108.1-123-22 16.6c6.4-26.1 10.6-49.9 12.5-71.1h158.7v-8c0-40.1-18.5-63.9-19.2-64.9l-2.4-3z\"\n      fill=\"#1296db\"\n      p-id=\"8715\"\n    />\n  </svg>\n);\n"
  },
  {
    "path": "src/icon/index.css",
    "content": ".icon {\n  transition: fill 0.5s;\n}\n\n.icon:hover {\n  fill: #40a9ff;\n}\n"
  },
  {
    "path": "src/icon/index.js",
    "content": "import React from \"react\";\n\nimport Copy from \"./Copy\";\nimport Down from \"./Down\";\nimport Environment from \"./Environment\";\nimport GitHub from \"./GitHub\";\nimport Inbox from \"./Inbox\";\nimport More from \"./More\";\nimport Rabbit from \"./Rabbit\";\nimport Smile from \"./Smile\";\nimport Mobile from \"./Mobile\";\nimport PC from \"./PC\";\nimport Wechat from \"./Wechat\";\nimport Zhihu from \"./Zhihu\";\nimport Juejin from \"./Juejin\";\nimport Close from \"./Close\";\nimport FontCase from \"./FontCase\";\nimport Replace from \"./Replace\";\nimport ReplaceAll from \"./ReplaceAll\";\nimport User from \"./User\";\n\nexport default (props) => {\n  switch (props.name) {\n    case \"copy\":\n      return <Copy {...props} />;\n    case \"down\":\n      return <Down {...props} />;\n    case \"environment\":\n      return <Environment {...props} />;\n    case \"github\":\n      return <GitHub {...props} />;\n    case \"inbox\":\n      return <Inbox {...props} />;\n    case \"more\":\n      return <More {...props} />;\n    case \"rabbit\":\n      return <Rabbit {...props} />;\n    case \"smile\":\n      return <Smile {...props} />;\n    case \"pc\":\n      return <PC {...props} />;\n    case \"mobile\":\n      return <Mobile {...props} />;\n    case \"wechat\":\n      return <Wechat {...props} />;\n    case \"zhihu\":\n      return <Zhihu {...props} />;\n    case \"juejin\":\n      return <Juejin {...props} />;\n    case \"close\":\n      return <Close {...props} />;\n    case \"fontCase\":\n      return <FontCase {...props} />;\n    case \"replace\":\n      return <Replace {...props} />;\n    case \"replaceAll\":\n      return <ReplaceAll {...props} />;\n    case \"user\":\n      return <User {...props} />;\n    default:\n      return <svg />;\n  }\n};\n"
  },
  {
    "path": "src/index.css",
    "content": "body {\n  margin: 0;\n  padding: 0;\n  font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\",\n    \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\",\n    sans-serif;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n  line-height: 1 !important;\n}\n\ncode {\n  font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\",\n    monospace;\n}\n"
  },
  {
    "path": "src/index.d.ts",
    "content": "import * as React from \"react\";\n\n// declare const PreviewTypes: [\"pc\", \"mobile\"];\n\n// export declare type PreviewType = (typeof PreviewTypes)[number];\n\nexport interface MarkdownNiceProps {\n  /**\n   * 默认标题\n   */\n  defaultTitle?: string;\n  // /**\n  //  * 右侧预览类型 pc 或者 mobile\n  //  */\n  // previewType?: PreviewType;\n  /**\n   * 默认编辑器内容\n   */\n  defaultText?: string;\n  /**\n   * 编辑器内容监听函数\n   */\n  onTextChange?: (text: string) => void;\n  /**\n   * 编辑器失去焦点函数\n   */\n  onTextBlur?: (text: string) => void;\n  /**\n   * 编辑器获得焦点函数\n   */\n  onTextFocus?: (text: string) => void;\n  /**\n   * 自定义主题编辑器内容监听函数\n   */\n  onStyleChange?: (text: string) => void;\n  /**\n   * 自定义主题编辑器失去焦点函数\n   */\n  onStyleBlur?: (text: string) => void;\n  /**\n   * 自定义主题编辑器获得焦点函数\n   */\n  onStyleFocus?: (text: string) => void;\n  /**\n   * 用户认证信息\n   */\n  token?: string;\n  /**\n   * 是否启用用户提供的图床\b, 内部为图床的URL以及要显示的图床名称。\n   */\n  useImageHosting?: {\n    url: string;\n    name: string;\n    isSmmsOpen: boolean;\n    isQiniuyunOpen: boolean;\n    isAliyunOpen: boolean;\n    isGiteeOpen: boolean;\n    isGitHubOpen: boolean;\n  };\n}\n\ndeclare class MarkdownNice extends React.Component<MarkdownNiceProps, any> {}\n\nexport default MarkdownNice;\n"
  },
  {
    "path": "src/index.js",
    "content": "import React from \"react\";\nimport ReactDOM from \"react-dom\";\n\nimport Lib from \"./Lib\";\nimport * as serviceWorker from \"./serviceWorker\";\n\nReactDOM.render(\n  <Lib\n    useImageHosting={{\n      url: \"https://imgkr.com/api/files/upload\",\n      name: \"图壳\",\n      isSmmsOpen: false,\n      isQiniuyunOpen: false,\n      isAliyunOpen: true,\n      isGiteeOpen: true,\n      isGitHubOpen: true,\n    }}\n    defaultTitle=\"Markdown Nice\"\n  />,\n  document.getElementById(\"root\"),\n);\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: http://bit.ly/CRA-PWA\nserviceWorker.register();\n"
  },
  {
    "path": "src/layout/Dialog.js",
    "content": "import React, {Component} from \"react\";\nimport ImageDialog from \"../component/Dialog/ImageDialog\";\nimport LinkDialog from \"../component/Dialog/LinkDialog\";\nimport AboutDialog from \"../component/Dialog/AboutDialog\";\nimport VersionDialog from \"../component/Dialog/VersionDialog\";\nimport FormDialog from \"../component/Dialog/FormDialog\";\nimport HistoryDialog from \"../component/Dialog/HistoryDialog\";\nimport SitDownDialog from \"../component/Dialog/SitDownDialog\";\nimport TutorialDialog from \"../component/Dialog/TutorialDialog\";\n\nclass Dialog extends Component {\n  render() {\n    return (\n      <div>\n        <ImageDialog />\n        <LinkDialog />\n        <AboutDialog />\n        <VersionDialog />\n        <FormDialog />\n        <HistoryDialog />\n        <SitDownDialog />\n        <TutorialDialog />\n      </div>\n    );\n  }\n}\n\nexport default Dialog;\n"
  },
  {
    "path": "src/layout/EditorMenu.css",
    "content": ".nice-editor-menu {\n  position: absolute;\n  z-index: 1000;\n  display: none;\n  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;\n  border-radius: 4px;\n  padding: 4px 0;\n}\n\n.nice-editor-menu .ant-dropdown-menu-item {\n  clear: both;\n  margin: 0;\n  padding: 0;\n  color: rgba(0, 0, 0, 0.65);\n  font-weight: normal;\n  font-size: 14px;\n  line-height: 22px;\n  height: 32px;\n  white-space: nowrap;\n  cursor: pointer;\n}\n\n.nice-editor-menu .ant-menu-item-selected {\n  background-color: white !important;\n}\n.nice-editor-menu .ant-dropdown-menu-item:hover {\n  background-color: #e6f7ff !important;\n}\n"
  },
  {
    "path": "src/layout/EditorMenu.js",
    "content": "import React, {Component} from \"react\";\nimport {Menu} from \"antd\";\n\nimport LinkToFoot from \"../component/MenuLeft/Pattern/LinkToFoot\";\nimport Format from \"../component/MenuLeft/Pattern/Format\";\nimport Image from \"../component/MenuLeft/Pattern/Image\";\nimport \"./EditorMenu.css\";\n\nclass EditorMenu extends Component {\n  render() {\n    return (\n      <Menu id=\"nice-editor-menu\" className=\"nice-editor-menu\">\n        <Menu.Item className=\"ant-dropdown-menu-item\">\n          <LinkToFoot />\n        </Menu.Item>\n        <Menu.Item className=\"ant-dropdown-menu-item\">\n          <Format />\n        </Menu.Item>\n        <Menu.Item className=\"ant-dropdown-menu-item\">\n          <Image />\n        </Menu.Item>\n      </Menu>\n    );\n  }\n}\n\nexport default EditorMenu;\n"
  },
  {
    "path": "src/layout/Footer.css",
    "content": ".nice-footer-container {\n  display: flex;\n  align-items: center;\n  position: fixed;\n  bottom: 0;\n  width: 100%;\n  height: 20px;\n  background: white;\n  padding: 0 10px;\n  font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, \"PingFang SC\", Cambria, Cochin, Georgia,\n    Times, \"Times New Roman\", serif;\n}\n\n.nice-footer-container p {\n  font-size: 12px;\n  margin: 0;\n  padding: 0 10px;\n}\n\n.nice-footer-message {\n  display: flex;\n  align-items: center;\n  color: #333;\n  font-size: 12px;\n  cursor: pointer;\n  background: #e6f7ff;\n  animation: gradientChange 5s ease forwards;\n  height: 100%;\n  padding: 0 10px;\n}\n\n@keyframes gradientChange {\n  100% {\n    background: white;\n  }\n}\n\n.nice-footer-message:hover {\n  color: #333;\n  background: #e6f7ff;\n  animation: none;\n}\n\n.nice-footer-engine {\n  display: flex;\n  color: #333;\n  font-size: 12px;\n  line-height: 12px;\n  padding: 0px 5px;\n  cursor: pointer;\n}\n\n.nice-footer-engine:hover {\n  color: #333;\n}\n\n.nice-footer-engine:focus {\n  color: #333;\n  background: #e6f7ff;\n}\n\n.nice-footer-overlay {\n}\n"
  },
  {
    "path": "src/layout/Footer.js",
    "content": "import React, {Component} from \"react\";\nimport {Menu, Dropdown, message} from \"antd\";\nimport {observer, inject} from \"mobx-react\";\nimport {wordCalc} from \"../utils/helper\";\nimport SitDownConverter from \"../utils/sitdownConverter\";\nimport {SITDOWN_OPTIONS} from \"../utils/constant\";\nimport SvgIcon from \"../icon\";\n\nimport \"./Footer.css\";\n\n@inject(\"content\")\n@inject(\"navbar\")\n@inject(\"footer\")\n@observer\nclass Footer extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      engineDesc: SITDOWN_OPTIONS[0].desc,\n    };\n  }\n\n  handleMessage = () => {\n    const {pasteHtml, pasteText} = this.props.footer;\n    let toMarkdown = SitDownConverter.GFM;\n    switch (this.state.platform) {\n      case \"csdn\":\n        toMarkdown = SitDownConverter.CSDN;\n        break;\n      case \"wechat\":\n        toMarkdown = SitDownConverter.Wechat;\n        break;\n      case \"juejin\":\n        toMarkdown = SitDownConverter.Juejin;\n        break;\n      case \"zhihu\":\n        toMarkdown = SitDownConverter.Zhihu;\n        break;\n      default:\n        toMarkdown = SitDownConverter.Wechat;\n        break;\n    }\n    const markdown = toMarkdown(pasteHtml);\n    const {content} = this.props.content;\n    const convertContent = content.replace(pasteText, markdown);\n    this.props.content.setContent(convertContent);\n\n    // 设置粘贴检测为 false\n    this.props.footer.setPasteHtmlChecked(false);\n\n    message.success(\"转换成功！\");\n  };\n\n  handleMenu = ({key, domEvent}) => {\n    if (key === \"thanks\") {\n      const w = window.open(\"about:blank\");\n      w.location.href = \"https://github.com/mdnice/sitdown\";\n    } else {\n      this.setState({engineDesc: key});\n    }\n    domEvent.stopPropagation();\n  };\n\n  render() {\n    const menu = (\n      <Menu onClick={this.handleMenu}>\n        {SITDOWN_OPTIONS.map((option) => (\n          <Menu.Item key={option.desc}>\n            <div>{option.value}</div>\n          </Menu.Item>\n        ))}\n        <Menu.Divider />\n        <Menu.Item key=\"thanks\">\n          <a>SitDown 引擎提供支持</a>\n        </Menu.Item>\n      </Menu>\n    );\n\n    const {content, themeList} = this.props.content;\n    const {templateNum} = this.props.navbar;\n    const {isPasteHtmlChecked} = this.props.footer;\n\n    const lineCount = content.split(\"\\n\").length;\n    const wordCount = wordCalc(content);\n    const themeName = themeList[templateNum] && themeList[templateNum].name;\n    return (\n      <div className=\"nice-footer-container\">\n        <p>\n          行数：\n          {lineCount}\n        </p>\n        <p>\n          字数：\n          {wordCount}\n        </p>\n        <p>\n          主题：\n          {themeName}\n        </p>\n        {isPasteHtmlChecked && (\n          <div className=\"nice-footer-message\" onClick={this.handleMessage}>\n            点击使用\n            <Dropdown overlay={menu} trigger={[\"click\"]} overlayClassName=\"nice-footer-overlay\" placement=\"topLeft\">\n              <a\n                id=\"nice-footer-engine\"\n                className=\"nice-footer-engine\"\n                href=\"#\"\n                onClick={(e) => {\n                  e.stopPropagation();\n                }}\n              >\n                {this.state.engineDesc}\n                <SvgIcon name=\"down\" style={style.svgIcon} fill=\"#40a9ff\" />\n              </a>\n            </Dropdown>\n            将粘贴的富文本转换为 markdown\n          </div>\n        )}\n      </div>\n    );\n  }\n}\n\nconst style = {\n  svgIcon: {\n    width: \"12px\",\n    height: \"12px\",\n  },\n};\n\nexport default Footer;\n"
  },
  {
    "path": "src/layout/Navbar.css",
    "content": ".nice-navbar {\n  height: 30px;\n  display: flex;\n  align-items: center;\n  /* justify-content: space-between; */\n  flex: none;\n  position: relative;\n  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);\n  z-index: 2;\n  background: white;\n}\n\n.nice-left-nav {\n  display: flex;\n  flex: 1;\n  justify-content: flex-start;\n  align-items: center;\n}\n\n.nice-right-nav {\n  display: flex;\n  justify-content: flex-end;\n  align-items: center;\n}\n\n.nice-btn-group-margin {\n  margin-right: 10px;\n}\n\n.nice-btn-group-right {\n  margin-right: 20px;\n}\n\n.nice-icon-bar {\n  margin-top: 5;\n}\n\n.nice-title {\n  padding: 0 10px 0 20px;\n  font-weight: bold;\n  font-size: 16px;\n  font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, \"PingFang SC\", Cambria, Cochin, Georgia,\n    Times, \"Times New Roman\", serif;\n}\n\n.nice-navbar-hide {\n  display: none;\n}\n"
  },
  {
    "path": "src/layout/Navbar.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport classnames from \"classnames\";\n\nimport File from \"../component/MenuLeft/File\";\nimport Help from \"../component/MenuLeft/Help\";\nimport Tutorial from \"../component/MenuLeft/Tutorial\";\nimport Pattern from \"../component/MenuLeft/Pattern\";\nimport Function from \"../component/MenuLeft/Function\";\nimport Theme from \"../component/MenuLeft/Theme\";\nimport CodeTheme from \"../component/MenuLeft/CodeTheme\";\nimport Setting from \"../component/MenuLeft/Setting\";\nimport View from \"../component/MenuLeft/View\";\n\nimport \"./Navbar.css\";\n\n@inject(\"view\")\n@observer\nclass Navbar extends Component {\n  render() {\n    const {title, token} = this.props;\n    const {isImmersiveEditing} = this.props.view;\n    const niceNavbarClass = classnames({\n      \"nice-navbar\": true,\n      \"nice-navbar-hide\": isImmersiveEditing,\n    });\n    return (\n      <div className={niceNavbarClass}>\n        <div className=\"nice-left-nav\">\n          {title === \"\" ? null : (\n            <section id=\"nice-title\" className=\"nice-title\">\n              {title}\n            </section>\n          )}\n          <File />\n          <Pattern />\n          <Function />\n          <View />\n          <Theme token={token} />\n          <CodeTheme />\n          <Setting />\n          <Help />\n          <Tutorial />\n        </div>\n        <div className=\"nice-right-nav\" />\n      </div>\n    );\n  }\n}\n\nexport default Navbar;\n"
  },
  {
    "path": "src/layout/Sidebar.css",
    "content": ".nice-sidebar {\n  display: flex;\n  position: absolute;\n  top: 20px;\n  right: 15px;\n  flex-direction: column;\n  align-items: center;\n}\n\n.nice-sidebar-hide {\n  display: none;\n}\n"
  },
  {
    "path": "src/layout/Sidebar.js",
    "content": "import React, {Component} from \"react\";\nimport {observer, inject} from \"mobx-react\";\nimport classnames from \"classnames\";\n\nimport PreviewType from \"../component/Sidebar/PreviewType\";\nimport Wechat from \"../component/Sidebar/Wechat\";\nimport Zhihu from \"../component/Sidebar/Zhihu\";\nimport Juejin from \"../component/Sidebar/Juejin\";\nimport \"./Sidebar.css\";\n\n// @inject(\"userInfo\")\n@inject(\"view\")\n@observer\nclass Sidebar extends Component {\n  render() {\n    const {isImmersiveEditing} = this.props.view;\n    const niceSidebarClass = classnames({\n      \"nice-sidebar\": true,\n      \"nice-sidebar-hide\": isImmersiveEditing,\n    });\n    return (\n      <div className={niceSidebarClass}>\n        <Wechat />\n        <Zhihu />\n        <Juejin />\n        <PreviewType />\n      </div>\n    );\n  }\n}\n\nexport default Sidebar;\n"
  },
  {
    "path": "src/layout/StyleEditor.js",
    "content": "import React, {Component} from \"react\";\nimport {Modal} from \"antd\";\n\nimport CodeMirror from \"@uiw/react-codemirror\";\nimport \"codemirror/keymap/sublime\";\nimport \"codemirror/addon/edit/closebrackets\";\nimport \"codemirror/addon/hint/show-hint\";\nimport \"codemirror/addon/hint/show-hint.css\";\nimport \"codemirror/addon/hint/css-hint\";\nimport \"antd/dist/antd.css\";\nimport {observer, inject} from \"mobx-react\";\n\nimport \"../utils/styleMirror.css\";\n\n@inject(\"content\")\n@inject(\"navbar\")\n@observer\nclass StyleEditor extends Component {\n  constructor(props) {\n    super(props);\n    this.focus = false;\n  }\n\n  getStyleInstance = (instance) => {\n    if (instance) {\n      this.styleEditor = instance.editor;\n      this.styleEditor.on(\"keyup\", (cm, event) => {\n        if ((event.keyCode >= 65 && event.keyCode <= 90) || event.keyCode === 189) {\n          cm.showHint({completeSingle: false});\n        }\n      });\n    }\n  };\n\n  showConfirm = () => {\n    Modal.confirm({\n      title: \"是否想使用该模板？\",\n      content: \"确定后将复制当前内容和样式并切换为自定义\",\n      cancelText: \"取消\",\n      okText: \"确定\",\n      onOk: () => {\n        const {templateNum} = this.props.navbar;\n        const {themeList} = this.props.content;\n        const {css} = themeList[templateNum];\n        const style = `/*自定义样式，实时生效*/\\n\\n` + css;\n        this.props.content.setCustomStyle(style);\n        this.props.onStyleChange && this.props.onStyleChange(style);\n        this.props.navbar.setTemplateNum(themeList.length - 1);\n      },\n      onCancel: () => {},\n    });\n  };\n\n  changeStyle = (editor) => {\n    const {templateNum} = this.props.navbar;\n    const {themeList} = this.props.content;\n    // focus状态很重要，初始化时被调用则不会进入条件\n    if (this.focus) {\n      if (templateNum !== themeList.length - 1) {\n        this.showConfirm();\n      } else {\n        const style = editor.getValue();\n        this.props.content.setCustomStyle(style);\n        this.props.onStyleChange && this.props.onStyleChange(style);\n      }\n    }\n  };\n\n  handleFocus = (editor) => {\n    this.focus = true;\n    this.props.onStyleFocus && this.props.onStyleFocus(editor.getValue());\n  };\n\n  handleBlur = (editor) => {\n    this.focus = false;\n    this.props.onStyleBlur && this.props.onStyleBlur(editor.getValue());\n  };\n\n  render() {\n    return (\n      <CodeMirror\n        value={this.props.content.style}\n        options={{\n          theme: \"style-mirror\",\n          keyMap: \"sublime\",\n          mode: \"css\",\n          lineWrapping: true,\n          lineNumbers: false,\n        }}\n        id=\"css-editor\"\n        onChange={this.changeStyle}\n        onFocus={this.handleFocus}\n        onBlur={this.handleBlur}\n        ref={this.getStyleInstance}\n      />\n    );\n  }\n}\n\nexport default StyleEditor;\n"
  },
  {
    "path": "src/serviceWorker.js",
    "content": "// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read http://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n  window.location.hostname === \"localhost\" ||\n    // [::1] is the IPv6 localhost address.\n    window.location.hostname === \"[::1]\" ||\n    // 127.0.0.1/8 is considered localhost for IPv4.\n    window.location.hostname.match(/^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/),\n);\n\nexport function register(config) {\n  if (process.env.NODE_ENV === \"production\" && \"serviceWorker\" in navigator) {\n    // The URL constructor is available in all browsers that support SW.\n    const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n    if (publicUrl.origin !== window.location.origin) {\n      // Our service worker won't work if PUBLIC_URL is on a different origin\n      // from what our page is served on. This might happen if a CDN is used to\n      // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n      return;\n    }\n\n    window.addEventListener(\"load\", () => {\n      const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n      if (isLocalhost) {\n        // This is running on localhost. Let's check if a service worker still exists or not.\n        checkValidServiceWorker(swUrl, config);\n\n        // Add some additional logging to localhost, pointing developers to the\n        // service worker/PWA documentation.\n        navigator.serviceWorker.ready.then(() => {\n          console.log(\n            \"This web app is being served cache-first by a service \" +\n              \"worker. To learn more, visit http://bit.ly/CRA-PWA\",\n          );\n        });\n      } else {\n        // Is not localhost. Just register service worker\n        registerValidSW(swUrl, config);\n      }\n    });\n  }\n}\n\nfunction registerValidSW(swUrl, config) {\n  navigator.serviceWorker\n    .register(swUrl)\n    .then((registration) => {\n      registration.onupdatefound = () => {\n        const installingWorker = registration.installing;\n        if (installingWorker == null) {\n          return;\n        }\n        installingWorker.onstatechange = () => {\n          if (installingWorker.state === \"installed\") {\n            if (navigator.serviceWorker.controller) {\n              // At this point, the updated precached content has been fetched,\n              // but the previous service worker will still serve the older\n              // content until all client tabs are closed.\n              console.log(\n                \"New content is available and will be used when all \" +\n                  \"tabs for this page are closed. See http://bit.ly/CRA-PWA.\",\n              );\n\n              // Execute callback\n              if (config && config.onUpdate) {\n                config.onUpdate(registration);\n              }\n            } else {\n              // At this point, everything has been precached.\n              // It's the perfect time to display a\n              // \"Content is cached for offline use.\" message.\n              console.log(\"Content is cached for offline use.\");\n\n              // Execute callback\n              if (config && config.onSuccess) {\n                config.onSuccess(registration);\n              }\n            }\n          }\n        };\n      };\n    })\n    .catch((error) => {\n      console.error(\"Error during service worker registration:\", error);\n    });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n  // Check if the service worker can be found. If it can't reload the page.\n  fetch(swUrl)\n    .then((response) => {\n      // Ensure service worker exists, and that we really are getting a JS file.\n      const contentType = response.headers.get(\"content-type\");\n      if (response.status === 404 || (contentType != null && contentType.indexOf(\"javascript\") === -1)) {\n        // No service worker found. Probably a different app. Reload the page.\n        navigator.serviceWorker.ready.then((registration) => {\n          registration.unregister().then(() => {\n            window.location.reload();\n          });\n        });\n      } else {\n        // Service worker found. Proceed as normal.\n        registerValidSW(swUrl, config);\n      }\n    })\n    .catch(() => {\n      console.log(\"No internet connection found. App is running in offline mode.\");\n    });\n}\n\nexport function unregister() {\n  if (\"serviceWorker\" in navigator) {\n    navigator.serviceWorker.ready.then((registration) => {\n      registration.unregister();\n    });\n  }\n}\n"
  },
  {
    "path": "src/store/content.js",
    "content": "import {observable, action} from \"mobx\";\nimport {CONTENT, STYLE, MARKDOWN_THEME_ID, BASIC_THEME_ID, STYLE_LABELS, THEME_LIST} from \"../utils/constant\";\nimport {replaceStyle, addStyleLabel} from \"../utils/helper\";\nimport TEMPLATE from \"../template/index\";\n\nclass Content {\n  @observable content;\n\n  @observable style;\n\n  @observable themeList;\n\n  @observable markdownEditor;\n\n  @action\n  setThemeList = (themeList) => {\n    this.themeList = themeList;\n    window.localStorage.setItem(THEME_LIST, JSON.stringify(themeList));\n  };\n\n  @action\n  setMarkdownEditor = (markdownEditor) => {\n    this.markdownEditor = markdownEditor;\n  };\n\n  @action\n  setContent = (content) => {\n    this.content = content;\n    window.localStorage.setItem(CONTENT, content);\n  };\n\n  @action\n  setStyle = (style) => {\n    this.style = style;\n    replaceStyle(MARKDOWN_THEME_ID, style);\n  };\n\n  // 自定义样式\n  @action\n  setCustomStyle = (style = \"\") => {\n    // 如果传入则更新\n    if (style) {\n      window.localStorage.setItem(STYLE, style);\n    }\n    this.style = window.localStorage.getItem(STYLE);\n    replaceStyle(MARKDOWN_THEME_ID, this.style);\n  };\n}\n\nconst store = new Content();\n\n// 如果为空先把数据放进去\nif (window.localStorage.getItem(CONTENT) === null) {\n  window.localStorage.setItem(CONTENT, TEMPLATE.content);\n}\nif (!window.localStorage.getItem(STYLE)) {\n  window.localStorage.setItem(STYLE, TEMPLATE.custom);\n}\nif (!window.localStorage.getItem(THEME_LIST)) {\n  window.localStorage.setItem(\n    THEME_LIST,\n    JSON.stringify([\n      {themeId: \"normal\", name: \"默认主题\", css: TEMPLATE.normal},\n      {themeId: \"custom\", name: \"自定义\", css: TEMPLATE.custom},\n    ]),\n  );\n}\n\nstore.themeList = JSON.parse(window.localStorage.getItem(THEME_LIST));\n\n// 在head中添加style标签\naddStyleLabel(STYLE_LABELS);\n\n// 初始化整体主题\nreplaceStyle(BASIC_THEME_ID, TEMPLATE.basic);\n\nstore.content = window.localStorage.getItem(CONTENT);\n\nexport default store;\n"
  },
  {
    "path": "src/store/dialog.js",
    "content": "import {observable, action} from \"mobx\";\n\nclass Dialog {\n  @observable isImageOpen = false;\n\n  @observable isLinkOpen = false;\n\n  @observable isAboutOpen = false;\n\n  @observable isVersionOpen = false;\n\n  @observable isFormOpen = false;\n\n  @observable isHistoryOpen = false;\n\n  @observable isSearchOpen = false;\n\n  @observable isSitDownOpen = false;\n\n  @observable isTutorialOpen = false;\n\n  @observable tutorialTitle;\n\n  @observable tutorialContent;\n\n  @observable tutorialPicture;\n\n  @action\n  setImageOpen = (isImageOpen) => {\n    this.isImageOpen = isImageOpen;\n  };\n\n  @action\n  setLinkOpen = (isLinkOpen) => {\n    this.isLinkOpen = isLinkOpen;\n  };\n\n  @action\n  setAboutOpen = (isAboutOpen) => {\n    this.isAboutOpen = isAboutOpen;\n  };\n\n  @action\n  setVersionOpen = (isVersionOpen) => {\n    this.isVersionOpen = isVersionOpen;\n  };\n\n  @action\n  setFormOpen = (isFormOpen) => {\n    this.isFormOpen = isFormOpen;\n  };\n\n  @action\n  setHistoryOpen = (isHistoryOpen) => {\n    this.isHistoryOpen = isHistoryOpen;\n  };\n\n  @action\n  setSearchOpen = (isSearchOpen) => {\n    this.isSearchOpen = isSearchOpen;\n  };\n\n  @action\n  setSitDownOpen = (isSitDownOpen) => {\n    this.isSitDownOpen = isSitDownOpen;\n  };\n\n  @action\n  setTutorialOpen = (isTutorialOpen) => {\n    this.isTutorialOpen = isTutorialOpen;\n  };\n\n  @action\n  setTutorialTitle = (tutorialTitle) => {\n    this.tutorialTitle = tutorialTitle;\n  };\n\n  @action\n  setTutorialContent = (tutorialContent) => {\n    this.tutorialContent = tutorialContent;\n  };\n\n  @action\n  setTutorialPicture = (tutorialPicture) => {\n    this.tutorialPicture = tutorialPicture;\n  };\n}\n\nconst store = new Dialog();\n\nexport default store;\n"
  },
  {
    "path": "src/store/footer.js",
    "content": "import {observable, action} from \"mobx\";\n\nclass Footer {\n  // 是否检测到富文本粘贴\n  @observable isPasteHtmlChecked = false;\n\n  // 粘贴的富文本\n  @observable pasteHtml = \"\";\n\n  // 粘贴的普通文本\n  @observable pasteText = \"\";\n\n  @action\n  setPasteHtmlChecked = (isPasteHtmlChecked) => {\n    this.isPasteHtmlChecked = isPasteHtmlChecked;\n  };\n\n  @action\n  setPasteHtml = (pasteHtml) => {\n    this.pasteHtml = pasteHtml;\n  };\n\n  @action\n  setPasteText = (pasteText) => {\n    this.pasteText = pasteText;\n  };\n}\n\nconst store = new Footer();\n\nexport default store;\n"
  },
  {
    "path": "src/store/imageHosting.js",
    "content": "import {observable, action} from \"mobx\";\nimport {\n  IMAGE_HOSTING_TYPE,\n  ALIOSS_IMAGE_HOSTING,\n  QINIUOSS_IMAGE_HOSTING,\n  GITEE_IMAGE_HOSTING,\n  GITHUB_IMAGE_HOSTING,\n} from \"../utils/constant\";\n\nclass ImageHosting {\n  @observable type = \"\";\n\n  @observable hostingList = [];\n\n  @observable hostingUrl = \"\";\n\n  @observable hostingName = \"\";\n\n  @action\n  setType = (type) => {\n    this.type = type;\n  };\n\n  @action\n  setHostingUrl = (url) => {\n    this.hostingUrl = url;\n  };\n\n  @action\n  setHostingName = (name) => {\n    this.hostingName = name;\n  };\n\n  @action\n  addImageHosting = (name) => {\n    this.hostingList.push({\n      value: name,\n      label: name,\n    });\n  };\n}\n\nconst store = new ImageHosting();\n\n// 如果为空先把数据放进去\nif (!window.localStorage.getItem(ALIOSS_IMAGE_HOSTING)) {\n  const alioss = JSON.stringify({\n    region: \"\",\n    accessKeyId: \"\",\n    accessKeySecret: \"\",\n    bucket: \"\",\n  });\n  window.localStorage.setItem(ALIOSS_IMAGE_HOSTING, alioss);\n}\n\n// 如果为空先把数据放进去\nif (!window.localStorage.getItem(QINIUOSS_IMAGE_HOSTING)) {\n  const qiniuoss = JSON.stringify({\n    region: \"\",\n    accessKey: \"\",\n    secretKey: \"\",\n    bucket: \"\",\n    domain: \"https://\",\n    namespace: \"\",\n  });\n  window.localStorage.setItem(QINIUOSS_IMAGE_HOSTING, qiniuoss);\n}\n\n// 如果为空先把数据放进去\nif (!window.localStorage.getItem(GITEE_IMAGE_HOSTING)) {\n  const gitee = JSON.stringify({\n    username: \"\",\n    repo: \"\",\n    token: \"\",\n  });\n  window.localStorage.setItem(GITEE_IMAGE_HOSTING, gitee);\n}\n\n// 如果为空先把数据放进去\nif (!window.localStorage.getItem(GITHUB_IMAGE_HOSTING)) {\n  const github = JSON.stringify({\n    username: \"\",\n    repo: \"\",\n    token: \"\",\n    jsdelivr: \"true\",\n  });\n  window.localStorage.setItem(GITHUB_IMAGE_HOSTING, github);\n}\n\nstore.type = window.localStorage.getItem(IMAGE_HOSTING_TYPE);\n\nexport default store;\n"
  },
  {
    "path": "src/store/navbar.js",
    "content": "import {observable, action} from \"mobx\";\nimport {\n  TEMPLATE_NUM,\n  CODE_NUM,\n  CODE_THEME_ID,\n  CODE_OPTIONS,\n  PREVIEW_TYPE,\n  IS_SYNC_SCROLL,\n  IS_CONTAIN_IMG_NAME,\n  IS_MAC_CODE,\n} from \"../utils/constant\";\nimport TEMPLATE from \"../template/index\";\nimport {replaceStyle} from \"../utils/helper\";\n\nclass Navbar {\n  // 是否同步滚动\n  @observable isSyncScroll = true;\n\n  // 是否保留图片名称\n  @observable isContainImgName = false;\n\n  // 主题序号\n  @observable templateNum;\n\n  // 代码主题序号\n  @observable codeNum;\n\n  // 是否为 Mac 风格代码\n  @observable isMacCode = true;\n\n  // 预览类型\n  @observable previewType;\n\n  @action\n  setSyncScroll = (isSyncScroll) => {\n    this.isSyncScroll = isSyncScroll;\n    window.localStorage.setItem(IS_SYNC_SCROLL, isSyncScroll);\n  };\n\n  @action\n  setContainImgName = (isContainImgName) => {\n    this.isContainImgName = isContainImgName;\n    window.localStorage.setItem(IS_CONTAIN_IMG_NAME, isContainImgName);\n  };\n\n  @action\n  setTemplateNum = (templateNum) => {\n    this.templateNum = templateNum;\n    window.localStorage.setItem(TEMPLATE_NUM, templateNum);\n  };\n\n  @action\n  setCodeNum = (codeNum, isMacCode) => {\n    this.codeNum = codeNum;\n    window.localStorage.setItem(CODE_NUM, codeNum);\n    // 更新style\n    const {id, macId} = CODE_OPTIONS[codeNum];\n    //  Mac 风格代码\n    if (isMacCode) {\n      replaceStyle(CODE_THEME_ID, TEMPLATE.code[macId]);\n    } else {\n      replaceStyle(CODE_THEME_ID, TEMPLATE.code[id]);\n    }\n  };\n\n  @action\n  setMacCode = (isMacCode) => {\n    this.isMacCode = isMacCode;\n    window.localStorage.setItem(IS_MAC_CODE, isMacCode);\n  };\n\n  @action\n  setPreviewType = (previewType) => {\n    this.previewType = previewType;\n    window.localStorage.setItem(PREVIEW_TYPE, previewType);\n  };\n}\n\nconst store = new Navbar();\n\n// 如果为空先把数据放进去\nif (!window.localStorage.getItem(TEMPLATE_NUM)) {\n  window.localStorage.setItem(TEMPLATE_NUM, 0);\n}\n\n// 如果为空先把数据放进去\nif (!window.localStorage.getItem(CODE_NUM)) {\n  window.localStorage.setItem(CODE_NUM, 0);\n}\n\nif (!window.localStorage.getItem(PREVIEW_TYPE)) {\n  window.localStorage.setItem(PREVIEW_TYPE, \"mobile\");\n}\n\nif (!window.localStorage.getItem(IS_SYNC_SCROLL)) {\n  window.localStorage.setItem(IS_SYNC_SCROLL, true);\n}\n\nif (!window.localStorage.getItem(IS_CONTAIN_IMG_NAME)) {\n  window.localStorage.setItem(IS_CONTAIN_IMG_NAME, false);\n}\n\nif (!window.localStorage.getItem(IS_MAC_CODE)) {\n  window.localStorage.setItem(IS_MAC_CODE, false);\n}\n\n// 获取之前选择的主题状态\nstore.templateNum = parseInt(window.localStorage.getItem(TEMPLATE_NUM), 10);\n\nif (parseInt(window.localStorage.getItem(CODE_NUM), 10) >= CODE_OPTIONS.length) {\n  window.localStorage.setItem(CODE_NUM, 0);\n}\nstore.codeNum = parseInt(window.localStorage.getItem(CODE_NUM), 10);\n\nstore.previewType = window.localStorage.getItem(PREVIEW_TYPE);\nstore.isSyncScroll = window.localStorage.getItem(IS_SYNC_SCROLL) === \"true\";\nstore.isContainImgName = window.localStorage.getItem(IS_CONTAIN_IMG_NAME) === \"true\";\nstore.isMacCode = window.localStorage.getItem(IS_MAC_CODE) === \"true\";\n\n// 初始化代码主题\nconst {macId, id} = CODE_OPTIONS[store.codeNum];\nif (store.isMacCode) {\n  replaceStyle(CODE_THEME_ID, TEMPLATE.code[macId]);\n} else {\n  replaceStyle(CODE_THEME_ID, TEMPLATE.code[id]);\n}\n\nexport default store;\n"
  },
  {
    "path": "src/store/title.js",
    "content": "// mobx\nimport {observable, action} from \"mobx\";\n\nclass Title {\n  // 观察值\n  @observable title = \"\";\n\n  @action\n  setTitle = (title) => {\n    this.title = title;\n  };\n}\n\nconst title = new Title();\n\nexport default title;\n"
  },
  {
    "path": "src/store/userInfo.js",
    "content": "// mobx\nimport {observable, action} from \"mobx\";\n\nclass UserInfo {\n  // 观察值\n  @observable userInfo = {};\n\n  @observable userRepo = [];\n\n  @action\n  setUserInfo = (userInfo) => {\n    this.userInfo = userInfo;\n  };\n\n  @action\n  setUserRepo = (userRepoList) => {\n    this.userRepo = userRepoList;\n  };\n}\n\nconst userInfo = new UserInfo();\n\nexport default userInfo;\n"
  },
  {
    "path": "src/store/view.js",
    "content": "import {observable, action} from \"mobx\";\n\nclass View {\n  @observable isEditAreaOpen = true;\n\n  @observable isPreviewAreaOpen = true;\n\n  @observable isStyleEditorOpen = false;\n\n  @observable isImmersiveEditing = false;\n\n  @action\n  setEditAreaOpen = (isEditAreaOpen) => {\n    this.isEditAreaOpen = isEditAreaOpen;\n  };\n\n  @action\n  setPreviewAreaOpen = (isPreviewAreaOpen) => {\n    this.isPreviewAreaOpen = isPreviewAreaOpen;\n  };\n\n  @action\n  setStyleEditorOpen = (isStyleEditorOpen) => {\n    this.isStyleEditorOpen = isStyleEditorOpen;\n  };\n\n  @action\n  setImmersiveEditing = (isImmersiveEditing) => {\n    this.isImmersiveEditing = isImmersiveEditing;\n  };\n}\n\nconst store = new View();\n\nexport default store;\n"
  },
  {
    "path": "src/template/basic.js",
    "content": "export default `/*默认样式，最佳实践*/\n\n/*全局属性*/\n#nice {\n  font-size: 16px;\n  color: black;\n  padding: 0 10px;\n  line-height: 1.6;\n  word-spacing: 0px;\n  letter-spacing: 0px;\n  word-break: break-word;\n  word-wrap: break-word;\n  text-align: left;\n  font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;\n  /* margin-top: -10px; 解决开头空隙过大问题*/\n}\n\n/*段落*/\n#nice p {\n  font-size: 16px;\n  padding-top: 8px;\n  padding-bottom: 8px;\n  margin: 0;\n  line-height: 26px;\n  color: black;\n}\n\n/*标题*/\n#nice h1,\n#nice h2,\n#nice h3,\n#nice h4,\n#nice h5,\n#nice h6 {\n  margin-top: 30px;\n  margin-bottom: 15px;\n  padding: 0px;\n  font-weight: bold;\n  color: black;\n}\n#nice h1 {\n  font-size: 24px;\n}\n#nice h2 {\n  font-size: 22px;\n}\n#nice h3 {\n  font-size: 20px;\n}\n#nice h4 {\n  font-size: 18px;\n}\n#nice h5 {\n  font-size: 16px;\n}\n#nice h6 {\n  font-size: 16px;\n}\n\n#nice h1 .prefix,\n#nice h2 .prefix,\n#nice h3 .prefix,\n#nice h4 .prefix,\n#nice h5 .prefix,\n#nice h6 .prefix {\n  display: none;\n}\n\n#nice h1 .suffix\n#nice h2 .suffix,\n#nice h3 .suffix,\n#nice h4 .suffix,\n#nice h5 .suffix,\n#nice h6 .suffix {\n  display: none;\n}\n\n/*列表*/\n#nice ul,\n#nice ol {\n  margin-top: 8px;\n  margin-bottom: 8px;\n  padding-left: 25px;\n  color: black;\n}\n#nice ul {\n  list-style-type: disc;\n}\n#nice ul ul {\n  list-style-type: square;\n}\n\n#nice ol {\n  list-style-type: decimal;\n}\n\n#nice li section {\n  margin-top: 5px;\n  margin-bottom: 5px;\n  line-height: 26px;\n  text-align: left;\n  color: rgb(1,1,1); /* 只要是纯黑色微信编辑器就会把color这个属性吞掉。。。*/\n  font-weight: 500;\n}\n\n/*引用*/\n#nice blockquote {\n  border: none;\n}\n\n#nice .multiquote-1 {\n  display: block;\n  font-size: 0.9em;\n  overflow: auto;\n  overflow-scrolling: touch;\n  border-left: 3px solid rgba(0, 0, 0, 0.4);\n  background: rgba(0, 0, 0, 0.05);\n  color: #6a737d;\n  padding-top: 10px;\n  padding-bottom: 10px;\n  padding-left: 20px;\n  padding-right: 10px;\n  margin-bottom: 20px;\n  margin-top: 20px;\n}\n\n#nice .multiquote-1 p {\n  margin: 0px;\n  color: black;\n  line-height: 26px;\n}\n\n#nice .multiquote-2 {\n  box-shadow: 1px 1px 10px rgba(0,0,0,0.2);\n  padding: 20px;\n  margin-bottom: 20px;\n  margin-top: 20px;\n}\n\n#nice .multiquote-3 {\n  box-shadow: 1px 1px 10px rgba(0,0,0,0.2);\n  padding: 20px;\n  margin-bottom: 20px;\n  margin-top: 20px;\n}\n\n#nice .multiquote-3 p {\n  text-align: center;\n}\n\n#nice .multiquote-3 h3 {\n  text-align: center;\n}\n\n#nice .table-of-contents a {\n  border: none;\n  color: black;\n  font-weight: normal;\n}\n\n/*链接*/\n#nice a {\n  text-decoration: none;\n  color: #1e6bb8;\n  word-wrap: break-word;\n  font-weight: bold;\n  border-bottom: 1px solid #1e6bb8;\n}\n\n/*加粗*/\n#nice strong {\n  font-weight: bold;\n  color: black;\n}\n\n/*斜体*/\n#nice em {\n  font-style: italic;\n  color: black;\n}\n\n/*加粗斜体*/\n#nice em strong {\n  font-weight: bold;\n  color: black;\n}\n\n/*删除线*/\n#nice del {\n  font-style: italic;\n  color: black;\n}\n\n/*分隔线*/\n#nice hr {\n  height: 1px;\n  margin: 0;\n  margin-top: 10px;\n  margin-bottom: 10px;\n  border: none;\n  border-top: 1px solid black;\n}\n\n/*代码块*/\n#nice pre {\n  margin-top: 10px;\n  margin-bottom: 10px;\n}\n#nice pre code {\n  display: -webkit-box;\n  font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;\n  border-radius: 0px;\n  font-size: 12px;\n  -webkit-overflow-scrolling: touch;\n}\n#nice pre code span {\n  line-height: 26px;\n}\n\n/*行内代码*/\n#nice p code,\n#nice li code {\n  font-size: 14px;\n  word-wrap: break-word;\n  padding: 2px 4px;\n  border-radius: 4px;\n  margin: 0 2px;\n  color: #1e6bb8;\n  background-color: rgba(27,31,35,.05);\n  font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;\n  word-break: break-all;\n}\n\n/*图片*/\n#nice img {\n  display: block;\n  margin: 0 auto;\n  max-width: 100%;\n}\n\n/*图片*/\n#nice figure {\n  margin: 0;\n  margin-top: 10px;\n  margin-bottom: 10px;\n}\n\n/*图片描述文字*/\n#nice figcaption {\n  margin-top: 5px;\n  text-align: center;\n  color: #888;\n  font-size: 14px;\n}\n\n\n/*表格容器 */\n#nice .table-container{\n  overflow-x: auto;\n}\n\n/*表格*/\n#nice table {\n  display: table;\n  text-align: left;\n}\n#nice tbody {\n  border: 0;\n}\n\n#nice table tr {\n  border: 0;\n  border-top: 1px solid #ccc;\n  background-color: white;\n}\n\n#nice table tr:nth-child(2n) {\n  background-color: #F8F8F8;\n}\n\n#nice table tr th,\n#nice table tr td {\n  font-size: 16px;\n  border: 1px solid #ccc;\n  padding: 5px 10px;\n  text-align: left;\n}\n\n#nice table tr th {\n  font-weight: bold;\n  background-color: #f0f0f0;\n}\n\n/* 表格最小列宽4个汉字 */\n#nice table tr th:nth-of-type(n),\n#nice table tr td:nth-of-type(n){\n  min-width:85px;\n}\n\n#nice .footnote-word {\n  color: #1e6bb8;\n  font-weight: bold;\n}\n\n#nice .footnote-ref {\n  color: #1e6bb8;\n  font-weight: bold;\n}\n\n#nice .footnote-item {\n  display: flex;\n}\n\n#nice .footnote-num {\n  display: inline;\n  width: 10%; /*神奇，50px就不可以*/\n  background: none;\n  font-size: 80%;\n  opacity: 0.6;\n  line-height: 26px;\n  font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;\n}\n\n#nice .footnote-item p {\n  display: inline;\n  font-size: 14px;\n  width: 90%;\n  padding: 0px;\n  margin: 0;\n  line-height: 26px;\n  color: black;\n  word-break:break-all;\n  width: calc(100%-50)\n}\n\n#nice sub, sup {\n  line-height: 0;\n}\n\n#nice .footnotes-sep:before {\n  content: \"参考资料\";\n  display: block;\n}\n\n/* 解决公式问题 */\n#nice .block-equation {\n  display:block;\n  text-align: center;\n  overflow: auto;\n  display: block;\n  -webkit-overflow-scrolling: touch;\n}\n\n#nice .block-equation svg {\n  max-width: 300% !important;\n  -webkit-overflow-scrolling: touch;\n}\n\n#nice .inline-equation {\n}\n\n#nice .inline-equation svg {\n}\n\n#nice .imageflow-layer1 {\n  margin-top: 1em;\n  margin-bottom: 0.5em;\n  white-space: normal;\n  border: 0px none;\n  padding: 0px;\n  overflow: hidden;\n}\n\n#nice .imageflow-layer2 {\n  white-space: nowrap;\n  width: 100%;\n  overflow-x: scroll;\n}\n\n#nice .imageflow-layer3 {\n  display: inline-block;\n  word-wrap: break-word;\n  white-space: normal;\n  vertical-align: middle;\n  width: 100%;\n}\n\n#nice .imageflow-img {\n  display: inline-block;\n}\n\n#nice .imageflow-caption {\n  text-align: center;\n  margin-top: 0px;\n  padding-top: 0px;\n  color: #888;\n}\n\n#nice .nice-suffix-juejin-container {\n  margin-top: 20px !important;\n}\n\n#nice figure a {\n  border: none;\n}\n\n#nice figure a img {\n  margin: 0px;\n}\n\n#nice figure {\n  display:flex;\n  flex-direction: column;\n  justify-content: center;\n  align-items: center;\n}\n\n/* 图片链接嵌套 */\n#nice figure a {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n\n/* 图片链接嵌套，图片解释 */\n#nice figure a + figcaption {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  width: 100%;\n  margin-top: -35px;\n  background: rgba(0,0,0,0.7);\n  color: white;\n  line-height: 35px;\n  z-index: 20;\n}\n`;\n"
  },
  {
    "path": "src/template/code/atomOneDark.js",
    "content": "export default `/*\n\nAtom One Dark by Daniel Gamage\nOriginal One Dark Syntax theme from https://github.com/atom/one-dark-syntax\n\nbase:    #282c34\nmono-1:  #abb2bf\nmono-2:  #818896\nmono-3:  #5c6370\nhue-1:   #56b6c2\nhue-2:   #61aeee\nhue-3:   #c678dd\nhue-4:   #98c379\nhue-5:   #e06c75\nhue-5-2: #be5046\nhue-6:   #d19a66\nhue-6-2: #e6c07b\n\n*/\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  color: #abb2bf;\n  background: #282c34;\n}\n\n.hljs-comment,\n.hljs-quote {\n  color: #5c6370;\n  font-style: italic;\n}\n\n.hljs-doctag,\n.hljs-keyword,\n.hljs-formula {\n  color: #c678dd;\n}\n\n.hljs-section,\n.hljs-name,\n.hljs-selector-tag,\n.hljs-deletion,\n.hljs-subst {\n  color: #e06c75;\n}\n\n.hljs-literal {\n  color: #56b6c2;\n}\n\n.hljs-string,\n.hljs-regexp,\n.hljs-addition,\n.hljs-attribute,\n.hljs-meta-string {\n  color: #98c379;\n}\n\n.hljs-built_in,\n.hljs-class .hljs-title {\n  color: #e6c07b;\n}\n\n.hljs-attr,\n.hljs-variable,\n.hljs-template-variable,\n.hljs-type,\n.hljs-selector-class,\n.hljs-selector-attr,\n.hljs-selector-pseudo,\n.hljs-number {\n  color: #d19a66;\n}\n\n.hljs-symbol,\n.hljs-bullet,\n.hljs-link,\n.hljs-meta,\n.hljs-selector-id,\n.hljs-title {\n  color: #61aeee;\n}\n\n.hljs-emphasis {\n  font-style: italic;\n}\n\n.hljs-strong {\n  font-weight: bold;\n}\n\n.hljs-link {\n  text-decoration: underline;\n}`;\n"
  },
  {
    "path": "src/template/code/atomOneLight.js",
    "content": "export default `/*\n\nAtom One Light by Daniel Gamage\nOriginal One Light Syntax theme from https://github.com/atom/one-light-syntax\n\nbase:    #fafafa\nmono-1:  #383a42\nmono-2:  #686b77\nmono-3:  #a0a1a7\nhue-1:   #0184bb\nhue-2:   #4078f2\nhue-3:   #a626a4\nhue-4:   #50a14f\nhue-5:   #e45649\nhue-5-2: #c91243\nhue-6:   #986801\nhue-6-2: #c18401\n\n*/\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  color: #383a42;\n  background: #fafafa;\n}\n\n.hljs-comment,\n.hljs-quote {\n  color: #a0a1a7;\n  font-style: italic;\n}\n\n.hljs-doctag,\n.hljs-keyword,\n.hljs-formula {\n  color: #a626a4;\n}\n\n.hljs-section,\n.hljs-name,\n.hljs-selector-tag,\n.hljs-deletion,\n.hljs-subst {\n  color: #e45649;\n}\n\n.hljs-literal {\n  color: #0184bb;\n}\n\n.hljs-string,\n.hljs-regexp,\n.hljs-addition,\n.hljs-attribute,\n.hljs-meta-string {\n  color: #50a14f;\n}\n\n.hljs-built_in,\n.hljs-class .hljs-title {\n  color: #c18401;\n}\n\n.hljs-attr,\n.hljs-variable,\n.hljs-template-variable,\n.hljs-type,\n.hljs-selector-class,\n.hljs-selector-attr,\n.hljs-selector-pseudo,\n.hljs-number {\n  color: #986801;\n}\n\n.hljs-symbol,\n.hljs-bullet,\n.hljs-link,\n.hljs-meta,\n.hljs-selector-id,\n.hljs-title {\n  color: #4078f2;\n}\n\n.hljs-emphasis {\n  font-style: italic;\n}\n\n.hljs-strong {\n  font-weight: bold;\n}\n\n.hljs-link {\n  text-decoration: underline;\n}`;\n"
  },
  {
    "path": "src/template/code/github.js",
    "content": "export default `/*\n\ngithub.com style (c) Vasily Polovnyov <vast@whiteants.net>\n\n*/\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  color: #333;\n  background: #f8f8f8;\n}\n\n.hljs-comment,\n.hljs-quote {\n  color: #998;\n  font-style: italic;\n}\n\n.hljs-keyword,\n.hljs-selector-tag,\n.hljs-subst {\n  color: #333;\n  font-weight: bold;\n}\n\n.hljs-number,\n.hljs-literal,\n.hljs-variable,\n.hljs-template-variable,\n.hljs-tag .hljs-attr {\n  color: #008080;\n}\n\n.hljs-string,\n.hljs-doctag {\n  color: #d14;\n}\n\n.hljs-title,\n.hljs-section,\n.hljs-selector-id {\n  color: #900;\n  font-weight: bold;\n}\n\n.hljs-subst {\n  font-weight: normal;\n}\n\n.hljs-type,\n.hljs-class .hljs-title {\n  color: #458;\n  font-weight: bold;\n}\n\n.hljs-tag,\n.hljs-name,\n.hljs-attribute {\n  color: #000080;\n  font-weight: normal;\n}\n\n.hljs-regexp,\n.hljs-link {\n  color: #009926;\n}\n\n.hljs-symbol,\n.hljs-bullet {\n  color: #990073;\n}\n\n.hljs-built_in,\n.hljs-builtin-name {\n  color: #0086b3;\n}\n\n.hljs-meta {\n  color: #999;\n  font-weight: bold;\n}\n\n.hljs-deletion {\n  background: #fdd;\n}\n\n.hljs-addition {\n  background: #dfd;\n}\n\n.hljs-emphasis {\n  font-style: italic;\n}\n\n.hljs-strong {\n  font-weight: bold;\n}`;\n"
  },
  {
    "path": "src/template/code/monokai.js",
    "content": "export default `/*\nMonokai style - ported by Luigi Maselli - http://grigio.org\n*/\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  background: #272822; color: #ddd;\n}\n\n.hljs-tag,\n.hljs-keyword,\n.hljs-selector-tag,\n.hljs-literal,\n.hljs-strong,\n.hljs-name {\n  color: #f92672;\n}\n\n.hljs-code {\n  color: #66d9ef;\n}\n\n.hljs-class .hljs-title {\n  color: white;\n}\n\n.hljs-attribute,\n.hljs-symbol,\n.hljs-regexp,\n.hljs-link {\n  color: #bf79db;\n}\n\n.hljs-string,\n.hljs-bullet,\n.hljs-subst,\n.hljs-title,\n.hljs-section,\n.hljs-emphasis,\n.hljs-type,\n.hljs-built_in,\n.hljs-builtin-name,\n.hljs-selector-attr,\n.hljs-selector-pseudo,\n.hljs-addition,\n.hljs-variable,\n.hljs-template-tag,\n.hljs-template-variable {\n  color: #a6e22e;\n}\n\n.hljs-comment,\n.hljs-quote,\n.hljs-deletion,\n.hljs-meta {\n  color: #75715e;\n}\n\n.hljs-keyword,\n.hljs-selector-tag,\n.hljs-literal,\n.hljs-doctag,\n.hljs-title,\n.hljs-section,\n.hljs-type,\n.hljs-selector-id {\n  font-weight: bold;\n}`;\n"
  },
  {
    "path": "src/template/code/vs2015.js",
    "content": "export default `/*\n * Visual Studio 2015 dark style\n * Author: Nicolas LLOBERA <nllobera@gmail.com>\n */\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  background: #1E1E1E;\n  color: #DCDCDC;\n}\n\n.hljs-keyword,\n.hljs-literal,\n.hljs-symbol,\n.hljs-name {\n  color: #569CD6;\n}\n.hljs-link {\n  color: #569CD6;\n  text-decoration: underline;\n}\n\n.hljs-built_in,\n.hljs-type {\n  color: #4EC9B0;\n}\n\n.hljs-number,\n.hljs-class {\n  color: #B8D7A3;\n}\n\n.hljs-string,\n.hljs-meta-string {\n  color: #D69D85;\n}\n\n.hljs-regexp,\n.hljs-template-tag {\n  color: #9A5334;\n}\n\n.hljs-subst,\n.hljs-function,\n.hljs-title,\n.hljs-params,\n.hljs-formula {\n  color: #DCDCDC;\n}\n\n.hljs-comment,\n.hljs-quote {\n  color: #57A64A;\n  font-style: italic;\n}\n\n.hljs-doctag {\n  color: #608B4E;\n}\n\n.hljs-meta,\n.hljs-meta-keyword,\n.hljs-tag {\n  color: #9B9B9B;\n}\n\n.hljs-variable,\n.hljs-template-variable {\n  color: #BD63C5;\n}\n\n.hljs-attr,\n.hljs-attribute,\n.hljs-builtin-name {\n  color: #9CDCFE;\n}\n\n.hljs-section {\n  color: gold;\n}\n\n.hljs-emphasis {\n  font-style: italic;\n}\n\n.hljs-strong {\n  font-weight: bold;\n}\n\n/*.hljs-code {\n  font-family:'Monospace';\n}*/\n\n.hljs-bullet,\n.hljs-selector-tag,\n.hljs-selector-id,\n.hljs-selector-class,\n.hljs-selector-attr,\n.hljs-selector-pseudo {\n  color: #D7BA7D;\n}\n\n.hljs-addition {\n  background-color: #144212;\n  display: inline-block;\n  width: 100%;\n}\n\n.hljs-deletion {\n  background-color: #600;\n  display: inline-block;\n  width: 100%;\n}`;\n"
  },
  {
    "path": "src/template/code/xcode.js",
    "content": "export default `/*\n\nXCode style (c) Angel Garcia <angelgarcia.mail@gmail.com>\n\n*/\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  background: #fff;\n  color: black;\n}\n\n/* Gray DOCTYPE selectors like WebKit */\n.xml .hljs-meta {\n  color: #c0c0c0;\n}\n\n.hljs-comment,\n.hljs-quote {\n  color: #007400;\n}\n\n.hljs-tag,\n.hljs-attribute,\n.hljs-keyword,\n.hljs-selector-tag,\n.hljs-literal,\n.hljs-name {\n  color: #aa0d91;\n}\n\n.hljs-variable,\n.hljs-template-variable {\n  color: #3F6E74;\n}\n\n.hljs-code,\n.hljs-string,\n.hljs-meta-string {\n  color: #c41a16;\n}\n\n.hljs-regexp,\n.hljs-link {\n  color: #0E0EFF;\n}\n\n.hljs-title,\n.hljs-symbol,\n.hljs-bullet,\n.hljs-number {\n  color: #1c00cf;\n}\n\n.hljs-section,\n.hljs-meta {\n  color: #643820;\n}\n\n\n.hljs-class .hljs-title,\n.hljs-type,\n.hljs-built_in,\n.hljs-builtin-name,\n.hljs-params {\n  color: #5c2699;\n}\n\n.hljs-attr {\n  color: #836C28;\n}\n\n.hljs-subst {\n  color: #000;\n}\n\n.hljs-formula {\n  background-color: #eee;\n  font-style: italic;\n}\n\n.hljs-addition {\n  background-color: #baeeba;\n}\n\n.hljs-deletion {\n  background-color: #ffc8bd;\n}\n\n.hljs-selector-id,\n.hljs-selector-class {\n  color: #9b703f;\n}\n\n.hljs-doctag,\n.hljs-strong {\n  font-weight: bold;\n}\n\n.hljs-emphasis {\n  font-style: italic;\n}`;\n"
  },
  {
    "path": "src/template/content.md",
    "content": "![](https://my-wechat.mdnice.com/logo.svg)\n\n请使用 **Chrome** 浏览器。\n\n请阅读下方文本熟悉工具使用方法，本文可直接拷贝到微信中预览。\n\n## 1 Markdown Nice 简介\n\n- 支持自定义样式的 Markdown 编辑器\n- 支持微信公众号、知乎和稀土掘金\n- 欢迎扫码回复「排版」加入用户群\n\n![](https://my-wechat.mdnice.com/wechat.jpg)\n\n## 2 主题\n\n**https://preview.mdnice.com/themes/**\n\n欢迎提交主题，提供更多文章示例~~\n\n## 3 通用语法\n\n### 3.1 标题\n\n在文字写书写不同数量的`#`可以完成不同的标题，如下：\n\n# 一级标题\n\n## 二级标题\n\n### 三级标题\n\n### 3.2 无序列表\n\n无序列表的使用，在符号`-`后加空格使用。如下：\n\n- 无序列表 1\n- 无序列表 2\n- 无序列表 3\n\n如果要控制列表的层级，则需要在符号`-`前使用空格。如下：\n\n- 无序列表 1\n- 无序列表 2\n  - 无序列表 2.1\n  - 无序列表 2.2\n\n**由于微信原因，最多支持到二级列表**。\n\n### 3.3 有序列表\n\n有序列表的使用，在数字及符号`.`后加空格后输入内容，如下：\n\n1. 有序列表 1\n2. 有序列表 2\n3. 有序列表 3\n\n### 3.4 粗体和斜体\n\n粗体的使用是在需要加粗的文字前后各加两个`*`。\n\n而斜体的使用则是在需要斜体的文字前后各加一个`*`。\n\n如果要使用粗体和斜体，那么就是在需要操作的文字前后加三个`*`。如下：\n\n**这个是粗体**\n\n_这个是斜体_\n\n**_这个是粗体加斜体_**\n\n注：由于 commonmark 标准，可能会导致加粗与想象不一致，如下\n\n**今天天气好晴朗，**处处好风光。\n\n这个是正常现象，请参考[加粗 Issue](https://github.com/markdown-it/markdown-it/issues/410 \"加粗 Issue\")。\n\n### 3.5 链接\n\n微信公众号仅支持公众号文章链接，即域名为`https://mp.weixin.qq.com/`的合法链接。使用方法如下所示：\n\n对于该论述，欢迎读者查阅之前发过的文章，[你是《未来世界的幸存者》么？](https://mp.weixin.qq.com/s/s5IhxV2ooX3JN_X416nidA)\n\n### 3.6 引用\n\n引用的格式是在符号 `>` 后面书写文字，文字的内容可以包含标题、链接、图片、粗体和斜体等。\n\n一级引用如下：\n\n> ### 一级引用示例\n> \n> 读一本好书，就是在和高尚的人谈话。 **——歌德**\n> \n> [Markdown Nice最全功能介绍](https://mp.weixin.qq.com/s/lM808MxUu6tp8zU8SBu3sg)\n> \n> ![这里写图片描述](https://my-wechat.mdnice.com/wechat.jpg)\n\n当使用多个 `>` 符号时，就会变成多级引用\n\n二级引用如下：\n\n>> ### 二级引用示例\n>>\n>> 读一本好书，就是在和高尚的人谈话。 **——歌德**\n>>\n>> [Markdown Nice最全功能介绍](https://mp.weixin.qq.com/s/lM808MxUu6tp8zU8SBu3sg)\n>> \n>> ![这里写图片描述](https://my-wechat.mdnice.com/wechat.jpg)\n\n三级引用如下：\n\n>>> ### 三级引用示例\n>>>\n>>> 读一本好书，就是在和高尚的人谈话。 **——歌德**\n>>>\n>>> [Markdown Nice最全功能介绍](https://mp.weixin.qq.com/s/lM808MxUu6tp8zU8SBu3sg)\n>>> \n>>> ![这里写图片描述](https://my-wechat.mdnice.com/wechat.jpg)\n\n### 3.7 分割线\n\n可以在一行中用三个以上的减号来建立一个分隔线，同时需要在分隔线的上面空一行。如下：\n\n---\n\n### 3.8 删除线\n\n删除线的使用，在需要删除的文字前后各使用两个`~`，如下：\n\n~~这是要被删除的内容。~~\n\n### 3.9 表格\n\n可以使用冒号来定义表格的对齐方式，如下：\n\n| 姓名       | 年龄 |         工作 |\n| :--------- | :--: | -----------: |\n| 小可爱     |  18  |     吃可爱多 |\n| 小小勇敢   |  20  |   爬棵勇敢树 |\n| 小小小机智 |  22  | 看一本机智书 |\n\n宽度过长的表格可以滚动，可在自定义主题中调节宽度：\n\n| 姓名       | 年龄 |         工作 |      邮箱       |    手机     |\n| :--------- | :--: | -----------: | :-------------: | :---------: |\n| 小可爱     |  18  |     吃可爱多 | lovely@test.com | 18812345678 |\n| 小小勇敢   |  20  |   爬棵勇敢树 | brave@test.com  | 17712345678 |\n| 小小小机智 |  22  | 看一本机智书 | smart@test.com  | 16612345678 |\n\n### 3.10 图片\n\n插入图片，如果是行内图片则无图例，否则有图例，格式如下：\n\n![这里写图片描述](https://my-wechat.mdnice.com/wechat.jpg)\n\n可以通过在图片尾部添加宽度和高度控制图片大小，用法如下：\n\n![同时设置宽度和高度](https://my-wechat.mdnice.com/logo.png =150x150)\n\n![只设置宽度，推荐使用百分比](https://my-wechat.mdnice.com/logo.png =40%x)\n\n该语法比较特殊，其他 Markdown 编辑器不完全通用。\n\n支持 jpg、png、gif、svg 等图片格式，**其中 svg 文件仅可在微信公众平台中使用**，svg 文件示例如下：\n\n![](https://my-wechat.mdnice.com/i-am-svg.svg)\n\n- 支持图片**拖拽和截图粘贴**到编辑器中上传，上传时使用当前选择的图床。\n- 可使用**格式->图片**上传本地图片，网站目前支持「图壳」图床，失败率低，但是只可保存一天用于排版\n\n**注：仅支持 https 的图片，图片粘贴到微信、知乎或掘金时会自动上传其服务器，不必担心使用上述图床会导致图片丢失**。\n\n图片还可以和链接嵌套使用，能够实现推荐卡片的效果，用法如下：\n\n[![Markdown Nice 最全功能介绍](https://my-wechat.mdnice.com/dance.gif)](https://mp.weixin.qq.com/s/lM808MxUu6tp8zU8SBu3sg)\n\n## 4. 特殊语法\n\n### 4.1 脚注\n\n> 支持平台：微信公众号、知乎。\n\n脚注与链接的区别如下所示：\n\n```markdown\n链接：[文字](链接)\n脚注：[文字](脚注解释 \"脚注名字\")\n```\n\n有人认为在[大前端时代](https://en.wikipedia.org/wiki/Front-end_web_development \"Front-end web development\")的背景下，移动端开发（Android、IOS）将逐步退出历史舞台。\n\n[全栈工程师](是指掌握多种技能，并能利用多种技能独立完成产品的人。 \"什么是全栈工程师\")在业务开发流程中起到了至关重要的作用。\n\n脚注内容请拉到最下面观看。\n\n### 4.2 代码块\n\n> 支持平台：微信公众号、知乎。\n\n如果在一个行内需要引用代码，只要用反引号引起来就好，如下：\n\nUse the `printf()` function.\n\n在需要高亮的代码块的前一行及后一行使用三个反引号，同时**第一行反引号后面表示代码块所使用的语言**，如下：\n\n```java\n// FileName: HelloWorld.java\npublic class HelloWorld {\n  // Java 入口程序，程序从此入口\n  public static void main(String[] args) {\n    System.out.println(\"Hello,World!\"); // 向控制台打印一条语句\n  }\n}\n```\n\n支持以下语言种类：\n\n```\nbash\nclojure，cpp，cs，css\ndart，dockerfile, diff\nerlang\ngo，gradle，groovy\nhaskell\njava，javascript，json，julia\nkotlin\nlisp，lua\nmakefile，markdown，matlab\nobjectivec\nperl，php，python\nr，ruby，rust\nscala，shell，sql，swift\ntex，typescript\nverilog，vhdl\nxml\nyaml\n```\n\n如果想要更换代码主题，可在上方挑选，不支持代码主题自定义。\n\n其中**微信代码主题与微信官方一致**，有以下注意事项：\n\n- 带行号且不换行，代码大小与官方一致\n- 需要在代码块处标志语言，否则无法高亮\n- 粘贴到公众号后，用鼠标点代码块内外一次，完成高亮\n\ndiff 不能同时和其他语言的高亮同时显示，且需要调整代码主题为微信代码主题以外的代码主题才能看到 diff 效果，使用效果如下:\n\n```diff\n+ 新增项\n- 删除项\n```\n\n**其他主题不带行号，可自定义是否换行，代码大小与当前编辑器一致**\n\n### 4.3 数学公式\n\n> 支持平台：微信公众号、知乎。\n\n行内公式使用方法，比如这个化学公式：$\\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$\n\n块公式使用方法如下：\n\n$$H(D_2) = -\\left(\\frac{2}{4}\\log_2 \\frac{2}{4} + \\frac{2}{4}\\log_2 \\frac{2}{4}\\right) = 1$$\n\n矩阵：\n\n$$\n  \\begin{pmatrix}\n  1 & a_1 & a_1^2 & \\cdots & a_1^n \\\\\n  1 & a_2 & a_2^2 & \\cdots & a_2^n \\\\\n  \\vdots & \\vdots & \\vdots & \\ddots & \\vdots \\\\\n  1 & a_m & a_m^2 & \\cdots & a_m^n \\\\\n  \\end{pmatrix}\n$$\n\n公式由于微信不支持，目前的解决方案是转成 svg 放到微信中，无需调整，矢量不失真。\n\n目前测试如果公式量过大，在 Chrome 下会存在粘贴后无响应，但是在 Firefox 中始终能够成功。\n\n### 4.4 TOC\n\n> 支持平台：微信公众号、知乎。\n\nTOC 全称为 Table of Content，列出全部标题。由于示例标题过多，需要使用将下方代码段去除即可。\n\n```\n[TOC]\n```\n\n由于微信只支持到二级列表，本工具仅支持二级标题和三级标题的显示。\n\n### 4.5 注音符号\n\n> 支持平台：微信公众号。\n\n支持注音符号，用法如下：\n\nMarkdown Nice 这么好用，简直是{喜大普奔|hē hē hē hē}呀！\n\n### 4.6 横屏滑动幻灯片\n\n> 支持平台：微信公众号。\n\n通过`<![](url),![](url)>`这种语法设置横屏滑动滑动片，具体用法如下：\n\n<![蓝1](https://my-wechat.mdnice.com/blue.jpg),![绿2](https://my-wechat.mdnice.com/green.jpg),![红3](https://my-wechat.mdnice.com/red.jpg)>\n\n## 5 其他语法\n\n### 5.1 HTML\n\n支持原生 HTML 语法，请写内联样式，如下：\n\n<span style=\"display:block;text-align:right;color:orangered;\">橙色居右</span>\n<span style=\"display:block;text-align:center;color:orangered;\">橙色居中</span>\n\n### 5.2 UML\n\n不支持，推荐使用开源工具`https://draw.io/`制作后再导入图片\n\n### 5.3 更多文档\n\n更多文档请参考 [markdown-nice-docs](https://preview.mdnice.com/articles/ \"更多文档\")\n"
  },
  {
    "path": "src/template/index.js",
    "content": "import custom from \"./markdown/custom\";\nimport normal from \"./markdown/normal\";\n\nimport content from \"./content.md\";\n\nimport atomOneDark from \"./code/atomOneDark\";\nimport atomOneLight from \"./code/atomOneLight\";\nimport github from \"./code/github\";\nimport monokai from \"./code/monokai\";\nimport vs2015 from \"./code/vs2015\";\nimport xcode from \"./code/xcode\";\n\nimport macAtomOneDark from \"./macCode/macAtomOneDark\";\nimport macAtomOneLight from \"./macCode/macAtomOneLight\";\nimport macGithub from \"./macCode/macGithub\";\nimport macMonokai from \"./macCode/macMonokai\";\nimport macVs2015 from \"./macCode/macVs2015\";\nimport macXcode from \"./macCode/macXcode\";\n\nimport basic from \"./basic\";\n\nexport default {\n  basic,\n  normal,\n  custom,\n  code: {\n    atomOneDark,\n    atomOneLight,\n    github,\n    monokai,\n    vs2015,\n    xcode,\n    macAtomOneDark,\n    macAtomOneLight,\n    macGithub,\n    macMonokai,\n    macVs2015,\n    macXcode,\n  },\n  content,\n};\n"
  },
  {
    "path": "src/template/macCode/macAtomOneDark.js",
    "content": "export default `/*\n\nAtom One Dark by Daniel Gamage\nOriginal One Dark Syntax theme from https://github.com/atom/one-dark-syntax\n\nbase:    #282c34\nmono-1:  #abb2bf\nmono-2:  #818896\nmono-3:  #5c6370\nhue-1:   #56b6c2\nhue-2:   #61aeee\nhue-3:   #c678dd\nhue-4:   #98c379\nhue-5:   #e06c75\nhue-5-2: #be5046\nhue-6:   #d19a66\nhue-6-2: #e6c07b\n\n*/\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  color: #abb2bf;\n  background: #282c34;\n}\n\n.hljs-comment,\n.hljs-quote {\n  color: #5c6370;\n  font-style: italic;\n}\n\n.hljs-doctag,\n.hljs-keyword,\n.hljs-formula {\n  color: #c678dd;\n}\n\n.hljs-section,\n.hljs-name,\n.hljs-selector-tag,\n.hljs-deletion,\n.hljs-subst {\n  color: #e06c75;\n}\n\n.hljs-literal {\n  color: #56b6c2;\n}\n\n.hljs-string,\n.hljs-regexp,\n.hljs-addition,\n.hljs-attribute,\n.hljs-meta-string {\n  color: #98c379;\n}\n\n.hljs-built_in,\n.hljs-class .hljs-title {\n  color: #e6c07b;\n}\n\n.hljs-attr,\n.hljs-variable,\n.hljs-template-variable,\n.hljs-type,\n.hljs-selector-class,\n.hljs-selector-attr,\n.hljs-selector-pseudo,\n.hljs-number {\n  color: #d19a66;\n}\n\n.hljs-symbol,\n.hljs-bullet,\n.hljs-link,\n.hljs-meta,\n.hljs-selector-id,\n.hljs-title {\n  color: #61aeee;\n}\n\n.hljs-emphasis {\n  font-style: italic;\n}\n\n.hljs-strong {\n  font-weight: bold;\n}\n\n.hljs-link {\n  text-decoration: underline;\n}\n\n#nice .custom code {\n  padding-top: 15px;\n  background: #282c34;\n  border-radius: 5px;\n}\n\n#nice .custom:before {\n  content: '';\n  display:block;\n  background: url(https://my-wechat.mdnice.com/point.png);\n  height: 30px;\n  width: 100%;\n  background-size:40px;\n  background-repeat: no-repeat;\n  background-color: #282c34;\n  margin-bottom: -7px;\n  border-radius: 5px;\n  background-position: 10px 10px;\n}\n\n#nice .custom {\n  border-radius: 5px;\n  box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\n}`;\n"
  },
  {
    "path": "src/template/macCode/macAtomOneLight.js",
    "content": "export default `/*\n\nAtom One Light by Daniel Gamage\nOriginal One Light Syntax theme from https://github.com/atom/one-light-syntax\n\nbase:    #fafafa\nmono-1:  #383a42\nmono-2:  #686b77\nmono-3:  #a0a1a7\nhue-1:   #0184bb\nhue-2:   #4078f2\nhue-3:   #a626a4\nhue-4:   #50a14f\nhue-5:   #e45649\nhue-5-2: #c91243\nhue-6:   #986801\nhue-6-2: #c18401\n\n*/\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  color: #383a42;\n  background: #fafafa;\n}\n\n.hljs-comment,\n.hljs-quote {\n  color: #a0a1a7;\n  font-style: italic;\n}\n\n.hljs-doctag,\n.hljs-keyword,\n.hljs-formula {\n  color: #a626a4;\n}\n\n.hljs-section,\n.hljs-name,\n.hljs-selector-tag,\n.hljs-deletion,\n.hljs-subst {\n  color: #e45649;\n}\n\n.hljs-literal {\n  color: #0184bb;\n}\n\n.hljs-string,\n.hljs-regexp,\n.hljs-addition,\n.hljs-attribute,\n.hljs-meta-string {\n  color: #50a14f;\n}\n\n.hljs-built_in,\n.hljs-class .hljs-title {\n  color: #c18401;\n}\n\n.hljs-attr,\n.hljs-variable,\n.hljs-template-variable,\n.hljs-type,\n.hljs-selector-class,\n.hljs-selector-attr,\n.hljs-selector-pseudo,\n.hljs-number {\n  color: #986801;\n}\n\n.hljs-symbol,\n.hljs-bullet,\n.hljs-link,\n.hljs-meta,\n.hljs-selector-id,\n.hljs-title {\n  color: #4078f2;\n}\n\n.hljs-emphasis {\n  font-style: italic;\n}\n\n.hljs-strong {\n  font-weight: bold;\n}\n\n.hljs-link {\n  text-decoration: underline;\n}\n\n#nice .custom code {\n  padding-top: 15px;\n  background: #fafafa;\n  border-radius: 5px;\n}\n\n#nice .custom:before {\n  content: '';\n  display:block;\n  background: url(https://my-wechat.mdnice.com/point.png);\n  height: 30px;\n  width: 100%;\n  background-size:40px;\n  background-repeat: no-repeat;\n  background-color: #fafafa;\n  margin-bottom: -7px;\n  border-radius: 5px;\n  background-position: 10px 10px;\n}\n\n#nice .custom {\n  border-radius: 5px;\n  box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\n}`;\n"
  },
  {
    "path": "src/template/macCode/macGithub.js",
    "content": "export default `/*\n\ngithub.com style (c) Vasily Polovnyov <vast@whiteants.net>\n\n*/\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  color: #333;\n  background: #f8f8f8;\n}\n\n.hljs-comment,\n.hljs-quote {\n  color: #998;\n  font-style: italic;\n}\n\n.hljs-keyword,\n.hljs-selector-tag,\n.hljs-subst {\n  color: #333;\n  font-weight: bold;\n}\n\n.hljs-number,\n.hljs-literal,\n.hljs-variable,\n.hljs-template-variable,\n.hljs-tag .hljs-attr {\n  color: #008080;\n}\n\n.hljs-string,\n.hljs-doctag {\n  color: #d14;\n}\n\n.hljs-title,\n.hljs-section,\n.hljs-selector-id {\n  color: #900;\n  font-weight: bold;\n}\n\n.hljs-subst {\n  font-weight: normal;\n}\n\n.hljs-type,\n.hljs-class .hljs-title {\n  color: #458;\n  font-weight: bold;\n}\n\n.hljs-tag,\n.hljs-name,\n.hljs-attribute {\n  color: #000080;\n  font-weight: normal;\n}\n\n.hljs-regexp,\n.hljs-link {\n  color: #009926;\n}\n\n.hljs-symbol,\n.hljs-bullet {\n  color: #990073;\n}\n\n.hljs-built_in,\n.hljs-builtin-name {\n  color: #0086b3;\n}\n\n.hljs-meta {\n  color: #999;\n  font-weight: bold;\n}\n\n.hljs-deletion {\n  background: #fdd;\n}\n\n.hljs-addition {\n  background: #dfd;\n}\n\n.hljs-emphasis {\n  font-style: italic;\n}\n\n.hljs-strong {\n  font-weight: bold;\n}\n\n#nice .custom code {\n  padding-top: 15px;\n  background: #f8f8f8;\n  border-radius: 5px;\n}\n\n#nice .custom:before {\n  content: '';\n  display:block;\n  background: url(https://my-wechat.mdnice.com/point.png);\n  height: 30px;\n  width: 100%;\n  background-size:40px;\n  background-repeat: no-repeat;\n  background-color: #f8f8f8;\n  margin-bottom: -7px;\n  border-radius: 5px;\n  background-position: 10px 10px;\n}\n\n#nice .custom {\n  border-radius: 5px;\n  box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\n}`;\n"
  },
  {
    "path": "src/template/macCode/macMonokai.js",
    "content": "export default `/*\nMonokai style - ported by Luigi Maselli - http://grigio.org\n*/\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  background: #272822; color: #ddd;\n}\n\n.hljs-tag,\n.hljs-keyword,\n.hljs-selector-tag,\n.hljs-literal,\n.hljs-strong,\n.hljs-name {\n  color: #f92672;\n}\n\n.hljs-code {\n  color: #66d9ef;\n}\n\n.hljs-class .hljs-title {\n  color: white;\n}\n\n.hljs-attribute,\n.hljs-symbol,\n.hljs-regexp,\n.hljs-link {\n  color: #bf79db;\n}\n\n.hljs-string,\n.hljs-bullet,\n.hljs-subst,\n.hljs-title,\n.hljs-section,\n.hljs-emphasis,\n.hljs-type,\n.hljs-built_in,\n.hljs-builtin-name,\n.hljs-selector-attr,\n.hljs-selector-pseudo,\n.hljs-addition,\n.hljs-variable,\n.hljs-template-tag,\n.hljs-template-variable {\n  color: #a6e22e;\n}\n\n.hljs-comment,\n.hljs-quote,\n.hljs-deletion,\n.hljs-meta {\n  color: #75715e;\n}\n\n.hljs-keyword,\n.hljs-selector-tag,\n.hljs-literal,\n.hljs-doctag,\n.hljs-title,\n.hljs-section,\n.hljs-type,\n.hljs-selector-id {\n  font-weight: bold;\n}\n\n#nice .custom code {\n  padding-top: 15px;\n  background: #272822;\n  border-radius: 5px;\n}\n\n#nice .custom:before {\n  content: '';\n  display:block;\n  background: url(https://my-wechat.mdnice.com/point.png);\n  height: 30px;\n  width: 100%;\n  background-size:40px;\n  background-repeat: no-repeat;\n  background-color: #272822;\n  margin-bottom: -7px;\n  border-radius: 5px;\n  background-position: 10px 10px;\n}\n\n#nice .custom {\n  border-radius: 5px;\n  box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\n}`;\n"
  },
  {
    "path": "src/template/macCode/macVs2015.js",
    "content": "export default `/*\n * Visual Studio 2015 dark style\n * Author: Nicolas LLOBERA <nllobera@gmail.com>\n */\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  background: #1E1E1E;\n  color: #DCDCDC;\n}\n\n.hljs-keyword,\n.hljs-literal,\n.hljs-symbol,\n.hljs-name {\n  color: #569CD6;\n}\n.hljs-link {\n  color: #569CD6;\n  text-decoration: underline;\n}\n\n.hljs-built_in,\n.hljs-type {\n  color: #4EC9B0;\n}\n\n.hljs-number,\n.hljs-class {\n  color: #B8D7A3;\n}\n\n.hljs-string,\n.hljs-meta-string {\n  color: #D69D85;\n}\n\n.hljs-regexp,\n.hljs-template-tag {\n  color: #9A5334;\n}\n\n.hljs-subst,\n.hljs-function,\n.hljs-title,\n.hljs-params,\n.hljs-formula {\n  color: #DCDCDC;\n}\n\n.hljs-comment,\n.hljs-quote {\n  color: #57A64A;\n  font-style: italic;\n}\n\n.hljs-doctag {\n  color: #608B4E;\n}\n\n.hljs-meta,\n.hljs-meta-keyword,\n.hljs-tag {\n  color: #9B9B9B;\n}\n\n.hljs-variable,\n.hljs-template-variable {\n  color: #BD63C5;\n}\n\n.hljs-attr,\n.hljs-attribute,\n.hljs-builtin-name {\n  color: #9CDCFE;\n}\n\n.hljs-section {\n  color: gold;\n}\n\n.hljs-emphasis {\n  font-style: italic;\n}\n\n.hljs-strong {\n  font-weight: bold;\n}\n\n/*.hljs-code {\n  font-family:'Monospace';\n}*/\n\n.hljs-bullet,\n.hljs-selector-tag,\n.hljs-selector-id,\n.hljs-selector-class,\n.hljs-selector-attr,\n.hljs-selector-pseudo {\n  color: #D7BA7D;\n}\n\n.hljs-addition {\n  background-color: #144212;\n  display: inline-block;\n  width: 100%;\n}\n\n.hljs-deletion {\n  background-color: #600;\n  display: inline-block;\n  width: 100%;\n}\n\n#nice .custom code {\n  padding-top: 15px;\n  background: #1E1E1E;\n  border-radius: 5px;\n}\n\n#nice .custom:before {\n  content: '';\n  display:block;\n  background: url(https://my-wechat.mdnice.com/point.png);\n  height: 30px;\n  width: 100%;\n  background-size:40px;\n  background-repeat: no-repeat;\n  background-color: #1E1E1E;\n  margin-bottom: -7px;\n  border-radius: 5px;\n  background-position: 10px 10px;\n}\n\n#nice .custom {\n  border-radius: 5px;\n  box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\n}`;\n"
  },
  {
    "path": "src/template/macCode/macXcode.js",
    "content": "export default `/*\n\nXCode style (c) Angel Garcia <angelgarcia.mail@gmail.com>\n\n*/\n\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 16px;\n  background: #fff;\n  color: black;\n}\n\n/* Gray DOCTYPE selectors like WebKit */\n.xml .hljs-meta {\n  color: #c0c0c0;\n}\n\n.hljs-comment,\n.hljs-quote {\n  color: #007400;\n}\n\n.hljs-tag,\n.hljs-attribute,\n.hljs-keyword,\n.hljs-selector-tag,\n.hljs-literal,\n.hljs-name {\n  color: #aa0d91;\n}\n\n.hljs-variable,\n.hljs-template-variable {\n  color: #3F6E74;\n}\n\n.hljs-code,\n.hljs-string,\n.hljs-meta-string {\n  color: #c41a16;\n}\n\n.hljs-regexp,\n.hljs-link {\n  color: #0E0EFF;\n}\n\n.hljs-title,\n.hljs-symbol,\n.hljs-bullet,\n.hljs-number {\n  color: #1c00cf;\n}\n\n.hljs-section,\n.hljs-meta {\n  color: #643820;\n}\n\n\n.hljs-class .hljs-title,\n.hljs-type,\n.hljs-built_in,\n.hljs-builtin-name,\n.hljs-params {\n  color: #5c2699;\n}\n\n.hljs-attr {\n  color: #836C28;\n}\n\n.hljs-subst {\n  color: #000;\n}\n\n.hljs-formula {\n  background-color: #eee;\n  font-style: italic;\n}\n\n.hljs-addition {\n  background-color: #baeeba;\n}\n\n.hljs-deletion {\n  background-color: #ffc8bd;\n}\n\n.hljs-selector-id,\n.hljs-selector-class {\n  color: #9b703f;\n}\n\n.hljs-doctag,\n.hljs-strong {\n  font-weight: bold;\n}\n\n.hljs-emphasis {\n  font-style: italic;\n}\n\n#nice .custom code {\n  padding-top: 15px;\n  background: #fff;\n  border-radius: 5px;\n}\n\n#nice .custom:before {\n  content: '';\n  display:block;\n  background: url(https://my-wechat.mdnice.com/point.png);\n  height: 30px;\n  width: 100%;\n  background-size:40px;\n  background-repeat: no-repeat;\n  background-color: #fff;\n  margin-bottom: -7px;\n  border-radius: 5px;\n  background-position: 10px 10px;\n}\n\n#nice .custom {\n  border-radius: 5px;\n  box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\n}`;\n"
  },
  {
    "path": "src/template/markdown/custom.js",
    "content": "export default `/* 自定义样式，实时生效，浏览器实时缓存 */\n\n/* 全局属性\n * 页边距 padding: 30px;\n * 全文字体 font-family: ptima-Regular;\n * 英文换行 word-break: break-all;\n */\n#nice {\n}\n\n/* 段落，下方未标注标签参数均同此处\n * 上边距 margin-top: 5px;\n * 下边距 margin-bottom: 5px;\n * 行高 line-height: 26px;\n * 词间距 word-spacing: 3px;\n * 字间距 letter-spacing: 3px;\n * 对齐 text-align: left;\n * 颜色 color: #3e3e3e;\n * 字体大小 font-size: 16px;\n * 首行缩进 text-indent: 2em;\n */\n#nice p {\n}\n\n/* 一级标题 */\n#nice h1 {\n}\n\n/* 一级标题内容 */\n#nice h1 .content {\n}\n\n/* 一级标题前缀 */\n#nice h1 .prefix {\n}\n\n/* 一级标题后缀 */\n#nice h1 .suffix {\n}\n\n/* 二级标题 */\n#nice h2 {\n}\n\n/* 二级标题内容 */\n#nice h2 .content {\n}\n\n/* 二级标题前缀 */\n#nice h2 .prefix {\n}\n\n/* 二级标题后缀 */\n#nice h2 .suffix {\n}\n\n/* 三级标题 */\n#nice h3 {\n}\n\n/* 三级标题内容 */\n#nice h3 .content {\n}\n\n/* 三级标题前缀 */\n#nice h3 .prefix {\n}\n\n/* 三级标题后缀 */\n#nice h3 .suffix {\n}\n\n/* 无序列表整体样式\n * list-style-type: square|circle|disc;\n */\n#nice ul {\n}\n\n/* 有序列表整体样式\n * list-style-type: upper-roman|lower-greek|lower-alpha;\n */\n#nice ol {\n}\n\n/* 列表内容，不要设置li\n */\n#nice li section {\n}\n\n/* 一级引用\n * 左边缘颜色 border-left-color: black;\n * 背景色 background: gray;\n */\n#nice .multiquote-1 {\n}\n\n/* 一级引用文字 */\n#nice .multiquote-1 p {\n}\n\n/* 二级引用\n */\n#nice .multiquote-2 {\n}\n\n/* 二级引用文字 */\n#nice .multiquote-2 p {\n}\n\n/* 三级引用\n */\n#nice .multiquote-3 {\n}\n\n/* 三级引用文字 */\n#nice .multiquote-3 p {\n}\n\n/* 链接 \n * border-bottom: 1px solid #009688;\n */\n#nice a {\n}\n\n/* 加粗 */\n#nice strong {\n}\n\n/* 斜体 */\n#nice em {\n}\n\n/* 加粗斜体 */\n#nice em strong {\n}\n\n/* 删除线 */\n#nice del {\n}\n\n/* 分隔线\n * 粗细、样式和颜色\n * border-top: 1px solid #3e3e3e;\n */\n#nice hr {\n}\n\n/* 图片\n * 宽度 width: 80%;\n * 居中 margin: 0 auto;\n * 居左 margin: 0 0;\n */\n#nice img {\n}\n\n/* 行内代码 */\n#nice p code, #nice li code {\n}\n\n/* \n * 代码块不换行 display: -webkit-box !important;\n * 代码块换行 display: block;\n */\n#nice pre code {\n}\n\n/*\n * 表格内的单元格\n * 字体大小 font-size: 16px;\n * 边框 border: 1px solid #ccc;\n * 内边距 padding: 5px 10px;\n */\n#nice table tr th,\n#nice table tr td {\n}\n\n/* \n * 某一列表格列宽控制\n * n 可以修改为具体数字，不修改时表示所有列\n * 最小列宽 min-width: 85px;\n */\n#nice table tr th:nth-of-type(n),\n#nice table tr td:nth-of-type(n){\n}\n\n/* 脚注文字 */\n#nice .footnote-word {\n}\n\n/* 脚注上标 */\n#nice .footnote-ref {\n}\n\n/* \"参考资料\"四个字 \n * 内容 content: \"参考资料\";\n */\n#nice .footnotes-sep:before {\n}\n\n/* 参考资料编号 */\n#nice .footnote-num {\n}\n\n/* 参考资料文字 */\n#nice .footnote-item p { \n}\n\n/* 参考资料解释 */\n#nice .footnote-item p em {\n}\n\n/* 行间公式\n * 最大宽度 max-width: 300% !important;\n */\n#nice .block-equation svg {\n}\n\n/* 行内公式\n */\n#nice .inline-equation svg {  \n}`;\n"
  },
  {
    "path": "src/template/markdown/normal.js",
    "content": "export default `/* 全局属性\n * 页边距 padding: 30px;\n * 全文字体 font-family: ptima-Regular;\n * 英文换行 word-break: break-all;\n */\n#nice {\n}\n\n/* 段落，下方未标注标签参数均同此处\n * 上边距 margin-top: 5px;\n * 下边距 margin-bottom: 5px;\n * 行高 line-height: 26px;\n * 词间距 word-spacing: 3px;\n * 字间距 letter-spacing: 3px;\n * 对齐 text-align: left;\n * 颜色 color: #3e3e3e;\n * 字体大小 font-size: 16px;\n * 首行缩进 text-indent: 2em;\n */\n#nice p {\n}\n\n/* 一级标题 */\n#nice h1 {\n}\n\n/* 一级标题内容 */\n#nice h1 .content {\n}\n\n/* 一级标题前缀 */\n#nice h1 .prefix {\n}\n\n/* 一级标题后缀 */\n#nice h1 .suffix {\n}\n\n/* 二级标题 */\n#nice h2 {\n}\n\n/* 二级标题内容 */\n#nice h2 .content {\n}\n\n/* 二级标题前缀 */\n#nice h2 .prefix {\n}\n\n/* 二级标题后缀 */\n#nice h2 .suffix {\n}\n\n/* 三级标题 */\n#nice h3 {\n}\n\n/* 三级标题内容 */\n#nice h3 .content {\n}\n\n/* 三级标题前缀 */\n#nice h3 .prefix {\n}\n\n/* 三级标题后缀 */\n#nice h3 .suffix {\n}\n\n/* 无序列表整体样式\n * list-style-type: square|circle|disc;\n */\n#nice ul {\n}\n\n/* 有序列表整体样式\n * list-style-type: upper-roman|lower-greek|lower-alpha;\n */\n#nice ol {\n}\n\n/* 列表内容，不要设置li\n */\n#nice li section {\n}\n\n/* 一级引用\n * 左边缘颜色 border-left-color: black;\n * 背景色 background: gray;\n */\n#nice .multiquote-1 {\n}\n\n/* 一级引用文字 */\n#nice .multiquote-1 p {\n}\n\n/* 二级引用\n */\n#nice .multiquote-2 {\n}\n\n/* 二级引用文字 */\n#nice .multiquote-2 p {\n}\n\n/* 三级引用\n */\n#nice .multiquote-3 {\n}\n\n/* 三级引用文字 */\n#nice .multiquote-3 p {\n}\n\n/* 链接 \n * border-bottom: 1px solid #009688;\n */\n#nice a {\n}\n\n/* 加粗 */\n#nice strong {\n}\n\n/* 斜体 */\n#nice em {\n}\n\n/* 加粗斜体 */\n#nice em strong {\n}\n\n/* 删除线 */\n#nice del {\n}\n\n/* 分隔线\n* 粗细、样式和颜色\n* border-top: 1px solid #3e3e3e;\n*/\n#nice hr {\n}\n\n/* 图片\n* 宽度 width: 80%;\n* 居中 margin: 0 auto;\n* 居左 margin: 0 0;\n*/\n#nice img {\n}\n\n/* 图片描述文字 */\n#nice figcaption {\n}\n\n/* 行内代码 */\n#nice p code, #nice li code {\n}\n\n/* \n * 代码块不换行 display: -webkit-box !important;\n * 代码块换行 display: block;\n */\n#nice pre code {\n}\n\n/*\n * 表格内的单元格\n * 字体大小 font-size: 16px;\n * 边框 border: 1px solid #ccc;\n * 内边距 padding: 5px 10px;\n */\n#nice table tr th,\n#nice table tr td {\n}\n\n/* \n * 某一列表格列宽控制\n * n 可以修改为具体数字，不修改时表示所有列\n * 最小列宽 min-width: 85px;\n */\n#nice table tr th:nth-of-type(n),\n#nice table tr td:nth-of-type(n){\n}\n\n/* 脚注文字 */\n#nice .footnote-word {\n}\n\n/* 脚注上标 */\n#nice .footnote-ref {\n}\n\n/* \"参考资料\"四个字 \n * 内容 content: \"参考资料\";\n */\n#nice .footnotes-sep:before {\n}\n\n/* 参考资料编号 */\n#nice .footnote-num {\n}\n\n/* 参考资料文字 */\n#nice .footnote-item p { \n}\n\n/* 参考资料解释 */\n#nice .footnote-item p em {\n}\n\n/* 行间公式\n * 最大宽度 max-width: 300% !important;\n */\n#nice .block-equation svg {\n}\n\n/* 行内公式\n */\n#nice .inline-equation svg { \n}`;\n"
  },
  {
    "path": "src/utils/appContext.js",
    "content": "import React from \"react\";\n\nconst appContext = React.createContext(null);\n\nexport default appContext;\n"
  },
  {
    "path": "src/utils/constant.js",
    "content": "export const CLIENT_ID = process.env.NODE_ENV === \"development\" ? \"e791aa2a7a64b3f766a2\" : \"b3a3c46bd66318367efa\";\nexport const CLIENT_SECRET =\n  process.env.NODE_ENV === \"development\"\n    ? \"e80cde65c7071286086077892f3336bc2a3f4576\"\n    : \"dfd9fdc1da6a6b10e473280bf0a379513f1d154d\";\n\nexport const PROXY = \"https://cors-anywhere.herokuapp.com/https://github.com/login/oauth/access_token\";\nexport const SM_MS_PROXY = \"https://cors-anywhere.herokuapp.com/https://sm.ms/api/upload\";\nexport const ACCESS_TOKEN = \"ACCESS_TOKEN\";\n\nexport const USERNAME = \"username\";\nexport const AVATAR = \"avatar\";\nexport const USERID = \"userId\";\nexport const EMAIL = \"email\";\nexport const TOKEN = \"token\";\n\nexport const MJX_DATA_FORMULA = \"data-formula\";\nexport const MJX_DATA_FORMULA_TYPE = \"data-formula-type\";\n\nexport const CONTENT = \"content\";\nexport const STYLE = \"style\";\nexport const TEMPLATE_NUM = \"template_num\";\nexport const CODE_NUM = \"code_num\";\nexport const THEME_LIST = \"theme_list\";\nexport const PREVIEW_TYPE = \"preview_type\";\nexport const IS_SYNC_SCROLL = \"is_sync_scroll\";\nexport const IS_CONTAIN_IMG_NAME = \"is_contain_img_name\";\nexport const IS_MAC_CODE = \"is_mac_code\";\nexport const NEWEST_VERSION = \"newest_version\";\nexport const ALIOSS_IMAGE_HOSTING = \"alioss_image_hosting\";\nexport const GITEE_IMAGE_HOSTING = \"gitee_image_hosting\";\nexport const GITHUB_IMAGE_HOSTING = \"github_image_hosting\";\nexport const QINIUOSS_IMAGE_HOSTING = \"qiniuoss_image_hosting\";\nexport const IMAGE_HOSTING_TYPE = \"image_hosting_type\";\nexport const BASIC_THEME_ID = \"basic-theme\";\nexport const CODE_THEME_ID = \"code-theme\";\nexport const MARKDOWN_THEME_ID = \"markdown-theme\";\nexport const FONT_THEME_ID = \"font-theme\";\nexport const LAYOUT_ID = \"nice\";\nexport const BOX_ID = \"nice-rich-text-box\";\nexport const IMAGE_HOSTING_NAMES = {\n  smms: \"SM.MS\",\n  aliyun: \"阿里云\",\n  qiniuyun: \"七牛云\",\n  gitee: \"Gitee\",\n  github: \"GitHub\",\n};\n\nexport const RIGHT_SYMBOL = \"✔️\";\nexport const EXPORT_FILENAME_SUFFIX = \".md\";\n\nexport const STYLE_LABELS = [\"basic-theme\", \"markdown-theme\", \"code-theme\", \"font-theme\"];\n\nexport const ENTER_DELAY = 0.5;\nexport const LEAVE_DELAY = 0.0;\n\nexport const MAX_MD_NUMBER = 100000;\nexport const THROTTLE_MATHJAX_TIME = 1500;\nexport const THROTTLE_MD_RENDER_TIME = 100;\n\nexport const CODE_OPTIONS = [\n  {\n    id: \"atomOneDark\",\n    macId: \"macAtomOneDark\",\n    name: \"atom-one-dark\",\n  },\n  {\n    id: \"atomOneLight\",\n    macId: \"macAtomOneLight\",\n    name: \"atom-one-light\",\n  },\n  {\n    id: \"monokai\",\n    macId: \"macMonokai\",\n    name: \"monokai\",\n  },\n  {\n    id: \"github\",\n    macId: \"macGithub\",\n    name: \"github\",\n  },\n  {\n    id: \"vs2015\",\n    macId: \"macVs2015\",\n    name: \"vs2015\",\n  },\n  {\n    id: \"xcode\",\n    macId: \"macXcode\",\n    name: \"xcode\",\n  },\n];\n\nexport const SITDOWN_OPTIONS = [\n  {\n    key: \"default\",\n    value: \"默认引擎\",\n    desc: \"默认引擎\",\n  },\n  {\n    key: \"wechat\",\n    value: \"微信公众号 - https://mp.weixin.qq.com/\",\n    desc: \"微信引擎\",\n  },\n  {\n    key: \"zhihu\",\n    value: \"知乎专栏 - https://zhuanlan.zhihu.com/\",\n    desc: \"知乎引擎\",\n  },\n  {\n    key: \"juejin\",\n    value: \"掘金 - https://juejin.im/post/\",\n    desc: \"掘金引擎\",\n  },\n  {\n    key: \"csdn\",\n    value: \"CSDN - https://blog.csdn.net/\",\n    desc: \"CSDN引擎\",\n  },\n];\n\nexport const TUTORIALS = [\n  {\n    title: \"第1关：标题\",\n    content: `\n# 一级标题\n\n## 二级标题\n    \n### 三级标题`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309621-1.1标题.png\",\n  },\n  {\n    title: \"第2关：无序列表\",\n    content: `\n- 无序列表 1\n- 无序列表 2\n  - 无序列表 2.1\n  - 无序列表 2.2`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309622-1.2无序列表.png\",\n  },\n  {\n    title: \"第3关：有序列表\",\n    content: `\n1. 有序列表 1\n2. 有序列表 2\n3. 有序列表 3`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309623-1.3有序列表.png\",\n  },\n  {\n    title: \"第4关：引用\",\n    content: `\n一级引用如下：\n\n> ### 一级引用示例\n> \n> 读一本好书。 **——歌德**\n    \n二级引用如下：\n\n>> ### 二级引用示例\n>>\n>> 读一本好书。 **——歌德**\n\n三级引用如下：\n\n>>> ### 三级引用示例\n>>>\n>>> 读一本好书。**——歌德**`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-25/1601015511898-image.png\",\n  },\n  {\n    title: \"第5关：粗体和斜体\",\n    content: `\n**这个是粗体**\n\n*这个是斜体*\n    \n***这个是粗体加斜体***`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309625-1.5粗体和斜体.png\",\n  },\n  {\n    title: \"第6关：链接\",\n    content: `\n[Markdown Nice最全功能介绍](https://mp.weixin.qq.com/s/lM808MxUu6tp8zU8SBu3sg)\n\n图片还可以和链接嵌套使用，能够实现推荐卡片的效果，用法如下：\n\n[![Markdown Nice 最全功能介绍](https://my-wechat.mdnice.com/dance.gif)](https://mp.weixin.qq.com/s/lM808MxUu6tp8zU8SBu3sg)`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-25/1601015877358-image.png\",\n  },\n  {\n    title: \"第7关：分割线\",\n    content: `\n---`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309626-1.7分割线.png\",\n  },\n  {\n    title: \"第8关：删除线\",\n    content: `\n~~这是要被删除的内容。~~`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309627-1.8删除线.png\",\n  },\n  {\n    title: \"第9关：表格\",\n    content: `\n| 姓名       | 年龄 |         工作 |\n| :--------- | :--: | -----------: |\n| 小可爱     |  18  |     吃可爱多 |\n| 小小勇敢   |  20  |   爬棵勇敢树 |\n| 小小小机智 |  22  | 看一本机智书 |`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309628-1.9表格.png\",\n  },\n  {\n    title: \"第10关：图片\",\n    content: `\n![这里写图片描述](https://my-wechat.mdnice.com/wechat.jpg)\n\n![同时设置宽度和高度](https://my-wechat.mdnice.com/logo.png =150x150)\n    \n![只设置宽度，推荐使用百分比](https://my-wechat.mdnice.com/logo.png =40%x)`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309629-1.10图片.png\",\n  },\n  {\n    title: \"第11关：脚注\",\n    content: `\n[全栈工程师](是指掌握多种技能，并能利用多种技能独立完成产品的人。 \"什么是全栈工程师\")`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309632-2.1脚注.png\",\n  },\n  {\n    title: \"第12关：代码块\",\n    content: `\n\\`\\`\\`java\n// FileName: HelloWorld.java\npublic class HelloWorld {\n  // Java 入口程序，程序从此入口\n  public static void main(String[] args) {\n    System.out.println(\"Hello,World!\"); // 向控制台打印一条语句\n  }\n}\n\\`\\`\\`\n\n支持以下语言种类：\n\n\\`\\`\\`\nbash\nclojure，cpp，cs，css\ndart，dockerfile, diff\nerlang\ngo，gradle，groovy\nhaskell\njava，javascript，json，julia\nkotlin\nlisp，lua\nmakefile，markdown，matlab\nobjectivec\nperl，php，python\nr，ruby，rust\nscala，shell，sql，swift\ntex，typescript\nverilog，vhdl\nxml\nyaml\n\\`\\`\\`\n\ndiff 效果：\n\n\\`\\`\\`diff\n+ 新增项\n- 删除项\n\\`\\`\\``,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-25/1601015700784-image.png\",\n  },\n  {\n    title: \"第13关：数学公式\",\n    content: `\n行内公式：$\\\\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$\n\n块公式：$$H(D_2) = -\\\\left(\\\\frac{2}{4}\\\\log_2 \\\\frac{2}{4} + \\\\frac{2}{4}\\\\log_2 \\\\frac{2}{4}\\\\right) = 1$$`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309648-2.3数学公式.png\",\n  },\n  {\n    title: \"第14关：TOC\",\n    content: `\n[TOC]\n\n## 二级标题\n    \n### 三级标题`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309650-2.4TOC.png\",\n  },\n  {\n    title: \"第15关：注音符号\",\n    content: `\nMarkdown Nice 这么好用，简直是{喜大普奔|hē hē hē hē}呀！`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309651-2.5注音符号.png\",\n  },\n  {\n    title: \"第16关：横屏滑动幻灯片\",\n    content: `\n<![蓝1](https://my-wechat.mdnice.com/blue.jpg),![绿2](https://my-wechat.mdnice.com/green.jpg),![红3](https://my-wechat.mdnice.com/red.jpg)>`,\n    picture: \"https://gitee.com/guanpengchn/picture/raw/master/2020-9-9/1599653309652-2.6横屏滑动幻灯片.png\",\n  },\n];\n\nexport const THEME_API = () => {\n  const currentPage = 0;\n  const pageSize = 15;\n  const checked = true;\n  const order = \"ASC\";\n  return `https://api.mdnice.com/themes?currentPage=${currentPage}&pageSize=${pageSize}&checked=${checked}&order=${order}`;\n};\n"
  },
  {
    "path": "src/utils/converter.js",
    "content": "import juice from \"juice\";\nimport {message} from \"antd\";\nimport {\n  BASIC_THEME_ID,\n  CODE_THEME_ID,\n  MARKDOWN_THEME_ID,\n  LAYOUT_ID,\n  BOX_ID,\n  FONT_THEME_ID,\n  MJX_DATA_FORMULA,\n} from \"./constant\";\n\nexport const solveWeChatMath = () => {\n  const layout = document.getElementById(LAYOUT_ID);\n  const mjxs = layout.getElementsByTagName(\"mjx-container\");\n  for (let i = 0; i < mjxs.length; i++) {\n    const mjx = mjxs[i];\n    if (!mjx.hasAttribute(\"jax\")) {\n      break;\n    }\n\n    // mjx.removeAttribute(\"data\");\n    mjx.removeAttribute(\"jax\");\n    mjx.removeAttribute(\"display\");\n    mjx.removeAttribute(\"tabindex\");\n    mjx.removeAttribute(\"ctxtmenu_counter\");\n    const svg = mjx.firstChild;\n    const width = svg.getAttribute(\"width\");\n    const height = svg.getAttribute(\"height\");\n    svg.removeAttribute(\"width\");\n    svg.removeAttribute(\"height\");\n    svg.style.width = width;\n    svg.style.height = height;\n  }\n};\n\nexport const solveZhihuMath = () => {\n  const layout = document.getElementById(LAYOUT_ID);\n  const mjxs = layout.getElementsByTagName(\"mjx-container\");\n  while (mjxs.length > 0) {\n    const mjx = mjxs[0];\n    let data = mjx.getAttribute(MJX_DATA_FORMULA);\n    if (!data) {\n      continue;\n    }\n\n    if (mjx.hasAttribute(\"display\") && data.indexOf(\"\\\\tag\") === -1) {\n      data += \"\\\\\\\\\";\n    }\n\n    mjx.outerHTML = '<img class=\"Formula-image\" data-eeimg=\"true\" src=\"\" alt=\"' + data + '\">';\n  }\n};\n\nexport const solveJuejinMath = () => {\n  const layout = document.getElementById(LAYOUT_ID);\n  const mjxs = layout.getElementsByTagName(\"mjx-container\");\n  while (mjxs.length > 0) {\n    const mjx = mjxs[0];\n    const data = mjx.getAttribute(MJX_DATA_FORMULA);\n    if (!data) {\n      continue;\n    }\n\n    // 行间公式\n    if (mjx.hasAttribute(\"display\")) {\n      mjx.outerHTML = `<figure><img class=\"equation\" src=\"https://juejin.im/equation?tex=${data}\" alt=\"\"/></figure>`;\n    }\n    // 行内公式\n    else {\n      mjx.outerHTML = `<span><img style=\"display:inline;\" class=\"equation\" src=\"https://juejin.im/equation?tex=${data}\" alt=\"\"/></span>`;\n    }\n  }\n};\n\n// 掘金单独处理代码块\nexport const solveJuejinCode = (html) => {\n  // 掘金代码不换行问题\n  const brReg = /<pre([^>])*class=\"custom\"([^>])*>(.*?)<\\/pre>/g;\n  const brMatchList = html.match(brReg);\n  if (brMatchList) {\n    for (const item of brMatchList) {\n      const content = item\n        .replace(/display: -webkit-box;/g, \"display: block;\") // -webkit-box替换为block\n        .replace(/<br>/g, \"\\n<span/>\") // <br>替换为\\n<span/>\n        .replace(/&nbsp;/g, \" \"); // 空格转回，不转回遇到 \"$ \" 情况会出现问题\n\n      html = html.replace(item, content);\n    }\n  }\n  return html;\n};\n\nexport const addJuejinSuffix = () => {\n  const suffix = document.createElement(\"p\");\n  suffix.id = \"nice-suffix-juejin-container\";\n  suffix.className = \"nice-suffix-juejin-container\";\n  suffix.innerHTML = `本文使用 <a href=\"https://mdnice.com/?from=juejin\">mdnice</a> 排版`;\n\n  const element = document.getElementById(LAYOUT_ID);\n  element.appendChild(suffix);\n};\n\nexport const solveHtml = () => {\n  const element = document.getElementById(BOX_ID);\n\n  const inner = element.children[0].children;\n  for (const item of inner) {\n    item.setAttribute(\"data-tool\", \"mdnice编辑器\");\n  }\n  let html = element.innerHTML;\n  html = html.replace(/<mjx-container (class=\"inline.+?)<\\/mjx-container>/g, \"<span $1</span>\");\n  html = html.replace(/\\s<span class=\"inline/g, '&nbsp;<span class=\"inline');\n  html = html.replace(/svg><\\/span>\\s/g, \"svg></span>&nbsp;\");\n  html = html.replace(/mjx-container/g, \"section\");\n  html = html.replace(/class=\"mjx-solid\"/g, 'fill=\"none\" stroke-width=\"70\"');\n  html = html.replace(/<mjx-assistive-mml.+?<\\/mjx-assistive-mml>/g, \"\");\n  const basicStyle = document.getElementById(BASIC_THEME_ID).innerText;\n  const markdownStyle = document.getElementById(MARKDOWN_THEME_ID).innerText;\n  const codeStyle = document.getElementById(CODE_THEME_ID).innerText;\n  const fontStyle = document.getElementById(FONT_THEME_ID).innerText;\n  let res = \"\";\n  try {\n    res = juice.inlineContent(html, basicStyle + markdownStyle + codeStyle + fontStyle, {\n      inlinePseudoElements: true,\n      preserveImportant: true,\n    });\n  } catch (e) {\n    message.error(\"请检查 CSS 文件是否编写正确！\");\n  }\n\n  return res;\n};\n\nexport const copySafari = (text) => {\n  // 获取 input\n  let input = document.getElementById(\"copy-input\");\n  if (!input) {\n    // input 不能用 CSS 隐藏，必须在页面内存在。\n    input = document.createElement(\"input\");\n    input.id = \"copy-input\";\n    input.style.position = \"absolute\";\n    input.style.left = \"-1000px\";\n    input.style.zIndex = \"-1000\";\n    document.body.appendChild(input);\n  }\n  // 让 input 选中一个字符，无所谓那个字符\n  input.value = \"NOTHING\";\n  input.setSelectionRange(0, 1);\n  input.focus();\n\n  // 复制触发\n  document.addEventListener(\"copy\", function copyCall(e) {\n    e.preventDefault();\n    e.clipboardData.setData(\"text/html\", text);\n    e.clipboardData.setData(\"text/plain\", text);\n    document.removeEventListener(\"copy\", copyCall);\n  });\n  document.execCommand(\"copy\");\n};\n"
  },
  {
    "path": "src/utils/editorKeyEvents.js",
    "content": "import {message} from \"antd\";\nimport prettier from \"prettier/standalone\";\nimport prettierMarkdown from \"prettier/parser-markdown\";\n\nconst wrapChar = /windows|win32/i.test(navigator.userAgent) ? \"\\r\\n\" : \"\\n\";\n\nconst handleWechatOuterLink = (content) => {\n  const linkImgReg = /(!)*\\[.*?\\]\\(((?!mp.weixin.qq.com).)*?\\)/g;\n  const res = content.match(linkImgReg); // 匹配到图片、链接和脚注\n\n  if (res === null) {\n    return content;\n  }\n\n  const footReg = /.*?\\(.*?\"(.*?)\".*?\\)/;\n  const filterRes = res.filter((val) => {\n    const comment = val.match(footReg);\n    if (val[0] === \"!\") {\n      return false;\n    }\n    if (comment && comment[1] !== \"\") {\n      return false;\n    }\n    return true;\n  }); // 过滤掉图片和脚注\n\n  if (filterRes.length > 0) {\n    filterRes.forEach((val) => {\n      const linkReg = /\\[(.*?)\\]\\((.*?)\\)/; // 匹配链接中具体的值\n      const matchValue = val.match(linkReg);\n      const name = matchValue[1];\n      const url = matchValue[2].trim();\n\n      const newVal = `[${name}](${url} \"${name}\")`;\n      content = content.replace(val, newVal);\n    });\n    return content;\n  } else {\n    return content;\n  }\n};\n\nconst handleReferenceLink = (content) => {\n  const refLinkReg = /[\\r\\n]+(\\s{0,3}?(?:(?:\\d+\\.|-)\\s{0,3}?)?\\[(\\w+)\\]:\\s*([^\"]+)(?:\\s+\"(\\w+)\")?\\s*[\\r\\n]+)+/gi;\n  let res;\n  let newContent = content;\n\n  const lineHandler = (refLinkText) => {\n    const lineMatch = refLinkText.match(/\\s{0,3}?(?:(?:\\d+\\.|-)\\s{0,3}?)?\\[(\\w+)\\]:\\s*([^\\s]+)(?:\\s+\"(\\w+)\")?/i);\n    if (!lineMatch) {\n      return;\n    }\n    const [rawLine, ref, link, title] = lineMatch;\n    if (/^https?:\\/\\/mp\\.weixin\\.qq\\.com/i.test(link)) {\n      return;\n    }\n\n    const rawReg = new RegExp(\"\\\\[([^\\\\[\\\\]\\\\(\\\\)]+)\\\\]\\\\[\" + ref + \"\\\\]\", \"ig\");\n    newContent = newContent.replace(rawReg, (_, name) => `[${name}](${link} \"${title || name}\")`).replace(rawLine, \"\");\n  };\n\n  // eslint-disable-next-line no-cond-assign\n  while ((res = refLinkReg.exec(content)) !== null) {\n    const lines = res[0].split(/[\\r\\n]+/).filter((v) => v.trim());\n    lines.forEach(lineHandler);\n  }\n  return newContent;\n};\n\nexport const parseLinkToFoot = (content, store) => {\n  content = handleWechatOuterLink(content);\n  content = handleReferenceLink(content);\n  content = content.replace(/([\\u4e00-\\u9fa5])\\$/g, \"$1 $\");\n  content = content.replace(/\\$([\\u4e00-\\u9fa5])/g, \"$ $1\");\n  store.setContent(content);\n  message.success(\"微信外链转脚注完成！\");\n};\n\nconst handlePrettierDoc = (content) => {\n  const prettierRes = prettier.format(content, {\n    parser: \"markdown\",\n    plugins: [prettierMarkdown],\n  });\n  return prettierRes;\n};\n\nexport const formatDoc = (content, store) => {\n  content = handlePrettierDoc(content);\n  content = content.replace(/([\\u4e00-\\u9fa5])\\$/g, \"$1 $\");\n  content = content.replace(/\\$([\\u4e00-\\u9fa5])/g, \"$ $1\");\n  store.setContent(content);\n  message.success(\"格式化文档完成！\");\n};\n\nexport const bold = (editor, selection) => {\n  editor.replaceSelection(`**${selection}**`);\n  const cursor = editor.getCursor();\n  cursor.ch -= 2;\n  editor.setCursor(cursor);\n};\n\nexport const del = (editor, selection) => {\n  editor.replaceSelection(`~~${selection}~~`);\n  const cursor = editor.getCursor();\n  cursor.ch -= 2;\n  editor.setCursor(cursor);\n};\n\nexport const italic = (editor, selection) => {\n  editor.replaceSelection(`*${selection}*`);\n  const cursor = editor.getCursor();\n  cursor.ch -= 1;\n  editor.setCursor(cursor);\n};\n\nexport const code = (editor, selection) => {\n  editor.replaceSelection(`${wrapChar}\\`\\`\\`${wrapChar}${selection}${wrapChar}\\`\\`\\`${wrapChar}`);\n  const cursor = editor.getCursor();\n  cursor.line -= 2;\n  editor.setCursor(cursor);\n};\n\nexport const inlineCode = (editor, selection) => {\n  editor.replaceSelection(`\\`${selection}\\``);\n  const cursor = editor.getCursor();\n  cursor.ch -= 1;\n  editor.setCursor(cursor);\n};\n\nexport const h1 = (editor, selection) => {\n  editor.replaceSelection(`# ${selection}`);\n};\n\nexport const h2 = (editor, selection) => {\n  editor.replaceSelection(`## ${selection}`);\n};\n\nexport const h3 = (editor, selection) => {\n  editor.replaceSelection(`### ${selection}`);\n};\n"
  },
  {
    "path": "src/utils/helper.js",
    "content": "import axios from \"axios\";\nimport MarkdownIt from \"markdown-it\";\nimport markdownItMath from \"./markdown-it-math\";\nimport markdownItDeflist from \"markdown-it-deflist\";\nimport markdownItImplicitFigures from \"markdown-it-implicit-figures\";\nimport markdownItTableOfContents from \"markdown-it-table-of-contents\";\nimport markdownItRuby from \"markdown-it-ruby\";\nimport markdownItImsize from \"markdown-it-imsize\";\n\nimport markdownItSpan from \"./markdown-it-span\";\nimport markdownItTableContainer from \"./markdown-it-table-container\";\nimport markdownItLinkfoot from \"./markdown-it-linkfoot\";\nimport markdownItImageFlow from \"./markdown-it-imageflow\";\nimport markdownItMultiquote from \"./markdown-it-multiquote\";\nimport highlightjs from \"./langHighlight\";\nimport markdownItLiReplacer from \"./markdown-it-li\";\n\nexport const axiosGithub = axios.create({\n  baseURL: \"https://api.github.com\",\n  headers: {\n    Accept: \"application/json\",\n  },\n});\n\nexport const axiosJSON = axios.create({\n  headers: {\n    Accept: \"application/json\",\n    \"Content-Type\": \"application/json\",\n  },\n});\n\nexport const axiosMdnice = axios.create({\n  // baseURL: process.env.NODE_ENV === \"development\" ? \"http://localhost:8081\" : \"https://math.mdnice.com\",\n  baseURL: process.env.NODE_ENV === \"development\" ? \"https://math.mdnice.com\" : \"https://math.mdnice.com\",\n});\n\nexport const queryParse = (search = window.location.search) => {\n  if (!search) return {};\n  const queryString = search[0] === \"?\" ? search.substring(1) : search;\n  const query = {};\n  queryString.split(\"&\").forEach((queryStr) => {\n    const [key, value] = queryStr.split(\"=\");\n    /* istanbul ignore else */\n    if (key) query[decodeURIComponent(key)] = decodeURIComponent(value);\n  });\n  return query;\n};\n\nexport const transCode = (str) => {\n  return window.btoa(unescape(encodeURIComponent(str)));\n};\n\nexport const deCode = (str) => {\n  return decodeURIComponent(escape(window.atob(str)));\n};\n\n// 普通解析器，代码高亮用highlight\nexport const markdownParser = new MarkdownIt({\n  html: true,\n  highlight: (str, lang) => {\n    if (lang === undefined || lang === \"\") {\n      lang = \"bash\";\n    }\n    // 加上custom则表示自定义样式，而非微信专属，避免被remove pre\n    if (lang && highlightjs.getLanguage(lang)) {\n      try {\n        const formatted = highlightjs\n          .highlight(lang, str, true)\n          .value.replace(/\\n/g, \"<br/>\") // 换行用br表示\n          .replace(/\\s/g, \"&nbsp;\") // 用nbsp替换空格\n          .replace(/span&nbsp;/g, \"span \"); // span标签修复\n        return '<pre class=\"custom\"><code class=\"hljs\">' + formatted + \"</code></pre>\";\n      } catch (e) {\n        console.log(e);\n      }\n    }\n    return '<pre class=\"custom\"><code class=\"hljs\">' + markdownParser.utils.escapeHtml(str) + \"</code></pre>\";\n  },\n});\n\nmarkdownParser\n  .use(markdownItSpan) // 在标题标签中添加span\n  .use(markdownItTableContainer) // 在表格外部添加容器\n  .use(markdownItMath) // 数学公式\n  .use(markdownItLinkfoot) // 修改脚注\n  .use(markdownItTableOfContents, {\n    transformLink: () => \"\",\n    includeLevel: [2, 3],\n    markerPattern: /^\\[toc\\]/im,\n  }) // TOC仅支持二级和三级标题\n  .use(markdownItRuby) // 注音符号\n  .use(markdownItImplicitFigures, {figcaption: true}) // 图示\n  .use(markdownItDeflist) // 定义列表\n  .use(markdownItLiReplacer) // li 标签中加入 p 标签\n  .use(markdownItImageFlow) // 横屏移动插件\n  .use(markdownItMultiquote) // 给多级引用加 class\n  .use(markdownItImsize);\n\nexport const replaceStyle = (id, css) => {\n  const style = document.getElementById(id);\n  try {\n    style.innerHTML = css;\n  } catch (e) {\n    console.log(e);\n    style.styleSheet.cssText = css;\n  }\n  const head = document.getElementsByTagName(\"head\")[0];\n  head.appendChild(style);\n};\n\nexport const b64toBlob = (b64Data, contentType = \"\", sliceSize = 512) => {\n  const byteCharacters = atob(b64Data);\n  const byteArrays = [];\n\n  for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {\n    const slice = byteCharacters.slice(offset, offset + sliceSize);\n\n    const byteNumbers = new Array(slice.length);\n    for (let i = 0; i < slice.length; i++) {\n      byteNumbers[i] = slice.charCodeAt(i);\n    }\n\n    const byteArray = new Uint8Array(byteNumbers);\n\n    byteArrays.push(byteArray);\n  }\n\n  const blob = new Blob(byteArrays, {type: contentType});\n  return blob;\n};\n\n// base64转blob\nexport const toBlob = (base64, fileType) => {\n  const bytes = window.atob(base64);\n  let n = bytes.length;\n  const u8arr = new Uint8Array(n);\n  while (n--) {\n    u8arr[n] = bytes.charCodeAt(n);\n  }\n  return new Blob([u8arr], {type: fileType});\n};\n\nexport const dateFormat = (date, fmt) => {\n  var o = {\n    \"M+\": date.getMonth() + 1, // 月份\n    \"d+\": date.getDate(), // 日\n    \"h+\": date.getHours(), // 小时\n    \"m+\": date.getMinutes(), // 分\n    \"s+\": date.getSeconds(), // 秒\n    \"q+\": Math.floor((date.getMonth() + 3) / 3), // 季度\n    S: date.getMilliseconds(), // 毫秒\n  };\n  if (/(y+)/.test(fmt)) {\n    fmt = fmt.replace(RegExp.$1, (date.getFullYear() + \"\").substr(4 - RegExp.$1.length));\n  }\n  for (var k in o) {\n    if (new RegExp(\"(\" + k + \")\").test(fmt)) {\n      fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : (\"00\" + o[k]).substr((\"\" + o[k]).length));\n    }\n  }\n  return fmt;\n};\n\n// export const url2Blob = (imgUrl) => {\n//   window.URL = window.URL || window.webkitURL;\n//   var xhr = new XMLHttpRequest();\n//   xhr.open(\"get\", imgUrl, true);\n//   xhr.responseType = \"blob\";\n//   xhr.onload = function () {\n//     if (this.status == 200) {\n//       //得到一个blob对象\n//       var blob = this.response;\n//       console.log(\"blob\", blob)\n//     }\n//   }\n//   xhr.send();\n// }\n\nfunction getBase64Image(img) {\n  var canvas = document.createElement(\"canvas\");\n  canvas.width = img.width;\n  canvas.height = img.height;\n  var ctx = canvas.getContext(\"2d\");\n  ctx.drawImage(img, 0, 0, img.width, img.height);\n  var dataURL = canvas.toDataURL(\"image/png\"); // 可选其他值 image/jpeg\n  return dataURL;\n}\n\nexport const url2Blob = (src, cb) => {\n  var image = new Image();\n  image.src = src + \"?v=\" + Math.random(); // 处理缓存\n  image.crossOrigin = \"Anonymous\"; // 支持跨域图片\n  image.onload = () => {\n    var base64 = getBase64Image(image);\n    cb && cb(base64);\n  };\n};\n\n// 是否为PC端\nexport const isPC = () => {\n  var userAgentInfo = navigator.userAgent;\n  var Agents = [\"Android\", \"iPhone\", \"SymbianOS\", \"Windows Phone\", \"iPad\", \"iPod\"];\n  var flag = true;\n  for (var v = 0; v < Agents.length; v++) {\n    if (userAgentInfo.indexOf(Agents[v]) > 0) {\n      flag = false;\n      break;\n    }\n  }\n  return flag;\n};\n\nexport const getOSSName = (originName, namespace = \"\") => {\n  const names = originName.split(\".\");\n  let key = \"\";\n  if (names.length > 1) {\n    const suffix = names.pop();\n    key = `${names.join(\".\")}_${dateFormat(new Date(), \"yyyyMMddhhmmss\")}.${suffix}`;\n  } else {\n    key = originName + \"_\" + dateFormat(new Date(), \"yyyyMMddhhmmss\");\n  }\n  return `${namespace}${key}`;\n};\n\nexport const addStyleLabel = (styleLabels) => {\n  const add = (name) => {\n    const style = document.createElement(\"style\");\n    style.id = name;\n    const head = document.getElementsByTagName(\"head\")[0];\n    head.appendChild(style);\n  };\n  styleLabels.forEach((name) => add(name));\n};\n\nexport const updateMathjax = () => {\n  window.MathJax.texReset();\n  window.MathJax.typesetClear();\n  window.MathJax.typesetPromise();\n};\n\nexport const download = (content, filename) => {\n  const eleLink = document.createElement(\"a\");\n  eleLink.download = filename;\n  eleLink.style.display = \"none\";\n  // 字符内容转变成blob地址\n  const blob = new Blob([content]);\n  eleLink.href = URL.createObjectURL(blob);\n  // 触发点击\n  document.body.appendChild(eleLink);\n  eleLink.click();\n  // 然后移除\n  document.body.removeChild(eleLink);\n};\n\nexport const isPlatformWindows = /windows|win32/i.test(navigator.userAgent);\n\nexport const wordCalc = (data) => {\n  const pattern = /[a-zA-Z0-9_\\u0392-\\u03c9\\u0410-\\u04F9]+|[\\u4E00-\\u9FFF\\u3400-\\u4dbf\\uf900-\\ufaff\\u3040-\\u309f\\uac00-\\ud7af]+/g;\n  const m = data.match(pattern);\n  let count = 0;\n  if (m === null) return count;\n  for (let i = 0; i < m.length; i++) {\n    if (m[i].charCodeAt(0) >= 0x4e00) {\n      count += m[i].length;\n    } else {\n      count += 1;\n    }\n  }\n  return count;\n};\n"
  },
  {
    "path": "src/utils/hotkey.js",
    "content": "import * as keyEvents from \"./editorKeyEvents\";\nimport {isPlatformWindows} from \"./helper\";\n\nconst handlePressHotkey = (type, content) => {\n  const {markdownEditor} = content;\n  const selection = markdownEditor.getSelection();\n  switch (type) {\n    case \"Bold\":\n      keyEvents.bold(markdownEditor, selection);\n      break;\n    case \"Del\":\n      keyEvents.del(markdownEditor, selection);\n      break;\n    case \"Italic\":\n      keyEvents.italic(markdownEditor, selection);\n      break;\n    case \"Code\":\n      keyEvents.code(markdownEditor, selection);\n      break;\n    case \"InlineCode\":\n      keyEvents.inlineCode(markdownEditor, selection);\n      break;\n    case \"H1\":\n      keyEvents.h1(markdownEditor, selection);\n      break;\n    case \"H2\":\n      keyEvents.h2(markdownEditor, selection);\n      break;\n    case \"H3\":\n      keyEvents.h3(markdownEditor, selection);\n      break;\n    default:\n      return;\n  }\n\n  const editorContent = markdownEditor.getValue();\n  content.setContent(editorContent);\n};\n\nconst bindHotkeys = (content, dialog) =>\n  isPlatformWindows\n    ? {\n        \"Ctrl-B\": () => {\n          handlePressHotkey(\"Bold\", content);\n        },\n        \"Ctrl-U\": () => {\n          handlePressHotkey(\"Del\", content);\n        },\n        \"Ctrl-I\": () => {\n          handlePressHotkey(\"Italic\", content);\n        },\n        \"Ctrl-Alt-C\": () => {\n          handlePressHotkey(\"Code\", content);\n        },\n        \"Ctrl-Alt-V\": () => {\n          handlePressHotkey(\"InlineCode\", content);\n        },\n        \"Ctrl-Alt-1\": () => {\n          handlePressHotkey(\"H1\", content);\n        },\n        \"Ctrl-Alt-2\": () => {\n          handlePressHotkey(\"H2\", content);\n        },\n        \"Ctrl-Alt-3\": () => {\n          handlePressHotkey(\"H3\", content);\n        },\n        \"Ctrl-K\": () => {\n          dialog.setLinkOpen(true);\n        },\n        \"Ctrl-Alt-I\": () => {\n          dialog.setImageOpen(true);\n        },\n        \"Ctrl-Alt-T\": () => {\n          dialog.setFormOpen(true);\n        },\n        \"Ctrl-Alt-S\": () => {\n          // Converting between sans serif and serif\n        },\n        \"Ctrl-Alt-L\": () => {\n          keyEvents.parseLinkToFoot(content.content, content);\n        },\n        \"Ctrl-Alt-F\": () => {\n          keyEvents.formatDoc(content.content, content);\n        },\n        \"Ctrl-F\": () => {\n          dialog.setSearchOpen(!dialog.isSearchOpen);\n        },\n      }\n    : {\n        \"Cmd-B\": () => {\n          handlePressHotkey(\"Bold\", content);\n        },\n        \"Cmd-U\": () => {\n          handlePressHotkey(\"Del\", content);\n        },\n        \"Cmd-I\": () => {\n          handlePressHotkey(\"Italic\", content);\n        },\n        \"Cmd-Alt-C\": () => {\n          handlePressHotkey(\"Code\", content);\n        },\n        \"Cmd-Alt-V\": () => {\n          handlePressHotkey(\"InlineCode\", content);\n        },\n        \"Cmd-Alt-1\": () => {\n          handlePressHotkey(\"H1\", content);\n        },\n        \"Cmd-Alt-2\": () => {\n          handlePressHotkey(\"H2\", content);\n        },\n        \"Cmd-Alt-3\": () => {\n          handlePressHotkey(\"H3\", content);\n        },\n        \"Cmd-K\": () => {\n          dialog.setLinkOpen(true);\n        },\n        \"Cmd-Alt-I\": () => {\n          dialog.setImageOpen(true);\n        },\n        \"Cmd-Alt-T\": () => {\n          dialog.setFormOpen(true);\n        },\n        \"Cmd-Alt-S\": () => {\n          // Converting between sans serif and serif\n        },\n        \"Cmd-Alt-L\": () => {\n          keyEvents.parseLinkToFoot(content.content, content);\n        },\n        \"Cmd-Alt-F\": () => {\n          keyEvents.formatDoc(content.content, content);\n        },\n        \"Cmd-F\": () => {\n          dialog.setSearchOpen(!dialog.isSearchOpen);\n        },\n      };\n\nexport const hotKeys = isPlatformWindows\n  ? {\n      bold: \"Ctrl+B\",\n      del: \"Ctrl+U\",\n      italic: \"Ctrl+I\",\n      code: \"Ctrl+Alt+C\",\n      inlineCode: \"Ctrl+Alt+V\",\n      link: \"Ctrl+K\",\n      image: \"Ctrl+Alt+I\",\n      form: \"Ctrl+Alt+T\",\n      format: \"Ctrl+Alt+F\",\n      linkToFoot: \"Ctrl+Alt+L\",\n      search: \"Ctrl+F\",\n    }\n  : {\n      bold: \"⌘B\",\n      del: \"⌘U\",\n      italic: \"⌘I\",\n      code: \"⌥⌘C\",\n      inlineCode: \"⌥⌘V\",\n      link: \"⌘K\",\n      image: \"⌥⌘I\",\n      form: \"⌥⌘T\",\n      format: \"⌥⌘F\",\n      linkToFoot: \"⌥⌘L\",\n      search: \"⌘F\",\n    };\n\nexport const betterTab = (cm) => {\n  if (cm.somethingSelected()) {\n    cm.indentSelection(\"add\");\n  } else {\n    cm.replaceSelection(\n      cm.getOption(\"indentWithTabs\") ? \"\\t\" : Array(cm.getOption(\"indentUnit\") + 1).join(\" \"),\n      \"end\",\n      \"+input\",\n    );\n  }\n};\n\nexport const rightClick = (cm) => {\n  const ele = document.getElementById(\"nice-md-editor\");\n  ele.oncontextmenu = (e) => {\n    const element = document.getElementById(\"nice-editor-menu\");\n    element.style.display = \"block\";\n    // event--ie  ev--其他浏览器\n    const oEvent = window.event || window.ev;\n    // documentElement--其他游览器    body--谷歌\n    const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;\n    // 菜单的style样式跟随鼠标的位置\n    element.style.top = oEvent.clientY + scrollTop + \"px\";\n    const scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;\n    element.style.left = oEvent.clientX + scrollLeft + \"px\";\n    return false;\n  };\n  window.onclick = (e) => {\n    const element = document.getElementById(\"nice-editor-menu\");\n    element.style.display = \"none\";\n  };\n};\nexport default bindHotkeys;\n"
  },
  {
    "path": "src/utils/imageHosting.js",
    "content": "/**\n * 图片上传\n */\nimport * as qiniu from \"qiniu-js\";\nimport {message} from \"antd\";\nimport axios from \"axios\";\nimport OSS from \"ali-oss\";\nimport imageHosting from \"../store/imageHosting\";\n\nimport {\n  SM_MS_PROXY,\n  ALIOSS_IMAGE_HOSTING,\n  QINIUOSS_IMAGE_HOSTING,\n  GITEE_IMAGE_HOSTING,\n  GITHUB_IMAGE_HOSTING,\n  IMAGE_HOSTING_TYPE,\n  IS_CONTAIN_IMG_NAME,\n  IMAGE_HOSTING_NAMES,\n} from \"./constant\";\nimport {toBlob, getOSSName, axiosMdnice} from \"./helper\";\n\nfunction showUploadNoti() {\n  message.loading(\"图片上传中\", 0);\n}\n\nfunction uploadError(description = \"图片上传失败\") {\n  message.error(description, 3);\n}\n\nfunction hideUploadNoti() {\n  message.destroy();\n  message.success(\"图片上传成功\");\n}\n\nfunction writeToEditor({content, image}) {\n  const isContainImgName = window.localStorage.getItem(IS_CONTAIN_IMG_NAME) === \"true\";\n  let text = \"\";\n  if (isContainImgName) {\n    text = `\\n![${image.filename}](${image.url})\\n`;\n  } else {\n    text = `\\n![](${image.url})\\n`;\n  }\n  const {markdownEditor} = content;\n  const cursor = markdownEditor.getCursor();\n  markdownEditor.replaceSelection(text, cursor);\n  content.setContent(markdownEditor.getValue());\n}\n\n// 七牛云对象存储上传\nexport const qiniuOSSUpload = async ({\n  file = {},\n  onSuccess = () => {},\n  onError = () => {},\n  onProgress = () => {},\n  images = [],\n  content = null, // store content\n}) => {\n  showUploadNoti();\n  const config = JSON.parse(window.localStorage.getItem(QINIUOSS_IMAGE_HOSTING));\n  try {\n    let {domain} = config;\n    const {namespace} = config;\n    // domain可能配置时末尾没有加‘/’\n    if (domain[domain.length - 1] !== \"/\") {\n      domain += \"/\";\n    }\n    const result = await axiosMdnice.get(`/qiniu/${config.bucket}/${config.accessKey}/${config.secretKey}`);\n    const token = result.data;\n\n    const base64Reader = new FileReader();\n\n    base64Reader.readAsDataURL(file);\n\n    base64Reader.onload = (e) => {\n      const urlData = e.target.result;\n      const base64 = urlData.split(\",\").pop();\n      const fileType = urlData\n        .split(\";\")\n        .shift()\n        .split(\":\")\n        .pop();\n\n      // base64转blob\n      const blob = toBlob(base64, fileType);\n\n      const conf = {\n        useCdnDomain: true,\n        region: qiniu.region[config.region], // 区域\n      };\n\n      const putExtra = {\n        fname: \"\",\n        params: {},\n        mimeType: [] || null,\n      };\n\n      const OSSName = getOSSName(file.name, namespace);\n\n      // 这里第一个参数的形式是blob\n      const imageObservable = qiniu.upload(blob, OSSName, token, putExtra, conf);\n\n      // 上传成功后回调\n      const complete = (response) => {\n        // console.log(response);\n        const names = file.name.split(\".\");\n        names.pop();\n        const filename = names.join(\".\");\n        const image = {\n          filename, // 名字不变并且去掉后缀\n          url: encodeURI(`${domain}${response.key}`),\n        };\n        images.push(image);\n\n        if (content) {\n          writeToEditor({content, image});\n        }\n        onSuccess(response);\n        setTimeout(() => {\n          hideUploadNoti();\n        }, 500);\n      };\n\n      // 上传过程回调\n      const next = (response) => {\n        // console.log(response);\n        const percent = parseInt(Math.round(response.total.percent.toFixed(2)), 10);\n        onProgress(\n          {\n            percent,\n          },\n          file,\n        );\n      };\n\n      // 上传错误回调\n      const error = (err) => {\n        hideUploadNoti();\n        uploadError();\n        onError(err, err.toString());\n      };\n\n      const imageObserver = {\n        next,\n        error,\n        complete,\n      };\n      // 注册 imageObserver 对象\n      imageObservable.subscribe(imageObserver);\n    };\n  } catch (err) {\n    onError(err, err.toString());\n  }\n};\n\n// 用户自定义的图床上传\nexport const customImageUpload = async ({\n  formData = new FormData(),\n  file = {},\n  onSuccess = () => {},\n  onError = () => {},\n  images = [],\n  content = null,\n}) => {\n  showUploadNoti();\n  try {\n    formData.append(\"file\", file);\n    const config = {\n      headers: {\n        \"Content-Type\": \"multipart/form-data\",\n      },\n    };\n    const postURL = imageHosting.hostingUrl;\n    const result = await axios.post(postURL, formData, config);\n    const names = file.name.split(\".\");\n    names.pop();\n    const filename = names.join(\".\");\n    const image = {\n      filename,\n      url: encodeURI(result.data.data), // 这里要和外接图床规定好数据逻辑，否则会接入失败\n    };\n\n    if (content) {\n      writeToEditor({content, image});\n    }\n    images.push(image);\n    onSuccess(result);\n    setTimeout(() => {\n      hideUploadNoti();\n    }, 500);\n  } catch (error) {\n    message.destroy();\n    uploadError(error.toString());\n    onError(error, error.toString());\n  }\n};\n\n// SM.MS存储上传\nexport const smmsUpload = ({\n  formData = new FormData(),\n  file = {},\n  action = SM_MS_PROXY,\n  onProgress = () => {},\n  onSuccess = () => {},\n  onError = () => {},\n  headers = {},\n  withCredentials = false,\n  images = [],\n  content = null, // store content\n}) => {\n  showUploadNoti();\n  // SM.MS图床必须这里命名为smfile\n  formData.append(\"smfile\", file);\n  axios\n    .post(action, formData, {\n      withCredentials,\n      headers,\n      onUploadProgress: ({total, loaded}) => {\n        onProgress(\n          {\n            percent: parseInt(Math.round((loaded / total) * 100).toFixed(2), 10),\n          },\n          file,\n        );\n      },\n    })\n    .then(({data: response}) => {\n      if (response.code === \"exception\") {\n        throw response.message;\n      }\n      const image = {\n        filename: response.data.filename,\n        url: response.data.url,\n      };\n      if (content) {\n        writeToEditor({content, image});\n      }\n      images.push(image);\n      onSuccess(response, file);\n      setTimeout(() => {\n        hideUploadNoti();\n      }, 500);\n    })\n    .catch((error) => {\n      hideUploadNoti();\n      uploadError(error.toString());\n      onError(error, error.toString());\n    });\n};\n\n// 阿里对象存储，上传部分\nconst aliOSSPutObject = ({config, file, buffer, onSuccess, onError, images, content}) => {\n  let client;\n  try {\n    client = new OSS(config);\n  } catch (error) {\n    message.error(\"OSS配置错误，请根据文档检查配置项\");\n    return;\n  }\n\n  const OSSName = getOSSName(file.name);\n\n  client\n    .put(OSSName, buffer)\n    .then((response) => {\n      const names = file.name.split(\".\");\n      names.pop();\n      const filename = names.join(\".\");\n      const image = {\n        filename, // 名字不变并且去掉后缀\n        url: response.url,\n      };\n      if (content) {\n        writeToEditor({content, image});\n      }\n      images.push(image);\n      onSuccess(response, file);\n      setTimeout(() => {\n        hideUploadNoti();\n      }, 500);\n    })\n    .catch((error) => {\n      console.log(error);\n\n      hideUploadNoti();\n      uploadError(\"请根据文档检查配置项\");\n      onError(error, error.toString());\n    });\n};\n\n// 阿里云对象存储上传，处理部分\nexport const aliOSSUpload = ({\n  file = {},\n  onSuccess = () => {},\n  onError = () => {},\n  images = [],\n  content = null, // store content\n}) => {\n  showUploadNoti();\n  const config = JSON.parse(window.localStorage.getItem(ALIOSS_IMAGE_HOSTING));\n  const base64Reader = new FileReader();\n  base64Reader.readAsDataURL(file);\n  base64Reader.onload = (e) => {\n    const urlData = e.target.result;\n    const base64 = urlData.split(\",\").pop();\n    const fileType = urlData\n      .split(\";\")\n      .shift()\n      .split(\":\")\n      .pop();\n\n    // base64转blob\n    const blob = toBlob(base64, fileType);\n\n    // blob转arrayBuffer\n    const bufferReader = new FileReader();\n    bufferReader.readAsArrayBuffer(blob);\n    bufferReader.onload = (event) => {\n      const buffer = new OSS.Buffer(event.target.result);\n      aliOSSPutObject({config, file, buffer, onSuccess, onError, images, content});\n    };\n  };\n};\n\n// Gitee存储上传\nexport const giteeUpload = ({\n  formData = new FormData(),\n  file = {},\n  onProgress = () => {},\n  onSuccess = () => {},\n  onError = () => {},\n  headers = {},\n  withCredentials = false,\n  images = [],\n  content = null, // store content\n}) => {\n  showUploadNoti();\n\n  if (file.size / 1024 / 1024 > 1) {\n    message.warn(\"有图片超过 1 MB，无法使用\");\n  }\n\n  const config = JSON.parse(window.localStorage.getItem(GITEE_IMAGE_HOSTING));\n\n  const base64Reader = new FileReader();\n  base64Reader.readAsDataURL(file);\n  base64Reader.onload = (e) => {\n    const urlData = e.target.result;\n    const base64 = urlData.split(\",\").pop();\n\n    const date = new Date();\n    const seperator = \"-\";\n    const dir = date.getFullYear() + seperator + (date.getMonth() + 1) + seperator + date.getDate();\n\n    const dateFilename = new Date().getTime() + \"-\" + file.name;\n    const url = `https://gitee.com/api/v5/repos/${config.username}/${config.repo}/contents/${dir}/${dateFilename}`;\n\n    formData.append(\"content\", base64);\n    formData.append(\"access_token\", config.token);\n    formData.append(\"message\", \"mdnice upload picture\");\n\n    axios\n      .post(url, formData, {\n        withCredentials,\n        headers,\n        onUploadProgress: ({total, loaded}) => {\n          onProgress(\n            {\n              percent: parseInt(Math.round((loaded / total) * 100).toFixed(2), 10),\n            },\n            file,\n          );\n        },\n      })\n      .then(({data: response}) => {\n        if (response.code === \"exception\") {\n          throw response.message;\n        }\n        const names = file.name.split(\".\");\n        names.pop();\n        const filename = names.join(\".\");\n        const image = {\n          filename,\n          url: encodeURI(response.content.download_url),\n        };\n        if (content) {\n          writeToEditor({content, image});\n        }\n        images.push(image);\n        onSuccess(response, file);\n        setTimeout(() => {\n          hideUploadNoti();\n        }, 500);\n      })\n      .catch((error, info) => {\n        hideUploadNoti();\n        uploadError(error.toString() + \" 可能存在图片名重复等问题\");\n        onError(error, error.toString() + \" 可能存在图片名重复等问题\");\n      });\n  };\n};\n\n// GitHub存储上传\nexport const githubUpload = ({\n  formData = new FormData(),\n  file = {},\n  onProgress = () => {},\n  onSuccess = () => {},\n  onError = () => {},\n  headers = {},\n  withCredentials = false,\n  images = [],\n  content = null, // store content\n}) => {\n  showUploadNoti();\n\n  const config = JSON.parse(window.localStorage.getItem(GITHUB_IMAGE_HOSTING));\n\n  const base64Reader = new FileReader();\n  base64Reader.readAsDataURL(file);\n  base64Reader.onload = (e) => {\n    const urlData = e.target.result;\n    const base64 = urlData.split(\",\").pop();\n\n    const date = new Date();\n    const seperator = \"-\";\n    const dir = date.getFullYear() + seperator + (date.getMonth() + 1) + seperator + date.getDate();\n\n    const dateFilename = new Date().getTime() + \"-\" + file.name;\n    const url = `https://api.github.com/repos/${config.username}/${config.repo}/contents/${dir}/${dateFilename}?access_token=${config.token}`;\n\n    const data = {\n      content: base64,\n      message: \"mdnice upload picture\",\n    };\n\n    axios\n      .put(url, data, {\n        withCredentials,\n        headers,\n        onUploadProgress: ({total, loaded}) => {\n          onProgress(\n            {\n              percent: parseInt(Math.round((loaded / total) * 100).toFixed(2), 10),\n            },\n            file,\n          );\n        },\n      })\n      .then(({data: response}) => {\n        if (response.code === \"exception\") {\n          throw response.message;\n        }\n        const names = file.name.split(\".\");\n        names.pop();\n        const filename = names.join(\".\");\n\n        const imageUrl =\n          config.jsdelivr === \"true\"\n            ? `https://cdn.jsdelivr.net/gh/${config.username}/${config.repo}/${dir}/${dateFilename}`\n            : response.content.download_url;\n\n        const image = {\n          filename,\n          url: encodeURI(imageUrl),\n        };\n        if (content) {\n          writeToEditor({content, image});\n        }\n        images.push(image);\n        onSuccess(response, file);\n        setTimeout(() => {\n          hideUploadNoti();\n        }, 500);\n      })\n      .catch((error, info) => {\n        hideUploadNoti();\n        uploadError(error.toString());\n        onError(error, error.toString());\n      });\n  };\n};\n\n// 自动检测上传配置，进行上传\nexport const uploadAdaptor = (...args) => {\n  const type = localStorage.getItem(IMAGE_HOSTING_TYPE); // SM.MS | 阿里云 | 七牛云 | Gitee | GitHub | 用户自定义图床\n  const userType = imageHosting.hostingName;\n  if (type === userType) {\n    return customImageUpload(...args);\n  } else if (type === IMAGE_HOSTING_NAMES.smms) {\n    return smmsUpload(...args);\n  } else if (type === IMAGE_HOSTING_NAMES.qiniuyun) {\n    const config = JSON.parse(window.localStorage.getItem(QINIUOSS_IMAGE_HOSTING));\n    if (\n      !config.region.length ||\n      !config.accessKey.length ||\n      !config.secretKey.length ||\n      !config.bucket.length ||\n      !config.domain.length\n    ) {\n      message.error(\"请先配置七牛云图床\");\n      return false;\n    }\n    return qiniuOSSUpload(...args);\n  } else if (type === IMAGE_HOSTING_NAMES.aliyun) {\n    const config = JSON.parse(window.localStorage.getItem(ALIOSS_IMAGE_HOSTING));\n    if (\n      !config.region.length ||\n      !config.accessKeyId.length ||\n      !config.accessKeySecret.length ||\n      !config.bucket.length\n    ) {\n      message.error(\"请先配置阿里云图床\");\n      return false;\n    }\n    return aliOSSUpload(...args);\n  } else if (type === IMAGE_HOSTING_NAMES.gitee) {\n    const config = JSON.parse(window.localStorage.getItem(GITEE_IMAGE_HOSTING));\n    if (!config.username.length || !config.repo.length || !config.token.length) {\n      message.error(\"请先配置 Gitee 图床\");\n      return false;\n    }\n    return giteeUpload(...args);\n  } else if (type === IMAGE_HOSTING_NAMES.github) {\n    const config = JSON.parse(window.localStorage.getItem(GITHUB_IMAGE_HOSTING));\n    if (!config.username.length || !config.repo.length || !config.token.length) {\n      message.error(\"请先配置 GitHub 图床\");\n      return false;\n    }\n    return githubUpload(...args);\n  }\n  return true;\n};\n"
  },
  {
    "path": "src/utils/langHighlight.js",
    "content": "// 缩小highlight包大小，按需引入，900kb->90kb\nimport highlightjs from \"highlight.js/lib/highlight\";\n\nimport bash from \"highlight.js/lib/languages/bash\";\nimport clojure from \"highlight.js/lib/languages/clojure\";\nimport cpp from \"highlight.js/lib/languages/cpp\";\nimport cs from \"highlight.js/lib/languages/cs\";\nimport css from \"highlight.js/lib/languages/css\";\nimport dart from \"highlight.js/lib/languages/dart\";\nimport dockerfile from \"highlight.js/lib/languages/dockerfile\";\nimport erlang from \"highlight.js/lib/languages/erlang\";\nimport go from \"highlight.js/lib/languages/go\";\nimport gradle from \"highlight.js/lib/languages/gradle\";\nimport groovy from \"highlight.js/lib/languages/groovy\";\nimport haskell from \"highlight.js/lib/languages/haskell\";\nimport java from \"highlight.js/lib/languages/java\";\nimport javascript from \"highlight.js/lib/languages/javascript\";\nimport json from \"highlight.js/lib/languages/json\";\nimport julia from \"highlight.js/lib/languages/julia\";\nimport kotlin from \"highlight.js/lib/languages/kotlin\";\nimport lisp from \"highlight.js/lib/languages/lisp\";\nimport lua from \"highlight.js/lib/languages/lua\";\nimport makefile from \"highlight.js/lib/languages/makefile\";\nimport markdown from \"highlight.js/lib/languages/markdown\";\nimport matlab from \"highlight.js/lib/languages/matlab\";\nimport objectivec from \"highlight.js/lib/languages/objectivec\";\nimport perl from \"highlight.js/lib/languages/perl\";\nimport php from \"highlight.js/lib/languages/php\";\nimport python from \"highlight.js/lib/languages/python\";\nimport r from \"highlight.js/lib/languages/r\";\nimport ruby from \"highlight.js/lib/languages/ruby\";\nimport rust from \"highlight.js/lib/languages/rust\";\nimport scala from \"highlight.js/lib/languages/scala\";\nimport shell from \"highlight.js/lib/languages/shell\";\nimport sql from \"highlight.js/lib/languages/sql\";\nimport swift from \"highlight.js/lib/languages/swift\";\nimport tex from \"highlight.js/lib/languages/tex\";\nimport typescript from \"highlight.js/lib/languages/typescript\";\nimport verilog from \"highlight.js/lib/languages/verilog\";\nimport vhdl from \"highlight.js/lib/languages/vhdl\";\nimport xml from \"highlight.js/lib/languages/xml\";\nimport yaml from \"highlight.js/lib/languages/yaml\";\nimport diff from \"highlight.js/lib/languages/diff\";\nimport protobuf from \"highlight.js/lib/languages/protobuf\";\n\nhighlightjs.registerLanguage(\"bash\", bash);\nhighlightjs.registerLanguage(\"clojure\", clojure);\nhighlightjs.registerLanguage(\"cpp\", cpp);\nhighlightjs.registerLanguage(\"cs\", cs);\nhighlightjs.registerLanguage(\"css\", css);\nhighlightjs.registerLanguage(\"dart\", dart);\nhighlightjs.registerLanguage(\"dockerfile\", dockerfile);\nhighlightjs.registerLanguage(\"erlang\", erlang);\nhighlightjs.registerLanguage(\"go\", go);\nhighlightjs.registerLanguage(\"gradle\", gradle);\nhighlightjs.registerLanguage(\"groovy\", groovy);\nhighlightjs.registerLanguage(\"haskell\", haskell);\nhighlightjs.registerLanguage(\"java\", java);\nhighlightjs.registerLanguage(\"javascript\", javascript);\nhighlightjs.registerLanguage(\"json\", json);\nhighlightjs.registerLanguage(\"julia\", julia);\nhighlightjs.registerLanguage(\"kotlin\", kotlin);\nhighlightjs.registerLanguage(\"lisp\", lisp);\nhighlightjs.registerLanguage(\"lua\", lua);\nhighlightjs.registerLanguage(\"makefile\", makefile);\nhighlightjs.registerLanguage(\"markdown\", markdown);\nhighlightjs.registerLanguage(\"matlab\", matlab);\nhighlightjs.registerLanguage(\"objectivec\", objectivec);\nhighlightjs.registerLanguage(\"perl\", perl);\nhighlightjs.registerLanguage(\"php\", php);\nhighlightjs.registerLanguage(\"python\", python);\nhighlightjs.registerLanguage(\"r\", r);\nhighlightjs.registerLanguage(\"ruby\", ruby);\nhighlightjs.registerLanguage(\"rust\", rust);\nhighlightjs.registerLanguage(\"scala\", scala);\nhighlightjs.registerLanguage(\"shell\", shell);\nhighlightjs.registerLanguage(\"sql\", sql);\nhighlightjs.registerLanguage(\"swift\", swift);\nhighlightjs.registerLanguage(\"tex\", tex);\nhighlightjs.registerLanguage(\"typescript\", typescript);\nhighlightjs.registerLanguage(\"verilog\", verilog);\nhighlightjs.registerLanguage(\"vhdl\", vhdl);\nhighlightjs.registerLanguage(\"xml\", xml);\nhighlightjs.registerLanguage(\"yaml\", yaml);\nhighlightjs.registerLanguage(\"diff\", diff);\nhighlightjs.registerLanguage(\"protobuf\", protobuf);\n\nexport default highlightjs;\n"
  },
  {
    "path": "src/utils/markdown-it-imageflow.js",
    "content": "const defaultOption = {\n  limitless: false, // 限制图片数量\n  limit: 10, // 图片数量上限\n};\n\nconst imageFlowPlugin = (md, opt) => {\n  const options = opt || defaultOption;\n\n  const tokenize = (state, start) => {\n    let token;\n\n    const matchReg = /^<((!\\[[^[\\]]*\\]\\([^()]+\\)(,?\\s*(?=>)|,\\s*(?!>)))+)>/;\n    const srcLine = state.src.slice(state.bMarks[start], state.eMarks[start]);\n\n    if (srcLine.charCodeAt(0) !== 0x3c /* < */) {\n      return false;\n    }\n    const match = matchReg.exec(srcLine);\n\n    if (match) {\n      const images = match[1].match(/\\[[^\\]]*\\]\\([^)]+\\)/g);\n      if (!options.limitless && images.length <= options.limit) {\n        token = state.push(\"imageFlow\", \"\", 0);\n        token.meta = images;\n        token.block = true;\n\n        // update line\n        state.line++;\n        return true;\n      }\n    }\n    return false;\n  };\n\n  md.renderer.rules.imageFlow = (tokens, idx) => {\n    const start = `<section class=\"imageflow-layer1\"><section class=\"imageflow-layer2\">`;\n    const end = `</section></section><p class=\"imageflow-caption\"><<< 左右滑动见更多 >>></p>`;\n    const contents = tokens[idx].meta;\n    let wrappedContent = \"\";\n    let alt;\n    let src;\n    contents.forEach((content) => {\n      [, alt] = content.match(/\\[([^[\\]]*)\\]/);\n      [, src] = content.match(/[^[]*\\(([^()]*)\\)[^\\]]*/);\n      wrappedContent += `<section class=\"imageflow-layer3\"><img alt=\"${alt}\" src=\"${src}\" class=\"imageflow-img\" /></section>`;\n    });\n\n    return start + wrappedContent + end;\n  };\n\n  md.block.ruler.before(\"paragraph\", \"imageFlow\", tokenize);\n};\n\nexport default imageFlowPlugin;\n"
  },
  {
    "path": "src/utils/markdown-it-li.js",
    "content": "function makeRule(md) {\n  return function replaceListItem() {\n    md.renderer.rules.list_item_open = function replaceOpen() {\n      return \"<li><section>\";\n    };\n    md.renderer.rules.list_item_close = function replaceClose() {\n      return \"</section></li>\";\n    };\n  };\n}\n\nexport default (md) => {\n  md.core.ruler.push(\"replace-li\", makeRule(md));\n};\n"
  },
  {
    "path": "src/utils/markdown-it-linkfoot.js",
    "content": "function renderFootnoteAnchorName(tokens, idx, options, env) {\n  const n = Number(tokens[idx].meta.id + 1).toString();\n  let prefix = \"\";\n\n  if (typeof env.docId === \"string\") {\n    prefix = \"-\" + env.docId + \"-\";\n  }\n\n  return prefix + n;\n}\n\nfunction renderFootnoteCaption(tokens, idx) {\n  let n = Number(tokens[idx].meta.id + 1).toString();\n\n  if (tokens[idx].meta.subId > 0) {\n    n += \":\" + tokens[idx].meta.subId;\n  }\n\n  return \"[\" + n + \"]\";\n}\n\n// eslint-disable-next-line\nfunction renderFootnoteWord(tokens, idx, options, env, slf) {\n  return '<span class=\"footnote-word\">' + tokens[idx].content + \"</span>\";\n}\n\nfunction renderFootnoteRef(tokens, idx, options, env, slf) {\n  // var id      = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);\n  const caption = slf.rules.footnote_caption(tokens, idx, options, env, slf);\n  return '<sup class=\"footnote-ref\">' + caption + \"</sup>\";\n}\n\n// eslint-disable-next-line\nfunction renderFootnoteBlockOpen(tokens, idx, options) {\n  return '<h3 class=\"footnotes-sep\"></h3>\\n<section class=\"footnotes\">\\n';\n}\n\nfunction renderFootnoteBlockClose() {\n  return \"</section>\\n\";\n}\n\nfunction renderFootnoteOpen(tokens, idx, options, env, slf) {\n  let id = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);\n\n  if (tokens[idx].meta.subId > 0) {\n    id += \":\" + tokens[idx].meta.subId;\n  }\n\n  return '<span id=\"fn' + id + '\" class=\"footnote-item\"><span class=\"footnote-num\">[' + id + \"] </span>\";\n}\n\nfunction renderFootnoteClose() {\n  return \"</span>\\n\";\n}\n\n// Process [link](<to> \"stuff\")\nfunction isSpace(code) {\n  switch (code) {\n    case 0x09:\n    case 0x20:\n      return true;\n    default:\n  }\n  return false;\n}\n\nfunction normalizeReference(str) {\n  // use .toUpperCase() instead of .toLowerCase()\n  // here to avoid a conflict with Object.prototype\n  // members (most notably, `__proto__`)\n  return str\n    .trim()\n    .replace(/\\s+/g, \" \")\n    .toUpperCase();\n}\n\nfunction linkFoot(state, silent) {\n  let attrs,\n    code,\n    label,\n    pos,\n    res,\n    ref,\n    title,\n    token,\n    href = \"\",\n    start = state.pos,\n    footnoteContent,\n    parseReference = true;\n  const oldPos = state.pos;\n  const max = state.posMax;\n\n  if (state.src.charCodeAt(state.pos) !== 0x5b /* [ */) {\n    return false;\n  }\n\n  const labelStart = state.pos + 1;\n  const labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);\n\n  // parser failed to find ']', so it's not a valid link\n  if (labelEnd < 0) {\n    return false;\n  }\n\n  pos = labelEnd + 1;\n  if (pos < max && state.src.charCodeAt(pos) === 0x28 /* ( */) {\n    //\n    // Inline link\n    //\n\n    // might have found a valid shortcut link, disable reference parsing\n    parseReference = false;\n\n    // [link](  <href>  \"title\"  )\n    //        ^^ skipping these spaces\n    pos++;\n    for (; pos < max; pos++) {\n      code = state.src.charCodeAt(pos);\n      if (!isSpace(code) && code !== 0x0a) {\n        break;\n      }\n    }\n    if (pos >= max) {\n      return false;\n    }\n\n    // [link](  <href>  \"title\"  )\n    //          ^^^^^^ parsing link destination\n    start = pos;\n    res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);\n    if (res.ok) {\n      href = state.md.normalizeLink(res.str);\n      footnoteContent = res.str;\n      if (state.md.validateLink(href)) {\n        pos = res.pos;\n      } else {\n        href = \"\";\n      }\n    }\n\n    // [link](  <href>  \"title\"  )\n    //                ^^ skipping these spaces\n    start = pos;\n    for (; pos < max; pos++) {\n      code = state.src.charCodeAt(pos);\n      if (!isSpace(code) && code !== 0x0a) {\n        break;\n      }\n    }\n\n    // [link](  <href>  \"title\"  )\n    //                  ^^^^^^^ parsing link title\n    res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);\n    if (pos < max && start !== pos && res.ok) {\n      title = res.str;\n      pos = res.pos;\n\n      // [link](  <href>  \"title\"  )\n      //                         ^^ skipping these spaces\n      for (; pos < max; pos++) {\n        code = state.src.charCodeAt(pos);\n        if (!isSpace(code) && code !== 0x0a) {\n          break;\n        }\n      }\n    } else {\n      title = \"\";\n    }\n\n    if (pos >= max || state.src.charCodeAt(pos) !== 0x29 /* ) */) {\n      // parsing a valid shortcut link failed, fallback to reference\n      parseReference = true;\n    }\n    pos++;\n  }\n\n  if (parseReference) {\n    //\n    // Link reference\n    //\n    if (typeof state.env.references === \"undefined\") {\n      return false;\n    }\n\n    if (pos < max && state.src.charCodeAt(pos) === 0x5b /* [ */) {\n      start = pos + 1;\n      pos = state.md.helpers.parseLinkLabel(state, pos);\n      if (pos >= 0) {\n        label = state.src.slice(start, pos++);\n      } else {\n        pos = labelEnd + 1;\n      }\n    } else {\n      pos = labelEnd + 1;\n    }\n\n    // covers label === '' and label === undefined\n    // (collapsed reference link and shortcut reference link respectively)\n    if (!label) {\n      label = state.src.slice(labelStart, labelEnd);\n    }\n\n    ref = state.env.references[normalizeReference(label)];\n    if (!ref) {\n      state.pos = oldPos;\n      return false;\n    }\n    href = ref.href;\n    title = ref.title;\n  }\n\n  //\n  // We found the end of the link, and know for a fact it's a valid link;\n  // so all that's left to do is to call tokenizer.\n  //\n  if (!silent) {\n    // 如果存在标题则转成脚注\n    if (title) {\n      state.pos = labelStart;\n      state.posMax = labelEnd;\n\n      let tokens;\n\n      if (!state.env.footnotes) {\n        state.env.footnotes = {};\n      }\n      if (!state.env.footnotes.list) {\n        state.env.footnotes.list = [];\n      }\n\n      const footnoteId = state.env.footnotes.list.length;\n\n      // *用来让链接倾斜\n      state.md.inline.parse(`${title}: *${footnoteContent}*`, state.md, state.env, (tokens = []));\n\n      token = state.push(\"footnote_word\", \"\", 0);\n      token.content = state.src.slice(labelStart, labelEnd);\n\n      token = state.push(\"footnote_ref\", \"\", 0);\n      token.meta = {id: footnoteId};\n\n      state.env.footnotes.list[footnoteId] = {tokens: tokens};\n    }\n    // 不存在标题则判断域名\n    else {\n      state.pos = labelStart;\n      state.posMax = labelEnd;\n\n      token = state.push(\"link_open\", \"a\", 1);\n      attrs = [[\"href\", href]];\n      token.attrs = attrs;\n      if (title) {\n        attrs.push([\"title\", title]);\n      }\n\n      state.md.inline.tokenize(state);\n\n      token = state.push(\"link_close\", \"a\", -1);\n    }\n  }\n\n  state.pos = pos;\n  state.posMax = max;\n\n  return true;\n}\n\n// Glue footnote tokens to end of token stream\nfunction footnoteTail(state) {\n  var i,\n    l,\n    lastParagraph,\n    list,\n    token,\n    tokens,\n    current,\n    currentLabel,\n    insideRef = false,\n    refTokens = {};\n\n  if (!state.env.footnotes) {\n    return;\n  }\n\n  state.tokens = state.tokens.filter((tok) => {\n    if (tok.type === \"footnote_reference_open\") {\n      insideRef = true;\n      current = [];\n      currentLabel = tok.meta.label;\n      return false;\n    }\n    if (tok.type === \"footnote_reference_close\") {\n      insideRef = false;\n      // prepend ':' to avoid conflict with Object.prototype members\n      refTokens[\":\" + currentLabel] = current;\n      return false;\n    }\n    if (insideRef) {\n      current.push(tok);\n    }\n    return !insideRef;\n  });\n\n  if (!state.env.footnotes.list) {\n    return;\n  }\n  list = state.env.footnotes.list;\n\n  token = new state.Token(\"footnote_block_open\", \"\", 1);\n  state.tokens.push(token);\n\n  for (i = 0, l = list.length; i < l; i++) {\n    token = new state.Token(\"footnote_open\", \"\", 1);\n    token.meta = {id: i, label: list[i].label};\n    state.tokens.push(token);\n\n    if (list[i].tokens) {\n      tokens = [];\n\n      token = new state.Token(\"paragraph_open\", \"p\", 1);\n      token.block = true;\n      tokens.push(token);\n\n      token = new state.Token(\"inline\", \"\", 0);\n      token.children = list[i].tokens;\n      token.content = \"\";\n      tokens.push(token);\n\n      token = new state.Token(\"paragraph_close\", \"p\", -1);\n      token.block = true;\n      tokens.push(token);\n    } else if (list[i].label) {\n      tokens = refTokens[\":\" + list[i].label];\n    }\n\n    state.tokens = state.tokens.concat(tokens);\n    if (state.tokens[state.tokens.length - 1].type === \"paragraph_close\") {\n      lastParagraph = state.tokens.pop();\n    } else {\n      lastParagraph = null;\n    }\n\n    if (lastParagraph) {\n      state.tokens.push(lastParagraph);\n    }\n\n    token = new state.Token(\"footnote_close\", \"\", -1);\n    state.tokens.push(token);\n  }\n\n  token = new state.Token(\"footnote_block_close\", \"\", -1);\n  state.tokens.push(token);\n}\n\nexport default (md) => {\n  md.renderer.rules.footnote_ref = renderFootnoteRef;\n  md.renderer.rules.footnote_word = renderFootnoteWord;\n  md.renderer.rules.footnote_block_open = renderFootnoteBlockOpen;\n  md.renderer.rules.footnote_block_close = renderFootnoteBlockClose;\n  md.renderer.rules.footnote_open = renderFootnoteOpen;\n  md.renderer.rules.footnote_close = renderFootnoteClose;\n\n  // helpers (only used in other rules, no tokens are attached to those)\n  md.renderer.rules.footnote_caption = renderFootnoteCaption;\n  md.renderer.rules.footnote_anchor_name = renderFootnoteAnchorName;\n\n  md.inline.ruler.at(\"link\", linkFoot);\n  md.core.ruler.after(\"inline\", \"footnote_tail\", footnoteTail);\n};\n"
  },
  {
    "path": "src/utils/markdown-it-math.js",
    "content": "/* Process inline math */\n/*\nLike markdown-it-simplemath, this is a stripped down, simplified version of:\nhttps://github.com/runarberg/markdown-it-math\nIt differs in that it takes (a subset of) LaTeX as input and relies on KaTeX\nfor rendering output.\n*/\n/* eslint-disable */\n// var katex = require(\"katex\");\n\n// Test if potential opening or closing delimieter\n// Assumes that there is a \"$\" at state.src[pos]\nfunction isValidDelim(state, pos) {\n  var prevChar,\n    nextChar,\n    max = state.posMax,\n    can_open = true,\n    can_close = true;\n\n  prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1;\n  nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1;\n\n  // Check non-whitespace conditions for opening and closing, and\n  // check that closing delimeter isn't followed by a number\n  if (\n    prevChar === 0x20 /* \" \" */ ||\n    prevChar === 0x09 /* \\t */ ||\n    (nextChar >= 0x30 /* \"0\" */ && nextChar <= 0x39) /* \"9\" */\n  ) {\n    can_close = false;\n  }\n  if (nextChar === 0x20 /* \" \" */ || nextChar === 0x09 /* \\t */) {\n    can_open = false;\n  }\n\n  return {\n    can_open: can_open,\n    can_close: can_close,\n  };\n}\n\nfunction math_inline(state, silent) {\n  var start, match, token, res, pos, esc_count;\n\n  if (state.src[state.pos] !== \"$\") {\n    return false;\n  }\n\n  res = isValidDelim(state, state.pos);\n  if (!res.can_open) {\n    if (!silent) {\n      state.pending += \"$\";\n    }\n    state.pos += 1;\n    return true;\n  }\n\n  // First check for and bypass all properly escaped delimieters\n  // This loop will assume that the first leading backtick can not\n  // be the first character in state.src, which is known since\n  // we have found an opening delimieter already.\n  start = state.pos + 1;\n  match = start;\n  while ((match = state.src.indexOf(\"$\", match)) !== -1) {\n    // Found potential $, look for escapes, pos will point to\n    // first non escape when complete\n    pos = match - 1;\n    while (state.src[pos] === \"\\\\\") {\n      pos -= 1;\n    }\n\n    // Even number of escapes, potential closing delimiter found\n    if ((match - pos) % 2 == 1) {\n      break;\n    }\n    match += 1;\n  }\n\n  // No closing delimter found.  Consume $ and continue.\n  if (match === -1) {\n    if (!silent) {\n      state.pending += \"$\";\n    }\n    state.pos = start;\n    return true;\n  }\n\n  // Check if we have empty content, ie: $$.  Do not parse.\n  if (match - start === 0) {\n    if (!silent) {\n      state.pending += \"$$\";\n    }\n    state.pos = start + 1;\n    return true;\n  }\n\n  // Check for valid closing delimiter\n  res = isValidDelim(state, match);\n  if (!res.can_close) {\n    if (!silent) {\n      state.pending += \"$\";\n    }\n    state.pos = start;\n    return true;\n  }\n\n  if (!silent) {\n    token = state.push(\"math_inline\", \"math\", 0);\n    token.markup = \"$\";\n    token.content = state.src.slice(start, match);\n  }\n\n  state.pos = match + 1;\n  return true;\n}\n\nfunction math_block(state, start, end, silent) {\n  var firstLine,\n    lastLine,\n    next,\n    lastPos,\n    found = false,\n    token,\n    pos = state.bMarks[start] + state.tShift[start],\n    max = state.eMarks[start];\n\n  if (pos + 2 > max) {\n    return false;\n  }\n  if (state.src.slice(pos, pos + 2) !== \"$$\") {\n    return false;\n  }\n\n  pos += 2;\n  firstLine = state.src.slice(pos, max);\n\n  if (silent) {\n    return true;\n  }\n  if (firstLine.trim().slice(-2) === \"$$\") {\n    // Single line expression\n    firstLine = firstLine.trim().slice(0, -2);\n    found = true;\n  }\n\n  for (next = start; !found; ) {\n    next++;\n\n    if (next >= end) {\n      break;\n    }\n\n    pos = state.bMarks[next] + state.tShift[next];\n    max = state.eMarks[next];\n\n    if (pos < max && state.tShift[next] < state.blkIndent) {\n      // non-empty line with negative indent should stop the list:\n      break;\n    }\n\n    if (\n      state.src\n        .slice(pos, max)\n        .trim()\n        .slice(-2) === \"$$\"\n    ) {\n      lastPos = state.src.slice(0, max).lastIndexOf(\"$$\");\n      lastLine = state.src.slice(pos, lastPos);\n      found = true;\n    }\n  }\n\n  state.line = next + 1;\n\n  token = state.push(\"math_block\", \"math\", 0);\n  token.block = true;\n  token.content =\n    (firstLine && firstLine.trim() ? firstLine + \"\\n\" : \"\") +\n    state.getLines(start + 1, next, state.tShift[start], true) +\n    (lastLine && lastLine.trim() ? lastLine : \"\");\n  token.map = [start, state.line];\n  token.markup = \"$$\";\n  return true;\n}\n\nexport default (md, options) => {\n  // Default options\n\n  options = options || {};\n\n  // set KaTeX as the renderer for markdown-it-simplemath\n  var katexInline = function(latex) {\n    options.displayMode = false;\n    try {\n      return \"$\" + latex + \"$\";\n      // return katex.renderToString(latex, options);\n    } catch (error) {\n      if (options.throwOnError) {\n        console.log(error);\n      }\n      return latex;\n    }\n  };\n\n  var inlineRenderer = function(tokens, idx) {\n    return katexInline(tokens[idx].content);\n  };\n\n  var katexBlock = function(latex) {\n    options.displayMode = true;\n    try {\n      // console.log(latex);\n      return \"$$\" + latex + \"$$\";\n      // return \"<p>\" + katex.renderToString(latex, options) + \"</p>\";\n    } catch (error) {\n      if (options.throwOnError) {\n        console.log(error);\n      }\n      return latex;\n    }\n  };\n\n  var blockRenderer = function(tokens, idx) {\n    return katexBlock(tokens[idx].content) + \"\\n\";\n  };\n\n  md.inline.ruler.after(\"escape\", \"math_inline\", math_inline);\n  md.block.ruler.after(\"blockquote\", \"math_block\", math_block, {\n    alt: [\"paragraph\", \"reference\", \"blockquote\", \"list\"],\n  });\n  md.renderer.rules.math_inline = inlineRenderer;\n  md.renderer.rules.math_block = blockRenderer;\n};\n"
  },
  {
    "path": "src/utils/markdown-it-multiquote.js",
    "content": "function makeRule() {\n  return function addTableContainer(state) {\n    let count = 0;\n    let outerQuoteToekn;\n    for (var i = 0; i < state.tokens.length; i++) {\n      const curToken = state.tokens[i];\n      if (curToken.type === \"blockquote_open\") {\n        if (count === 0) {\n          // 最外层 blockquote 的 token\n          outerQuoteToekn = curToken;\n        }\n        count++;\n        continue;\n      }\n      if (count > 0) {\n        outerQuoteToekn.attrs = [[\"class\", \"multiquote-\" + count]];\n        count = 0;\n      }\n    }\n  };\n}\n\nexport default (md) => {\n  md.core.ruler.push(\"blockquote-class\", makeRule(md));\n};\n"
  },
  {
    "path": "src/utils/markdown-it-removepre.js",
    "content": "// 用来移除微信自定义代码前方的 pre code\nexport default (md) => {\n  const oldFence = md.renderer.rules.fence;\n  md.renderer.rules.fence = (tokens, idx, options, env, slf) => {\n    const old = oldFence(tokens, idx, options, env, slf);\n    const preReg = /<pre><code[\\w\\s-=\"]*>/;\n    // 微信专属\n    if (preReg.exec(old)) {\n      const pre = preReg.exec(old)[0];\n      const post = `</code></pre>`;\n      return old.replace(pre, \"\").replace(post, \"\");\n    }\n    // 自定义\n    else {\n      return old;\n    }\n  };\n};\n"
  },
  {
    "path": "src/utils/markdown-it-span.js",
    "content": "function slugify(s, md) {\n  // Unicode-friendly\n  var spaceRegex = new RegExp(md.utils.lib.ucmicro.Z.source, \"g\");\n  return encodeURIComponent(s.replace(spaceRegex, \"\"));\n}\n\nfunction makeRule(md, options) {\n  return function addHeadingAnchors(state) {\n    // Go to length-2 because we're going to be peeking ahead.\n    for (var i = 0; i < state.tokens.length - 1; i++) {\n      if (state.tokens[i].type !== \"heading_open\" || state.tokens[i + 1].type !== \"inline\") {\n        continue;\n      }\n\n      var headingInlineToken = state.tokens[i + 1];\n\n      if (!headingInlineToken.content) {\n        continue;\n      }\n\n      if (options.addHeadingSpan) {\n        var spanTokenPre = new state.Token(\"html_inline\", \"\", 0);\n        spanTokenPre.content = `<span class=\"prefix\"></span><span class=\"content\">`;\n        headingInlineToken.children.unshift(spanTokenPre);\n        var spanTokenPost = new state.Token(\"html_inline\", \"\", 0);\n        spanTokenPost.content = `</span><span class=\"suffix\"></span>`;\n        headingInlineToken.children.push(spanTokenPost);\n      }\n\n      // Advance past the inline and heading_close tokens.\n      i += 2;\n    }\n  };\n}\n\nexport default (md, opts) => {\n  var defaults = {\n    anchorClass: \"markdown-it-headingspan\",\n    addHeadingSpan: true,\n    slugify: slugify,\n  };\n  var options = md.utils.assign(defaults, opts);\n  md.core.ruler.push(\"heading_span\", makeRule(md, options));\n};\n"
  },
  {
    "path": "src/utils/markdown-it-table-container.js",
    "content": "function makeRule() {\n  return function addTableContainer(state) {\n    var arr = [];\n    for (var i = 0; i < state.tokens.length; i++) {\n      var curToken = state.tokens[i];\n      if (curToken.type === \"table_open\") {\n        var tableContainerStart = new state.Token(\"html_inline\", \"\", 0);\n        tableContainerStart.content = `<section class=\"table-container\">`;\n        arr.push(tableContainerStart);\n        arr.push(curToken);\n      } else if (curToken.type === \"table_close\") {\n        var tableContainerClose = new state.Token(\"html_inline\", \"\", 0);\n        tableContainerClose.content = `</section>`;\n        arr.push(curToken);\n        arr.push(tableContainerClose);\n      } else {\n        arr.push(curToken);\n      }\n    }\n    state.tokens = arr;\n  };\n}\n\nexport default (md) => {\n  md.core.ruler.push(\"table-container\", makeRule(md));\n};\n"
  },
  {
    "path": "src/utils/mdMirror.css",
    "content": "/*\n\n    Name:       Base16 Default Light\n    Author:     Chris Kempson (http://chriskempson.com)\n\n    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)\n    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)\n\n*/\n\n.cm-s-md-mirror.CodeMirror {\n  background: #f5f5f5;\n  color: #202020;\n  font-size: 16px;\n  padding: 20px;\n  line-height: 25px;\n}\n.cm-s-md-mirror div.CodeMirror-selected {\n  background: #e0e0e0;\n}\n\n.cm-s-md-mirror pre.CodeMirror-line {\n  word-break: break-all;\n}\n\n.cm-s-md-mirror .CodeMirror-line::selection,\n.cm-s-md-mirror .CodeMirror-line > span::selection,\n.cm-s-md-mirror .CodeMirror-line > span > span::selection {\n  background: #e0e0e0;\n}\n.cm-s-md-mirror .CodeMirror-line::-moz-selection,\n.cm-s-md-mirror .CodeMirror-line > span::-moz-selection,\n.cm-s-md-mirror .CodeMirror-line > span > span::-moz-selection {\n  background: #e0e0e0;\n}\n.cm-s-md-mirror .CodeMirror-gutters {\n  background: #f5f5f5;\n  border-right: 0px;\n}\n.cm-s-md-mirror .CodeMirror-guttermarker {\n  color: #ac4142;\n}\n.cm-s-md-mirror .CodeMirror-guttermarker-subtle {\n  color: #b0b0b0;\n}\n.cm-s-md-mirror .CodeMirror-linenumber {\n  color: #b0b0b0;\n}\n.cm-s-md-mirror .CodeMirror-cursor {\n  border-left: 1px solid #505050;\n}\n\n.cm-s-md-mirror span.cm-comment {\n  color: #ac002b;\n}\n.cm-s-md-mirror span.cm-atom {\n  color: #aa759f;\n}\n.cm-s-md-mirror span.cm-number {\n  color: #aa759f;\n}\n\n.cm-s-md-mirror span.cm-property,\n.cm-s-md-mirror span.cm-attribute {\n  color: #90a959;\n}\n.cm-s-md-mirror span.cm-keyword {\n  color: #023a52;\n}\n.cm-s-md-mirror span.cm-string {\n  color: #e46918;\n}\n\n.cm-s-md-mirror span.cm-variable {\n  color: #90a959;\n}\n.cm-s-md-mirror span.cm-variable-2 {\n  color: #00695f;\n}\n.cm-s-md-mirror span.cm-variable-3 {\n  color: #2e6e8a;\n}\n.cm-s-md-mirror span.cm-def {\n  color: #d28445;\n}\n.cm-s-md-mirror span.cm-bracket {\n  color: #202020;\n}\n.cm-s-md-mirror span.cm-tag {\n  color: #ac4142;\n}\n.cm-s-md-mirror span.cm-link {\n  color: #b26a00;\n}\n.cm-s-md-mirror span.cm-error {\n  /* background: #ac4142;\n  color: #f5f5f5; */\n  text-decoration: underline;\n  text-decoration-style: wavy;\n  text-decoration-color: #df8d8e;\n}\n.cm-s-md-mirror .CodeMirror-activeline-background {\n  background: #dddcdc;\n}\n.cm-s-md-mirror .CodeMirror-matchingbracket {\n  color: rgb(32,32,32) !important;\n  background-color: rgba(0,0,0,0.1) !important;\n}\n"
  },
  {
    "path": "src/utils/pluginCenter.js",
    "content": "// 检测插件是否安装\nexport default {\n  mathjax: false,\n};\n"
  },
  {
    "path": "src/utils/sitdownConverter.js",
    "content": "import {Sitdown, RootNode} from \"sitdown/dist/src.esm\";\nimport {applyJuejinRule} from \"@sitdown/juejin/dist/src.esm\";\nimport {applyWechatRule, extraFootLinks} from \"@sitdown/wechat/dist/src.esm\";\nimport {applyZhihuRule} from \"@sitdown/zhihu/dist/src.esm\";\n\nconst gfm = new Sitdown({\n  keepFilter: [\"style\"],\n  codeBlockStyle: \"fenced\",\n});\nconst juejin = new Sitdown({\n  keepFilter: [\"style\"],\n  codeBlockStyle: \"fenced\",\n  bulletListMarker: \"-\",\n  hr: \"---\",\n});\njuejin.use(applyJuejinRule);\nconst wechat = new Sitdown({\n  keepFilter: [\"style\"],\n  codeBlockStyle: \"fenced\",\n  bulletListMarker: \"-\",\n  hr: \"---\",\n});\nwechat.use(applyWechatRule);\nconst wechatToMD = (html) => {\n  const root = new RootNode(html);\n  const footLinks = extraFootLinks(root);\n  return wechat.HTMLToMD(html, {footLinks});\n};\nconst zhihu = new Sitdown({\n  keepFilter: [\"style\"],\n  codeBlockStyle: \"fenced\",\n  bulletListMarker: \"-\",\n  hr: \"---\",\n});\nzhihu.use(applyZhihuRule);\nconst csdn = new Sitdown({\n  keepFilter: [\"style\"],\n  codeBlockStyle: \"fenced\",\n  bulletListMarker: \"-\",\n  hr: \"---\",\n});\nconst methods = {\n  GFM: (input) => gfm.HTMLToMD(input),\n  Juejin: (input) => juejin.HTMLToMD(input),\n  Zhihu: (input) => zhihu.HTMLToMD(input),\n  Wechat: (input) => wechatToMD(input),\n  CSDN: (input) => csdn.HTMLToMD(input),\n};\n\nexport default methods;\n"
  },
  {
    "path": "src/utils/styleMirror.css",
    "content": "/*\n\n    Name:       Base16 Default Light\n    Author:     Chris Kempson (http://chriskempson.com)\n\n    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)\n    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)\n\n*/\n\n.cm-s-style-mirror.CodeMirror {\n  background: #f5f5f5;\n  color: #202020;\n  font-size: 14px;\n  padding: 20px;\n  line-height: 25px;\n}\n.cm-s-style-mirror div.CodeMirror-selected {\n  background: #e0e0e0;\n}\n.cm-s-style-mirror .CodeMirror-line::selection,\n.cm-s-style-mirror .CodeMirror-line > span::selection,\n.cm-s-style-mirror .CodeMirror-line > span > span::selection {\n  background: #e0e0e0;\n}\n.cm-s-style-mirror .CodeMirror-line::-moz-selection,\n.cm-s-style-mirror .CodeMirror-line > span::-moz-selection,\n.cm-s-style-mirror .CodeMirror-line > span > span::-moz-selection {\n  background: #e0e0e0;\n}\n.cm-s-style-mirror .CodeMirror-gutters {\n  background: #f5f5f5;\n  border-right: 0px;\n}\n.cm-s-style-mirror .CodeMirror-guttermarker {\n  color: #ac4142;\n}\n.cm-s-style-mirror .CodeMirror-guttermarker-subtle {\n  color: #b0b0b0;\n}\n.cm-s-style-mirror .CodeMirror-linenumber {\n  color: #b0b0b0;\n}\n.cm-s-style-mirror .CodeMirror-cursor {\n  border-left: 1px solid #505050;\n}\n\n.cm-s-style-mirror span.cm-comment {\n  color: #ac002b;\n}\n.cm-s-style-mirror span.cm-atom {\n  color: #aa759f;\n}\n.cm-s-style-mirror span.cm-number {\n  color: #aa759f;\n}\n\n.cm-s-style-mirror span.cm-property,\n.cm-s-style-mirror span.cm-attribute {\n  color: #90a959;\n}\n.cm-s-style-mirror span.cm-keyword {\n  color: #023a52;\n}\n.cm-s-style-mirror span.cm-string {\n  color: #e46918;\n}\n\n.cm-s-style-mirror span.cm-variable {\n  color: #90a959;\n}\n.cm-s-style-mirror span.cm-variable-2 {\n  color: #00695f;\n}\n.cm-s-style-mirror span.cm-variable-3 {\n  color: #2e6e8a;\n}\n.cm-s-style-mirror span.cm-def {\n  color: #d28445;\n}\n.cm-s-style-mirror span.cm-bracket {\n  color: #202020;\n}\n.cm-s-style-mirror span.cm-tag {\n  color: #ac4142;\n}\n.cm-s-style-mirror span.cm-link {\n  color: #b26a00;\n}\n.cm-s-style-mirror span.cm-error {\n  /* background: #ac4142;\n  color: #f5f5f5; */\n  text-decoration: underline;\n  text-decoration-style: wavy;\n  text-decoration-color: #df8d8e;\n}\n.cm-s-style-mirror .CodeMirror-activeline-background {\n  background: #dddcdc;\n}\n.cm-s-style-mirror .CodeMirror-matchingbracket {\n  color: rgb(32, 32, 32) !important;\n  background-color: rgba(0, 0, 0, 0.1) !important;\n}\n\n.CodeMirror-hints {\n  background-color: rgb(245, 245, 245);\n  font-size: 14px;\n  font-family: 'source-code-pro', Menlo, 'Courier New', Consolas, monospace;\n}\n\n.CodeMirror-hints li {\n  line-height: 20px;\n}\n\nli.CodeMirror-hint-active  {\n  color: black;\n  background-color: rgb(202,222,185);\n}\n\n.CodeMirror-hints li:hover {\n  background-color: rgb(224, 224, 224);\n}\n"
  },
  {
    "path": "stories/allImageHosting.js",
    "content": "import React from \"react\";\nimport MarkdownNice from \"../lib/Lib\";\n\n// 编辑器默认的内容\nconst defaultText = `编辑器默认的内容`;\n// 标题，是一个字符串\nconst defaultTitle = \"Markdown Nice\";\n\n// 自定义图床参数\nconst useImageHosting = {\n  url: \"https://imgkr.com/api/files/upload\",\n  name: \"图壳\",\n  isSmmsOpen: true,\n  isQiniuyunOpen: true,\n  isAliyunOpen: true,\n};\n\nfunction App() {\n  return (\n    <MarkdownNice\n      defaultTitle={defaultTitle}\n      defaultText={defaultText}\n      onTextChange={t => console.log(\"text => \", t)}\n      useImageHosting={useImageHosting}\n    />\n  );\n}\n\nexport default App;"
  },
  {
    "path": "stories/defaultImageHosting.js",
    "content": "import React from \"react\";\nimport MarkdownNice from \"../lib/Lib\";\n\n// 编辑器默认的内容\nconst defaultText = `编辑器默认的内容`;\n// 标题，是一个字符串\nconst defaultTitle = \"Markdown Nice\";\n\nfunction App() {\n  return (\n    <MarkdownNice\n      defaultTitle={defaultTitle}\n      defaultText={defaultText}\n      onTextChange={t => console.log(\"text => \", t)}\n    />\n  );\n}\n\nexport default App;"
  },
  {
    "path": "stories/index.js",
    "content": "import React from \"react\";\nimport {storiesOf} from \"@storybook/react\";\nimport Online from \"./online\";\nimport AllImageHosting from \"./allImageHosting\";\nimport NoneImageHosting from \"./noneImageHosting\";\nimport DefaultImageHosting from \"./defaultImageHosting\";\n\nstoriesOf(\"线上版\", module).add(\"线上版\", () => <Online />);\n\nstoriesOf(\"图床参数\", module)\n  .add(\"默认图床\", () => <DefaultImageHosting />)\n  .add(\"全部图床\", () => <AllImageHosting />)\n  .add(\"无图床\", () => <NoneImageHosting />);\n"
  },
  {
    "path": "stories/noneImageHosting.js",
    "content": "import React from \"react\";\nimport MarkdownNice from \"../lib/Lib\";\n\n// 编辑器默认的内容\nconst defaultText = `编辑器默认的内容`;\n// 标题，是一个字符串\nconst defaultTitle = \"Markdown Nice\";\n\n// 自定义图床参数\nconst useImageHosting = {\n  isSmmsOpen: false,\n  isQiniuyunOpen: false,\n  isAliyunOpen: false,\n};\n\nfunction App() {\n  return (\n    <MarkdownNice\n      defaultTitle={defaultTitle}\n      defaultText={defaultText}\n      onTextChange={t => console.log(\"text => \", t)}\n      useImageHosting={useImageHosting}\n    />\n  );\n}\n\nexport default App;"
  },
  {
    "path": "stories/online.js",
    "content": "import React from \"react\";\nimport MarkdownNice from \"../lib/Lib\";\n\n// 编辑器默认的内容\nconst defaultText = `编辑器默认的内容`;\n// 标题，是一个字符串\nconst defaultTitle = \"Markdown Nice\";\n\n// 自定义图床参数\nconst useImageHosting = {\n  url: \"https://imgkr.com/api/files/upload\",\n  name: \"图壳\"\n};\n\nfunction App() {\n  return (\n    <MarkdownNice\n      defaultTitle={defaultTitle}\n      defaultText={defaultText}\n      onTextChange={t => console.log(\"text => \", t)}\n      onTextBlur={t => console.log(\"text => \", t)}\n      onStyleChange={t => console.log(\"text => \", t)}\n      onStyleBlur={t => console.log(\"text => \", t)}\n      token=\"12345\"\n      useImageHosting={useImageHosting}\n    />\n  );\n}\n\nexport default App;"
  },
  {
    "path": "watch.js",
    "content": "const chalk = require(\"chalk\");\nconst shelljs = require(\"shelljs\");\nconst chokidar = require(\"chokidar\");\n\nfunction debounce(func, wait, immediate) {\n  let timeout;\n  function debounced(...args) {\n    const ctx = this;\n    if (timeout) clearTimeout(timeout);\n\n    if (immediate) {\n      const callNow = !timeout;\n      timeout = setTimeout(() => {\n        // 这里只有在 wait 时长之后，timeout 为 null，然后触发防抖函数才能立即执行，\n        // 否则 callNow 为 false，不会立即执行，计时器会重新计时\n        timeout = null;\n      }, wait);\n      if (callNow) func.apply(ctx, args);\n    } else {\n      timeout = setTimeout(() => {\n        func.apply(ctx, args);\n      }, wait);\n    }\n  }\n  debounced.cancel = function cancel() {\n    clearTimeout(timeout);\n    timeout = null;\n  };\n  return debounced;\n}\n\nfunction build() {\n  console.log();\n  console.log(chalk.green(\"-> building\"));\n  shelljs.exec(\"cross-env NODE_ENV=production && npx babel src --out-dir lib --copy-files\");\n  console.log(chalk.green(\"-> build finished\"));\n}\n\nconst dBuild = debounce(build, 1000);\n\nfunction setupWatch() {\n  const watcher = chokidar.watch(\"./src\", {\n    ignoreInitial: true,\n  });\n\n  watcher.on(\"change\", dBuild);\n  watcher.on(\"add\", dBuild);\n\n  watcher.on(\"ready\", () => {\n    dBuild();\n  });\n\n  process.on(\"SIGINT\", function() {\n    watcher.close();\n    process.exit(0);\n  });\n\n  watcher.on(\"error\", (error) => {\n    console.error(\"Watcher failure\", error);\n    process.exit(1);\n  });\n}\n\nconsole.log(chalk.green(\"rebuild while code under src/ changed\"));\nsetupWatch();\n"
  }
]