Repository: hinesboy/mavonEditor Branch: master Commit: aaaafa97c43c Files: 104 Total size: 399.4 KB Directory structure: gitextract_k4v0_48_/ ├── .babelrc ├── .eslintrc.js ├── .gitattributes ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_template.md │ │ ├── feature_template.md │ │ └── question_template.md │ └── workflows/ │ └── gha.yml ├── .gitignore ├── .npmignore ├── LICENSE ├── LOG.md ├── README-EN.md ├── README.md ├── SECURITY.md ├── _config.yml ├── doc/ │ ├── cn/ │ │ ├── images.md │ │ ├── markdown.md │ │ ├── no-cnd.md │ │ ├── upload-images.md │ │ └── use.md │ └── en/ │ ├── images.md │ ├── markdown.md │ ├── no-cnd.md │ ├── upload-images.md │ └── use.md ├── jest.config.js ├── mavon-editor.d.ts ├── package.json ├── src/ │ ├── components/ │ │ ├── md-toolbar-left.vue │ │ └── md-toolbar-right.vue │ ├── dev/ │ │ ├── app.vue │ │ ├── assets/ │ │ │ ├── config.js │ │ │ └── lang/ │ │ │ ├── de/ │ │ │ │ ├── help_de.md │ │ │ │ └── words_de.json │ │ │ ├── en/ │ │ │ │ ├── help_en.md │ │ │ │ └── words_en.json │ │ │ ├── fr/ │ │ │ │ ├── help_fr.md │ │ │ │ └── words_fr.json │ │ │ ├── pt-BR/ │ │ │ │ ├── help_pt-BR.md │ │ │ │ └── words_pt-BR.json │ │ │ ├── ru/ │ │ │ │ ├── help_ru.md │ │ │ │ └── words_ru.json │ │ │ ├── zh-CN/ │ │ │ │ ├── help_zh-CN.md │ │ │ │ └── words_zh-CN.json │ │ │ └── zh-TW/ │ │ │ ├── help_zh-TW.md │ │ │ └── words_zh-TW.json │ │ ├── demo.vue │ │ ├── editor.vue │ │ ├── index.html │ │ └── index.js │ ├── index.js │ ├── lib/ │ │ ├── config.js │ │ ├── core/ │ │ │ ├── extra-function.js │ │ │ ├── highlight.js │ │ │ ├── hljs/ │ │ │ │ ├── lang.hljs.css.js │ │ │ │ └── lang.hljs.js │ │ │ ├── keydown-listen.js │ │ │ ├── markdown.js │ │ │ ├── onecolumn-event.js │ │ │ ├── sanitizer.js │ │ │ └── to-markdown.js │ │ ├── css/ │ │ │ ├── markdown.css │ │ │ ├── mavon-editor.styl │ │ │ ├── md.css │ │ │ └── scroll.styl │ │ ├── font/ │ │ │ ├── LICENSE.txt │ │ │ ├── README.txt │ │ │ ├── config.json │ │ │ ├── css/ │ │ │ │ ├── animation.css │ │ │ │ ├── fontello-codes.css │ │ │ │ ├── fontello-embedded.css │ │ │ │ ├── fontello-ie7-codes.css │ │ │ │ ├── fontello-ie7.css │ │ │ │ └── fontello.css │ │ │ └── demo.html │ │ ├── lang/ │ │ │ ├── de/ │ │ │ │ ├── help_de.md │ │ │ │ └── words_de.json │ │ │ ├── en/ │ │ │ │ ├── help_en.md │ │ │ │ └── words_en.json │ │ │ ├── fr/ │ │ │ │ ├── help_fr.md │ │ │ │ └── words_fr.json │ │ │ ├── ja/ │ │ │ │ ├── help_ja.md │ │ │ │ └── words_ja.json │ │ │ ├── kr/ │ │ │ │ ├── help_kr.md │ │ │ │ └── words_kr.json │ │ │ ├── pt-BR/ │ │ │ │ ├── help_pt-BR.md │ │ │ │ └── words_pt-BR.json │ │ │ ├── ru/ │ │ │ │ ├── help_ru.md │ │ │ │ └── words_ru.json │ │ │ ├── zh-CN/ │ │ │ │ ├── help_zh-CN.md │ │ │ │ └── words_zh-CN.json │ │ │ └── zh-TW/ │ │ │ ├── help_zh-TW.md │ │ │ └── words_zh-TW.json │ │ ├── mixins/ │ │ │ └── markdown.js │ │ ├── toolbar_left_click.js │ │ ├── toolbar_right_click.js │ │ └── util.js │ └── mavon-editor.vue ├── tests/ │ └── unit/ │ ├── __snapshots__/ │ │ └── mavon-editor.spec.js.snap │ ├── base.spec.js │ └── mavon-editor.spec.js └── webpack/ ├── webpack.base.js ├── webpack.build.js └── webpack.dev.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .babelrc ================================================ { "presets": [ ["env", { "modules": false }], [ "babel-preset-env", { "targets": { "node": "current" } } ], "stage-2" ], "plugins": ["transform-runtime"], "comments": false } ================================================ FILE: .eslintrc.js ================================================ // http://eslint.org/docs/user-guide/configuring module.exports = { root: true, parser: 'babel-eslint', parserOptions: { sourceType: 'module' }, env: { browser: true, }, // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style extends: 'standard', // required to lint *.vue files plugins: [ 'html' ], // add your custom rules here 'rules': { // allow paren-less arrow functions 'arrow-parens': 0, // allow async-await 'generator-star-spacing': 0, // allow debugger during development 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, // 忽略; 'semi':0, // 忽略缩进 'indent':0, // camel case 'camelcase':0, // 键值对:后强制空格 'key-spacing':0, // ,前不允许空格 'comma-spacing':0, // 函数空格 'space-before-function-paren':0, // 'no-unused-vars':0, // else 强制换行 'brace-style':0, 'no-unneeded-ternary': 0, 'quotes': 0, 'no-useless-escape': 0, 'no-eval': 0, // 允许多个空格 'no-multi-spaces': 0 } } ================================================ FILE: .gitattributes ================================================ *.js linguist-language=Vue *.css linguist-language=Vue *.html linguist-language=Vue *.vue linguist-language=Vue *.less linguist-language=Vue *.sass linguist-language=Vue ================================================ FILE: .github/ISSUE_TEMPLATE/bug_template.md ================================================ --- name: 🐛 Bug report about: Create a report to help us improve title: '[Bug] XYZ' labels: ':bug: Bug' --- ## 🐛 Bug Report **Steps To Reproduce** **Screenshots** **The expected behaviour** **Possible solution (optional, but very helpful)** ================================================ FILE: .github/ISSUE_TEMPLATE/feature_template.md ================================================ --- name: 🚀 Feature Proposal title: '[Feature] XYZ' labels: ':rocket: Feature Request' about: Submit a proposal for a new feature --- ## 🚀 Feature Proposal A clear and concise description of what the feature is. **Motivation** Please outline the motivation for the proposal. **Example** Please provide an example for how this feature would be used. ================================================ FILE: .github/ISSUE_TEMPLATE/question_template.md ================================================ --- name: 💬 Questions / Help title: '[Question] XYZ' label: ':speech_balloon: Question' about: Ask us a question --- ## 💬 Questions and Help ================================================ FILE: .github/workflows/gha.yml ================================================ name: CI on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: install dependence run: | yarn install --no-lockfile - name: run eslint run: | yarn lint - name: run test run: | yarn test ================================================ FILE: .gitignore ================================================ /node_modules/* /.idea/* npm-debug.log git-debug.log package-lock.json .idea/ .DS_Store .ftpconfig *.swp /tests/unit/coverage/* dist ================================================ FILE: .npmignore ================================================ /node_modules/* /.idea/* /.git/* /img/* /src/dev/* LICENSE npm-debug.log git-debug.log ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2017 hinesboy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: LOG.md ================================================ # 更新日志 - **2.10.4** (21.12.16) - refactor: provides a standard interface to get markdown-it by @jiawulin001 in https://github.com/hinesboy/mavonEditor/pull/750 - doc: update maekdown.md by @wangsongc in https://github.com/hinesboy/mavonEditor/pull/751 - **2.10.3** (21.12.14) - fix: error while uploading image by @wangsongc in https://github.com/hinesboy/mavonEditor/pull/748 - **2.10.2** (21.12.14) - fix: Add sanitizer for filtering HTML tags by @jiawulin001 in https://github.com/hinesboy/mavonEditor/pull/744 - **2.10.1** (21.12.04) - fix build warnings and optimize console output by @jiawulin001 in https://github.com/hinesboy/mavonEditor/pull/728 - fix: image cannot be previewed by @jiawulin001 in https://github.com/hinesboy/mavonEditor/pull/738 - fix: Fix the content of code blocks to be displayed outside the pre container by @jiawulin001 in https://github.com/hinesboy/mavonEditor/pull/730 - **2.10.0** (21.11.23) Enable XSS defense by default, It also fixes the invalidity of codestyle caused by XSS protection. - fix eslint error by @ygj6 in https://github.com/hinesboy/mavonEditor/pull/637 - Test framework by @wangsongc in https://github.com/hinesboy/mavonEditor/pull/668 - fix issue#658,重构插入代码块逻辑 by @ygj6 in https://github.com/hinesboy/mavonEditor/pull/661 - Bump elliptic from 6.5.3 to 6.5.4 by @dependabot in https://github.com/hinesboy/mavonEditor/pull/677 - Fixed pop-up style issues when pages use multiple editors by @wangsongc in https://github.com/hinesboy/mavonEditor/pull/667 - fix eslint error and testcase by @ygj6 in https://github.com/hinesboy/mavonEditor/pull/679 - fix: codeStyle not working by @wangsongc in https://github.com/hinesboy/mavonEditor/pull/717 - feat: Add support for highlightjs v11.3.1 by @wangsongc in https://github.com/hinesboy/mavonEditor/pull/718 - Update upload-images.md [replace `in` by `of` for multiple files upload] by @Sequoya42 in https://github.com/hinesboy/mavonEditor/pull/698 - Clean up invalid code by @jiawulin001 in https://github.com/hinesboy/mavonEditor/pull/720 - update highlight style list by @jiawulin001 in https://github.com/hinesboy/mavonEditor/pull/721 - Bump y18n from 3.2.1 to 3.2.2 by @dependabot in https://github.com/hinesboy/mavonEditor/pull/681 - Bump lodash from 4.17.19 to 4.17.21 by @dependabot in https://github.com/hinesboy/mavonEditor/pull/694 - Bump hosted-git-info from 2.8.8 to 2.8.9 by @dependabot in https://github.com/hinesboy/mavonEditor/pull/695 - Bump path-parse from 1.0.6 to 1.0.7 by @dependabot in https://github.com/hinesboy/mavonEditor/pull/708 - Bump dns-packet from 1.3.1 to 1.3.4 by @dependabot in https://github.com/hinesboy/mavonEditor/pull/700 - Adjust the list of npm install package by @jiawulin001 in https://github.com/hinesboy/mavonEditor/pull/722 - Optimization project by @jiawulin001 in https://github.com/hinesboy/mavonEditor/pull/724 - Feat: Enable XSS defense by default by @XLCYun in https://github.com/hinesboy/mavonEditor/pull/611 - test: add xss test by @wangsongc in https://github.com/hinesboy/mavonEditor/pull/726 - **2.9.1** (20.12.28) - 修复codestyle切换不生效bug PR #650 - 插入代码块时增加换行 PR #641 - 修复帮助文档区域点击锚点导致页面关闭 PR #640 - 对传入的value增加空处理 PR #639 - **2.9.0** (20.4.20) - 将xss组件设置为prop - 去除 markdown-it-sanitizer - **2.8.3** (20.4.5) - 调整整体默认字号为14px - **2.8.2** (20.4.5) - 语言切换bug - **2.8.1** (20.4.5) - xss 过滤规则改进 - **2.8.0** (20.4.1) - 合并PR(感谢帮助维护mavon的朋友) - 更新部分依赖 - 部署演示网页 - **2.7.7** (19.10.23) - 修复图片预览覆盖不生效问题 - **2.7.6** (19.9.12) - [pr #478](https://github.com/hinesboy/mavonEditor/pull/478) - **2.7.5** (19.6.12) - [pr #421](https://github.com/hinesboy/mavonEditor/pull/421) - [pr #428](https://github.com/hinesboy/mavonEditor/pull/428) - [pr #430](https://github.com/hinesboy/mavonEditor/pull/430) - **2.7.4** (19.4.30) - [pr #415](https://github.com/hinesboy/mavonEditor/pull/415) - [pr #417](https://github.com/hinesboy/mavonEditor/pull/417) - **2.7.3** (19.3.28) - 添加shortCut控制快捷键的开关 - 修复自定义图片上传bug - 修复多次触发change事件bug - **2.7.2** 合并Pull Request(19.3.19) - [pr #404](https://github.com/hinesboy/mavonEditor/pull/404) - **2.7.0** 合并Pull Request(19.3.12) - [pr #400](https://github.com/hinesboy/mavonEditor/pull/400) - **2.7.0** 合并Pull Request(19.3.5) - [pr #394](https://github.com/hinesboy/mavonEditor/pull/394) - [pr #377](https://github.com/hinesboy/mavonEditor/pull/377) - [pr #395](https://github.com/hinesboy/mavonEditor/pull/395) - [pr #342](https://github.com/hinesboy/mavonEditor/pull/342) - [pr #369](https://github.com/hinesboy/mavonEditor/pull/369) - [pr #339](https://github.com/hinesboy/mavonEditor/pull/339) - [pr #332](https://github.com/hinesboy/mavonEditor/pull/339) - [pr #331](https://github.com/hinesboy/mavonEditor/pull/331) - **2.6.16** 合并Pull Request(18.8.18) - [pr #303](https://github.com/hinesboy/mavonEditor/pull/303) - [pr #302](https://github.com/hinesboy/mavonEditor/pull/302) - **2.6.12** 修复issues(18.7.3) - [issue #276](https://github.com/hinesboy/mavonEditor/pull/276) - [issue #275](https://github.com/hinesboy/mavonEditor/pull/275) - **2.6.11** [pr #274](https://github.com/hinesboy/mavonEditor/pull/274)(18.7.1) - **2.6.9** 增加toc插件(18.6.15) - **2.6.7** 处理粗体+斜体不生效问题(18.6.15) - [issue #264](https://github.com/hinesboy/mavonEditor/pull/264) - **2.6.6** PR合并(18.6.15) - [pr #266](https://github.com/hinesboy/mavonEditor/pull/266) - [pr #265](https://github.com/hinesboy/mavonEditor/pull/265) - **2.6.5** 修复issues(18.6.6) - [issue #257](https://github.com/hinesboy/mavonEditor/pull/257) - [issue #256](https://github.com/hinesboy/mavonEditor/pull/256) - [issue #255](https://github.com/hinesboy/mavonEditor/pull/255) - [issue #253](https://github.com/hinesboy/mavonEditor/pull/253) - [issue #246](https://github.com/hinesboy/mavonEditor/pull/246) - **2.6.4** [issue #248](https://github.com/hinesboy/mavonEditor/pull/48)(18.6.1) - **2.6.3** [issue #231](https://github.com/hinesboy/mavonEditor/pull/231)(18.5.10) - **2.6.2** (18.5.9) - 修改添加链接与添加图片的弹出框文字描述 - 添加todo list语法插件 - 默认图片预览的关闭修改为点击即关闭 - 略微调整获取markdownIt对象的方式 - readme添加语法拓展的板块 - **2.6.0** 优化图片上传 (18.5.7) - **2.5.10** 添加props: boxShadow控制样式 (18.5.1) - **2.5.9** 添加删除行快捷键 [Ctrl + D](18.4.24) - **2.5.8** 有序、无序列表优化(18.4.24) - 添加【Enter】、【Tab】、【Shift+Tab】键对列表的操作,简化编写过程 - 允许选中多行文本添加列表样式 - TAB修改为插入制表符(原为4个空格) - **2.5.6** 工具栏按钮修改(18.4.22) - 将【标题按钮】修改为【标题下拉选择】,可以选择1~6级标题 - 将`click`触发下拉框,修改为`hover`触发 - 标题语法去除闭合# - **2.5.5** PR合并(18.4.19) - [#213](https://github.com/hinesboy/mavonEditor/pull/213) - **2.5.4** 问题修复 / PR合并(18.4.18) - [issue #210](https://github.com/hinesboy/mavonEditor/pull/210) - [issue #208](https://github.com/hinesboy/mavonEditor/pull/208) - [pr #211](https://github.com/hinesboy/mavonEditor/pull/211) - [pr #206](https://github.com/hinesboy/mavonEditor/pull/206) - **2.5.3** 问题修复(18.4.11) - [#203](https://github.com/hinesboy/mavonEditor/pull/203) - [#202](https://github.com/hinesboy/mavonEditor/pull/202) - 个别类选择器名称更换 - 图标样式垂直居中 - **2.5.2** 合并PR(18.3.14) - [#160](https://github.com/hinesboy/mavonEditor/pull/160) - [#161](https://github.com/hinesboy/mavonEditor/pull/161) - **2.5.1** 问题修复(18.3.5) - 点击图片自定义事件 - 添加Prop navigation 默认展示目录 - 修改Prop 以及 Event 的命名规范(老版本不兼容) - **2.4.15** 解决图片下拉菜单在火狐浏览器兼容性问题(17.12.22) - **2.4.14** 细节性调整(17.12.20) - 在mavon最外层添加样式`text-align: left`,防止受到外部样式影响 - 单双栏切换逻辑调整,单双栏切换更加合理 - 去除自动切换单双栏逻辑(在 `width < 768px`变单栏) - 添加链接、图片链接弹出页面优化,支持TAB键、回车键操作 - 上传图片限制文件格式为`gif,jpeg,jpg,png,svg` - fix [#157](https://github.com/hinesboy/mavonEditor/issues/157)(17.12.19 [CHENXCHEN](https://github.com/CHENXCHEN)) - fix [#156](https://github.com/hinesboy/mavonEditor/issues/156)(17.12.19 [CHENXCHEN](https://github.com/CHENXCHEN)) - **2.4.13** 修复bug[#79](https://github.com/hinesboy/mavonEditor/issues/79), 修改`markdown-it`实例获取方式,引入插件`markdown-it-highlightjs-external`(17.12.12 [CHENXCHEN](https://github.com/CHENXCHEN)) - **2.4.11** 修复bug[#147](https://github.com/hinesboy/mavonEditor/issues/147)(17.12.7 [CHENXCHEN](https://github.com/CHENXCHEN)) - **2.4.10** 添加图片名正则过滤(17.12.6) - **2.4.9** 删除上传图片时同时删除其文本(17.12.2) - **2.4.8** 将链接打开方式调整为新界面打开, 整改图片上传样式, 增加直接添加链接方式(17.12.2) - **2.4.7** 修改外链使用方式,将`katex`提取出来作为外链(17.11.27 [CHENXCHEN](https://github.com/CHENXCHEN)) - **2.4.6** 修复导出markdownIt不正确的错误(17.11.25 [CHENXCHEN](https://github.com/CHENXCHEN)) - **2.4.5** 修改webpack配置,修复编译导出时的`const`问题(17.11.25 [CHENXCHEN](https://github.com/CHENXCHEN)) - **2.4.3** 添加图片点击预览原图、开放markdown-it对象(17.11.24) - **2.4.2** 修复`github-markdown-css`与`hljs-css`的冲突,提供一种自定义按需加载`hljs`以及`markdown`相关文件的方式(17.11.24 [CHENXCHEN](https://github.com/CHENXCHEN)) - **2.4.0** 抛弃集成`hljs`,改为使用`cdnjs`外链,代码高亮方案也改为使用`cdnjs`外链(17.11.22 [CHENXCHEN](https://github.com/CHENXCHEN)) - **2.3.1** 修复帮助文档链接无法跳转问题 [#125](https://github.com/hinesboy/mavonEditor/issues/125)(17.11.14 ) - **2.3.0** 解决const关键字报错问题 (17.10.27 / [lwdgit](https://github.com/lwdgit)) - **2.2.10** 更新babel-preset-env配置 (17.10.17) - **2.2.8** 添加TAB缩进[#75](https://github.com/hinesboy/mavonEditor/issues/75) (17.9.29) - **2.2.7** 修复[#88](https://github.com/hinesboy/mavonEditor/issues/88) (17.9.26) - **2.2.6** 修复[#57](https://github.com/hinesboy/mavonEditor/issues/57) (17.9.11) - **2.2.5** 合并贡献[65](https://github.com/hinesboy/mavonEditor/pull/65), 修复[#66](https://github.com/hinesboy/mavonEditor/issues/66), [#61](https://github.com/hinesboy/mavonEditor/issues/61)(17.9.10 / [cyy0418](https://github.com/cyy0418), [CHENXCHEN](https://github.com/CHENXCHEN)) - **2.2.4** 合并贡献[52](https://github.com/hinesboy/mavonEditor/pull/52), 给 ``` > [more ways...](./doc/en/use.md) > [set markdown-it object...](./doc/en/markdown.md) ## API ### props | name | type | default value | describe | | -------- | :---------: | :------------: | ------- | | value | String | | Initial value | | language | String | zh-CN | Language switch, zh-CN: Simplified Chinese, zh-TW: Traditional Chinese, en: English, fr: French, pt-BR: Brazilian Portuguese, ru: Russian, de: German, ja: Japanese | | fontSize | String | 14px | font-size of edit area | | scrollStyle| Boolean | true | Open the scroll bar style(Temp only support chrome) | | boxShadow | Boolean | true | css: box-shadow of mavonEditor | | subfield | Boolean | true | true: Double columns - Edit preview same screen , Single Columns - otherwise not | | defaultOpen | String | |Default display area in single columns (subfield=false).
edit: default show edit area
preview: default show preview area
other = edit | | placeholder | String | Begin editing... | The default prompt text when the textarea is empty | | editable | Boolean | true | Edit switch | | codeStyle | String | code-github | markdown Style: default github, [option hljs color scheme](./src/lib/core/hljs/lang.hljs.css.js) | | toolbarsFlag | Boolean | true | Show toolbars | | navigation | Boolean | false | Show navigation | | shortCut | Boolean | true | shortcut switch | | ishljs | Boolean | true | highlight code switch | | imageFilter | Function | null | Image file filter Function, params is a `File Object`, you should return `Boolean` about the test result | | imageClick | function | null | Image Click Function | | tabSize | Number | null | How many spaces equals one tab, default \t | | html | Boolean | true | Enable HTML tags in source, for historical reasons this tag has always been true by default, but it is recommended to turn it off if you don't need this feature, as doing so it eliminates the security vulnerabilities altogether. | | xssOptions | Object | {} | xss rules configuration, enabled by default, set to false to turn off, enabled will filter HTML tags, the default filter all HTML tag attributes, it is recommended to configure the whitelist on demand to reduce the possibility of being attacked.
- custom rule reference: [https://jsxss.com/zh/options.html](https://jsxss.com/zh/options.html)
- Demo: [dev-demo](./src/dev/editor.vue) | | toolbars | Object | As in the following example | toolbars | #### toolbars The default toolbar properties are all true, You can customize the object to cover them. ```javascript /* eg: { bold: true, italic: true, header: true, } At this point, the toolbar only displays the three function keys. */ toolbars: { bold: true, italic: true, header: true, underline: true, strikethrough: true, mark: true, superscript: true, subscript: true, quote: true, ol: true, ul: true, link: true, imagelink: true, code: true, table: true, fullscreen: true, readmodel: true, htmlcode: true, help: true, /* 1.3.5 */ undo: true, redo: true, trash: true, save: true, /* 1.4.2 */ navigation: true, /* 2.1.8 */ alignleft: true, aligncenter: true, alignright: true, /* 2.2.1 */ subfield: true, preview: true } ``` If you need to customize and add toolbar buttons, you can do the following: ```vue ``` ### events | name | params | describe| | -------- | :---------: | ------- | | change | String: value , String: reder | Edit area change callback event (render: Html source code) | | save | String: value , String: reder | Ctrl+s and click save button | | fullScreen | Boolean: status , String: value | Fullscreen editing toggle callback event(boolean: Fullscreen status) | | readModel | Boolean: status , String: value | Reading mode toggle callback event(boolean: Reading mode status) | | htmlCode | Boolean: status , String: value |Html code mode toggle callback event(boolean: status) | | subfieldToggle | Boolean: status , String: value | Double columns edit mode toggle callback event(boolean: double columns status) | | previewToggle | Boolean: status , String: value | Preview & Edit toggle callback event(boolean: preview status) | | helpToggle | Boolean: status , String: value | Help-me toggle callback event(boolean: help status) | | navigationToggle | Boolean: status , String: value | Navigation mode toggle callback event(boolean: nav status) | | imgAdd | Number: pos, [File](https://developer.mozilla.org/en-US/docs/Web/API/File): imgfile | Add image file callback event(pos: position in the list of images, File: File Object) | | imgDel | Array(2):[Number: pos,[File](https://developer.mozilla.org/en-US/docs/Web/API/File):imgfile ] | Delete image file callback event(Array(2): An array of length 2,the first is `pos`: position in the list of images, the second is `file`: File Object) | ### Hightlight > If you do not need code highlighting, you need set ishljs to false Set ishljs = true ```vue     ``` For optimize the size of pack, since **v2.4.2**, the following files will default to using `cdnjs` outside the chain: + `highlight.js` + `github-markdown-css` + `katex`(**v2.4.7**) The language parsing files and code highlighting in Code Highlighting `highlight.js` will be loaded on demand. `github-markdown-css` and` katex` will load only when mounted. **Notice**: [Option hljs color scheme](./src/lib/core/hljs/lang.hljs.css.js) and [Supported language](./src/lib/core/hljs/lang.hljs.js) is export from [highlight.js/9.12.0](https://github.com/isagalaev/highlight.js/tree/master/src) > [without cdn, Click here to local on-demand loading...](./doc/en/no-cnd.md) ### Upload images ```vue ``` > [more info about upload images ...](./doc/en/upload-images.md) ### Note - **Default size: min-height: 300px , min-width: 300px , Can be covered** - **z-index: 1500** - **Just for show html of md: toolbarsFlag: false , subfield: false, defaultOpen: "preview"** ### keyboard shortcuts | key | keycode | fun | | ---------------- | :----------------: | :-----------------------------: | | F8 | 119 | toggle navigation | | F9 | 120 | toggle [edit/preview] | | F10 | 121 | toggle fullscreen | | F11 | 122 | toggle readModel | | F12 | 123 | toggle [double columns / single column] | | TAB | 9 | \t | | CTRL + S | 17 + 83 | @save | | CTRL + D | 17 + 68 | remove selected lines | | CTRL + Z | 17 + 90 | prev step | | CTRL + Y | 17 + 89 | next step | | CTRL + BreakSpace | 17 + 8 | trash | | CTRL + B | 17 + 66 | \*\*Bold\*\* | | CTRL + I | 17 + 73 | \*Italic\* | | CTRL + H | 17 + 72 | # Header | | CTRL + U | 17 + 85 | ++Underline++ | | CTRL + M | 17 + 77 | ==Mark== | | CTRL + Q | 17 + 81 | > Quote | | CTRL + O | 17 + 79 | 1. OL | | CTRL + L | 17 + 76 | \[Link title\](Link url) | | CTRL + ALT + S | 17 + 18 + 83 | ^Superscript^ | | CTRL + ALT + U | 17 + 18 + 85 | - UL | | CTRL + ALT + C | 17 + 18 + 67 | \`\`\` Code block | | CTRL + ALT + L | 17 + 18 + 76 | \!\[Image title\](Image link) | | CTRL + ALT + T | 17 + 18 + 84 | Table | | CTRL + SHIFT + S | 17 + 16 + 83 | ~Subscript~ | | CTRL + SHIFT + D | 17 + 16 + 68 | \~\~Strikethrough\~\~ | | CTRL + SHIFT + C | 17 + 16 + 67 | align center | | CTRL + SHIFT + L | 17 + 16 + 76 | align left | | CTRL + SHIFT + R | 17 + 16 + 82 | align right | | SHIFT + TAB | 16 + 9 | remove \t | ## Dependencies - [markdown-it](https://github.com/markdown-it/markdown-it) - [auto-textarea](https://github.com/hinesboy/auto-textarea) ## Syntax extensions - [emoji](https://github.com/markdown-it/markdown-it-emoji) - [subscript](https://github.com/markdown-it/markdown-it-sub) - [superscript](https://github.com/markdown-it/markdown-it-sup) - [container](https://github.com/markdown-it/markdown-it-container) - [definition list](https://github.com/markdown-it/markdown-it-deflist) - [abbreviation](https://github.com/markdown-it/markdown-it-abbr) - [footnote](https://github.com/markdown-it/markdown-it-footnote) - [insert](https://github.com/markdown-it/markdown-it-ins) - [mark](https://github.com/markdown-it/markdown-it-mark) - [todo list](https://github.com/revin/markdown-it-task-lists) - [highlight](https://github.com/isagalaev/highlight.js) - [katex](https://github.com/Khan/KaTeX) - [images preview](https://github.com/CHENXCHEN/markdown-it-images-preview) - [toc](https://github.com/tylerlong/markdown-it-toc) > 可通过获取[markdown-it](./doc/cn/markdown.md)对象引入[其他语法插件](https://www.npmjs.com/search?q=keywords:markdown-it-plugin) ## Collaborators - [CHENXCHEN](https://github.com/CHENXCHEN) - [ygj6](https://github.com/ygj6) - [yukaige](https://github.com/yukaige) ## License mavonEditor is open source and released under the MIT License. Copyright (c) 2017 hinesboy ================================================ FILE: README.md ================================================ # mavonEditor | Vue2 | [![npm](https://img.shields.io/npm/v/mavon-editor/latest.svg)](https://www.npmjs.com/package/mavon-editor/v/latest) | | ---- | ------------------------------------------------------------ | | **Vue3** | [![npm](https://img.shields.io/npm/v/mavon-editor/next.svg)](https://www.npmjs.com/package/mavon-editor/v/next) | ### [English Documents](./README-EN.md) [Demo for jsfiddle](https://jsfiddle.net/CHENXCHEN/qf7gLw3a/3/) ## example (图片展示) ### PC ![PC](./img/cn/cn-common.png) ![PC](./img/cn/cn-image.gif) > [查看更多图片点击这里...](./doc/cn/images.md) ### Install mavon-editor (安装) ``` $ npm install mavon-editor --save ``` ### Use (如何引入) `index.js`: ```javascript // 全局注册 // import with ES6 import Vue from 'vue' import mavonEditor from 'mavon-editor' import 'mavon-editor/dist/css/index.css' // use Vue.use(mavonEditor) new Vue({ 'el': '#main', data() { return { value: '' } } }) ``` `index.html` ```html
``` ### 如何在nuxt.js 中使用 > 首先在工程目录plugins 下新建 vue-mavon-editor.js ```javascrpt import Vue from 'vue'; import mavonEditor from 'mavon-editor'; import 'mavon-editor/dist/css/index.css'; Vue.use(mavonEditor); ``` > 然后在nuxt.config.js 中添加plugins配置 ```javascript plugins: [ ... { src: '@/plugins/vue-mavon-editor', ssr: false } ], ``` > 最后一步在页面或者组件中引入 ```vue ``` > [更多引入方式点击这里...](./doc/cn/use.md) > [如何获取并设置markdown-it对象...](./doc/cn/markdown.md) ## API 文档 ### props | name 名称 | type 类型 | default 默认值 | describe 描述 | | ------------ | :-----: | :---------: | ---------------------------------------- | | value | String | | 初始值 | | language | String | zh-CN | 语言选择,暂支持 zh-CN: 简体中文, zh-TW: 正体中文 , en: 英文 , fr: 法语, pt-BR: 葡萄牙语, ru: 俄语, de: 德语, ja: 日语 | | fontSize | String | 14px | 编辑区域文字大小 | | scrollStyle | Boolean | true | 开启滚动条样式(暂时仅支持chrome) | | boxShadow | Boolean | true | 开启边框阴影 | | boxShadowStyle | String | 0 2px 12px 0 rgba(0, 0, 0, 0.1) | 边框阴影样式 | | transition | Boolean | true | 是否开启过渡动画 | | toolbarsBackground | String | #ffffff | 工具栏背景颜色 | | previewBackground | String | #fbfbfb | 预览框背景颜色 | | subfield | Boolean | true | true: 双栏(编辑预览同屏), false: 单栏(编辑预览分屏) | | defaultOpen | String | |在单栏(`subfield=false`)时默认展示区域.
edit: 默认展示编辑区域,
preview: 默认展示预览区域
其他 = edit | | placeholder | String | 开始编辑... | 输入框为空时默认提示文本 | | editable | Boolean | true | 是否允许编辑 | | codeStyle | String | code-github | markdown样式: 默认github, [可选配色方案](./src/lib/core/hljs/lang.hljs.css.js) | | toolbarsFlag | Boolean | true | 工具栏是否显示 | | navigation | Boolean | false | 默认展示目录 | | shortCut | Boolean | true | 是否启用快捷键 | | autofocus | Boolean | true | 自动聚焦到文本框 | | ishljs | Boolean | true | 代码高亮 | | imageFilter | function | null | 图片过滤函数,参数为一个`File Object`,要求返回一个`Boolean`, `true`表示文件合法,`false`表示文件不合法 | | imageClick | function | null | 图片点击事件,默认为预览,可覆盖 | | tabSize | Number | \t | tab转化为几个空格,默认为\t | | html | Boolean | true | 启用HTML标签,因为历史原因这个标记一直默认为true,但建议不使用HTML标签就关闭它,它能彻底杜绝安全问题。 | | xssOptions | Object | {} | xss规则配置, 默认开启,设置false可以关闭,开启后会对HTML标签进行过滤,默认过滤所有HTML标签属性,建议按需配置白名单减少被攻击的可能。
- 自定义规则参考: [https://jsxss.com/zh/options.html](https://jsxss.com/zh/options.html)
- 参考DEMO: [dev-demo](./src/dev/editor.vue) | | toolbars | Object | 如下例 | 工具栏 | #### toolbars 默认工具栏按钮全部开启, 传入自定义对象,可以选择启用部分按钮 ```javascript /* 例如: { bold: true, // 粗体 italic: true,// 斜体 header: true,// 标题 } 此时, 仅仅显示此三个功能键 */ toolbars: { bold: true, // 粗体 italic: true, // 斜体 header: true, // 标题 underline: true, // 下划线 strikethrough: true, // 中划线 mark: true, // 标记 superscript: true, // 上角标 subscript: true, // 下角标 quote: true, // 引用 ol: true, // 有序列表 ul: true, // 无序列表 link: true, // 链接 imagelink: true, // 图片链接 code: true, // code table: true, // 表格 fullscreen: true, // 全屏编辑 readmodel: true, // 沉浸式阅读 htmlcode: true, // 展示html源码 help: true, // 帮助 /* 1.3.5 */ undo: true, // 上一步 redo: true, // 下一步 trash: true, // 清空 save: true, // 保存(触发events中的save事件) /* 1.4.2 */ navigation: true, // 导航目录 /* 2.1.8 */ alignleft: true, // 左对齐 aligncenter: true, // 居中 alignright: true, // 右对齐 /* 2.2.1 */ subfield: true, // 单双栏模式 preview: true, // 预览 } ``` 如果需要自定义添加工具栏按钮,可以通过以下方式 ```js ``` ### events 事件绑定 | name 方法名 | params 参数 | describe 描述 | | ---------------- | :-----------------------------: | ---------------------------------------- | | change | String: value , String: render | 编辑区发生变化的回调事件(render: value 经过markdown解析后的结果) | | save | String: value , String: render | ctrl + s 的回调事件(保存按键,同样触发该回调) | | fullScreen | Boolean: status , String: value | 切换全屏编辑的回调事件(boolean: 全屏开启状态) | | readModel | Boolean: status , String: value | 切换沉浸式阅读的回调事件(boolean: 阅读开启状态) | | htmlCode | Boolean: status , String: value | 查看html源码的回调事件(boolean: 源码开启状态) | | subfieldToggle | Boolean: status , String: value | 切换单双栏编辑的回调事件(boolean: 双栏开启状态) | | previewToggle | Boolean: status , String: value | 切换预览编辑的回调事件(boolean: 预览开启状态) | | helpToggle | Boolean: status , String: value | 查看帮助的回调事件(boolean: 帮助开启状态) | | navigationToggle | Boolean: status , String: value | 切换导航目录的回调事件(boolean: 导航开启状态) | | imgAdd | Number: pos, [File](https://developer.mozilla.org/en-US/docs/Web/API/File): imgfile | 图片文件添加回调事件(pos: 图片在列表中的位置, File: File Object) | | imgDel | Array(2):[Number: pos,[File](https://developer.mozilla.org/en-US/docs/Web/API/File):imgfile ] | 图片文件删除回调事件(Array(2): 两个元素的数组,第一位是图片在列表中的位置,第二位是File对象) | ### 代码高亮 > 如不需要hightlight代码高亮显示,你应该设置ishljs为false 开启代码高亮props ```vue ``` 为优化插件体积,从**v2.4.2**起以下文件将默认使用`cdnjs`外链: + `highlight.js` + `github-markdown-css` + `katex`(**v2.4.7**) 代码高亮`highlight.js`中的语言解析文件和代码高亮样式将在使用时按需加载. `github-markdown-css`和`katex`仅会在`mounted`时加载 **Notice**: [可选配色方案](./src/lib/core/hljs/lang.hljs.css.js) 和 [支持的语言](./src/lib/core/hljs/lang.hljs.js) 是从 [highlight.js/9.12.0](https://github.com/isagalaev/highlight.js/tree/master/src) 导出的 > [不使用cdn,本地按需加载点击这里...](./doc/cn/no-cnd.md) ### 图片上传 ```vue ``` > [图片上传详情点击这里...](./doc/cn/upload-images.md) ### 注 - **默认大小样式为 min-height: 300px , min-width: 300px 可自行覆盖** - **基础z-index: 1500** - **仅用作展示可以设置props: toolbarsFlag: false , subfield: false, defaultOpen: "preview"** ### 快捷键 | key | keycode | 功能 | | ---------------- | :----------------: | :-----------------------------: | | F8 | 119 | 开启/关闭导航 | | F9 | 120 | 预览/编辑切换 | | F10 | 121 | 开启/关闭全屏 | | F11 | 122 | 开启/关闭阅读模式 | | F12 | 123 | 单栏/双栏切换 | | TAB | 9 | 缩进 | | CTRL + S | 17 + 83 | 触发保存 | | CTRL + D | 17 + 68 | 删除选中行 | | CTRL + Z | 17 + 90 | 上一步 | | CTRL + Y | 17 + 89 | 下一步 | | CTRL + BreakSpace | 17 + 8 | 清空编辑 | | CTRL + B | 17 + 66 | \*\*加粗\*\* | | CTRL + I | 17 + 73 | \*斜体\* | | CTRL + H | 17 + 72 | # 标题 | | CTRL + 1 | 17 + 97 or 49 | # 标题 | | CTRL + 2 | 17 + 98 or 50 | ## 标题 | | CTRL + 3 | 17 + 99 or 51 | ### 标题 | | CTRL + 4 | 17 + 100 or 52 | #### 标题 | | CTRL + 5 | 17 + 101 or 53 | ##### 标题 | | CTRL + 6 | 17 + 102 or 54 | ###### 标题 | | CTRL + U | 17 + 85 | ++下划线++ | | CTRL + M | 17 + 77 | ==标记== | | CTRL + Q | 17 + 81 | > 引用 | | CTRL + O | 17 + 79 | 1. 有序列表 | | CTRL + L | 17 + 76 | \[链接标题\](链接地址) | | CTRL + ALT + S | 17 + 18 + 83 | ^上角标^ | | CTRL + ALT + U | 17 + 18 + 85 | - 无序列表 | | CTRL + ALT + C | 17 + 18 + 67 | \`\`\` 代码块 | | CTRL + ALT + L | 17 + 18 + 76 | \!\[图片标题\](图片链接) | | CTRL + ALT + T | 17 + 18 + 84 | 表格 | | CTRL + SHIFT + S | 17 + 16 + 83 | ~下角标~ | | CTRL + SHIFT + D | 17 + 16 + 68 | \~\~中划线\~\~ | | CTRL + SHIFT + C | 17 + 16 + 67 | 居中 | | CTRL + SHIFT + L | 17 + 16 + 76 | 居左 | | CTRL + SHIFT + R | 17 + 16 + 82 | 居右 | | SHIFT + TAB | 16 + 9 | 取消缩进 | ## Dependencies (依赖) - [markdown-it](https://github.com/markdown-it/markdown-it) - [auto-textarea](https://github.com/hinesboy/auto-textarea) ## Markdown 语法拓展 - [emoji](https://github.com/markdown-it/markdown-it-emoji) - [subscript](https://github.com/markdown-it/markdown-it-sub) - [superscript](https://github.com/markdown-it/markdown-it-sup) - [container](https://github.com/markdown-it/markdown-it-container) - [definition list](https://github.com/markdown-it/markdown-it-deflist) - [abbreviation](https://github.com/markdown-it/markdown-it-abbr) - [footnote](https://github.com/markdown-it/markdown-it-footnote) - [insert](https://github.com/markdown-it/markdown-it-ins) - [mark](https://github.com/markdown-it/markdown-it-mark) - [todo list](https://github.com/revin/markdown-it-task-lists) - [highlight](https://github.com/isagalaev/highlight.js) - [katex](https://github.com/Khan/KaTeX) - [images preview](https://github.com/CHENXCHEN/markdown-it-images-preview) - [toc](https://github.com/tylerlong/markdown-it-toc) > 可通过[获取markdown-it对象](./doc/cn/markdown.md)引入[其他语法插件](https://www.npmjs.com/search?q=keywords:markdown-it-plugin) 可通过[获取markdown-it对象](./doc/cn/markdown.md)引入[其他语法插件](https://www.npmjs.com/search?q=keywords:markdown-it-plugin) ## update(更新内容) - [更新日志](./LOG.md) ## Collaborators(合作者) - [CHENXCHEN](https://github.com/CHENXCHEN) - [ygj6](https://github.com/ygj6) - [yukaige](https://github.com/yukaige) ## License (证书) mavonEditor is open source and released under the MIT License. Copyright (c) 2017 hinesboy ================================================ FILE: SECURITY.md ================================================ # Security Policy ## Supported Versions Security is of the highest importance and all security vulnerabilities or suspected security vulnerabilities should be reported to mavonEditor team privately, to minimize attacks against current users of mavonEditor before they are fixed. Vulnerabilities will be investigated and patched on the next patch (or minor) release as soon as possible. This information could be kept entirely internal to the project. ## Reporting a Vulnerability If you know of a publicly disclosed security vulnerability for mavonEditor, please IMMEDIATELY contact jiawulin@vip.qq.com to inform the mavonEditor Team. IMPORTANT: Do not file public issues on GitHub for security vulnerabilities. ================================================ FILE: _config.yml ================================================ theme: jekyll-theme-cayman ================================================ FILE: doc/cn/images.md ================================================ ## 图片展示 ### PC ![PC](../../img/cn/cn-common.png) ![PC](../../img/cn/cn-nav.png) ![PC](../../img/cn/cn-help.png) #### 链接 & 上传图片 Gif ![PC](../../img/cn/cn-link.gif) ![PC](../../img/cn/cn-drag.gif) ![PC](../../img/cn/cn-image.gif) ### 移动 ![移动](../../img/cn/cn-phone.png)     ![移动](../../img/cn/cn-phone-nav.png) ================================================ FILE: doc/cn/markdown.md ================================================ ## Markdown-It ### 获取mavonEditor中的markdown-it对象 #### 方法1 通过全局引入的mavonEditor获取 ```javascript import MavonEditor from 'mavon-editor' Vue.use(MavonEditor) ... const markdownIt = MavonEditor.mavonEditor.getMarkdownIt() ``` #### 方法2 通过局部引入的mavonEditor获取 ```javascript import { mavonEditor } from 'mavon-editor' const markdownIt = mavonEditor.getMarkdownIt() ``` #### 方法3 通过mavonEditor的实例获取 ```javascript ... const markdownIt = this.refs.md.getMarkdownIt() ``` ### 使用markdown-it对象 > 设置markdown换行格式必须为行尾添加两空格 ``` // markdownIt通过上述方式获取 markdownIt.set({ breaks: false }); ``` > [更多设置参考markdown-it...](https://github.com/markdown-it/markdown-it) ================================================ FILE: doc/cn/no-cnd.md ================================================ ### 本地按需加载 如果你想自己引入而不希望`mavon-editor`加载的话,可以将`externalLink`设置为`false`. 如果想本地按需加载,你需要安装`copy-webpack-plugin`插件(`npm install copy-webpack-plugin -D`) 配置webpack如下所示: (假定`webpack`配置文件位于项目的`/webpack/webpack.js`, 而你希望将`hljs`以及`markdown`相关文件导出位于项目的`/dist/highlightjs`以及`/dist/markdown`目录之下, `katex`和上面一样) ```javascript var CopyWebpackPlugin = require('copy-webpack-plugin'); module.exports = { // ... plugins: [ // ... new CopyWebpackPlugin([{ from: 'node_modules/mavon-editor/dist/highlightjs', to: path.resolve(__dirname, '../dist/highlightjs'), // 插件将会把文件导出于/dist/highlightjs之下 }, { from: 'node_modules/mavon-editor/dist/markdown', to: path.resolve(__dirname, '../dist/markdown'), // 插件将会把文件导出于/dist/markdown之下 }, { from: 'node_modules/mavon-editor/dist/katex', // 插件将会把文件导出 to: path.resolve(__dirname, '../dist/katex') }]), // ... ], // ... } ``` 然后你需要给`mavon-editor`设置`externalLink` 相关代码如下所示: (假定你的`web根目录`位于项目的`/dist/`, 你的网站是`www.site.com`, 那么 `markdown`, `hljs_js`, `hljs_css`, `hljs_lang`, `katex_css`, `katex_js`返回的是你的网站对应文件位置, 比如`www.site.com/markdown/github-markdown.min.css` 对应的文件应该位于项目的`/dist/markdown/github-markdown.min.css`) ```javascript ``` **Notice**: 如果你想禁用`mavon-editor`的自动加载, 可以将`externalLink`设置为`false`或`externalLink`中的某函数值设置为`false` 如: ```javascript export default { // ... data() { return { externalLink: false, // 这里只能为`true`/`false`和一个`Object`, 如果为`true`代表全使用外链且自动加载, 如果为`false`则禁用,如果为`Object`则如上所示 } } // ... } ``` 或者: ```javascript export default { // ... data() { return { externalLink: { hljs_css: function(css) { // 这是你的代码高亮配色文件路径 return '/highlightjs/styles/' + css + '.min.css'; }, katex_css: false, // `false`表示禁用自动加载,它也可以是个函数,如果它是个函数,那么这个函数应该返回一个可访问的`katex`的css路径字符串 // 我们没有设置`katex_js`, `hljs_js`, `hljs_lang`, `markdown_css`, `mavon-editor`会认为它的值为`true`,它会默认使用`cdnjs`相关外链加载 }, } } // ... } ``` ================================================ FILE: doc/cn/upload-images.md ================================================ ### 图片上传 #### 方式1:图片上传至文件服务器 > 每次添加图片触发上传 ```javascript exports default { methods: { // 绑定@imgAdd event $imgAdd(pos, $file){ // 第一步.将图片上传到服务器. var formdata = new FormData(); formdata.append('image', $file); axios({ url: 'server url', method: 'post', data: formdata, headers: { 'Content-Type': 'multipart/form-data' }, }).then((url) => { // 第二步.将返回的url替换到文本原位置![...](0) -> ![...](url) // $vm.$img2Url 详情见本页末尾 $vm.$img2Url(pos, url); }) } } } ``` > 统一上传多张图片 ```javascript exports default { data(){ return { img_file: {} } }, methods: { // 绑定@imgAdd event $imgAdd(pos, $file){ // 缓存图片信息 this.img_file[pos] = $file; }, $imgDel(pos){ delete this.img_file[pos]; }, uploadimg($e){ // 第一步.将图片上传到服务器. var formdata = new FormData(); for(var _img in this.img_file){ formdata.append(_img, this.img_file[_img]); } axios({ url: 'server url', method: 'post', data: formdata, headers: { 'Content-Type': 'multipart/form-data' }, }).then((res) => { /** * 例如:返回数据为 res = [[pos, url], [pos, url]...] * pos 为原图片标志(0) * url 为上传后图片的url地址 */ // 第二步.将返回的url替换到文本原位置![...](0) -> ![...](url) for (var img in res) { // $vm.$img2Url 详情见本页末尾 $vm.$img2Url(img[0], img[1]); } }) }, } } ``` #### 方式2:直接将图片保存为base64编码 ```javascript exports default { data() { return { mdStr: '### demo \n ![image](0)' }; }, mounted() { // 如果原始md字符串中存在曾上传的图片, 则需要将对应中的src替换为base64 this.$nextTick(() => { // $vm.$imgUpdateByUrl 详情见本页末尾 $vm.$imgUpdateByUrl(0, base64内容); } }, methods: { $imgAdd(pos, $file){ // 将图片上传到服务器. var formdata = new FormData(); formdata.append('image', $file); axios({ url: 'server url', method: 'post', data: formdata, headers: { 'Content-Type': 'multipart/form-data' }, }).then((flag) => { }) } } } ``` ### 图片事件 | name 方法名 | params 参数 | describe 描述 | | ---------------- | :-----------------------------: | ---------------------------------------- | | $vm.$refs.toolbar_left.$imgDelByFilename(>=**2.1.6**) | String: filename | 主动删除对应图片文件, 如果成功返回TRUE,否则返回FALSE, (并将其从 `md` 源码中删除 (>=**2.4.16**)) | | $vm.$refs.toolbar_left.$imgAddByFilename(>=**2.1.6**) | String: filename, File: file | 添加对应图片文件,文件别名为filename(filename 必须为 ./filename 样式), 如果成功返回TRUE,否则返回FALSE | | $vm.$refs.toolbar_left.$imgUpdateByFilename(>=**2.1.6**) | String: filename, File: file | 更新对应文件名的图片文件(filename 必须为 ./filename 样式), 如果成功返回TRUE,否则返回FALSE | | $vm.$imgUpdateByUrl(>=**2.1.5**) | String: filename, String: url | 将标签src相对路径值替换为url(如./0 -> http://path/to/png/some.png) | | $vm.$imgAddByUrl(>=**2.1.11**) | String: filename, String: url | 同上(如./0 -> http://path/to/png/some.png) | | $vm.$img2Url(>=**2.1.11**) | String: filename, String: url | 将md源码中图片文件名替换为url(如`![h](./0)` -> `![h](http://path/to/png/some.png)`) | | $vm.$imglst2Url(>=**2.1.11**) | Array: filenameLst | 同上(filenameLst: [[filename, url], ...]) | **注意**: `$vm`指为`mavonEditor`实例,可以通过如下两种方式获取 1. 通过引入对象获取: `import {mavonEditor} from ...` 等方式引入后,此时`$vm`即为`mavonEditor` 2. 通过$refs获取: html声明ref : `, 此时`$vm`为 `this.$refs.md` ================================================ FILE: doc/cn/use.md ================================================ ### Use (如何引入) #### 方法1 `index.js`: ```javascript // 全局注册 // import with ES6 import Vue from 'vue' import mavonEditor from 'mavon-editor' import 'mavon-editor/dist/css/index.css' // use Vue.use(mavonEditor) new Vue({ 'el': '#main', data() { return { value: '' } } }) ``` `index.html` ```html // 下同
``` #### 方法2 `index.js`: ```javascript // 全局注册 // require with Webpack/Node.js ... var mavonEditor = require('mavon-editor') import 'mavon-editor/dist/css/index.css' ... ``` #### 方法3 `editor.vue`: ```javascript ``` `index.js`: ```javascript // 下同 import Vue from 'vue'; var editor = require('./editor.vue'); new Vue({ el: '#main', render: h => h(editor) }); ``` `index.html`: ```html // 下同
``` #### 方法4 `editor.vue`: ```javascript ... ``` ================================================ FILE: doc/en/images.md ================================================ ## Example Pictures ### PC ![PC](../../img/en/en-common.png) ![PC](../../img/en/en-nav.png) ![PC](../../img/en/en-help.png) ### Link & Upload Images Gif ![PC](../../img/en/en-link.gif) ![PC](../../img/en/en-drag.gif) ![PC](../../img/en/en-image.gif) ### Mobile ![Mobile](../../img/en/en-phone.png)     ![Mobile](../../img/en/en-phone-nav.png) ================================================ FILE: doc/en/markdown.md ================================================ ## Markdown-It ### Get the markdown-it object of mavonEditor #### method 1: Global Registration ```javascript import MavonEditor from 'mavon-editor' Vue.use(MavonEditor) ... const markdownIt = MavonEditor.mavonEditor.getMarkdownIt() ``` #### method 2: Local Registration ```javascript import {mavonEditor} from 'mavon-editor' const markdownIt = mavonEditor.getMarkdownIt() ``` #### method 3: Use mavonEditor ref ```javascript ... const markdownIt = this.refs.md.getMarkdownIt() ``` ### Use markdown-it object > eg: set the line break style ``` // get markdownIt as above markdownIt.set({ breaks: false }); ``` > [markdown-it API](https://github.com/markdown-it/markdown-it) ================================================ FILE: doc/en/no-cnd.md ================================================ ### Local on-demand loading You can set `externalLink` to` false` if you want to introduce yourself without wanting `mavon-editor` to load. If you want to load locally, you need to install the `copy-webpack-plugin` plugin (` npm install copy-webpack-plugin -D`) Configuring your `webpack` as below: (We assume your configuration file locate in your project `/webpack/webpack.js`, and you want to export `hljs` and `markdown` files to `/dist/highlightjs` and `/dist/markdown`, `katex` is the same as above) ```javascript var CopyWebpackPlugin = require('copy-webpack-plugin'); module.exports = { // ... plugins: [ // ... new CopyWebpackPlugin([{ from: 'node_modules/mavon-editor/dist/highlightjs', to: path.resolve(__dirname, '../dist/highlightjs'), // plugin will export hljs files into /dist/highlightjs }, { from: 'node_modules/mavon-editor/dist/markdown', to: path.resolve(__dirname, '../dist/markdown'), // plugin will export markdown files into /dist/markdown }, { from: 'node_modules/mavon-editor/dist/katex', // plugin will export katex files into /dist/katex to: path.resolve(__dirname, '../dist/katex') }]), // ... ], // ... } ``` And then you need set `externalLink` to `mavon-editor`, the code is as follows: (We assume your `web root` located in your project `/dist/`, and your website url is `www.site.com`, then `markdown`, `hljs_js`, `hljs_css`, `hljs_lang`, `katex_css`, `katex_js` need return related file locations, for example, the `www.site.com/markdown/github-markdown.min.css` link file should be located in the `/dist/markdown/github-markdown.min.css`) ```javascript ``` **Notice**: If you want to disable `mavon-editor` autoload from `cdnjs`, You can set `externalLink` to` false` or a function in `externalLink` to` false` example: ```javascript export default { // ... data() { return { externalLink: false, // This can only be `true` /` false` and `Object`, if` true` means that all external links are used and loaded automatically, `false` is disabled,` Object` is as shown above } } // ... } ``` or: ```javascript export default { // ... data() { return { externalLink: { hljs_css: function(css) { return '/highlightjs/styles/' + css + '.min.css'; }, katex_css: false, // `false` means that autoloading is disabled, it can also be a function, and if it is a function then this function should return an accessible ` katex` css path string // We do not set `katex_js`,` hljs_js`, `hljs_lang`,` markdown_css`, `mavon-editor` to assume that it has the value` true` and it defaults to loading using `cdnjs` related outerchain. }, } } // ... } ``` ================================================ FILE: doc/en/upload-images.md ================================================ ### Upload images #### method 1: Upload to File server > Each time you add a image to trigger the upload ```javascript exports default { methods: { // bind @imgAdd event $imgAdd(pos, $file){ / step 1. upload image to server. var formdata = new FormData(); formdata.append('image', $file); axios({ url: 'server url', method: 'post', data: formdata, headers: { 'Content-Type': 'multipart/form-data' }, }).then((url) => { // step 2. replace url ![...](./0) -> ![...](url) // $vm.$img2Url. The details at the end of this page $vm.$img2Url(pos, url); }) } } } ``` > Multiple images unified upload ```javascript exports default { data(){ return { img_file: {} } }, methods: { // bind @imgAdd event $imgAdd(pos, $file){ // cache images info this.img_file[pos] = $file; }, $imgDel(pos){ delete this.img_file[pos]; }, uploadimg($e){ // step 1. upload images to server. var formdata = new FormData(); for(var _img in this.img_file){ formdata.append(_img, this.img_file[_img]); } axios({ url: 'server url', method: 'post', data: formdata, headers: { 'Content-Type': 'multipart/form-data' }, }).then((res) => { /** * eg:res = [[pos, url], [pos, url]...] */ // step 2. replace url ![...](0) -> ![...](url) for (var img of res) { // $vm.$img2Url. The details at the end of this page $vm.$img2Url(img[0], img[1]); } }) }, } } ``` #### method 2:base64 ```javascript exports default { data() { return { mdStr: '### demo \n ![image](./0)' }; }, mounted() { // init: replace this.$nextTick(() => { // $vm.$imgUpdateByUrl. The details at the end of this page $vm.$imgUpdateByUrl('./0', base64); } }, methods: { $imgAdd(pos, $file){ // upload image(base64) var formdata = new FormData(); formdata.append('image', $file); axios({ url: 'server url', method: 'post', data: formdata, headers: { 'Content-Type': 'multipart/form-data' }, }).then((flag) => { }) } } } ``` ### image methods | name | params | describe | | ---------------- | :-----------------------------: | ---------------------------------------- | | $vm.$refs.toolbar_left.$imgDelByFilename(>=**2.1.6**) | String: filename | Delete the image by filename, return true if sucess, false otherwise, (and it will remove from `md` (>=**2.4.16**)) | | $vm.$refs.toolbar_left.$imgAddByFilename(>=**2.1.6**) | String: filename, File: file | Add the image by filename (The filename alias style must be "./filename"), return true if sucess, false otherwise | | $vm.$refs.toolbar_left.$imgUpdateByFilename(>=**2.1.6**) | String: filename, File: file | Update the image by filename(The filename alias style must be "./filename"), return true if sucess, false otherwise | | $vm.$imgUpdateByUrl(>=**2.1.6**) | String: filename, String: url | Update filename to url(example: ./0 -> http://path/to/png/some.png) | | $vm.$imgAddByUrl(>=**2.1.11**) | String: filename, String: url | Same as above | | $vm.$img2Url(>=**2.1.11**) | String: filename, String: url | replace filename to url(example: `![h](./0)` -> `![h](http://path/to/png/some.png)`) | | $vm.$imglst2Url(>=**2.1.11**) | Array: filenameLst | Same as above(filenameLst: [[filename, url], ...]) | **Notice**: `$vm` => reference instance of component, you can get it: 1. `import {mavonEditor} from ...`: `$vm` == `mavonEditor` 2. `: `$vm` == `this.$refs.md` ================================================ FILE: doc/en/use.md ================================================ ### Use #### method 1 `index.js`: ```javascript // Global Registration // import with ES6 import Vue from 'vue' import mavonEditor from 'mavon-editor' import 'mavon-editor/dist/css/index.css' // use Vue.use(mavonEditor) new Vue({ 'el': '#main', data() { return { value: '' } } }) ``` `index.html` ```html // The same below
``` #### method 2 `index.js`: ```javascript // Global Registration // require with Webpack/Node.js ... var mavonEditor = require('mavon-editor') import 'mavon-editor/dist/css/index.css' ... ``` #### method 3 `editor.vue`: ```javascript ``` `index.js`: ```javascript // The same below import Vue from 'vue'; var editor = require('./editor.vue'); new Vue({ el: '#main', render: h => h(editor) }); ``` `index.html`: ```html // The same below
``` #### method 4 `editor.vue`: ```javascript ... ``` ================================================ FILE: jest.config.js ================================================ module.exports = { transformIgnorePatterns: ["/node_modules/(?!auto-textarea|@vue|src)"], testMatch: [ "**/tests/unit/*.spec.js" ], verbose: true, moduleFileExtensions: ['js', 'vue', 'md', 'html'], moduleNameMapper: { '\\.(css|scss)$': 'identity-obj-proxy', '^@/(.*)$': '/src/$1' }, transform: { "^.+\\.js$": "/node_modules/babel-jest", "^.+\\.vue$": "/node_modules/vue-jest", '.*\\.(yml|html|md)$': 'jest-raw-loader' }, // setupFiles: ['/tests/unit/setup.js'], coverageDirectory: '/tests/unit/coverage', collectCoverageFrom: [ 'src/**/*.{js,vue}', '!src/main.js', '!src/dev/**', '!**/node_modules/**' ], snapshotSerializers: [ "jest-serializer-vue" ] } ================================================ FILE: mavon-editor.d.ts ================================================ import { Component } from "vue"; interface VueMavonEditor { markdownIt: any; mavonEditor: Component; LeftToolbar: Component; RightToolbar: Component; install: (Vue: any) => any; } declare let editor: VueMavonEditor; export default editor; ================================================ FILE: package.json ================================================ { "name": "mavon-editor", "version": "2.10.5", "description": "Vue markdown editor", "main": "dist/mavon-editor.js", "types": "./mavon-editor.d.ts", "scripts": { "dev": "webpack-dev-server --progress --config webpack/webpack.dev.js", "ci-build": "webpack --progress --config webpack/webpack.build.js", "build": "run-s lint test ci-build", "test": "jest", "test:coverage": "jest --coverage", "lint": "eslint --ext .js,.vue src/", "lint:fix": "eslint --fix --ext .js,.vue src/" }, "repository": { "type": "git", "url": "git+https://github.com/hinesboy/mavonEditor.git" }, "keywords": [ "javascript", "vue", "markdown", "editor", "html" ], "files": [ "dist", "mavon-editor.d.ts", "src" ], "author": "hinesboy", "license": "MIT", "bugs": { "url": "https://github.com/hinesboy/mavonEditor/issues" }, "homepage": "https://github.com/hinesboy/mavonEditor#readme", "dependencies": { "xss": "^1.0.10" }, "devDependencies": { "@vue/test-utils": "^1.1.2", "auto-textarea": "^1.4.0", "autoprefixer": "^8.3.0", "babel-core": "^6.0.0", "babel-eslint": "^8.0.2", "babel-jest": "^23.6.0", "babel-loader": "^7.0.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-polyfill": "^6.26.0", "babel-preset-env": "^1.6.0", "babel-preset-stage-2": "^6.24.1", "copy-webpack-plugin": "^4.2.3", "css-loader": "^0.28.1", "eslint": "^4.11.0", "eslint-config-standard": "^10.2.1", "eslint-plugin-html": "^4.0.0", "eslint-plugin-import": "^2.8.0", "eslint-plugin-node": "^5.2.1", "eslint-plugin-promise": "^3.6.0", "eslint-plugin-standard": "^3.0.1", "extract-text-webpack-plugin": "^2.1.0", "file-loader": "^0.11.1", "github-markdown-css": "^2.6.0", "html-loader": "^0.4.5", "html-webpack-plugin": "^2.28.0", "identity-obj-proxy": "^3.0.0", "jest": "^23.6.0", "jest-raw-loader": "^1.0.1", "jest-serializer-vue": "^2.0.2", "katex": "^0.11.1", "keycode": "^2.1.9", "less": "^2.7.2", "less-loader": "^4.0.4", "markdown-it": "^10.0.0", "markdown-it-abbr": "^1.0.4", "markdown-it-container": "^2.0.0", "markdown-it-deflist": "^2.0.0", "markdown-it-emoji": "^1.1.1", "markdown-it-footnote": "^3.0.1", "markdown-it-for-inline": "~0.1.0", "markdown-it-highlightjs-external": "^1.0.1", "markdown-it-images-preview": "^1.0.0", "markdown-it-ins": "^2.0.0", "markdown-it-katex-external": "^1.0.0", "markdown-it-mark": "^2.0.0", "markdown-it-sub": "^1.0.0", "markdown-it-sup": "^1.0.0", "markdown-it-task-lists": "^2.1.1", "markdown-it-toc": "^1.1.0", "merges-utils": "^1.0.2", "npm-run-all": "^4.1.5", "optimize-css-assets-webpack-plugin": "^1.3.1", "postcss": "^5.0.10", "postcss-advanced-variables": "1.2.2", "postcss-atroot": "^0.1.2", "postcss-color-function": "^3.0.0", "postcss-custom-media": "^5.0.0", "postcss-custom-properties": "^5.0.0", "postcss-custom-selectors": "^3.0.0", "postcss-extend": "^1.0.1", "postcss-loader": "^1.3.3", "postcss-media-minmax": "^2.1.0", "postcss-mixins": "^5.4.1", "postcss-nested": "^1.0.0", "postcss-nested-import": "^0.1.0", "postcss-nesting": "^2.0.6", "postcss-partial-import": "^3.1.1", "postcss-property-lookup": "^1.1.3", "postcss-selector-matches": "^2.0.0", "postcss-selector-not": "^2.0.0", "raw-loader": "^0.5.1", "style-loader": "^0.17.0", "stylus": "^0.54.8", "stylus-loader": "^2.5.1", "url-loader": "^0.5.8", "vue": "^2.3.4", "vue-jest": "^3.0.7", "vue-loader": "^13.7.0", "vue-style-loader": "^3.0.0", "vue-template-compiler": "^2.2.1", "webpack": "^2.4.1", "webpack-bundle-analyzer": "^3.3.2", "webpack-dev-server": "^2.11.5", "webpack-md5-hash": "^0.0.5" } } ================================================ FILE: src/components/md-toolbar-left.vue ================================================ ================================================ FILE: src/components/md-toolbar-right.vue ================================================ ================================================ FILE: src/dev/app.vue ================================================ ================================================ FILE: src/dev/assets/config.js ================================================ /** * Created by zhy on 2017/5/11. */ import help_zh_CN from './lang/zh-CN/help_zh-CN.md' import help_zh_TW from './lang/zh-TW/help_zh-TW.md' import help_en from './lang/en/help_en.md' import help_fr from './lang/fr/help_fr.md' import help_pt_BR from './lang/pt-BR/help_pt-BR.md' import help_ru from './lang/ru/help_ru.md' import help_de from './lang/de/help_de.md' import words_zh_CN from './lang/zh-CN/words_zh-CN.json' import words_zh_TW from './lang/zh-TW/words_zh-TW.json' import words_en from './lang/en/words_en.json' import words_fr from './lang/fr/words_fr.json' import words_pt_BR from './lang/pt-BR/words_pt-BR.json' import words_ru from './lang/ru/words_ru.json' import words_de from './lang/de/words_de.json' export const CONFIG = { 'help_zh-CN': help_zh_CN, 'help_zh-TW': help_zh_TW, 'help_pt-BR': help_pt_BR, 'help_en': help_en, 'help_fr': help_fr, 'help_ru': help_ru, 'help_de': help_de, 'words_zh-CN': words_zh_CN, 'words_zh-TW': words_zh_TW, 'words_pt-BR': words_pt_BR, 'words_en': words_en, 'words_fr': words_fr, 'words_ru': words_ru, 'words_de': words_de } ================================================ FILE: src/dev/assets/lang/de/help_de.md ================================================ @[toc](Catalog) Markdown Handbuch === > Details: [http://commonmark.org/help/](http://commonmark.org/help/) ## **Fett** ``` **fett** __fett__ ``` ## *Kursiv* ``` *kursiv* _kursiv_ ``` ## Überschriften ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## Trennlinien ``` *** --- ``` **** ## ^Hoch^gestellt & ~Tief~gestellt ``` hochgestellt x^2^ tiefgestellt H~2~0 ``` ## ++Unterstrichen++ & ~~Durchgestrichen~~ ``` ++unterstrichen++ ~~durchgestrichen~~ ``` ## ==Markiert== ``` ==markiert== ``` ## Zitat ``` > zitat 1 >> zitat 2 >>> zitat 3 ... ``` ## Liste ``` ol 1. 2. 3. ... ul - - ... ``` ## Todo Liste - [x] aufgabe 1 - [ ] aufgabe 2 ``` - [x] aufgabe 1 - [ ] aufgabe 2 ``` ## Link ``` Text Link [Text](www.baidu.com) Link mit Bild ![Text](http://www.image.com) ``` ## Code \``` Typ Codeblock \``` \` code \` ```c++ int main() { printf("hello world!"); } ``` `code` ## Tabelle ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | links | mitte | rechts | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | links | mitte | rechts | | ---------------------- | ------------- | ----------------- | ## Fußnote ``` hallo[^hallo] ``` Schau zum unteren Rand[^hallo] [^hallo]: fussnote ## Emojis Details: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ Mathematik Formeln lassen sich darstellen z.b. :$x_i + y_i = z_i$ und $\sum_{i=1}^n a_i=0$ Formeln können auf einer eigenen Zeile gerendert werden $$\sum_{i=1}^n a_i=0$$ Details: [katex](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## Layout ::: hljs-left `::: hljs-left` `links` `:::` ::: ::: hljs-center `::: hljs-center` `mitte` `:::` ::: ::: hljs-right `::: hljs-right` `rechts` `:::` ::: ## Liste von Definitionen Term 1 : Definition 1 Term 2 mit *inline markup* : Definition 2 { ein wenig code, teil von Definition 2 } Dritter Absatz von Definition 2. ``` Term 1 : Definition 1 Term 2 mit *inline markup* : Definition 2 { ein wenig code, teil von Definition 2 } Dritter Absatz von Definition 2. ``` ## Abkürzungen *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium Die HTML Spezifikation wird gepflegt vom W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium Die HTML Spezifikation wird gepflegt vom W3C. ``` ================================================ FILE: src/dev/assets/lang/de/words_de.json ================================================ { "start_editor": "Bearbeitung beginnen...", "navigation_title": "Navigation", "tl_bold": "Fett", "tl_italic": "Kursiv", "tl_header": "Überschrift", "tl_header_one": "Überschrift 1", "tl_header_two": "Überschrift 2", "tl_header_three": "Überschrift 3", "tl_header_four": "Überschrift 4", "tl_header_five": "Überschrift 5", "tl_header_six": "Überschrift 6", "tl_underline": "Unterstrichen", "tl_strikethrough": "Durchgestrichen", "tl_mark": "Markiert", "tl_superscript": "Hochgestellt", "tl_subscript": "Tiefgestellt", "tl_quote": "Zitat", "tl_ol": "Ol", "tl_ul": "Ul", "tl_link": "Link", "tl_image": "Link mit Bild", "tl_code": "Code", "tl_table": "Tabelle", "tl_undo": "Rückgängig", "tl_redo": "Wiederherstellen", "tl_trash": "Mülleimer", "tl_save": "Speichern", "tl_navigation_on": "Navigation AN", "tl_navigation_off": "Navigation AUS", "tl_preview": "Vorschau", "tl_aligncenter": "Text zentrieren", "tl_alignleft": "Nach links ausrichten", "tl_alignright": "Nach rechts ausrichten", "tl_edit": "Bearbeiten", "tl_single_column": "Einspaltig", "tl_double_column": "Zweispaltig", "tl_fullscreen_on": "Vollbild AN", "tl_fullscreen_off": "Vollbild AUS", "tl_read": "Lesemodus", "tl_html_on": "HTML AN", "tl_html_off": "HTML AUS", "tl_help": "Markdown Handbuch", "tl_upload": "Bilder-Upload", "tl_upload_remove": "Entfernen", "tl_popup_link_title": "Link hinzufügen", "tl_popup_link_text": "Text des Links", "tl_popup_link_addr": "Linkziel", "tl_popup_img_link_title": "Bild hinzufügen", "tl_popup_img_link_text": "Text des Bildes", "tl_popup_img_link_addr": "Link auf Bild", "tl_popup_link_sure": "Ja", "tl_popup_link_cancel": "Abbruch" } ================================================ FILE: src/dev/assets/lang/en/help_en.md ================================================ @[toc](Catalog) Markdown Guide === > Detailed: [http://commonmark.org/help/](http://commonmark.org/help/) ## **Bold** ``` **bold** __bold__ ``` ## *Italic* ``` *italic* _italic_ ``` ## Header ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## Dividing line ``` *** --- ``` **** ## ^Super^script & ~Sub~script ``` super x^2^ sub H~2~0 ``` ## ++Underline++ & ~~Strikethrough~~ ``` ++underline++ ~~strikethrough~~ ``` ## ==Mark== ``` ==mark== ``` ## Quote ``` > quote 1 >> quote 2 >>> quote 3 ... ``` ## List ``` ol 1. 2. 3. ... ul - - ... ``` ## Todo List - [x] task 1 - [ ] task 2 ``` - [x] task 1 - [ ] task 2 ``` ## Link ``` Text Link [Text](www.baidu.com) Image Link ![Text](http://www.image.com) ``` ## Code \``` type code block \``` \` code \` ```c++ int main() { printf("hello world!"); } ``` `code` ## Table ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | | ---------------------- | ------------- | ----------------- | ## Footnote ``` hello[^hello] ``` Look at the bottom[^hello] [^hello]: footnote ## Emojis Detailed: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ Mathematics We can render formulas for example:$x_i + y_i = z_i$ and $\sum_{i=1}^n a_i=0$ We can also single-line rendering $$\sum_{i=1}^n a_i=0$$ Detailed: [katex](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## Layout ::: hljs-left `::: hljs-left` `left` `:::` ::: ::: hljs-center `::: hljs-center` `center` `:::` ::: ::: hljs-right `::: hljs-right` `right` `:::` ::: ## deflist Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` ## abbr *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` ================================================ FILE: src/dev/assets/lang/en/words_en.json ================================================ { "start_editor": "Begin editing...", "navigation_title": "Navigation", "tl_bold": "Bold", "tl_italic": "Italic", "tl_header": "Header", "tl_header_one": "Header 1", "tl_header_two": "Header 2", "tl_header_three": "Header 3", "tl_header_four": "Header 4", "tl_header_five": "Header 5", "tl_header_six": "Header 6", "tl_underline": "Underline", "tl_strikethrough": "Strikethrough", "tl_mark": "Mark", "tl_superscript": "Superscript", "tl_subscript": "Subscript", "tl_quote": "Quote", "tl_ol": "Ol", "tl_ul": "Ul", "tl_link": "Link", "tl_image": "Image Link", "tl_code": "Code", "tl_table": "Table", "tl_undo": "Undo", "tl_redo": "Redo", "tl_trash": "Trash", "tl_save": "Save", "tl_navigation_on": "Navigation ON", "tl_navigation_off": "Navigation OFF", "tl_preview": "Preview", "tl_aligncenter": "Center text", "tl_alignleft": "Clamp text to the left", "tl_alignright": "Clamp text to the right", "tl_edit": "Edit", "tl_single_column": "Single Column", "tl_double_column": "Double Columns", "tl_fullscreen_on": "FullScreen ON", "tl_fullscreen_off": "FullScreen OFF", "tl_read": "Read Model", "tl_html_on": "HTML ON", "tl_html_off": "HTML OFF", "tl_help": "Markdown Guide", "tl_upload": "Upload Images", "tl_upload_remove": "Remove", "tl_popup_link_title": "Add Link", "tl_popup_link_text": "Link text", "tl_popup_link_addr": "Link address", "tl_popup_img_link_title": "Add Image", "tl_popup_img_link_text": "Image Text", "tl_popup_img_link_addr": "Image Link", "tl_popup_link_sure": "Sure", "tl_popup_link_cancel": "Cancel" } ================================================ FILE: src/dev/assets/lang/fr/help_fr.md ================================================ @[toc](Catalogue) Guide Markdown ============== > Détail : [http://commonmark.org/help/](http://commonmark.org/help/) ## **Bold** ``` **bold** __bold__ ``` ## *Italic* ``` *italic* _italic_ ``` ## Header ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## Dividing line ``` *** --- ``` **** ## ^Super^script & ~Sub~script ``` super x^2^ sub H~2~0 ``` ## ++Underline++ & ~~Strikethrough~~ ``` ++underline++ ~~strikethrough~~ ``` ## ==Mark== ``` ==mark== ``` ## Quote ``` > quote 1 >> quote 2 >>> quote 3 ... ``` ## List ``` ol 1. 2. 3. ... ul - - ... ``` ## Link ## Todo List - [x] Équipe 1 - [ ] Équipe 2 ``` - [x] Équipe 1 - [ ] Équipe 2 ``` ``` Text Link [Text](www.baidu.com) Image Link ![Text](http://www.image.com) ``` ## Code \``` type code block \``` \` code \` ```c++ int main() { printf("hello world!"); } ``` `code` ## Table ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | | ---------------------- | ------------- | ----------------- | ## Footnote ``` hello[^hello] ``` Look at the bottom[^hello] [^hello]: footnote ## Emojis Detailed: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ Mathematics We can render formulas for example:$x_i + y_i = z_i$ and $\sum_{i=1}^n a_i=0$ We can also single-line rendering $$\sum_{i=1}^n a_i=0$$ Detailed: [katex](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## Layout ::: hljs-left `::: hljs-left` `left` `:::` ::: ::: hljs-center `::: hljs-center` `center` `:::` ::: ::: hljs-right `::: hljs-right` `right` `:::` ::: ## deflist Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` ## abbr *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` ================================================ FILE: src/dev/assets/lang/fr/words_fr.json ================================================ { "start_editor": "Début d'édition...", "navigation_title": "Navigation", "tl_bold": "Gras", "tl_italic": "Italique", "tl_header": "Entête", "tl_header_one": "Entête 1", "tl_header_two": "Entête 2", "tl_header_three": "Entête 3", "tl_header_four": "Entête 4", "tl_header_five": "Entête 5", "tl_header_six": "Entête 6", "tl_underline": "Souligné", "tl_strikethrough": "Barré", "tl_mark": "Mark", "tl_superscript": "Exposant", "tl_subscript": "Sous-exposant", "tl_quote": "Quote", "tl_ol": "Liste ", "tl_ul": "Puce", "tl_link": "Lien", "tl_image": "Image Lien", "tl_code": "Code", "tl_table": "Table", "tl_undo": "Annuler", "tl_redo": "Refaire", "tl_trash": "Supprimer", "tl_save": "Sauver", "tl_navigation_on": "Activer la navigation", "tl_navigation_off": "Désactiver le navigation", "tl_preview": "Previsualisé", "tl_aligncenter": "Center le texte", "tl_alignleft": "Férer le texte à gauche", "tl_alignright": "Férer le texte à droite", "tl_preview": "Previsualisé", "tl_edit": "Editer", "tl_single_column": "Seule Colonne", "tl_double_column": "Colonnes Doubles", "tl_fullscreen_on": "Activer le mode plein écran", "tl_fullscreen_off": "Désactiver le mode plein écran", "tl_read": "Lire le modèle", "tl_html_on": "Activer le mode HTML", "tl_html_off": "Désactiver le mode HTML", "tl_help": "Guide Markdown", "tl_upload": "Télécharger les images", "tl_upload_remove": "Supprimer", "tl_popup_link_title": "Ajouter un lien", "tl_popup_link_text": "Description", "tl_popup_link_addr": "Link", "tl_popup_img_link_title": "Ajouter une image", "tl_popup_img_link_text": "Description", "tl_popup_img_link_addr": "Link", "tl_popup_link_sure": "sûr", "tl_popup_link_cancel": "Annuler" } ================================================ FILE: src/dev/assets/lang/pt-BR/help_pt-BR.md ================================================ @[toc](Directory) Guia Markdown === > Detalhes: [http://commonmark.org/help/](http://commonmark.org/help/) ## **Negrito** ``` **negrito** __negrito__ ``` ## *Itálico* ``` *itálico* _itálico_ ``` ## Cabeçalho ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## Linha Divisora ``` *** --- ``` **** ## ^Sobre^scrito & ~Sub~scrito ``` sobre x^2^ sub H~2~0 ``` ## ++Sublinhar++ & ~~Tachar~~ ``` ++sublinhar++ ~~tachar~~ ``` ## ==Marcador== ``` ==marcador== ``` ## Citação ``` > citação 1 >> citação 2 >>> citação 3 ... ``` ## Listas ``` lista Numerada 1. 2. 3. ... lista com marcadores - - ... ``` ## Todo Listas - [x] Tarefa 1 - [ ] Tarefa 2 ``` - [x] Tarefa 1 - [ ] Tarefa 2 ``` ## Link ``` Link Texto [Text](www.baidu.com) Link Imagem ![Text](http://www.image.com) ``` ## Código \``` tipo bloco de código \``` \` código \` ```c++ int main() { printf("hello world!"); } ``` `code` ## Tabela ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | esquerda | centro | direita | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | esquerda | centro | direita | | ---------------------- | ------------- | ----------------- | ## Rodapé ``` olá[^olá] ``` Olhe para baixo[^olá] [^olá]: rodapé ## Emojis Detalhes: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ Mathematics Podemos mostrar fórmulas por exemplo:$x_i + y_i = z_i$ and $\sum_{i=1}^n a_i=0$ Podemos também mostrar em uma única linha: $$\sum_{i=1}^n a_i=0$$ Detalhes: [katex](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## Layout ::: hljs-left `::: hljs-left` `esquerda` `:::` ::: ::: hljs-center `::: hljs-center` `centro` `:::` ::: ::: hljs-right `::: hljs-right` `direita` `:::` ::: ## Definições Termo 1 : Definição 1 Termo 2 com *markup inline* : Definição 2 { um pouco de código, parte da Definição 2 } Terceiro parágrafo da definição 2. ``` Termo 1 : Definição 1 Termo 2 com *markup inline* : Definição 2 { um pouco de código, parte da Definição 2 } Terceiro parágrafo da definição 2. ``` ## Abreviações *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium A especificação HTML é mantida pela W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification é mantida pela W3C. ``` ================================================ FILE: src/dev/assets/lang/pt-BR/words_pt-BR.json ================================================ { "start_editor": "Começar edição...", "navigation_title": "Navegação", "tl_bold": "Negrito", "tl_italic": "Itálico", "tl_header": "Cabeçalho", "tl_header_one": "Cabeçalho 1", "tl_header_two": "Cabeçalho 2", "tl_header_three": "Cabeçalho 3", "tl_header_four": "Cabeçalho 4", "tl_header_five": "Cabeçalho 5", "tl_header_six": "Cabeçalho 6", "tl_underline": "Sublinhar", "tl_strikethrough": "Tachar", "tl_mark": "Marcação", "tl_superscript": "Sobrescrito", "tl_subscript": "Subscrito", "tl_quote": "Citação", "tl_ol": "Lista Numerada", "tl_ul": "Lista com marcadores", "tl_link": "Link", "tl_image": "Link de imagem", "tl_code": "Código", "tl_table": "Tabela", "tl_undo": "Desfazer", "tl_redo": "Refazer", "tl_trash": "Lixo", "tl_save": "Salvar", "tl_navigation_on": "Mostrar Navegação", "tl_navigation_off": "Esconder Navegação", "tl_preview": "Preview", "tl_aligncenter": "Alinhar no centro", "tl_alignleft": "Alinhar à esquerda", "tl_alignright": "Alinhar à direita", "tl_edit": "Editar", "tl_single_column": "Coluna Única", "tl_double_column": "Duas Colunas", "tl_fullscreen_on": "Ligar Tela Cheia", "tl_fullscreen_off": "Desligar Tela Cheia", "tl_read": "Modo de Leitura", "tl_html_on": "Ligar HTML", "tl_html_off": "Desligar HTML", "tl_help": "Guia Markdown", "tl_upload": "Upload de Imagens", "tl_upload_remove": "Remover", "tl_popup_link_title": "Adicionar Link", "tl_popup_link_text": "Descrição", "tl_popup_link_addr": "Link", "tl_popup_img_link_title": "Adicionar fotos", "tl_popup_img_link_text": "Descrição", "tl_popup_img_link_addr": "Link", "tl_popup_link_sure": "Confirmar", "tl_popup_link_cancel": "Cancelar" } ================================================ FILE: src/dev/assets/lang/ru/help_ru.md ================================================ @[toc](Catalog) Markdown помощь === > Подробнее: [http://commonmark.org/help/](http://commonmark.org/help/) ## **Полужирный** ``` **Полужирный** __Полужирный__ ``` ## *Курсив* ``` *Курсив* _Курсив_ ``` ## Заголовок ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## Разделительная линия ``` *** --- ``` **** ## ^Верхний^индекс & ~Нижний~индекс ``` верхний x^2^ нижний H~2~0 ``` ## ++Подчеркнутый++ & ~~Зачеркнутый~~ ``` ++Подчеркнутый++ ~~Зачеркнутый~~ ``` ## ==Отметка== ``` ==Отметка== ``` ## Цитата ``` > Цитата >> Цитата 2 >>> Цитата 3 ... ``` ## Список ``` ol 1. 2. 3. ... ul - - ... ``` ## Список задач - [x] Задача 1 - [ ] Задача 2 ``` - [x] Задача 1 - [ ] Задача 2 ``` ## Ссылка ``` Ссылка [Текст](www.baidu.com) Ссылка изображения ![Текст](http://www.image.com) ``` ## Код \``` type code block \``` \` code \` ```c++ int main() { printf("hello world!");} ``` `code` ## Таблица ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | | ---------------------- | ------------- | ----------------- | ## Сноска ``` Привет[^Привет] ``` Тут что-то непонятное[^Привет] [^Привет]: А тут объяснение ## Emojis Подробнее: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ Mathematics Можно выводить такие формулы:$x_i + y_i = z_i$ and $\sum_{i=1}^n a_i=0$ А также в одну строку: $$\sum_{i=1}^n a_i=0$$ Подробнее: - [katex](http://www.intmath.com/cg5/katex-mathjax-comparison.php) - [katex function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX) - [latex](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## Разметка ::: hljs-left `::: hljs-left` `left` `:::` ::: ::: hljs-center `::: hljs-center` `center` `:::` ::: ::: hljs-right `::: hljs-right` `right` `:::` ::: ## Список определений Термин 1 : Определение 1 Термин 2 с использованием *разметки* : Определение 2 { Какой-нибудь код, часть определения 2 } Третий параграф определения 2. ``` Термин 1 : Определение 1 Термин 2 с использованием *разметки* : Определение 2 { Какой-нибудь код, часть определения 2 } Третий параграф определения 2. ``` ## Сокращения *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` ================================================ FILE: src/dev/assets/lang/ru/words_ru.json ================================================ { "start_editor": "Начните редактирование...", "navigation_title": "Навигация", "tl_bold": "Полужирный", "tl_italic": "Курсив", "tl_header": "Заголовки", "tl_header_one": "Заголовок 1", "tl_header_two": "Заголовок 2", "tl_header_three": "Заголовок 3", "tl_header_four": "Заголовок 4", "tl_header_five": "Заголовок 5", "tl_header_six": "Заголовок 6", "tl_underline": "Подчеркнутый", "tl_strikethrough": "Зачеркнутый", "tl_mark": "Отметка", "tl_superscript": "Верхний индекс", "tl_subscript": "Нижний индекс", "tl_quote": "Цитата", "tl_ol": "Нумерованный список", "tl_ul": "Список", "tl_link": "Ссылка", "tl_image": "Ссылка изображения", "tl_code": "Код", "tl_table": "Таблица", "tl_undo": "Отменить", "tl_redo": "Вернуть", "tl_trash": "Удалить", "tl_save": "Сохранить", "tl_navigation_on": "Показать навигацию", "tl_navigation_off": "Скрыть навигацию", "tl_preview": "Предпросмотр", "tl_aligncenter": "Выровнять по центру", "tl_alignleft": "Выровнять по левому краю", "tl_alignright": "Выровнять по правому краю", "tl_edit": "Редактор", "tl_single_column": "Одно поле", "tl_double_column": "Два поля", "tl_fullscreen_on": "Полноэкранный режим", "tl_fullscreen_off": "Выключить полноэкранный режим", "tl_read": "Режим чтения", "tl_html_on": "Показать HTML", "tl_html_off": "Убрать HTML", "tl_help": "Markdown помощь", "tl_upload": "Загрузить изображение", "tl_upload_remove": "Удалить", "tl_popup_link_title": "Добавить ссылку", "tl_popup_link_text": "Текст ссылки", "tl_popup_link_addr": "Адрес ссылки", "tl_popup_img_link_title": "Локальное изображение", "tl_popup_img_link_text": "Текст изображения", "tl_popup_img_link_addr": "Ссылка изображения", "tl_popup_link_sure": "Добавить", "tl_popup_link_cancel": "Отменить" } ================================================ FILE: src/dev/assets/lang/zh-CN/help_zh-CN.md ================================================ @[toc](目录) Markdown 语法简介 ============= > [语法详解](http://commonmark.org/help/) ## **粗体** ``` **粗体** __粗体__ ``` ## *斜体* ``` *斜体* _斜体_ ``` ## 标题 ``` # 一级标题 # 一级标题 ==== ## 二级标题 ## 二级标题 ---- ### 三级标题 ### #### 四级标题 #### ##### 五级标题 ##### ###### 六级标题 ###### ``` ## 分割线 ``` *** --- ``` **** ## ^上^角~下~标 ``` 上角标 x^2^ 下角标 H~2~0 ``` ## ++下划线++ ~~中划线~~ ``` ++下划线++ ~~中划线~~ ``` ## ==标记== ``` ==标记== ``` ## 段落引用 ``` > 一级 >> 二级 >>> 三级 ... ``` ## 列表 ``` 有序列表 1. 2. 3. ... 无序列表 - - ... ``` ## 任务列表 - [x] 已完成任务 - [ ] 未完成任务 ``` - [x] 已完成任务 - [ ] 未完成任务 ``` ## 链接 ``` [链接](www.baidu.com) ![图片描述](http://www.image.com) ``` ## 代码段落 \``` type 代码段落 \``` \` 代码块 \` ```c++ int main() { printf("hello world!"); } ``` `code` ## 表格(table) ``` | 标题1 | 标题2 | 标题3 | | :-- | :--: | ----: | | 左对齐 | 居中 | 右对齐 | | ---------------------- | ------------- | ----------------- | ``` | 标题1 | 标题2 | 标题3 | | :-- | :--: | ----: | | 左对齐 | 居中 | 右对齐 | | ---------------------- | ------------- | ----------------- | ## 脚注(footnote) ``` hello[^hello] ``` 见底部脚注[^hello] [^hello]: 一个注脚 ## 表情(emoji) [参考网站: https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$公式 我们可以渲染公式例如:$x_i + y_i = z_i$和$\sum_{i=1}^n a_i=0$ 我们也可以单行渲染 $$\sum_{i=1}^n a_i=0$$ 具体可参照[katex文档](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex支持的函数](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex文档](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## 布局 ::: hljs-left `::: hljs-left` `居左` `:::` ::: ::: hljs-center `::: hljs-center` `居中` `:::` ::: ::: hljs-right `::: hljs-right` `居右` `:::` ::: ## 定义 术语一 : 定义一 包含有*行内标记*的术语二 : 定义二 {一些定义二的文字或代码} 定义二的第三段 ``` 术语一 : 定义一 包含有*行内标记*的术语二 : 定义二 {一些定义二的文字或代码} 定义二的第三段 ``` ## abbr *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium HTML 规范由 W3C 维护 ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium HTML 规范由 W3C 维护 ``` ================================================ FILE: src/dev/assets/lang/zh-CN/words_zh-CN.json ================================================ { "start_editor": "开始编辑...", "navigation_title": "导航目录", "tl_bold": "粗体", "tl_italic": "斜体", "tl_header": "标题", "tl_header_one": "一级标题", "tl_header_two": "二级标题", "tl_header_three": "三级标题", "tl_header_four": "四级标题", "tl_header_five": "五级标题", "tl_header_six": "六级标题", "tl_underline": "下划线", "tl_strikethrough": "中划线", "tl_mark": "标记", "tl_superscript": "上角标", "tl_subscript": "下角标", "tl_quote": "段落引用", "tl_ol": "有序列表", "tl_ul": "无序列表", "tl_link": "链接", "tl_image": "添加图片链接", "tl_code": "代码块", "tl_table": "表格", "tl_undo": "上一步", "tl_redo": "下一步", "tl_trash": "清空", "tl_save": "保存", "tl_navigation_on": "开启标题导航", "tl_navigation_off": "关闭标题导航", "tl_preview": "预览", "tl_aligncenter": "居中", "tl_alignleft": "居左", "tl_alignright": "居右", "tl_edit": "编辑", "tl_single_column": "单栏", "tl_double_column": "双栏", "tl_fullscreen_on": "全屏编辑", "tl_fullscreen_off": "退出全屏", "tl_read": "沉浸式阅读", "tl_html_on": "查看html文本", "tl_html_off": "返回markdown文本", "tl_help": "markdown语法帮助", "tl_upload": "上传图片", "tl_upload_remove": "删除", "tl_popup_link_title": "添加链接", "tl_popup_link_text": "链接描述", "tl_popup_link_addr": "链接地址", "tl_popup_img_link_title": "添加图片", "tl_popup_img_link_text": "图片描述", "tl_popup_img_link_addr": "图片链接", "tl_popup_link_sure": "确定", "tl_popup_link_cancel": "取消" } ================================================ FILE: src/dev/assets/lang/zh-TW/help_zh-TW.md ================================================ @[toc](目錄) Markdown 語法簡介 ============= > [語法詳解](http://commonmark.org/help/) ## **粗體** ``` **粗體** __粗體__ ``` ## *斜體* ``` *斜體* _斜體_ ``` ## 標題 ``` # 一級標題 # 一級標題 ==== ## 二級標題 ## 二級標題 ---- ### 三級標題 ### #### 四級標題 #### ##### 五級標題 ##### ###### 六級標題 ###### ``` ## 分割線 ``` *** --- ``` **** ## ^上^角~下~標 ``` 上角標 x^2^ 下角標 H~2~0 ``` ## ++下劃線++ ~~中劃線~~ ``` ++下劃線++ ~~中劃線~~ ``` ## ==標記== ``` ==標記== ``` ## 段落引用 ``` > 一級 >> 二級 >>> 三級 ... ``` ## 列表 ``` 有序列表 1. 2. 3. ... 無序列表 - - ... ``` ## 任務列表 - [x] 已完成任務 - [ ] 未完成任務 ``` - [x] 已完成任務 - [ ] 未完成任務 ``` ## 鏈接 ``` [鏈接](www.baidu.com) ![圖片描述](http://www.image.com) ``` ## 代碼段落 \``` type 代碼段落 \``` \` 代碼塊 \` ```c++ int main() { printf("hello world!"); } ``` `code` ## 表格(table) ``` | 標題1 | 標題2 | 標題3 | | :-- | :--: | ----: | | 左對齊 | 居中 | 右對齊 | | ---------------------- | ------------- | ----------------- | ``` | 標題1 | 標題2 | 標題3 | | :-- | :--: | ----: | | 左對齊 | 居中 | 右對齊 | | ---------------------- | ------------- | ----------------- | ## 腳註(footnote) ``` hello[^hello] ``` 見底部腳註[^hello] [^hello]: 一個註腳 ## 表情(emoji) [參考網站: https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$公式 我們可以渲染公式例如:$x_i + y_i = z_i$和$\sum_{i=1}^n a_i=0$ 我們也可以單行渲染 $$\sum_{i=1}^n a_i=0$$ 具體可參照[katex文檔](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex支持的函數](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex文檔](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## 布局 ::: hljs-left `::: hljs-left` `居左` `:::` ::: ::: hljs-center `::: hljs-center` `居中` `:::` ::: ::: hljs-right `::: hljs-right` `居右` `:::` ::: ## 定義 術語一 : 定義一 包含有*行內標記*的術語二 : 定義二 {一些定義二的文字或代碼} 定義二的第三段 ``` 術語一 : 定義一 包含有*行內標記*的術語二 : 定義二 {一些定義二的文字或代碼} 定義二的第三段 ``` ## abbr *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium HTML 規範由 W3C 維護 ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium HTML 規範由 W3C 維護 ``` ================================================ FILE: src/dev/assets/lang/zh-TW/words_zh-TW.json ================================================ { "start_editor": "開始編輯...", "navigation_title": "導航目錄", "tl_bold": "粗體", "tl_italic": "斜體", "tl_header": "標題", "tl_header_one": "一級標題", "tl_header_two": "二級標題", "tl_header_three": "三級標題", "tl_header_four": "四級標題", "tl_header_five": "五級標題", "tl_header_six": "六級標題", "tl_underline": "下劃線", "tl_strikethrough": "中劃線", "tl_mark": "標記", "tl_superscript": "上角標", "tl_subscript": "下角標", "tl_quote": "段落引用", "tl_ol": "有序列表", "tl_ul": "無序列表", "tl_link": "鏈接", "tl_image": "添加圖片鏈接", "tl_code": "代碼塊", "tl_table": "表格", "tl_undo": "上一步", "tl_redo": "下一步", "tl_trash": "清空", "tl_save": "保存", "tl_navigation_on": "開啟標題導航", "tl_navigation_off": "關閉標題導航", "tl_preview": "預覽", "tl_aligncenter": "居中", "tl_alignleft": "居左", "tl_alignright": "居右", "tl_edit": "編輯", "tl_single_column": "單欄", "tl_double_column": "雙欄", "tl_fullscreen_on": "全屏編輯", "tl_fullscreen_off": "退出全屏", "tl_read": "沈浸式閱讀", "tl_html_on": "查看html文本", "tl_html_off": "返回markdown文本", "tl_help": "markdown語法幫助", "tl_upload": "上傳圖片", "tl_upload_remove": "刪除", "tl_popup_link_title": "添加鏈接", "tl_popup_link_text": "鏈接描述", "tl_popup_link_addr": "鏈接地址", "tl_popup_img_link_title": "添加圖片", "tl_popup_img_link_text": "圖片描述", "tl_popup_img_link_addr": "圖片鏈接", "tl_popup_link_sure": "確定", "tl_popup_link_cancel": "取消" } ================================================ FILE: src/dev/demo.vue ================================================ ================================================ FILE: src/dev/editor.vue ================================================ ================================================ FILE: src/dev/index.html ================================================ md-test
================================================ FILE: src/dev/index.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-05-04T23:26:08+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: index.js * @Last modified by: chc * @Last modified time: 2017-11-25T12:14:56+08:00 * @License: MIT * @Copyright: 2017 */ import Vue from 'vue'; var demo = require('./demo.vue'); var sMd = require('../index.js'); Vue.use(sMd); var app = new Vue({ el: '#main', render: (h) => h(demo) }); ================================================ FILE: src/index.js ================================================ /** * Created by zhy on 2017/4/1. */ 'use strict'; /** * mavonEditor * @author hinesboy */ const mavonEditor = require('./mavon-editor.vue'); const VueMavonEditor = { /** * @deprecated * @see mavonEditor.getMarkdownIt() */ markdownIt: mavonEditor.mixins[0].data().markdownIt, mavonEditor: mavonEditor, LeftToolbar: require('./components/md-toolbar-left'), RightToolbar: require('./components/md-toolbar-right'), install: function(Vue) { Vue.component('mavon-editor', mavonEditor); } }; module.exports = VueMavonEditor; ================================================ FILE: src/lib/config.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-05-06T21:40:39+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: config.js * @Last modified by: CHC * @Last modified time: 2017-05-06T22:12:49+08:00 * @License: MIT * @Copyright: 2017 * @desc 初始化配置项 */ import help_zh_CN from './lang/zh-CN/help_zh-CN.md' import help_zh_TW from './lang/zh-TW/help_zh-TW.md' import help_en from './lang/en/help_en.md' import help_fr from './lang/fr/help_fr.md' import help_pt_BR from './lang/pt-BR/help_pt-BR.md' import help_ru from './lang/ru/help_ru.md' import help_de from './lang/de/help_de.md' import help_ja from './lang/ja/help_ja.md' import help_kr from './lang/kr/help_kr.md' import words_zh_CN from './lang/zh-CN/words_zh-CN.json' import words_zh_TW from './lang/zh-TW/words_zh-TW.json' import words_en from './lang/en/words_en.json' import words_fr from './lang/fr/words_fr.json' import words_pt_BR from './lang/pt-BR/words_pt-BR.json' import words_ru from './lang/ru/words_ru.json' import words_de from './lang/de/words_de.json' import words_ja from './lang/ja/words_ja.json' import words_kr from './lang/kr/words_kr.json' export const CONFIG = { 'help_zh-CN': help_zh_CN, 'help_zh-TW': help_zh_TW, 'help_pt-BR': help_pt_BR, 'help_en': help_en, 'help_fr': help_fr, 'help_ru': help_ru, 'help_de': help_de, 'help_ja': help_ja, 'words_zh-CN': words_zh_CN, 'words_zh-TW': words_zh_TW, 'words_pt-BR': words_pt_BR, 'words_en': words_en, 'words_fr': words_fr, 'words_ru': words_ru, 'words_de': words_de, 'words_ja': words_ja, 'words_kr': words_kr, 'langList': ['en', 'zh-CN', 'zh-TW', 'fr', 'pt-BR', 'ru', 'de', 'ja', 'kr'], 'toolbars': { 'bold': true, 'italic': true, 'header': true, 'underline': true, 'strikethrough': true, 'mark': true, 'superscript': true, 'subscript': true, 'quote': true, 'ol': true, 'ul': true, 'link': true, 'imagelink': true, 'code': true, 'table': true, 'undo': true, 'redo': true, 'trash': true, 'save': true, 'alignleft': true, 'aligncenter': true, 'alignright': true, 'navigation': true, 'subfield': true, 'fullscreen': true, 'readmodel': true, 'htmlcode': true, 'help': true, 'preview': true } }; ================================================ FILE: src/lib/core/extra-function.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-06-14T23:04:34+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: extra-function.js * @Last modified by: CHC * @Last modified time: 2017-12-19T17:46:48+08:00 * @License: MIT * @Copyright: 2017 */ /** * Created by zhy on 2017/4/24. */ /** * textarea 插入内容 */ export const insertTextAtCaret = (obj, {prefix, subfix, str, type}, $vm) => { obj.focus() if (isExistSelectionObj(obj)) { var startPos = obj.selectionStart; var endPos = obj.selectionEnd; var tmpStr = obj.value; if (startPos === endPos) { // 直接插入 obj.value = tmpStr.substring(0, startPos) + prefix + str + subfix + tmpStr.substring(endPos, tmpStr.length); obj.selectionStart = startPos + prefix.length; obj.selectionEnd = startPos + (str.length + prefix.length); } else { // 存在选中区域 if (tmpStr.substring(startPos - prefix.length, startPos) === prefix && tmpStr.substring(endPos, endPos + subfix.length) === subfix && judgeItalicAndBold(prefix, subfix, tmpStr, startPos, endPos)) { // 取消 obj.value = tmpStr.substring(0, startPos - prefix.length) + tmpStr.substring(startPos, endPos) + tmpStr.substring(endPos + subfix.length, tmpStr.length); obj.selectionStart = startPos - prefix.length; obj.selectionEnd = endPos - prefix.length; } else { // 确定 obj.value = tmpStr.substring(0, startPos) + prefix + tmpStr.substring(startPos, endPos) + subfix + tmpStr.substring(endPos, tmpStr.length); obj.selectionStart = startPos + prefix.length; obj.selectionEnd = startPos + (endPos - startPos + prefix.length); } } } else { alert('Error: Browser version is too low') // obj.value += str; } // 触发change事件 $vm.d_value = obj.value obj.focus() } const code_structure = { prefix: "```", subfix: "\n```\n", defaultLanguageText: "language" } export const insertCodeBlock = ($vm) => { let obj = $vm.getTextareaDom(); if (isExistSelectionObj(obj)) { const {defaultLanguageText: language} = code_structure; let { selectionStart: startPos, selectionEnd: endPos, value: tmpStr } = obj; if (startPos === endPos) { // 直接插入 insertCodeBlockToVM(language, "", obj); } else { // 存在选中区域 if (isCancelCodeBlock(obj)) { // 取消 removeCodeBlockFromVM(obj); } else { // 确定 let value = tmpStr.substring(startPos, endPos); insertCodeBlockToVM("", value, obj); } } } else { alert('Error: Browser version is too low'); return; } // 触发change事件 $vm.d_value = obj.value obj.focus(); } function insertCodeBlockToVM(language, content, selectionObj) { const {prefix, subfix} = code_structure; let { selectionStart: startPos, selectionEnd: endPos, value: tmpStr } = selectionObj; let value = tmpStr.substring(0, startPos); value += prefix + language + "\n"; value += content; value += subfix; value += tmpStr.substring(endPos, tmpStr.length); selectionObj.value = value; selectionObj.selectionStart = startPos + prefix.length + (language ? 0 : 1); selectionObj.selectionEnd = selectionObj.selectionStart + language.length + content.length; } function removeCodeBlockFromVM(selectionObj) { let {prefix, subfix, defaultLanguageText: language} = code_structure; let { selectionStart: startPos, selectionEnd: endPos, value: content } = selectionObj; let selectedValue = content.substring(startPos, endPos); if (content.substring(startPos - 1, startPos) === "\n") { prefix = prefix + "\n"; } else { subfix = "\n" + subfix; if (prefix + language + subfix === content.substring(startPos - prefix.length,endPos + subfix.length)) { let value = content.substring(0, startPos - prefix.length); value += content.substring(endPos + subfix.length, content.length) selectionObj.value = value; selectionObj.selectionStart = startPos - prefix.length; selectionObj.selectionEnd = selectionObj.selectionStart; return; } } let value = content.substring(0, startPos - prefix.length); value += selectedValue; value += content.substring(endPos + subfix.length, content.length) selectionObj.value = value; selectionObj.selectionStart = startPos - prefix.length; selectionObj.selectionEnd = selectionObj.selectionStart + selectedValue.length; } function isExistSelectionObj(textareaDom) { return typeof textareaDom.selectionStart === 'number' && typeof textareaDom.selectionEnd === 'number'; } function isCancelCodeBlock(selectionObj) { let { selectionStart: startPos, selectionEnd: endPos, value: content } = selectionObj; let {prefix, subfix} = code_structure; if (content.substring(startPos - 1, startPos) === "\n") { prefix = prefix + "\n"; } else { subfix = "\n" + subfix; } return content.substring(startPos - prefix.length, startPos) === prefix && content.substring(endPos, endPos + subfix.length) === subfix; } // 处理粗体与斜体冲突问题 function judgeItalicAndBold(prefix, subfix, tmpStr, startPos, endPos) { if (prefix === '*' && subfix === '*') { if (tmpStr.substring(startPos - 2, startPos - 1) === '*' && tmpStr.substring(endPos + 1, endPos + 2) === '*') { return false } } return true } // 插入有序列表 export const insertOl = ($vm) => { let obj = $vm.getTextareaDom(); if (isExistSelectionObj(obj)) { var startPos = obj.selectionStart; var endPos = obj.selectionEnd; var tmpStr = obj.value; if (startPos === endPos) { // 直接插入 obj.value = tmpStr.substring(0, startPos) + '1. ' + tmpStr.substring(endPos, tmpStr.length); obj.selectionEnd = obj.selectionStart = startPos + 3; } else { // 存在选中区域 let start = startPos while (start > 0 && tmpStr.substring(start - 1, start) !== '\n') { start-- } let selectStr = tmpStr.substring(start, endPos) let selectStrs = selectStr.split('\n') for (let i = 0; i < selectStrs.length; i++) { selectStrs[i] = (i + 1) + '. ' + selectStrs[i] } let newSelectStr = selectStrs.join('\n') obj.value = tmpStr.substring(0, start) + newSelectStr + tmpStr.substring(endPos, tmpStr.length); obj.selectionStart = start obj.selectionEnd = endPos + newSelectStr.length - selectStr.length; } } else { alert('Error: Browser version is too low') // obj.value += str; } // 触发change事件 $vm.d_value = obj.value obj.focus(); } // 删除行 export const removeLine = ($vm) => { let obj = $vm.getTextareaDom(); if (isExistSelectionObj(obj)) { var startPos = obj.selectionStart; var endPos = obj.selectionEnd; var tmpStr = obj.value; // 找到行首、行尾 let start = startPos while (start > 0 && tmpStr.substring(start - 1, start) !== '\n') { start-- } let end = endPos while (end < tmpStr.length && tmpStr.substring(end, end + 1) !== '\n') { end++ } if (end < tmpStr.length) { end++ } obj.value = tmpStr.substring(0, start) + tmpStr.substring(end, tmpStr.length); obj.selectionEnd = obj.selectionStart = start === 0 ? 0 : start - 1; } else { alert('Error: Browser version is too low') // obj.value += str; } // 触发change事件 $vm.d_value = obj.value obj.focus(); } // 插入无序列表 export const insertUl = ($vm) => { let obj = $vm.getTextareaDom(); if (isExistSelectionObj(obj)) { var startPos = obj.selectionStart; var endPos = obj.selectionEnd; var tmpStr = obj.value; if (startPos === endPos) { // 直接插入 obj.value = tmpStr.substring(0, startPos) + '- ' + tmpStr.substring(endPos, tmpStr.length); obj.selectionEnd = obj.selectionStart = startPos + 2; } else { // 存在选中区域 let start = startPos while (start > 0 && tmpStr.substring(start - 1, start) !== '\n') { start-- } let selectStr = tmpStr.substring(start, endPos) let newSelectStr = selectStr.replace(/\n/g, '\n- ') newSelectStr = '- ' + newSelectStr obj.value = tmpStr.substring(0, start) + newSelectStr + tmpStr.substring(endPos, tmpStr.length); obj.selectionStart = start obj.selectionEnd = endPos + newSelectStr.length - selectStr.length; } } else { alert('Error: Browser version is too low') // obj.value += str; } // 触发change事件 $vm.d_value = obj.value obj.focus(); } // 插入tab export const insertTab = ($vm, tab) => { tab = tab ? (new Array(tab)).fill(' ').join('') : '\t' let obj = $vm.getTextareaDom(); if (isExistSelectionObj(obj)) { var startPos = obj.selectionStart; var endPos = obj.selectionEnd; var tmpStr = obj.value; let lastLine = tmpStr.substring(0, startPos).split('\n').pop() if (lastLine.match(/^\s*[0-9]+\.\s+\S*/)) { // 有序列表 let temp = lastLine.replace(/(\d+)/, 1) obj.value = tmpStr.substring(0, startPos - temp.length) + tab + temp + tmpStr.substring(endPos, tmpStr.length); } else if (lastLine.match(/^\s*-\s+\S*/)) { // 无序列表 obj.value = tmpStr.substring(0, startPos - lastLine.length) + tab + lastLine + tmpStr.substring(endPos, tmpStr.length); } else { obj.value = tmpStr.substring(0, startPos) + tab + tmpStr.substring(endPos, tmpStr.length); } obj.selectionStart = obj.selectionEnd = startPos + tab.length; } else { alert('Error: Browser version is too low') // obj.value += str; } // 触发change事件 $vm.d_value = obj.value obj.focus(); } // shift + tab export const unInsertTab = ($vm, tab) => { let regTab = new RegExp(tab ? `\\s{${tab}}` : '\t') console.log(`regTab:`, regTab) let obj = $vm.getTextareaDom(); if (isExistSelectionObj(obj)) { var startPos = obj.selectionStart; var endPos = obj.selectionEnd; var tmpStr = obj.value; let lastLine = tmpStr.substring(0, startPos).split('\n').pop() if (lastLine.search(regTab) >= 0) { // 替换最后一个制表符为空 obj.value = tmpStr.substring(0, startPos - lastLine.length) + lastLine.replace(regTab, '') + tmpStr.substring(endPos, tmpStr.length); obj.selectionStart = obj.selectionEnd = startPos - (tab || 1); } } else { alert('Error: Browser version is too low') // obj.value += str; } // 触发change事件 $vm.d_value = obj.value obj.focus(); } // 插入enter export const insertEnter = ($vm, event) => { let obj = $vm.getTextareaDom() if (isExistSelectionObj(obj)) { var startPos = obj.selectionStart; var endPos = obj.selectionEnd; var tmpStr = obj.value; // 获取光标前最后一行字符串 let lastLine = tmpStr.substring(0, startPos).split('\n').pop() let matchListNeedChangeLine = lastLine.match(/^\s*(?:[0-9]+\.|-)\s+\S+/) if (matchListNeedChangeLine) { // 需要自动产生下一个列表项 event.preventDefault() // eg: [1. test] 仅获取[1. ] let subfix = matchListNeedChangeLine.shift().match(/^\s*(?:[0-9]+\.|-)\s/).shift() if (subfix.search(/-/) >= 0) { // 无序列表 obj.value = tmpStr.substring(0, startPos) + '\n' + subfix + tmpStr.substring(endPos, tmpStr.length); obj.selectionStart = obj.selectionEnd = startPos + subfix.length + 1 } else { // 有序列表 let temp = subfix.replace(/(\d+)/, parseInt(subfix) + 1) obj.value = tmpStr.substring(0, startPos) + '\n' + temp + tmpStr.substring(endPos, tmpStr.length); obj.selectionStart = obj.selectionEnd = startPos + temp.length + 1 } } else { let matchListNeedRemoveLine = lastLine.match(/^\s*(?:[0-9]+\.|-)\s+$/) if (matchListNeedRemoveLine) { // 需要跳出列表 event.preventDefault() let preLength = matchListNeedRemoveLine.shift().length obj.value = tmpStr.substring(0, startPos - preLength) + '\n' + tmpStr.substring(endPos, tmpStr.length); obj.selectionStart = obj.selectionEnd = startPos - preLength // TODO 检测是否存在嵌套列表,自动生成上一级 } } } else { alert('Error: Browser version is too low') } $vm.d_value = obj.value obj.focus(); } /** * 生成导航目录 */ export const getNavigation = ($vm , full) => { let navigationContent; navigationContent = $vm.$refs.navigationContent navigationContent.innerHTML = $vm.d_render let nodes = navigationContent.children if (nodes.length) { for (let i = 0; i < nodes.length; i++) { judageH(nodes[i] , i , nodes) } } function judageH(node , i , nodes) { let reg = /^H[1-6]{1}$/; if (!reg.exec(node.tagName)) { node.style.display = 'none' } else { node.onclick = function () { let vShowContent = $vm.$refs.vShowContent; let vNoteEdit = $vm.$refs.vNoteEdit; if ($vm.s_subfield) { // 双栏 if ($vm.s_preview_switch) { // 编辑预览 vNoteEdit.scrollTop = vShowContent.children[i].offsetTop * (vNoteEdit.scrollHeight - vNoteEdit.offsetHeight) / (vShowContent.scrollHeight - vShowContent.offsetHeight); } else { // todo 编辑 } } else { // 单栏 if ($vm.s_preview_switch) { // 预览 vShowContent.scrollTop = vShowContent.children[i].offsetTop; } else { // todo 编辑 } } } } } } /** * 滚动条联动 */ export const scrollLink = ($event, $vm) => { let element = $event.srcElement ? $event.srcElement : $event.target let ratio = element.scrollTop / (element.scrollHeight - element.offsetHeight) if ($vm.edit_scroll_height >= 0 && element.scrollHeight !== $vm.edit_scroll_height && (element.scrollHeight - element.offsetHeight - element.scrollTop <= 30)) { // star 内容变化 导致 高度增加 且滚动条距离底部小于25px 自动滚动到底部 $vm.$refs.vNoteEdit.scrollTop = element.scrollHeight - element.offsetHeight ratio = 1 } $vm.edit_scroll_height = element.scrollHeight // end ---- if ($vm.$refs.vShowContent.scrollHeight > $vm.$refs.vShowContent.offsetHeight) { $vm.$refs.vShowContent.scrollTop = ($vm.$refs.vShowContent.scrollHeight - $vm.$refs.vShowContent.offsetHeight) * ratio } } /** * 监听浏览器fullscreen * @param $vm */ export const fullscreenchange = ($vm) => { // 阅读模式 全屏监听事件 $vm.$el.addEventListener('fullscreenchange', function (e) { $vm.$toolbar_right_read_change_status() }, false); $vm.$el.addEventListener('mozfullscreenchange', function (e) { $vm.$toolbar_right_read_change_status() }, false); $vm.$el.addEventListener('webkitfullscreenchange', function (e) { $vm.$toolbar_right_read_change_status() }, false); $vm.$el.addEventListener('msfullscreenchange', function (e) { $vm.$toolbar_right_read_change_status() }, false); } /** * 监听浏览器onresize * @param $vm */ export const windowResize = ($vm) => { function sizeToStatus() { if ($vm.$el.clientWidth > 768) { // > 768 $vm.s_subfield = $vm.subfield; } else { // < 768 $vm.s_subfield = false; } } sizeToStatus(); window.addEventListener('resize', sizeToStatus); } export function loadScript(src, callback) { if (!(typeof callback === 'function')) { callback = function() {}; } var check = document.querySelectorAll("script[src='" + src + "']"); if (check.length > 0) { check[0].addEventListener('load', function() { callback(); }); callback(); return; } var script = document.createElement('script'); var head = document.getElementsByTagName('head')[0]; script.type = 'text/javascript'; script.charset = 'UTF-8'; script.src = src; if (script.addEventListener) { script.addEventListener('load', function () { callback(); }, false); } else if (script.attachEvent) { script.attachEvent('onreadystatechange', function () { var target = window.event.srcElement; if (target.readyState === 'loaded') { callback(); } }); } head.appendChild(script); } // export function loadLink(src, callback, id) { if (!(typeof callback === 'function')) { callback = function() {}; } var check = document.querySelectorAll("link[href='" + src + "']"); if (check.length > 0) { callback(); return; } if (id) { var styles = document.querySelectorAll("link#" + id); if (styles.length) { styles[0].href = src; return; } } var link = document.createElement('link'); var head = document.getElementsByTagName('head')[0]; link.rel = 'stylesheet'; link.href = src; id && (link['id'] = id); if (link.addEventListener) { link.addEventListener('load', function () { callback(); }, false); } else if (link.attachEvent) { link.attachEvent('onreadystatechange', function () { var target = window.event.srcElement; if (target.readyState === 'loaded') { callback(); } }); } head.appendChild(link); } export const ImagePreviewListener = ($vm) => { // vShowContent $vm.$refs.vShowContent.addEventListener('click', function (event) { event = event ? event : window.event; let ele = event.srcElement ? event.srcElement : event.target; if (ele.tagName === 'IMG') { if ($vm.imageClick != null) { // 覆盖图片点击事件 $vm.imageClick(ele); } else { $vm.d_preview_imgsrc = ele.src; } } }) } ================================================ FILE: src/lib/core/highlight.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-06-16T21:01:47+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: highlight.js * @Last modified by: chc * @Last modified time: 2017-11-24T19:55:22+08:00 * @License: MIT * @Copyright: 2017 */ import { loadScript } from './extra-function.js' function highLightCode(str, callback, hljsLangFuc, hljsFuc) { var hljs = window.hljs; if (!hljs) { if (typeof hljsFuc !== 'function') { console.warn('external_link.hljs_js is not a function, hljs can not load by mavon-editor, if you want to disabled this log, set external_link.hljs_js to function'); callback(str); return; } var url = hljsFuc(); console.warn('hljs parsing file is missing. mavon-editor will autoload', url); loadScript(url, function() { _highLightCode(str, callback, hljsLangFuc); }); } else { if (typeof hljsLangFuc === 'function') { _highLightCode(str, callback, hljsLangFuc); } else { console.warn('external_link.hljs_lang is not a function, hljs will not to work'); callback(str); } } } function _highLightCode(str, callback, hljsLangFuc) { var dom = document.createElement('div'); var hljs = window.hljs; dom.innerHTML = str; var pre_code = dom.querySelectorAll('pre > div.hljs > code'); if (pre_code && hljs && (typeof hljsLangFuc === 'function')) { var flag = 0; var i = 0; var deal = 0; var not_include_lang = {}; // these lang parse file need to be include. var url = ''; for (i = 0; i < pre_code.length; i++) { var lang = pre_code[i].className.toLowerCase(); if (lang.length > 0) { // if this lang parse file missing url = hljsLangFuc(lang); if (!hljs.getLanguage(lang) && !not_include_lang.hasOwnProperty(lang) && url.length > 0) { not_include_lang[lang] = url; } } } // we need to include these lang parse file manually var need_langs = []; for (var key in not_include_lang) { if (not_include_lang.hasOwnProperty(key)) { need_langs.push(key); } } for (i = 0; i < need_langs.length; i++) { url = not_include_lang[need_langs[i]]; loadScript(url, function() { deal = deal + 1; if (deal === need_langs.length) { for (var i = 0; i < pre_code.length; i++) { var lang = pre_code[i].className; // if lang is valid. if (lang.length > 0 && hljs.getLanguage(lang)) { hljs.highlightBlock(pre_code[i]) } } callback(dom.innerHTML); } }); } if (need_langs.length === 0) { for (i = 0; i < pre_code.length; i++) { lang = pre_code[i].className; // if lang is valid. if (lang.length > 0 && hljs.getLanguage(lang)) { hljs.highlightBlock(pre_code[i]) } } callback(dom.innerHTML); } } else { callback(dom.innerHTML); } } export default highLightCode; ================================================ FILE: src/lib/core/hljs/lang.hljs.css.js ================================================ export default { agate: 1, androidstudio: 1, 'arduino-light': 1, arta: 1, ascetic: 1, 'atom-one-dark': 1, 'atom-one-light': 1, 'brown-paper': 1, 'codepen-embed': 1, 'color-brewer': 1, dark: 1, default: 1, docco: 1, far: 1, foundation: 1, github: 1, googlecode: 1, grayscale: 1, hybrid: 1, idea: 1, 'ir-black': 1, magula: 1, 'mono-blue': 1, 'monokai-sublime': 1, monokai: 1, obsidian: 1, 'paraiso-dark': 1, 'paraiso-light': 1, pojoaque: 1, purebasic: 1, rainbow: 1, routeros: 1, 'school-book': 1, sunburst: 1, 'tomorrow-night-blue': 1, 'tomorrow-night-bright': 1, vs: 1, vs2015: 1, xcode: 1, xt256: 1, 'a11y-dark': 1, 'a11y-light': 1, 'an-old-hope': 1, 'atom-one-dark-reasonable': 1, 'brown-pap': 1, devibeans: 1, 'github-dark': 1, 'github-dark-dimmed': 1, gml: 1, 'gradient-dark': 1, 'gradient-light': 1, 'isbl-editor-dark': 1, 'isbl-editor-light': 1, 'kimbie-dark': 1, 'kimbie-light': 1, lightfair: 1, lioshi: 1, 'night-owl': 1, 'nnfx-dark': 1, 'nnfx-light': 1, nord: 1, pojo: 1, 'qtcreator-dark': 1, 'qtcreator-light': 1, 'shades-of-purple': 1, srcery: 1, 'stackoverflow-dark': 1, 'stackoverflow-light': 1 }; ================================================ FILE: src/lib/core/hljs/lang.hljs.js ================================================ export default { '1c': '1c', 'abnf': 'abnf', 'accesslog': 'accesslog', 'actionscript': 'actionscript', 'as': 'actionscript', 'ada': 'ada', 'apache': 'apache', 'apacheconf': 'apache', 'applescript': 'applescript', 'osascript': 'applescript', 'arduino': 'arduino', 'armasm': 'armasm', 'arm': 'armasm', 'asciidoc': 'asciidoc', 'adoc': 'asciidoc', 'aspectj': 'aspectj', 'autohotkey': 'autohotkey', 'ahk': 'autohotkey', 'autoit': 'autoit', 'avrasm': 'avrasm', 'awk': 'awk', 'axapta': 'axapta', 'bash': 'bash', 'sh': 'bash', 'zsh': 'bash', 'basic': 'basic', 'bnf': 'bnf', 'brainfuck': 'brainfuck', 'bf': 'brainfuck', 'cal': 'cal', 'capnproto': 'capnproto', 'capnp': 'capnproto', 'ceylon': 'ceylon', 'clean': 'clean', 'icl': 'clean', 'dcl': 'clean', 'clojure-repl': 'clojure-repl', 'clojure': 'clojure', 'clj': 'clojure', 'cmake': 'cmake', 'cmake.in': 'cmake', 'coffeescript': 'coffeescript', 'coffee': 'coffeescript', 'cson': 'coffeescript', 'iced': 'coffeescript', 'coq': 'coq', 'cos': 'cos', 'cls': 'cos', 'cpp': 'cpp', 'c': 'cpp', 'cc': 'cpp', 'h': 'cpp', 'c++': 'cpp', 'h++': 'cpp', 'hpp': 'cpp', 'crmsh': 'crmsh', 'crm': 'crmsh', 'pcmk': 'crmsh', 'crystal': 'crystal', 'cr': 'crystal', 'cs': 'cs', 'csharp': 'cs', 'csp': 'csp', 'css': 'css', 'd': 'd', 'dart': 'dart', 'delphi': 'delphi', 'dpr': 'delphi', 'dfm': 'delphi', 'pas': 'delphi', 'pascal': 'delphi', 'freepascal': 'delphi', 'lazarus': 'delphi', 'lpr': 'delphi', 'lfm': 'delphi', 'diff': 'diff', 'patch': 'diff', 'django': 'django', 'jinja': 'django', 'dns': 'dns', 'bind': 'dns', 'zone': 'dns', 'dockerfile': 'dockerfile', 'docker': 'dockerfile', 'dos': 'dos', 'bat': 'dos', 'cmd': 'dos', 'dsconfig': 'dsconfig', 'dts': 'dts', 'dust': 'dust', 'dst': 'dust', 'ebnf': 'ebnf', 'elixir': 'elixir', 'elm': 'elm', 'erb': 'erb', 'erlang-repl': 'erlang-repl', 'erlang': 'erlang', 'erl': 'erlang', 'excel': 'excel', 'xlsx': 'excel', 'xls': 'excel', 'fix': 'fix', 'flix': 'flix', 'fortran': 'fortran', 'f90': 'fortran', 'f95': 'fortran', 'fsharp': 'fsharp', 'fs': 'fsharp', 'gams': 'gams', 'gms': 'gams', 'gauss': 'gauss', 'gss': 'gauss', 'gcode': 'gcode', 'nc': 'gcode', 'gherkin': 'gherkin', 'feature': 'gherkin', 'glsl': 'glsl', 'go': 'go', 'golang': 'go', 'golo': 'golo', 'gradle': 'gradle', 'groovy': 'groovy', 'haml': 'haml', 'handlebars': 'handlebars', 'hbs': 'handlebars', 'html.hbs': 'handlebars', 'html.handlebars': 'handlebars', 'haskell': 'haskell', 'hs': 'haskell', 'haxe': 'haxe', 'hx': 'haxe', 'hsp': 'hsp', 'htmlbars': 'htmlbars', 'http': 'http', 'https': 'http', 'hy': 'hy', 'hylang': 'hy', 'inform7': 'inform7', 'i7': 'inform7', 'ini': 'ini', 'toml': 'ini', 'irpf90': 'irpf90', 'java': 'java', 'jsp': 'java', 'javascript': 'javascript', 'js': 'javascript', 'jsx': 'javascript', 'jboss-cli': 'jboss-cli', 'wildfly-cli': 'jboss-cli', 'json': 'json', 'julia-repl': 'julia-repl', 'julia': 'julia', 'kotlin': 'kotlin', 'lasso': 'lasso', 'ls': 'livescript', 'lassoscript': 'lasso', 'ldif': 'ldif', 'leaf': 'leaf', 'less': 'less', 'lisp': 'lisp', 'livecodeserver': 'livecodeserver', 'livescript': 'livescript', 'llvm': 'llvm', 'lsl': 'lsl', 'lua': 'lua', 'makefile': 'makefile', 'mk': 'makefile', 'mak': 'makefile', 'markdown': 'markdown', 'md': 'markdown', 'mkdown': 'markdown', 'mkd': 'markdown', 'mathematica': 'mathematica', 'mma': 'mathematica', 'matlab': 'matlab', 'maxima': 'maxima', 'mel': 'mel', 'mercury': 'mercury', 'm': 'mercury', 'moo': 'mercury', 'mipsasm': 'mipsasm', 'mips': 'mipsasm', 'mizar': 'mizar', 'mojolicious': 'mojolicious', 'monkey': 'monkey', 'moonscript': 'moonscript', 'moon': 'moonscript', 'n1ql': 'n1ql', 'nginx': 'nginx', 'nginxconf': 'nginx', 'nimrod': 'nimrod', 'nim': 'nimrod', 'nix': 'nix', 'nixos': 'nix', 'nsis': 'nsis', 'objectivec': 'objectivec', 'mm': 'objectivec', 'objc': 'objectivec', 'obj-c': 'objectivec', 'ocaml': 'ocaml', 'ml': 'sml', 'openscad': 'openscad', 'scad': 'openscad', 'oxygene': 'oxygene', 'parser3': 'parser3', 'perl': 'perl', 'pl': 'perl', 'pm': 'perl', 'pf': 'pf', 'pf.conf': 'pf', 'php': 'php', 'php3': 'php', 'php4': 'php', 'php5': 'php', 'php6': 'php', 'pony': 'pony', 'powershell': 'powershell', 'ps': 'powershell', 'processing': 'processing', 'profile': 'profile', 'prolog': 'prolog', 'protobuf': 'protobuf', 'puppet': 'puppet', 'pp': 'puppet', 'purebasic': 'purebasic', 'pb': 'purebasic', 'pbi': 'purebasic', 'python': 'python', 'py': 'python', 'gyp': 'python', 'q': 'q', 'k': 'q', 'kdb': 'q', 'qml': 'qml', 'qt': 'qml', 'r': 'r', 'rib': 'rib', 'roboconf': 'roboconf', 'graph': 'roboconf', 'instances': 'roboconf', 'routeros': 'routeros', 'mikrotik': 'routeros', 'rsl': 'rsl', 'ruby': 'ruby', 'rb': 'ruby', 'gemspec': 'ruby', 'podspec': 'ruby', 'thor': 'ruby', 'irb': 'ruby', 'ruleslanguage': 'ruleslanguage', 'rust': 'rust', 'rs': 'rust', 'scala': 'scala', 'scheme': 'scheme', 'scilab': 'scilab', 'sci': 'scilab', 'scss': 'scss', 'shell': 'shell', 'console': 'shell', 'smali': 'smali', 'smalltalk': 'smalltalk', 'st': 'smalltalk', 'sml': 'sml', 'sqf': 'sqf', 'sql': 'sql', 'stan': 'stan', 'stata': 'stata', 'do': 'stata', 'ado': 'stata', 'step21': 'step21', 'p21': 'step21', 'step': 'step21', 'stp': 'step21', 'stylus': 'stylus', 'styl': 'stylus', 'subunit': 'subunit', 'swift': 'swift', 'taggerscript': 'taggerscript', 'tap': 'tap', 'tcl': 'tcl', 'tk': 'tcl', 'tex': 'tex', 'thrift': 'thrift', 'tp': 'tp', 'twig': 'twig', 'craftcms': 'twig', 'typescript': 'typescript', 'ts': 'typescript', 'vala': 'vala', 'vbnet': 'vbnet', 'vb': 'vbnet', 'vbscript-html': 'vbscript-html', 'vbscript': 'vbscript', 'vbs': 'vbscript', 'verilog': 'verilog', 'v': 'verilog', 'sv': 'verilog', 'svh': 'verilog', 'vhdl': 'vhdl', 'vim': 'vim', 'x86asm': 'x86asm', 'xl': 'xl', 'tao': 'xl', 'xml': 'xml', 'html': 'xml', 'xhtml': 'xml', 'rss': 'xml', 'atom': 'xml', 'xjb': 'xml', 'xsd': 'xml', 'xsl': 'xml', 'plist': 'xml', 'xquery': 'xquery', 'xpath': 'xquery', 'xq': 'xquery', 'yaml': 'yaml', 'yml': 'yaml', 'YAML': 'yaml', 'zephir': 'zephir', 'zep': 'zephir' }; ================================================ FILE: src/lib/core/keydown-listen.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-05-03T00:31:20+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: keydown-listen.js * @Last modified by: chenhuachao * @Last modified time: 2017-12-04T00:03:33+08:00 * @License: MIT * @Copyright: 2017 */ /** * Created by zhy on 2017/4/24. */ const KEY_CODE = { F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, B: 66, I: 73, H: 72, U: 85, D: 68, M:77 , Q: 81, O: 79, L: 76, S: 83, Z: 90, Y: 89, C: 67, T: 84, R: 82, DELETE: 8, TAB: 9, ENTER: 13, ONE: 97, TWO: 98, THREE: 99, FOUR: 100, FIVE: 101, SIX: 102, _ONE: 49, _TWO: 50, _THREE: 51, _FOUR: 52, _FIVE: 53, _SIX: 54 }; export const keydownListen = ($vm) => { if (!$vm.shortCut) { return } $vm.$el.addEventListener('keydown', function (e) { // 注册监听键盘事件 if (!(e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey) { // one key switch (e.keyCode) { case KEY_CODE.F8: { // F8 导航 if ($vm.toolbars.navigation) { e.preventDefault() $vm.toolbar_right_click('navigation') } break; } case KEY_CODE.F9: { // F9 预览模式 if ($vm.toolbars.preview) { e.preventDefault() $vm.toolbar_right_click('preview') } break; } case KEY_CODE.F10: { // F10 全屏 if ($vm.toolbars.fullscreen) { e.preventDefault() $vm.toolbar_right_click('fullscreen') } break; } case KEY_CODE.F11: { // F11 阅读 if ($vm.toolbars.readmodel) { e.preventDefault() $vm.toolbar_right_click('read') } break; } case KEY_CODE.F12: { // F12 单双栏切换 if ($vm.toolbars.subfield) { e.preventDefault() $vm.toolbar_right_click('subfield') } break; } case KEY_CODE.TAB: { // TAB if (!$vm.$refs.toolbar_left.s_img_link_open) { e.preventDefault() $vm.insertTab(); } break; } case KEY_CODE.ENTER: { // enter if ($vm.$refs.toolbar_left.s_img_link_open) { // 当添加外部链接的弹出层打开时, enter表示确定输入此链接 e.preventDefault() $vm.$refs.toolbar_left.$imgLinkAdd(); } else { // 在文本框中输入enter $vm.insertEnter(e) } break; } } } else if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey) { // ctrl + switch (e.keyCode) { case KEY_CODE.B: { // B e.preventDefault() $vm.toolbar_left_click('bold') break; } case KEY_CODE.I: { // I e.preventDefault() $vm.toolbar_left_click('italic') break; } case KEY_CODE.H: { // H e.preventDefault() $vm.toolbar_left_click('header') break; } case KEY_CODE.U: { // U e.preventDefault() $vm.toolbar_left_click('underline') break; } case KEY_CODE.D: { // D e.preventDefault() $vm.toolbar_left_click('removeLine') break; } case KEY_CODE.M: { // M e.preventDefault() $vm.toolbar_left_click('mark') break; } case KEY_CODE.Q: { // Q e.preventDefault() $vm.toolbar_left_click('quote') break; } case KEY_CODE.O: { // O e.preventDefault() $vm.toolbar_left_click('ol') break; } case KEY_CODE.L: { // L e.preventDefault() $vm.toolbar_left_click('link') break; } case KEY_CODE.S: { // S e.preventDefault() $vm.toolbar_left_click('save') break; } case KEY_CODE.Z: { // Z e.preventDefault() $vm.toolbar_left_click('undo') break; } case KEY_CODE.Y: { // Y e.preventDefault() $vm.toolbar_left_click('redo') break; } case KEY_CODE.DELETE: { // delete e.preventDefault() $vm.toolbar_left_click('trash') break; } case KEY_CODE.ONE: { // ONE e.preventDefault() $vm.toolbar_left_click('header1') break; } case KEY_CODE.TWO: { // TWO e.preventDefault() $vm.toolbar_left_click('header2') break; } case KEY_CODE.THREE: { // THREE e.preventDefault() $vm.toolbar_left_click('header3') break; } case KEY_CODE.FOUR: { // FOUR e.preventDefault() $vm.toolbar_left_click('header4') break; } case KEY_CODE.FIVE: { // FIVE e.preventDefault() $vm.toolbar_left_click('header5') break; } case KEY_CODE.SIX: { // SIX e.preventDefault() $vm.toolbar_left_click('header6') break; } case KEY_CODE._ONE: { // ONE e.preventDefault() $vm.toolbar_left_click('header1') break; } case KEY_CODE._TWO: { // TWO e.preventDefault() $vm.toolbar_left_click('header2') break; } case KEY_CODE._THREE: { // THREE e.preventDefault() $vm.toolbar_left_click('header3') break; } case KEY_CODE._FOUR: { // FOUR e.preventDefault() $vm.toolbar_left_click('header4') break; } case KEY_CODE._FIVE: { // FIVE e.preventDefault() $vm.toolbar_left_click('header5') break; } case KEY_CODE._SIX: { // SIX e.preventDefault() $vm.toolbar_left_click('header6') break; } } } else if ((e.ctrlKey || e.metaKey) && e.altKey && !e.shiftKey) { // ctrl + alt + switch (e.keyCode) { case KEY_CODE.S: { // S e.preventDefault() $vm.toolbar_left_click('superscript') break; } case KEY_CODE.U: { // U e.preventDefault() $vm.toolbar_left_click('ul') break; } case KEY_CODE.L: { // L e.preventDefault() $vm.toolbar_left_click('imagelink') break; } case KEY_CODE.C: { // C e.preventDefault() $vm.toolbar_left_click('code') break; } case KEY_CODE.T: { // T e.preventDefault() $vm.toolbar_left_click('table') break; } } } else if ((e.ctrlKey || e.metaKey) && e.shiftKey && !e.altKey) { // ctrl + shift switch (e.keyCode) { case KEY_CODE.S: { // S e.preventDefault() $vm.toolbar_left_click('subscript') break; } case KEY_CODE.D: { // D e.preventDefault() $vm.toolbar_left_click('strikethrough') break; } case KEY_CODE.L: { // D e.preventDefault() $vm.toolbar_left_click('alignleft') break; } case KEY_CODE.R: { // D e.preventDefault() $vm.toolbar_left_click('alignright') break; } case KEY_CODE.C: { // D e.preventDefault() $vm.toolbar_left_click('aligncenter') break; } } } else if (!(e.ctrlKey || e.metaKey) && e.shiftKey && !e.altKey) { // shift + switch (e.keyCode) { case KEY_CODE.TAB: { // TAB if (!$vm.$refs.toolbar_left.s_img_link_open) { e.preventDefault() $vm.unInsertTab(); } break; } } } }); } ================================================ FILE: src/lib/core/markdown.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-05-03T00:31:20+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: markdown.js * @Last modified by: chc * @Last modified time: 2017-11-26T16:40:54+08:00 * @License: MIT * @Copyright: 2017 */ import hljsLangs from './hljs/lang.hljs.js' /** * Created by zhy on 2017/3/30. */ // default mode var markdown_config = { html: true, // Enable HTML tags in source xhtmlOut: true, // Use '/' to close single tags (
). breaks: true, // Convert '\n' in paragraphs into
langPrefix: 'language-', // CSS language prefix for fenced blocks. Can be linkify: false, // 自动识别url typographer: true, quotes: '“”‘’', highlight: function (str, lang) { if (lang && hljsLangs[lang]) { return '
' + markdown.utils.escapeHtml(str) + '
'; } return '
' + markdown.utils.escapeHtml(str) + '
'; } } var markdown = require('markdown-it')(markdown_config); // 表情 var emoji = require('markdown-it-emoji'); // 下标 var sub = require('markdown-it-sub') // 上标 var sup = require('markdown-it-sup') //
var deflist = require('markdown-it-deflist') // var abbr = require('markdown-it-abbr') // footnote var footnote = require('markdown-it-footnote') // insert 带有下划线 样式 ++ ++ var insert = require('markdown-it-ins') // mark var mark = require('markdown-it-mark') // taskLists var taskLists = require('markdown-it-task-lists') // var container = require('markdown-it-container') // add target="_blank" to all link var defaultRender = markdown.renderer.rules.link_open || function(tokens, idx, options, env, self) { return self.renderToken(tokens, idx, options); }; markdown.renderer.rules.link_open = function (tokens, idx, options, env, self) { // If you are sure other plugins can't add `target` - drop check below var aIndex = tokens[idx].attrIndex('target'); if (aIndex < 0) { tokens[idx].attrPush(['target', '_blank']); // add new attribute } else { tokens[idx].attrs[aIndex][1] = '_blank'; // replace value of existing attr } // pass token to default renderer. return defaultRender(tokens, idx, options, env, self); }; // math katex var katex = require('markdown-it-katex-external'); var miip = require('markdown-it-images-preview'); markdown.use(emoji) .use(taskLists) .use(sup) .use(sub) .use(container) .use(container, 'hljs-left') /* align left */ .use(container, 'hljs-center')/* align center */ .use(container, 'hljs-right')/* align right */ .use(deflist) .use(abbr) .use(footnote) .use(insert) .use(mark) .use(container) .use(miip) .use(katex) export default markdown ================================================ FILE: src/lib/core/onecolumn-event.js ================================================ /** * Created by zhy on 2017/4/24. */ /** * keydown enter */ export const onecolumnKeyDownEnter = ($event , $vm , tomarkdown) => { let element = $event.srcElement ? $event.srcElement : $event.target let sel = window.getSelection(); let range = sel.getRangeAt(0); // code中回车处理 if (range.startContainer.tagName === 'CODE' || range.startContainer.tagName === 'PRE') { $event.preventDefault() onecolumnInsert(range.startContainer , '\n') } else if (range.startContainer.parentElement.tagName === 'CODE' || range.startContainer.parentElement.tagName === 'PRE') { $event.preventDefault() onecolumnInsert(range.startContainer.parentElement , '\n') } else if (!blockQuoteDoubleEnter(range.startContainer , $event , range.startContainer)) { $vm.s_table_enter = false judgeRender(range.startContainer , $event , range.startContainer , range.startContainer , $vm) /* if (result) { range = range.cloneRange(); // code的渲染 if (result.children !== null && result.children.length > 0 && result.children[0].tagName === 'PRE') { result.children[0].children[0].innerHTML = '\n' result.innerHTML += '

' range.setStartAfter(result.children[0].children[0]); } else if (result.lastChild) { range.setStartAfter(result.lastChild); } else { range.setStartAfter(result); } range.collapse(true); sel.removeAllRanges(); sel.addRange(range); } */ } $vm.d_value = tomarkdown(element.innerHTML) } /** * insert */ export const onecolumnInsert = (dom , html) => { dom.focus() var sel var range if (window.getSelection) { // IE9 and non-IE sel = window.getSelection(); if (sel.getRangeAt && sel.rangeCount) { range = sel.getRangeAt(0); range.deleteContents(); // Range.createContextualFragment() would be useful here but is // non-standard and not supported in all browsers (IE9, for one) var el = document.createElement('div'); el.innerHTML = html; var frag = document.createDocumentFragment() var node var lastNode while ((node = el.firstChild)) { lastNode = frag.appendChild(node); } range.insertNode(frag); // Preserve the selection if (lastNode) { range = range.cloneRange(); range.setStartAfter(lastNode); range.collapse(true); sel.removeAllRanges(); sel.addRange(range); } } } else if (document.selection && document.selection.type !== 'Control') { // IE < 9 document.selection.createRange().pasteHTML(html); } } /** * 连续两次在段落中换行 跳出段落 */ export const blockQuoteDoubleEnter = (dom , $event , self) => { if (dom.tagName) { if (dom.getAttribute('class') === 'content-div content-div-edit') { return false } else if (dom.tagName === 'BLOCKQUOTE') { if (!self.innerText || self.innerText === '\n' || self.innerText === '') { $event.preventDefault() let sel = window.getSelection(); let range = sel.getRangeAt(0); let next = dom.nextSibling self.outerHTML = '' dom.outerHTML += '

' range = range.cloneRange() range.setStartAfter(next.previousSibling.lastChild); range.collapse(true); sel.removeAllRanges(); sel.addRange(range); } return true } return blockQuoteDoubleEnter(dom.parentElement, $event , dom) } else { return blockQuoteDoubleEnter(dom.parentElement, $event , dom) } } /** * 在表格中回车特殊处理(暂时只做表格回车 , 后续可能拓展) */ export const judgeRender = (dom , $event , self , pre , $vm) => { if (dom.tagName) { if (dom.tagName === 'TABLE') { $vm.s_table_enter = true self = dom } if (dom.getAttribute('class') === 'content-div content-div-edit') { // 在表格中回车 在表格后换行 if ($vm.s_table_enter) { let sel = window.getSelection(); let range = sel.getRangeAt(0); range = range.cloneRange() $event.preventDefault() let next = self.nextSibling self.outerHTML += '

' range.setStartAfter(next.previousSibling.lastChild); range.collapse(true); sel.removeAllRanges(); sel.addRange(range); } return; } judgeRender(dom.parentElement , $event , self , dom , $vm) /* let obj = document.createElement('div') obj.innerHTML = markdown.render(dom.innerHTML.replace('>' , '>')) var objText = obj.innerText var domText = dom.innerText var objTextNoSpaceEnter = objText.replace(/\s+/g, '').replace(/[\r\n]/g, '') var domTextNoSpaceEnter = domText.replace(/\s+/g, '').replace(/[\r\n]/g, '') if (obj.children.length > 0) { if (obj.children[0].innerText.replace(/\s+/g, '').replace(/[\r\n]/g, '') === domTextNoSpaceEnter || obj.children[0].innerText === domText || objText === domText || domTextNoSpaceEnter === objTextNoSpaceEnter) { return judgeRender(dom.parentElement , $event , self ,dom , $vm) } else { // 有变化 $event.preventDefault() dom.innerHTML = markdown.render(tomarkdown(dom.innerHTML)) return dom } } else { if (objText === domText || objTextNoSpaceEnter === domTextNoSpaceEnter) { return judgeRender(dom.parentElement , $event , self , dom , $vm) } else { // 有变化 dom.innerHTML = markdown.render(tomarkdown(obj.innerHTML)) return dom } } */ } else { judgeRender(dom.parentElement , $event , self , dom , $vm) } } ================================================ FILE: src/lib/core/sanitizer.js ================================================ import { FilterXSS } from 'xss'; let xssHandler; function mavoneditor_sanitizer(state) { if (!xssHandler) { return; } sanitizer(state.tokens, ['inline', 'html_block']); } function sanitizer(tokens, types) { let originContent, children; for (let i = 0; i < tokens.length; i++) { if (types.indexOf(tokens[i].type) !== -1) { originContent = tokens[i].content; children = tokens[i].children; tokens[i].content = xssHandler.process(originContent); if (children && children.length && originContent !== tokens[i].content) { sanitizer(children, ['html_inline']); } } } } export default function (md, xssOptions) { if (md.options.html) { xssHandler = new FilterXSS(xssOptions); md.core.ruler.push('mavoneditor_sanitizer', mavoneditor_sanitizer); } } ================================================ FILE: src/lib/core/to-markdown.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-05-03T00:31:20+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: to-markdown.js * @Last modified by: chc * @Last modified time: 2017-06-12T20:42:27+08:00 * @License: MIT * @Copyright: 2017 */ /** * Created by zhy on 2017/4/9. */ var toMarkdown = require('to-markdown'); // const coverterP = { filter: 'P', replacement: function (content) { return '\n' + content } } const coverterp = { filter: 'p', replacement: function (content) { return '\n' + content } } const coverterDiv = { filter: 'DIV', replacement: function (content) { return '\n' + content } } const coverterdiv = { filter: 'div', replacement: function (content) { return '\n' + content } } // 解析代码块 const coverterCode = { filter: 'pre', replacement: function (content) { let objE = document.createElement('div'); objE.innerHTML = content; let codes = objE.getElementsByTagName('code') if (codes !== null && codes.length > 0) { let code = codes[0] let codeType = code.getAttribute('class') === null ? '' : code.getAttribute('class') let codeContent = code.innerText return '\n```' + codeType + '\n' + codeContent + '\n```\n'; } return '\n```\n' + content + '\n```\n'; } } // 解析表格 const coverterTable = { filter: 'table', replacement: function (content) { let table = document.createElement('table'); table.innerHTML = content; let dom = '\n'; let tableMark = ''; let thead = table.getElementsByTagName('thead')[0]; let thead_tr = thead.getElementsByTagName('tr')[0]; let thead_th = thead_tr.getElementsByTagName('th') for (let i = 0; i < thead_th.length; i++) { dom += '| ' + thead_th[i].innerText + ' ' let text_align = thead_th[i].style.textAlign if (text_align === 'left') { tableMark += '| :- ' } else if (text_align === 'center') { tableMark += '| :-: ' } else if (text_align === 'right') { tableMark += '| -: ' } else { tableMark += '| - ' } if (i === thead_th.length - 1) { dom += '|\n' + tableMark + ' |\n' } } let tbody if (table.getElementsByTagName('tbody')) { tbody = table.getElementsByTagName('tbody')[0]; let tbody_tr = tbody.getElementsByTagName('tr') if (tbody_tr.length > 0) { for (let i = 0; i < tbody_tr.length; i++) { let tbody_td = tbody_tr[i].getElementsByTagName('td') for (let j = 0; j < tbody_td.length; j++) { dom += '| ' + tbody_td[j].innerText + ' '; if (j === tbody_td.length - 1) { dom += '|\n'; } } } } } return dom } } // 上角标 const coverterSup = { filter: 'sup', replacement: function (content) { return '^' + content + '^'; } } // 下角标 const coverterSub = { filter: 'sub', replacement: function (content) { return '~' + content + '~'; } } // 下划线 const coverterUnderline = { filter: 'ins', replacement: function (content) { return '++' + content + '++'; } } // 中画线 const coverterStrikethrough = { filter: 's', replacement: function (content) { return '~~' + content + '~~'; } } // 标记 const coverterMark = { filter: 'mark', replacement: function (content) { return '==' + content + '=='; } } // 图片 const converterImg = { filter: 'img', replacement: function(content, tag) { var rel = tag.getAttribute('rel'); var alt = tag.getAttribute('alt'); if (rel && alt) { return '![' + alt + ']' + '(' + rel + ')' } else { var src = tag.getAttribute('src'); return '![' + alt + ']' + '(' + src + ')' } } } var tomarkdown = function (str) { return toMarkdown(str, { converters: [ coverterCode, coverterTable, coverterSup, coverterSub, coverterUnderline, coverterStrikethrough, coverterMark, coverterP, coverterp, coverterDiv, coverterdiv, converterImg ] }); } export default tomarkdown ================================================ FILE: src/lib/css/markdown.css ================================================ @font-face { font-family: octicons-link; src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJBIMAAizAFoAAABiAGIAznjaY2BkYGAA4in8zwXi+W2+MjCzMIDApSwvXzC97Z4Ig8N/BxYGZgcgl52BCSQKAA3jCV8CAABfAAAAAAQAAEB42mNgZGBg4f3vACQZQABIMjKgAmYAKEgBXgAAeNpjYGY6wTiBgZWBg2kmUxoDA4MPhGZMYzBi1AHygVLYQUCaawqDA4PChxhmh/8ODDEsvAwHgMKMIDnGL0x7gJQCAwMAJd4MFwAAAHjaY2BgYGaA4DAGRgYQkAHyGMF8NgYrIM3JIAGVYYDT+AEjAwuDFpBmA9KMDEwMCh9i/v8H8sH0/4dQc1iAmAkALaUKLgAAAHjaTY9LDsIgEIbtgqHUPpDi3gPoBVyRTmTddOmqTXThEXqrob2gQ1FjwpDvfwCBdmdXC5AVKFu3e5MfNFJ29KTQT48Ob9/lqYwOGZxeUelN2U2R6+cArgtCJpauW7UQBqnFkUsjAY/kOU1cP+DAgvxwn1chZDwUbd6CFimGXwzwF6tPbFIcjEl+vvmM/byA48e6tWrKArm4ZJlCbdsrxksL1AwWn/yBSJKpYbq8AXaaTb8AAHja28jAwOC00ZrBeQNDQOWO//sdBBgYGRiYWYAEELEwMTE4uzo5Zzo5b2BxdnFOcALxNjA6b2ByTswC8jYwg0VlNuoCTWAMqNzMzsoK1rEhNqByEyerg5PMJlYuVueETKcd/89uBpnpvIEVomeHLoMsAAe1Id4AAAAAAAB42oWQT07CQBTGv0JBhagk7HQzKxca2sJCE1hDt4QF+9JOS0nbaaYDCQfwCJ7Au3AHj+LO13FMmm6cl7785vven0kBjHCBhfpYuNa5Ph1c0e2Xu3jEvWG7UdPDLZ4N92nOm+EBXuAbHmIMSRMs+4aUEd4Nd3CHD8NdvOLTsA2GL8M9PODbcL+hD7C1xoaHeLJSEao0FEW14ckxC+TU8TxvsY6X0eLPmRhry2WVioLpkrbp84LLQPGI7c6sOiUzpWIWS5GzlSgUzzLBSikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==) format('woff'); } .markdown-body { -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; line-height: 1.5; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; line-height: 1.5; word-wrap: break-word; } .markdown-body .pl-c { color: #969896; } .markdown-body .pl-c1, .markdown-body .pl-s .pl-v { color: #0086b3; } .markdown-body .pl-e, .markdown-body .pl-en { color: #795da3; } .markdown-body .pl-smi, .markdown-body .pl-s .pl-s1 { color: #333; } .markdown-body .pl-ent { color: #63a35c; } .markdown-body .pl-k { color: #a71d5d; } .markdown-body .pl-s, .markdown-body .pl-pds, .markdown-body .pl-s .pl-pse .pl-s1, .markdown-body .pl-sr, .markdown-body .pl-sr .pl-cce, .markdown-body .pl-sr .pl-sre, .markdown-body .pl-sr .pl-sra { color: #183691; } .markdown-body .pl-v, .markdown-body .pl-smw { color: #ed6a43; } .markdown-body .pl-bu { color: #b52a1d; } .markdown-body .pl-ii { color: #f8f8f8; background-color: #b52a1d; } .markdown-body .pl-c2 { color: #f8f8f8; background-color: #b52a1d; } .markdown-body .pl-c2::before { content: "^M"; } .markdown-body .pl-sr .pl-cce { font-weight: bold; color: #63a35c; } .markdown-body .pl-ml { color: #693a17; } .markdown-body .pl-mh, .markdown-body .pl-mh .pl-en, .markdown-body .pl-ms { font-weight: bold; color: #1d3e81; } .markdown-body .pl-mq { color: #008080; } .markdown-body .pl-mi { font-style: italic; color: #333; } .markdown-body .pl-mb { font-weight: bold; color: #333; } .markdown-body .pl-md { color: #bd2c00; background-color: #ffecec; } .markdown-body .pl-mi1 { color: #55a532; background-color: #eaffea; } .markdown-body .pl-mc { color: #ef9700; background-color: #ffe3b4; } .markdown-body .pl-mi2 { color: #d8d8d8; background-color: #808080; } .markdown-body .pl-mdr { font-weight: bold; color: #795da3; } .markdown-body .pl-mo { color: #1d3e81; } .markdown-body .pl-ba { color: #595e62; } .markdown-body .pl-sg { color: #c0c0c0; } .markdown-body .pl-corl { text-decoration: underline; color: #183691; } .markdown-body .octicon { display: inline-block; vertical-align: text-top; fill: currentColor; } .markdown-body a { background-color: transparent; -webkit-text-decoration-skip: objects; } .markdown-body a:active, .markdown-body a:hover { outline-width: 0; } .markdown-body strong { font-weight: inherit; } .markdown-body strong { font-weight: bolder; } .markdown-body h1 { font-size: 2.4em; margin: 0.67em 0; } .markdown-body img { border-style: none; } .markdown-body svg:not(:root) { overflow: hidden; } .markdown-body code, .markdown-body kbd, .markdown-body pre { font-family: monospace, monospace; font-size: 1em; } .markdown-body hr { box-sizing: content-box; height: 0; overflow: visible; } .markdown-body input { font: inherit; margin: 0; } .markdown-body input { overflow: visible; } .markdown-body [type="checkbox"] { box-sizing: border-box; padding: 0; } .markdown-body * { box-sizing: border-box; } .markdown-body input { font-family: inherit; font-size: inherit; line-height: inherit; } .markdown-body a { color: #0366d6; text-decoration: none; } .markdown-body a:hover { text-decoration: underline; } .markdown-body strong { font-weight: 600; } .markdown-body hr { height: 0; margin: 15px 0; overflow: hidden; background: transparent; border: 0; border-bottom: 1px solid #dfe2e5; } .markdown-body hr::before { display: table; content: ""; } .markdown-body hr::after { display: table; clear: both; content: ""; } .markdown-body table { border-spacing: 0; border-collapse: collapse; } .markdown-body td, .markdown-body th { padding: 0; } .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { margin-top: 0; margin-bottom: 0; } .markdown-body h1 { font-size: 36px; font-weight: 600; } .markdown-body h2 { font-size: 28px; font-weight: 600; } .markdown-body h3 { font-size: 20px; font-weight: 600; } .markdown-body h4 { font-size: 18px; font-weight: 600; } .markdown-body h5 { font-size: 14px; font-weight: 600; } .markdown-body h6 { font-size: 12px; font-weight: 600; } .markdown-body p { margin-top: 0; margin-bottom: 6px; } .markdown-body blockquote { margin: 0; } .markdown-body ul, .markdown-body ol { padding-left: 0; margin-top: 0; margin-bottom: 0; } .markdown-body ol ol, .markdown-body ul ol { list-style-type: lower-roman; } .markdown-body ul ul ol, .markdown-body ul ol ol, .markdown-body ol ul ol, .markdown-body ol ol ol { list-style-type: lower-alpha; } .markdown-body dd { margin-left: 0; } .markdown-body code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; } .markdown-body pre { margin-top: 0; margin-bottom: 0; font: 12px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; } .markdown-body .octicon { vertical-align: text-bottom; } .markdown-body .pl-0 { padding-left: 0 !important; } .markdown-body .pl-1 { padding-left: 4px !important; } .markdown-body .pl-2 { padding-left: 8px !important; } .markdown-body .pl-3 { padding-left: 16px !important; } .markdown-body .pl-4 { padding-left: 24px !important; } .markdown-body .pl-5 { padding-left: 32px !important; } .markdown-body .pl-6 { padding-left: 40px !important; } .markdown-body::before { display: table; content: ""; } .markdown-body::after { display: table; clear: both; content: ""; } .markdown-body > *:first-child { margin-top: 0 !important; } .markdown-body > *:last-child { margin-bottom: 0 !important; } .markdown-body a:not([href]) { color: inherit; text-decoration: none; } .markdown-body .anchor { float: left; padding-right: 4px; margin-left: -20px; line-height: 1; } .markdown-body .anchor:focus { outline: none; } .markdown-body blockquote, .markdown-body ul, .markdown-body ol, .markdown-body dl, .markdown-body table, .markdown-body pre { margin-top: 0; margin-bottom: 10px; } .markdown-body hr { height: 0.25em; padding: 0; margin: 24px 0; background-color: #e1e4e8; border: 0; } .markdown-body blockquote { padding: 0 1em; color: #6a737d; border-left: 0.25em solid #dfe2e5; } .markdown-body blockquote > :first-child { margin-top: 0; } .markdown-body blockquote > :last-child { margin-bottom: 0; } .markdown-body kbd { display: inline-block; padding: 3px 5px; font-size: 11px; line-height: 10px; color: #444d56; vertical-align: middle; background-color: #fafbfc; border: solid 1px #c6cbd1; border-bottom-color: #959da5; border-radius: 3px; box-shadow: inset 0 -1px 0 #959da5; } .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { margin-top: 20px; margin-bottom: 12px; font-weight: 600; line-height: 1.25; } .markdown-body h1 .octicon-link, .markdown-body h2 .octicon-link, .markdown-body h3 .octicon-link, .markdown-body h4 .octicon-link, .markdown-body h5 .octicon-link, .markdown-body h6 .octicon-link { color: #1b1f23; vertical-align: middle; visibility: hidden; } .markdown-body h1:hover .anchor, .markdown-body h2:hover .anchor, .markdown-body h3:hover .anchor, .markdown-body h4:hover .anchor, .markdown-body h5:hover .anchor, .markdown-body h6:hover .anchor { text-decoration: none; } .markdown-body h1:hover .anchor .octicon-link, .markdown-body h2:hover .anchor .octicon-link, .markdown-body h3:hover .anchor .octicon-link, .markdown-body h4:hover .anchor .octicon-link, .markdown-body h5:hover .anchor .octicon-link, .markdown-body h6:hover .anchor .octicon-link { visibility: visible; } .markdown-body h1 { padding-bottom: 0.3em; font-size: 2.2em; border-bottom: 1px solid #eaecef; } .markdown-body h2 { padding-bottom: 0.3em; font-size: 1.8em; border-bottom: 1px solid #eaecef; } .markdown-body h3 { font-size: 1.5em; } .markdown-body h4 { font-size: 1.2em; } .markdown-body h5 { font-size: 16px; } .markdown-body h6 { font-size: 14px; color: #6a737d; } .markdown-body ul, .markdown-body ol { padding-left: 2em; } .markdown-body ul ul, .markdown-body ul ol, .markdown-body ol ol, .markdown-body ol ul { margin-top: 0; margin-bottom: 0; } .markdown-body li > p { margin-top: 16px; } .markdown-body li + li { margin-top: 0.25em; } .markdown-body dl { padding: 0; } .markdown-body dl dt { padding: 0; margin-top: 16px; font-size: 1em; font-style: italic; font-weight: 600; } .markdown-body dl dd { padding: 0 16px; margin-bottom: 12px; } .markdown-body table { display: block; width: 100%; overflow: auto; } .markdown-body table th { font-weight: 600; } .markdown-body table th, .markdown-body table td { padding: 6px 13px; border: 1px solid #dfe2e5; } .markdown-body table tr { background-color: #fff; border-top: 1px solid #c6cbd1; } .markdown-body table tr:nth-child(2n) { background-color: #f6f8fa; } .markdown-body img { max-width: 100%; box-sizing: content-box; background-color: #fff; } .markdown-body code { padding: 0; padding-top: 0.2em; padding-bottom: 0.2em; margin: 0; font-size: 85%; background-color: rgba(27, 31, 35, 0.05); border-radius: 3px; } .markdown-body code::before, .markdown-body code::after { letter-spacing: -0.2em; content: "\00a0"; } .markdown-body pre { word-wrap: normal; } .markdown-body pre > code { padding: 0; margin: 0; font-size: 100%; word-break: normal; white-space: pre; background: transparent; border: 0; } .markdown-body .highlight { margin-bottom: 12px; } .markdown-body .highlight pre { margin-bottom: 0; word-break: normal; } .markdown-body .highlight pre, .markdown-body pre { padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45; border-radius: 3px; } .markdown-body pre code { display: inline; max-width: auto; padding: 0; margin: 0; overflow: visible; line-height: inherit; word-wrap: normal; background-color: transparent; border: 0; } .markdown-body pre code::before, .markdown-body pre code::after { content: normal; } .markdown-body .full-commit .btn-outline:not(:disabled):hover { color: #005cc5; border-color: #005cc5; } .markdown-body kbd { display: inline-block; padding: 3px 5px; font: 11px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; line-height: 10px; color: #444d56; vertical-align: middle; background-color: #fcfcfc; border: solid 1px #c6cbd1; border-bottom-color: #959da5; border-radius: 3px; box-shadow: inset 0 -1px 0 #959da5; } .markdown-body :checked + .radio-label { position: relative; z-index: 1; border-color: #0366d6; } .markdown-body .task-list-item { list-style-type: none; } .markdown-body .task-list-item + .task-list-item { margin-top: 3px; } .markdown-body .task-list-item input { margin: 0 0.2em 0.25em -1.6em; vertical-align: middle; } .markdown-body hr { border-bottom-color: #eee; } /* 高亮 */ .markdown-body .hljs { display: block; overflow-x: auto; padding: 0.5em; color: #333; background: #f2f3f1 } .markdown-body .hljs-comment, .hljs-quote { color: #998; font-style: italic } .markdown-body .hljs-keyword, .hljs-selector-tag, .hljs-subst { color: #333; font-weight: bold } .markdown-body .hljs-number, .hljs-literal, .hljs-variable, .hljs-template-variable, .hljs-tag .hljs-attr { color: #008080 } .markdown-body .hljs-string, .hljs-doctag { color: #d14 } .markdown-body .hljs-title, .hljs-section, .hljs-selector-id { color: #900; font-weight: bold } .markdown-body .hljs-subst { font-weight: normal } .markdown-body .hljs-type, .hljs-class .hljs-title { color: #458; font-weight: bold } .markdown-body .hljs-tag, .hljs-name, .hljs-attribute { color: #000080; font-weight: normal } .markdown-body .hljs-regexp, .hljs-link { color: #009926 } .markdown-body .hljs-symbol, .hljs-bullet { color: #990073 } .markdown-body .hljs-built_in, .hljs-builtin-name { color: #0086b3 } .markdown-body .hljs-meta { color: #999; font-weight: bold } .markdown-body .hljs-deletion { background: #fdd } .markdown-body .hljs-addition { background: #dfd } .markdown-body .hljs-emphasis { font-style: italic } .markdown-body .hljs-strong { font-weight: bold } ================================================ FILE: src/lib/css/mavon-editor.styl ================================================ border-color = 1px solid #F2F6FC op-height = 40px textarea:disabled background-color #ffffff /* 路由内容 */ .v-note-wrapper position relative min-width 300px min-height 300px display flex flex-direction column background-color #fff z-index 1500 text-align left border border-color border-radius 4px &.fullscreen position fixed left 0 right 0 bottom 0 top 0 margin 0 height auto z-index 1501 .v-note-op padding 1px width 100% display flex white-space pre-line flex none min-height op-height user-select none border-bottom border-color border-radius 4px 4px 0 0 background-color #fff z-index 1 .v-left-item, .v-right-item flex 1 min-height op-height box-sizing border-box .op-icon-divider height op-height border-left 1px solid #e5e5e5 margin 0 6px 0 4px .op-icon box-sizing border-box display inline-block cursor pointer height 28px width 28px margin 6px 0 5px 0px font-size 14px padding 4.5px 6px 5px 3.5px color #757575 border-radius 5px text-align center background none border none outline none line-height 1 //vertical-align middle &.dropdown-wrapper line-height 18px &.selected color rgba(0, 0, 0, 0.8) background #eaeaea &:hover color rgba(0, 0, 0, 0.8) background #e9e9eb &.transition .op-icon transition all 0.2s linear 0s .v-right-item text-align right padding-right 6px max-width 30% .v-left-item text-align left padding-left 6px .v-note-panel position relative border-top none display flex flex 1 width 100% box-sizing border-box overflow hidden .v-note-edit.divarea-wrapper flex 0 0 50% width 50% padding 0 overflow-y scroll overflow-x hidden box-sizing border-box cursor text border-bottom-left-radius: 4px; scrollbar() &.transition transition all 0.2s linear 0s &.single-edit width 100% flex 0 0 100% overflow-y auto &.single-show width 0 flex 0 0 0 display none .content-div width 100% padding 20px 25px box-sizing border-box outline 0 none border none !important color #2c3e50 font-size 16px .content-input-wrapper width 100% padding 8px 25px 15px 25px .v-note-show flex 0 0 50% width 50% overflow-y auto padding 0 0 transition all 0.2s linear 0s &.single-show flex 0 0 100% width 100% .v-show-content, .v-show-content-html width 100% height 100% padding 8px 25px 15px 25px overflow-y auto box-sizing border-box overflow-x hidden scrollbar() .v-note-navigation-wrapper display flex position absolute width 250px right 0 top 0 bottom 0 height 100% flex-direction column background-color rgba(255,255,255,0.98) border-left border-color border-right border-color &.transition transition all 0.1s linear 0s @media only screen and (max-width 768px) width 50% &.slideTop-enter-active, &.slideTop-leave-active height 100% &.slideTop-enter, &.slideTop-leave-active height 0 .v-note-navigation-title height 50px width 100% border-bottom border-color flex none line-height @height font-size 16px box-sizing border-box padding 0 12px 0 18px .v-note-navigation-close float right color #606266 font-size 18px cursor pointer &:hover color #303133 .v-note-navigation-content overflow-y auto flex 1 scrollbar() padding 8px 0 h1, h2, h3, h4, h5, h6 margin 2px 0 font-weight 500 font-size 17px color #2185d0 cursor pointer line-height normal overflow hidden text-overflow ellipsis white-space nowrap padding 0 12px border-bottom none &:hover color #483D8B text-decoration-line underline h2 padding-left 27px font-size 17px h3 padding-left 42px font-size 17px h4 padding-left 58px font-size 15px h5 padding-left 72px font-size 15px h6 padding-left 87px font-size 15px .v-note-read-model position relative display none width 100% height 100% background #fbfbfb padding 30px 8% 50px 8% overflow-y auto scrollbar() box-sizing border-box &.show display block &.shadow border none // box-shadow 0 2px 12px 0 rgba(0, 0, 0, 0.1) .v-note-help-wrapper position fixed left 0 right 0 top 0 bottom 0 background rgba(0, 0, 0, 0.7) z-index 1600 transition all 0.1s linear 0s &.fade-enter-active, &.fade-leave-active opacity 1 &.fade-enter, &.fade-leave-active opacity 0 .v-note-help-content position relative width 60% max-width 800px margin 30px auto height 90% min-width 320px transition all 0.1s linear 0s z-index 3 border border-color &.shadow border none box-shadow 0 0px 5px rgba(0, 0, 0, .156863), 0 0px 5px rgba(0, 0, 0, .227451) i font-size 28px position absolute right 15px top 8px color rgba(0, 0, 0, 0.7) cursor pointer &:hover color rgba(0, 0, 0, 1) .v-note-help-show width 100% height 100% font-size 18px background #fbfbfb overflow-y auto padding 2% 6% scrollbar() .v-note-img-wrapper position fixed display flex justify-content center align-items center left 0 right 0 top 0 bottom 0 background rgba(0, 0, 0, 0.7) z-index 1600 transition all 0.1s linear 0s &.fade-enter-active, &.fade-leave-active opacity 1 &.fade-enter, &.fade-leave-active opacity 0 img flex 0 0 auto z-index 3 i font-size 28px position absolute right 15px top 8px color rgba(255, 255, 255, 0.7) cursor pointer &:hover color rgba(255, 255, 255, 1) align() ================================================ FILE: src/lib/css/md.css ================================================ /** * @Author: HuaChao Chen * @Date: 2017-05-05T15:57:16+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: md.css * @Last modified by: chc * @Last modified time: 2017-06-15T00:13:34+08:00 * @License: MIT * @Copyright: 2017 */ .markdown-body strong{ font-weight: bolder; } .markdown-body .hljs-center { text-align: center; } .markdown-body .hljs-right { text-align: right; } .markdown-body .hljs-left { text-align: left; } .markdown-body .hljs { overflow: auto; } ================================================ FILE: src/lib/css/scroll.styl ================================================ scrollbar() &.scroll-style::-webkit-scrollbar width 6px background-color #e5e5e5 &.scroll-style::-webkit-scrollbar-thumb background-color #b7b7b7 border-radius 4px &.scroll-style::-webkit-scrollbar-thumb:hover background-color #a1a1a1 &.scroll-style::-webkit-scrollbar-thumb:active background-color #a1a1a1 &.scroll-style::-webkit-scrollbar-track -webkit-box-shadow 0 0 0px gray inset &.scroll-style-border-radius::-webkit-scrollbar border-bottom-right-radius 4px ================================================ FILE: src/lib/font/LICENSE.txt ================================================ Font license info ## Font Awesome Copyright (C) 2016 by Dave Gandy Author: Dave Gandy License: SIL () Homepage: http://fortawesome.github.com/Font-Awesome/ ================================================ FILE: src/lib/font/README.txt ================================================ This webfont is generated by http://fontello.com open source project. ================================================================================ Please, note, that you should obey original font licenses, used to make this webfont pack. Details available in LICENSE.txt file. - Usually, it's enough to publish content of LICENSE.txt file somewhere on your site in "About" section. - If your project is open-source, usually, it will be ok to make LICENSE.txt file publicly available in your repository. - Fonts, used in Fontello, don't require a clickable link on your site. But any kind of additional authors crediting is welcome. ================================================================================ Comments on archive content --------------------------- - /font/* - fonts in different formats - /css/* - different kinds of css, for all situations. Should be ok with twitter bootstrap. Also, you can skip style and assign icon classes directly to text elements, if you don't mind about IE7. - demo.html - demo file, to show your webfont content - LICENSE.txt - license info about source fonts, used to build your one. - config.json - keeps your settings. You can import it back into fontello anytime, to continue your work Why so many CSS files ? ----------------------- Because we like to fit all your needs :) - basic file, .css - is usually enough, it contains @font-face and character code definitions - *-ie7.css - if you need IE7 support, but still don't wish to put char codes directly into html - *-codes.css and *-ie7-codes.css - if you like to use your own @font-face rules, but still wish to benefit from css generation. That can be very convenient for automated asset build systems. When you need to update font - no need to manually edit files, just override old version with archive content. See fontello source code for examples. - *-embedded.css - basic css file, but with embedded WOFF font, to avoid CORS issues in Firefox and IE9+, when fonts are hosted on the separate domain. We strongly recommend to resolve this issue by `Access-Control-Allow-Origin` server headers. But if you ok with dirty hack - this file is for you. Note, that data url moved to separate @font-face to avoid problems with

fontello font demo

fa-mavon-bold0xe800
fa-mavon-italic0xe801
fa-mavon-thumb-tack0xe802
fa-mavon-link0xe803
fa-mavon-picture-o0xe804
fa-mavon-repeat0xe805
fa-mavon-undo0xe806
fa-mavon-trash-o0xe807
fa-mavon-floppy-o0xe808
fa-mavon-compress0xe809
fa-mavon-eye0xe80a
fa-mavon-eye-slash0xe80b
fa-mavon-question-circle0xe80c
fa-mavon-times0xe80d
fa-mavon-align-left0xe80f
fa-mavon-align-center0xe810
fa-mavon-align-right0xe811
fa-mavon-arrows-alt0xf0b2
fa-mavon-bars0xf0c9
fa-mavon-list-ul0xf0ca
fa-mavon-list-ol0xf0cb
fa-mavon-strikethrough0xf0cc
fa-mavon-underline0xf0cd
fa-mavon-table0xf0ce
fa-mavon-columns0xf0db
fa-mavon-quote-left0xf10d
fa-mavon-code0xf121
fa-mavon-superscript0xf12b
fa-mavon-subscript0xf12c
fa-mavon-header0xf1dc
fa-mavon-window-maximize0xf2d0
================================================ FILE: src/lib/lang/de/help_de.md ================================================ @[toc](Catalog) Markdown Handbuch === > Details: [http://commonmark.org/help/](http://commonmark.org/help/) ## **Fett** ``` **fett** __fett__ ``` ## *Kursiv* ``` *kursiv* _kursiv_ ``` ## Überschriften ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## Trennlinien ``` *** --- ``` **** ## ^Hoch^gestellt & ~Tief~gestellt ``` hochgestellt x^2^ tiefgestellt H~2~0 ``` ## ++Unterstrichen++ & ~~Durchgestrichen~~ ``` ++unterstrichen++ ~~durchgestrichen~~ ``` ## ==Markiert== ``` ==markiert== ``` ## Zitat ``` > zitat 1 >> zitat 2 >>> zitat 3 ... ``` ## Liste ``` ol 1. 2. 3. ... ul - - ... ``` ## Todo Liste - [x] aufgabe 1 - [ ] aufgabe 2 ``` - [x] aufgabe 1 - [ ] aufgabe 2 ``` ## Link ``` Text Link [Text](www.baidu.com) Link mit Bild ![Text](http://www.image.com) ``` ## Code \``` Typ Codeblock \``` \` code \` ```c++ int main() { printf("hello world!"); } ``` `code` ## Tabelle ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | links | mitte | rechts | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | links | mitte | rechts | | ---------------------- | ------------- | ----------------- | ## Fußnote ``` hallo[^hallo] ``` Schau zum unteren Rand[^hallo] [^hallo]: fussnote ## Emojis Details: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ Mathematik Formeln lassen sich darstellen z.b. :$x_i + y_i = z_i$ und $\sum_{i=1}^n a_i=0$ Formeln können auf einer eigenen Zeile gerendert werden $$\sum_{i=1}^n a_i=0$$ Details: [katex](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## Layout ::: hljs-left `::: hljs-left` `links` `:::` ::: ::: hljs-center `::: hljs-center` `mitte` `:::` ::: ::: hljs-right `::: hljs-right` `rechts` `:::` ::: ## Liste von Definitionen Term 1 : Definition 1 Term 2 mit *inline markup* : Definition 2 { ein wenig code, teil von Definition 2 } Dritter Absatz von Definition 2. ``` Term 1 : Definition 1 Term 2 mit *inline markup* : Definition 2 { ein wenig code, teil von Definition 2 } Dritter Absatz von Definition 2. ``` ## Abkürzungen *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium Die HTML Spezifikation wird gepflegt vom W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium Die HTML Spezifikation wird gepflegt vom W3C. ``` ================================================ FILE: src/lib/lang/de/words_de.json ================================================ { "start_editor": "Bearbeitung beginnen...", "navigation_title": "Navigation", "tl_bold": "Fett", "tl_italic": "Kursiv", "tl_header": "Überschrift", "tl_header_one": "Überschrift 1", "tl_header_two": "Überschrift 2", "tl_header_three": "Überschrift 3", "tl_header_four": "Überschrift 4", "tl_header_five": "Überschrift 5", "tl_header_six": "Überschrift 6", "tl_underline": "Unterstrichen", "tl_strikethrough": "Durchgestrichen", "tl_mark": "Markiert", "tl_superscript": "Hochgestellt", "tl_subscript": "Tiefgestellt", "tl_quote": "Zitat", "tl_ol": "Ol", "tl_ul": "Ul", "tl_link": "Link", "tl_image": "Link mit Bild", "tl_code": "Code", "tl_table": "Tabelle", "tl_undo": "Rückgängig", "tl_redo": "Wiederherstellen", "tl_trash": "Mülleimer", "tl_save": "Speichern", "tl_navigation_on": "Navigation AN", "tl_navigation_off": "Navigation AUS", "tl_preview": "Vorschau", "tl_aligncenter": "Text zentrieren", "tl_alignleft": "Nach links ausrichten", "tl_alignright": "Nach rechts ausrichten", "tl_edit": "Bearbeiten", "tl_single_column": "Einspaltig", "tl_double_column": "Zweispaltig", "tl_fullscreen_on": "Vollbild AN", "tl_fullscreen_off": "Vollbild AUS", "tl_read": "Lesemodus", "tl_html_on": "HTML AN", "tl_html_off": "HTML AUS", "tl_help": "Markdown Handbuch", "tl_upload": "Bilder-Upload", "tl_upload_remove": "Entfernen", "tl_popup_link_title": "Link hinzufügen", "tl_popup_link_text": "Text des Links", "tl_popup_link_addr": "Linkziel", "tl_popup_img_link_title": "Bild hinzufügen", "tl_popup_img_link_text": "Text des Bildes", "tl_popup_img_link_addr": "Link auf Bild", "tl_popup_link_sure": "Ja", "tl_popup_link_cancel": "Abbruch" } ================================================ FILE: src/lib/lang/en/help_en.md ================================================ @[toc](Catalog) Markdown Guide === > Detailed: [http://commonmark.org/help/](http://commonmark.org/help/) ## **Bold** ``` **bold** __bold__ ``` ## *Italic* ``` *italic* _italic_ ``` ## Header ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## Dividing line ``` *** --- ``` **** ## ^Super^script & ~Sub~script ``` super x^2^ sub H~2~0 ``` ## ++Underline++ & ~~Strikethrough~~ ``` ++underline++ ~~strikethrough~~ ``` ## ==Mark== ``` ==mark== ``` ## Quote ``` > quote 1 >> quote 2 >>> quote 3 ... ``` ## List ``` ol 1. 2. 3. ... ul - - ... ``` ## Todo List - [x] task 1 - [ ] task 2 ``` - [x] task 1 - [ ] task 2 ``` ## Link ``` Text Link [Text](www.baidu.com) Image Link ![Text](http://www.image.com) ``` ## Code \``` type code block \``` \` code \` ```c++ int main() { printf("hello world!"); } ``` `code` ## Table ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | | ---------------------- | ------------- | ----------------- | ## Footnote ``` hello[^hello] ``` Look at the bottom[^hello] [^hello]: footnote ## Emojis Detailed: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ Mathematics We can render formulas for example:$x_i + y_i = z_i$ and $\sum_{i=1}^n a_i=0$ We can also single-line rendering $$\sum_{i=1}^n a_i=0$$ Detailed: [katex](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## Layout ::: hljs-left `::: hljs-left` `left` `:::` ::: ::: hljs-center `::: hljs-center` `center` `:::` ::: ::: hljs-right `::: hljs-right` `right` `:::` ::: ## deflist Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` ## abbr *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` ================================================ FILE: src/lib/lang/en/words_en.json ================================================ { "start_editor": "Begin editing...", "navigation_title": "Navigation", "tl_bold": "Bold", "tl_italic": "Italic", "tl_header": "Header", "tl_header_one": "Header 1", "tl_header_two": "Header 2", "tl_header_three": "Header 3", "tl_header_four": "Header 4", "tl_header_five": "Header 5", "tl_header_six": "Header 6", "tl_underline": "Underline", "tl_strikethrough": "Strikethrough", "tl_mark": "Mark", "tl_superscript": "Superscript", "tl_subscript": "Subscript", "tl_quote": "Quote", "tl_ol": "Ol", "tl_ul": "Ul", "tl_link": "Link", "tl_image": "Image Link", "tl_code": "Code", "tl_table": "Table", "tl_undo": "Undo", "tl_redo": "Redo", "tl_trash": "Trash", "tl_save": "Save", "tl_navigation_on": "Navigation ON", "tl_navigation_off": "Navigation OFF", "tl_preview": "Preview", "tl_aligncenter": "Center text", "tl_alignleft": "Clamp text to the left", "tl_alignright": "Clamp text to the right", "tl_edit": "Edit", "tl_single_column": "Single Column", "tl_double_column": "Double Columns", "tl_fullscreen_on": "FullScreen ON", "tl_fullscreen_off": "FullScreen OFF", "tl_read": "Read Model", "tl_html_on": "HTML ON", "tl_html_off": "HTML OFF", "tl_help": "Markdown Guide", "tl_upload": "Upload Images", "tl_upload_remove": "Remove", "tl_popup_link_title": "Add Link", "tl_popup_link_text": "Link text", "tl_popup_link_addr": "Link address", "tl_popup_img_link_title": "Add Image", "tl_popup_img_link_text": "Image Text", "tl_popup_img_link_addr": "Image Link", "tl_popup_link_sure": "Sure", "tl_popup_link_cancel": "Cancel" } ================================================ FILE: src/lib/lang/fr/help_fr.md ================================================ @[toc](Catalogue) Guide Markdown ============== > Détail : [http://commonmark.org/help/](http://commonmark.org/help/) ## **Bold** ``` **bold** __bold__ ``` ## *Italic* ``` *italic* _italic_ ``` ## Header ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## Dividing line ``` *** --- ``` **** ## ^Super^script & ~Sub~script ``` super x^2^ sub H~2~0 ``` ## ++Underline++ & ~~Strikethrough~~ ``` ++underline++ ~~strikethrough~~ ``` ## ==Mark== ``` ==mark== ``` ## Quote ``` > quote 1 >> quote 2 >>> quote 3 ... ``` ## List ``` ol 1. 2. 3. ... ul - - ... ``` ## Link ## Todo List - [x] Équipe 1 - [ ] Équipe 2 ``` - [x] Équipe 1 - [ ] Équipe 2 ``` ``` Text Link [Text](www.baidu.com) Image Link ![Text](http://www.image.com) ``` ## Code \``` type code block \``` \` code \` ```c++ int main() { printf("hello world!"); } ``` `code` ## Table ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | | ---------------------- | ------------- | ----------------- | ## Footnote ``` hello[^hello] ``` Look at the bottom[^hello] [^hello]: footnote ## Emojis Detailed: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ Mathematics We can render formulas for example:$x_i + y_i = z_i$ and $\sum_{i=1}^n a_i=0$ We can also single-line rendering $$\sum_{i=1}^n a_i=0$$ Detailed: [katex](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## Layout ::: hljs-left `::: hljs-left` `left` `:::` ::: ::: hljs-center `::: hljs-center` `center` `:::` ::: ::: hljs-right `::: hljs-right` `right` `:::` ::: ## deflist Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` ## abbr *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` ================================================ FILE: src/lib/lang/fr/words_fr.json ================================================ { "start_editor": "Début d'édition...", "navigation_title": "Navigation", "tl_bold": "Gras", "tl_italic": "Italique", "tl_header": "Entête", "tl_header_one": "Entête 1", "tl_header_two": "Entête 2", "tl_header_three": "Entête 3", "tl_header_four": "Entête 4", "tl_header_five": "Entête 5", "tl_header_six": "Entête 6", "tl_underline": "Souligné", "tl_strikethrough": "Barré", "tl_mark": "Mark", "tl_superscript": "Exposant", "tl_subscript": "Sous-exposant", "tl_quote": "Quote", "tl_ol": "Liste ", "tl_ul": "Puce", "tl_link": "Lien", "tl_image": "Image Lien", "tl_code": "Code", "tl_table": "Table", "tl_undo": "Annuler", "tl_redo": "Refaire", "tl_trash": "Supprimer", "tl_save": "Sauver", "tl_navigation_on": "Activer la navigation", "tl_navigation_off": "Désactiver le navigation", "tl_preview": "Previsualisé", "tl_aligncenter": "Center le texte", "tl_alignleft": "Férer le texte à gauche", "tl_alignright": "Férer le texte à droite", "tl_preview": "Previsualisé", "tl_edit": "Editer", "tl_single_column": "Seule Colonne", "tl_double_column": "Colonnes Doubles", "tl_fullscreen_on": "Activer le mode plein écran", "tl_fullscreen_off": "Désactiver le mode plein écran", "tl_read": "Lire le modèle", "tl_html_on": "Activer le mode HTML", "tl_html_off": "Désactiver le mode HTML", "tl_help": "Guide Markdown", "tl_upload": "Télécharger les images", "tl_upload_remove": "Supprimer", "tl_popup_link_title": "Ajouter un lien", "tl_popup_link_text": "Description", "tl_popup_link_addr": "Link", "tl_popup_img_link_title": "Ajouter une image", "tl_popup_img_link_text": "Description", "tl_popup_img_link_addr": "Link", "tl_popup_link_sure": "sûr", "tl_popup_link_cancel": "Annuler" } ================================================ FILE: src/lib/lang/ja/help_ja.md ================================================ @[toc](目次) Markdown 文法ガイド === > Detailed: [http://commonmark.org/help/](http://commonmark.org/help/) ## **太字** ``` **太字** __太字__ ``` ## *斜体* ``` *斜体* _斜体_ ``` ## 見出し ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## 横線 ``` *** --- ``` **** ## ^上付き^文字 & ~下付き~文字 ``` super x^2^ sub H~2~0 ``` ## ++下線++ & ~~取り消し線~~ ``` ++underline++ ~~strikethrough~~ ``` ## ==蛍光ペン== ``` ==mark== ``` ## 引用 ``` > quote 1 >> quote 2 >>> quote 3 ... ``` ## リスト ``` 番号付きリスト 1. 2. 3. ... 箇条書きリスト - - ... ``` ## Todoリスト - [x] task 1 - [ ] task 2 ``` - [x] task 1 - [ ] task 2 ``` ## リンク ``` Text Link [Text](www.baidu.com) Image Link ![Text](http://www.image.com) ``` ## コード \``` type code block \``` \` code \` ```c++ int main() { printf("hello world!"); } ``` `code` ## 表 ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | | ---------------------- | ------------- | ----------------- | ## 脚注 ``` hello[^hello] ``` Look at the bottom[^hello] [^hello]: footnote ## 絵文字 > Detailed: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ 数式 > Detailed: [KaTeXマニュアル](http://www.intmath.com/cg5/katex-mathjax-comparison.php)、[KaTeX function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)、[LaTeXマニュアル](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) We can render formulas for example:$x_i + y_i = z_i$ and $\sum_{i=1}^n a_i=0$ We can also single-line rendering $$\sum_{i=1}^n a_i=0$$ ## レイアウト ::: hljs-left `::: hljs-left` `left` `:::` ::: ::: hljs-center `::: hljs-center` `center` `:::` ::: ::: hljs-right `::: hljs-right` `right` `:::` ::: ## 定義リスト Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` ## abbr *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` ================================================ FILE: src/lib/lang/ja/words_ja.json ================================================ { "start_editor": "編集を始めてね!", "navigation_title": "ナビゲーション", "tl_bold": "太字", "tl_italic": "斜体", "tl_header": "見出し", "tl_header_one": "見出し1", "tl_header_two": "見出し2", "tl_header_three": "見出し3", "tl_header_four": "見出し4", "tl_header_five": "見出し5", "tl_header_six": "見出し6", "tl_underline": "下線", "tl_strikethrough": "取り消し線", "tl_mark": "蛍光ペン", "tl_superscript": "上付き文字", "tl_subscript": "下付き文字", "tl_quote": "引用", "tl_ol": "番号付きリスト", "tl_ul": "箇条書きリスト", "tl_link": "ハイパーリンク", "tl_image": "画像のリンク", "tl_code": "コードの挿入", "tl_table": "表の挿入", "tl_undo": "戻る", "tl_redo": "進む", "tl_trash": "削除", "tl_save": "保存", "tl_navigation_on": "ナビゲーションを表示", "tl_navigation_off": "ナビゲーションを非表示", "tl_preview": "プレビュー", "tl_aligncenter": "中央揃え", "tl_alignleft": "左揃え", "tl_alignright": "右揃え", "tl_edit": "編集", "tl_single_column": "一列", "tl_double_column": "二列", "tl_fullscreen_on": "全画面表示", "tl_fullscreen_off": "全画面表示の終了", "tl_read": "モデルの読み込み", "tl_html_on": "HTMLで表示", "tl_html_off": "HTML表示の終了", "tl_help": "ヘルプ", "tl_upload": "画像をアップロード", "tl_upload_remove": "画像の削除", "tl_popup_link_title": "リンクの追加", "tl_popup_link_text": "リンクテキスト", "tl_popup_link_addr": "リンク先のURL", "tl_popup_img_link_title": "画像の追加", "tl_popup_img_link_text": "画像タイトル", "tl_popup_img_link_addr": "画像URL", "tl_popup_link_sure": "OK", "tl_popup_link_cancel": "戻る" } ================================================ FILE: src/lib/lang/kr/help_kr.md ================================================ @[toc](Catalog) 마크다운 가이드 === > 자세히 보기: [http://commonmark.org/help/](http://commonmark.org/help/) ## **볼드체(굵게)** ``` **볼드체** __볼드체__ ``` ## *이탈릭체(기울임꼴)* ``` *이탈릭체* _이탈릭체_ ``` ## 헤더 ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## 구분선 ``` *** --- ``` **** ## ^위^첨자 & ~아래~첨자 ``` 위첨자 x^2^ 아래첨자 H~2~0 ``` ## ++밑줄++ & ~~취소선~~ ``` ++밑줄++ ~~취소선~~ ``` ## ==마커== ``` ==마커== ``` ## 인용 ``` > quote 1 >> quote 2 >>> quote 3 ... ``` ## 리스트 ``` ol 1. 2. 3. ... ul - - ... ``` ## 할일 - [x] task 1 - [ ] task 2 ``` - [x] task 1 - [ ] task 2 ``` ## 링크 ``` 텍스트 링크 [Text](www.baidu.com) 이미지 링크 ![Text](http://www.image.com) ``` ## 코드블럭 \``` type code block \``` \` code \` ```c++ int main() { printf("hello world!"); } ``` `code` ## 테이블 ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | | ---------------------- | ------------- | ----------------- | ## Footnote ``` hello[^hello] ``` Look at the bottom[^hello] [^hello]: footnote ## 이모티콘 Detailed: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ 수학공식 우리는 다음과 같이 함수를 만들 수 있습니다.:$x_i + y_i = z_i$ and $\sum_{i=1}^n a_i=0$ 단일 항으로도 가능합니다. $$\sum_{i=1}^n a_i=0$$ Detailed: [katex](http://www.intmath.com/cg5/katex-mathjax-comparison.php) and [katex function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX) and [latex](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## 레이아웃 ::: hljs-left `::: hljs-left` `left` `:::` ::: ::: hljs-center `::: hljs-center` `center` `:::` ::: ::: hljs-right `::: hljs-right` `right` `:::` ::: ## deflist Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` Term 1 : Definition 1 Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` ## abbr *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` ================================================ FILE: src/lib/lang/kr/words_kr.json ================================================ { "start_editor": "작성해주세요.", "navigation_title": "네비게이션", "tl_bold": "굵게", "tl_italic": "기울임꼴", "tl_header": "헤더", "tl_header_one": "헤더 1", "tl_header_two": "헤더 2", "tl_header_three": "헤더 3", "tl_header_four": "헤더 4", "tl_header_five": "헤더 5", "tl_header_six": "헤더 6", "tl_underline": "밑줄", "tl_strikethrough": "취소선", "tl_mark": "마커", "tl_superscript": "위첨자", "tl_subscript": "아래첨자", "tl_quote": "Quote", "tl_ol": "숫자 리스트", "tl_ul": "점 리스트", "tl_link": "링크", "tl_image": "이미지 링크", "tl_code": "코드블럭", "tl_table": "테이블", "tl_undo": "실행취소", "tl_redo": "되돌리기", "tl_trash": "삭제", "tl_save": "저장", "tl_navigation_on": "네비게이션 끔", "tl_navigation_off": "네비게이션 켬", "tl_preview": "미리보기", "tl_aligncenter": "가운데 정렬", "tl_alignleft": "왼쪽 정렬", "tl_alignright": "오른쪽 정렬", "tl_edit": "수정", "tl_single_column": "단일 열", "tl_double_column": "복수 열", "tl_fullscreen_on": "전체화면 활성화", "tl_fullscreen_off": "전체화면 종료", "tl_read": "읽기모드", "tl_html_on": "HTML 켬", "tl_html_off": "HTML 끔", "tl_help": "마크다운 가이드", "tl_upload": "이미지 업로드", "tl_upload_remove": "제거", "tl_popup_link_title": "링크 삽입", "tl_popup_link_text": "텍스트", "tl_popup_link_addr": "링크주소", "tl_popup_img_link_title": "이미지 추가", "tl_popup_img_link_text": "이미지 이름", "tl_popup_img_link_addr": "링크주소", "tl_popup_link_sure": "삽입", "tl_popup_link_cancel": "취소" } ================================================ FILE: src/lib/lang/pt-BR/help_pt-BR.md ================================================ @[toc](Directory) Guia Markdown === > Detalhes: [http://commonmark.org/help/](http://commonmark.org/help/) ## **Negrito** ``` **negrito** __negrito__ ``` ## *Itálico* ``` *itálico* _itálico_ ``` ## Cabeçalho ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## Linha Divisora ``` *** --- ``` **** ## ^Sobre^scrito & ~Sub~scrito ``` sobre x^2^ sub H~2~0 ``` ## ++Sublinhar++ & ~~Tachar~~ ``` ++sublinhar++ ~~tachar~~ ``` ## ==Marcador== ``` ==marcador== ``` ## Citação ``` > citação 1 >> citação 2 >>> citação 3 ... ``` ## Listas ``` lista Numerada 1. 2. 3. ... lista com marcadores - - ... ``` ## Todo Listas - [x] Tarefa 1 - [ ] Tarefa 2 ``` - [x] Tarefa 1 - [ ] Tarefa 2 ``` ## Link ``` Link Texto [Text](www.baidu.com) Link Imagem ![Text](http://www.image.com) ``` ## Código \``` tipo bloco de código \``` \` código \` ```c++ int main() { printf("hello world!"); } ``` `code` ## Tabela ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | esquerda | centro | direita | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | esquerda | centro | direita | | ---------------------- | ------------- | ----------------- | ## Rodapé ``` olá[^olá] ``` Olhe para baixo[^olá] [^olá]: rodapé ## Emojis Detalhes: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ Mathematics Podemos mostrar fórmulas por exemplo:$x_i + y_i = z_i$ and $\sum_{i=1}^n a_i=0$ Podemos também mostrar em uma única linha: $$\sum_{i=1}^n a_i=0$$ Detalhes: [katex](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## Layout ::: hljs-left `::: hljs-left` `esquerda` `:::` ::: ::: hljs-center `::: hljs-center` `centro` `:::` ::: ::: hljs-right `::: hljs-right` `direita` `:::` ::: ## Definições Termo 1 : Definição 1 Termo 2 com *markup inline* : Definição 2 { um pouco de código, parte da Definição 2 } Terceiro parágrafo da definição 2. ``` Termo 1 : Definição 1 Termo 2 com *markup inline* : Definição 2 { um pouco de código, parte da Definição 2 } Terceiro parágrafo da definição 2. ``` ## Abreviações *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium A especificação HTML é mantida pela W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification é mantida pela W3C. ``` ================================================ FILE: src/lib/lang/pt-BR/words_pt-BR.json ================================================ { "start_editor": "Começar edição...", "navigation_title": "Navegação", "tl_bold": "Negrito", "tl_italic": "Itálico", "tl_header": "Cabeçalho", "tl_header_one": "Cabeçalho 1", "tl_header_two": "Cabeçalho 2", "tl_header_three": "Cabeçalho 3", "tl_header_four": "Cabeçalho 4", "tl_header_five": "Cabeçalho 5", "tl_header_six": "Cabeçalho 6", "tl_underline": "Sublinhar", "tl_strikethrough": "Tachar", "tl_mark": "Marcação", "tl_superscript": "Sobrescrito", "tl_subscript": "Subscrito", "tl_quote": "Citação", "tl_ol": "Lista Numerada", "tl_ul": "Lista com marcadores", "tl_link": "Link", "tl_image": "Link de imagem", "tl_code": "Código", "tl_table": "Tabela", "tl_undo": "Desfazer", "tl_redo": "Refazer", "tl_trash": "Lixo", "tl_save": "Salvar", "tl_navigation_on": "Mostrar Navegação", "tl_navigation_off": "Esconder Navegação", "tl_preview": "Preview", "tl_aligncenter": "Alinhar no centro", "tl_alignleft": "Alinhar à esquerda", "tl_alignright": "Alinhar à direita", "tl_edit": "Editar", "tl_single_column": "Coluna Única", "tl_double_column": "Duas Colunas", "tl_fullscreen_on": "Ligar Tela Cheia", "tl_fullscreen_off": "Desligar Tela Cheia", "tl_read": "Modo de Leitura", "tl_html_on": "Ligar HTML", "tl_html_off": "Desligar HTML", "tl_help": "Guia Markdown", "tl_upload": "Upload de Imagens", "tl_upload_remove": "Remover", "tl_popup_link_title": "Adicionar Link", "tl_popup_link_text": "Descrição", "tl_popup_link_addr": "Link", "tl_popup_img_link_title": "Adicionar fotos", "tl_popup_img_link_text": "Descrição", "tl_popup_img_link_addr": "Link", "tl_popup_link_sure": "Confirmar", "tl_popup_link_cancel": "Cancelar" } ================================================ FILE: src/lib/lang/ru/help_ru.md ================================================ @[toc](Catalog) Markdown помощь === > Подробнее: [http://commonmark.org/help/](http://commonmark.org/help/) ## **Полужирный** ``` **Полужирный** __Полужирный__ ``` ## *Курсив* ``` *Курсив* _Курсив_ ``` ## Заголовок ``` # h1 # h1 ==== ## h2 ## h2 ---- ### h3 ### #### h4 #### ##### h5 ##### ###### h6 ###### ``` ## Разделительная линия ``` *** --- ``` **** ## ^Верхний^индекс & ~Нижний~индекс ``` верхний x^2^ нижний H~2~0 ``` ## ++Подчеркнутый++ & ~~Зачеркнутый~~ ``` ++Подчеркнутый++ ~~Зачеркнутый~~ ``` ## ==Отметка== ``` ==Отметка== ``` ## Цитата ``` > Цитата >> Цитата 2 >>> Цитата 3 ... ``` ## Список ``` ol 1. 2. 3. ... ul - - ... ``` ## Список задач - [x] Задача 1 - [ ] Задача 2 ``` - [x] Задача 1 - [ ] Задача 2 ``` ## Ссылка ``` Ссылка [Текст](www.baidu.com) Ссылка изображения ![Текст](http://www.image.com) ``` ## Код \``` type code block \``` \` code \` ```c++ int main() { printf("hello world!");} ``` `code` ## Таблица ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | ``` | th1 | th2 | th3 | | :-- | :--: | ----: | | left | center | right | | ---------------------- | ------------- | ----------------- | ## Сноска ``` Привет[^Привет] ``` Тут что-то непонятное[^Привет] [^Привет]: А тут объяснение ## Emojis Подробнее: [https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$ Mathematics Можно выводить такие формулы:$x_i + y_i = z_i$ and $\sum_{i=1}^n a_i=0$ А также в одну строку: $$\sum_{i=1}^n a_i=0$$ Подробнее: - [katex](http://www.intmath.com/cg5/katex-mathjax-comparison.php) - [katex function](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX) - [latex](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## Разметка ::: hljs-left `::: hljs-left` `left` `:::` ::: ::: hljs-center `::: hljs-center` `center` `:::` ::: ::: hljs-right `::: hljs-right` `right` `:::` ::: ## Список определений Термин 1 : Определение 1 Термин 2 с использованием *разметки* : Определение 2 { Какой-нибудь код, часть определения 2 } Третий параграф определения 2. ``` Термин 1 : Определение 1 Термин 2 с использованием *разметки* : Определение 2 { Какой-нибудь код, часть определения 2 } Третий параграф определения 2. ``` ## Сокращения *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium The HTML specification is maintained by the W3C. ``` ================================================ FILE: src/lib/lang/ru/words_ru.json ================================================ { "start_editor": "Начните редактирование...", "navigation_title": "Навигация", "tl_bold": "Полужирный", "tl_italic": "Курсив", "tl_header": "Заголовки", "tl_header_one": "Заголовок 1", "tl_header_two": "Заголовок 2", "tl_header_three": "Заголовок 3", "tl_header_four": "Заголовок 4", "tl_header_five": "Заголовок 5", "tl_header_six": "Заголовок 6", "tl_underline": "Подчеркнутый", "tl_strikethrough": "Зачеркнутый", "tl_mark": "Отметка", "tl_superscript": "Верхний индекс", "tl_subscript": "Нижний индекс", "tl_quote": "Цитата", "tl_ol": "Нумерованный список", "tl_ul": "Список", "tl_link": "Ссылка", "tl_image": "Ссылка изображения", "tl_code": "Код", "tl_table": "Таблица", "tl_undo": "Отменить", "tl_redo": "Вернуть", "tl_trash": "Удалить", "tl_save": "Сохранить", "tl_navigation_on": "Показать навигацию", "tl_navigation_off": "Скрыть навигацию", "tl_preview": "Предпросмотр", "tl_aligncenter": "Выровнять по центру", "tl_alignleft": "Выровнять по левому краю", "tl_alignright": "Выровнять по правому краю", "tl_edit": "Редактор", "tl_single_column": "Одно поле", "tl_double_column": "Два поля", "tl_fullscreen_on": "Полноэкранный режим", "tl_fullscreen_off": "Выключить полноэкранный режим", "tl_read": "Режим чтения", "tl_html_on": "Показать HTML", "tl_html_off": "Убрать HTML", "tl_help": "Markdown помощь", "tl_upload": "Загрузить изображение", "tl_upload_remove": "Удалить", "tl_popup_link_title": "Добавить ссылку", "tl_popup_link_text": "Текст ссылки", "tl_popup_link_addr": "Адрес ссылки", "tl_popup_img_link_title": "Локальное изображение", "tl_popup_img_link_text": "Текст изображения", "tl_popup_img_link_addr": "Ссылка изображения", "tl_popup_link_sure": "Добавить", "tl_popup_link_cancel": "Отменить" } ================================================ FILE: src/lib/lang/zh-CN/help_zh-CN.md ================================================ @[toc](目录) Markdown 语法简介 ============= > [语法详解](http://commonmark.org/help/) ## **目录** ``` @[toc](目录) ``` ## **粗体** ``` **粗体** __粗体__ ``` ## *斜体* ``` *斜体* _斜体_ ``` ## 标题 ``` # 一级标题 # 一级标题 ==== ## 二级标题 ## 二级标题 ---- ### 三级标题 ### #### 四级标题 #### ##### 五级标题 ##### ###### 六级标题 ###### ``` ## 分割线 ``` *** --- ``` **** ## ^上^角~下~标 ``` 上角标 x^2^ 下角标 H~2~0 ``` ## ++下划线++ ~~中划线~~ ``` ++下划线++ ~~中划线~~ ``` ## ==标记== ``` ==标记== ``` ## 段落引用 ``` > 一级 >> 二级 >>> 三级 ... ``` ## 列表 ``` 有序列表 1. 2. 3. ... 无序列表 - - ... ``` ## 任务列表 - [x] 已完成任务 - [ ] 未完成任务 ``` - [x] 已完成任务 - [ ] 未完成任务 ``` ## 链接 ``` [链接](www.baidu.com) ![图片描述](http://www.image.com) ``` ## 代码段落 \``` type 代码段落 \``` \` 代码块 \` ```c++ int main() { printf("hello world!"); } ``` `code` ## 表格(table) ``` | 标题1 | 标题2 | 标题3 | | :-- | :--: | ----: | | 左对齐 | 居中 | 右对齐 | | ---------------------- | ------------- | ----------------- | ``` | 标题1 | 标题2 | 标题3 | | :-- | :--: | ----: | | 左对齐 | 居中 | 右对齐 | | ---------------------- | ------------- | ----------------- | ## 脚注(footnote) ``` hello[^hello] ``` 见底部脚注[^hello] [^hello]: 一个注脚 ## 表情(emoji) [参考网站: https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$公式 我们可以渲染公式例如:$x_i + y_i = z_i$和$\sum_{i=1}^n a_i=0$ 我们也可以单行渲染 $$\sum_{i=1}^n a_i=0$$ 具体可参照[katex文档](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex支持的函数](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex文档](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## 布局 ::: hljs-left `::: hljs-left` `居左` `:::` ::: ::: hljs-center `::: hljs-center` `居中` `:::` ::: ::: hljs-right `::: hljs-right` `居右` `:::` ::: ## 定义 术语一 : 定义一 包含有*行内标记*的术语二 : 定义二 {一些定义二的文字或代码} 定义二的第三段 ``` 术语一 : 定义一 包含有*行内标记*的术语二 : 定义二 {一些定义二的文字或代码} 定义二的第三段 ``` ## abbr *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium HTML 规范由 W3C 维护 ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium HTML 规范由 W3C 维护 ``` ================================================ FILE: src/lib/lang/zh-CN/words_zh-CN.json ================================================ { "start_editor": "开始编辑...", "navigation_title": "导航目录", "tl_bold": "粗体", "tl_italic": "斜体", "tl_header": "标题", "tl_header_one": "一级标题", "tl_header_two": "二级标题", "tl_header_three": "三级标题", "tl_header_four": "四级标题", "tl_header_five": "五级标题", "tl_header_six": "六级标题", "tl_underline": "下划线", "tl_strikethrough": "中划线", "tl_mark": "标记", "tl_superscript": "上角标", "tl_subscript": "下角标", "tl_quote": "段落引用", "tl_ol": "有序列表", "tl_ul": "无序列表", "tl_link": "链接", "tl_image": "添加图片链接", "tl_code": "代码块", "tl_table": "表格", "tl_undo": "上一步", "tl_redo": "下一步", "tl_trash": "清空", "tl_save": "保存", "tl_navigation_on": "开启标题导航", "tl_navigation_off": "关闭标题导航", "tl_preview": "预览", "tl_aligncenter": "居中", "tl_alignleft": "居左", "tl_alignright": "居右", "tl_edit": "编辑", "tl_single_column": "单栏", "tl_double_column": "双栏", "tl_fullscreen_on": "全屏编辑", "tl_fullscreen_off": "退出全屏", "tl_read": "沉浸式阅读", "tl_html_on": "查看html文本", "tl_html_off": "返回markdown文本", "tl_help": "markdown语法帮助", "tl_upload": "上传图片", "tl_upload_remove": "删除", "tl_popup_link_title": "添加链接", "tl_popup_link_text": "链接描述", "tl_popup_link_addr": "链接地址", "tl_popup_img_link_title": "添加图片", "tl_popup_img_link_text": "图片描述", "tl_popup_img_link_addr": "图片链接", "tl_popup_link_sure": "确定", "tl_popup_link_cancel": "取消" } ================================================ FILE: src/lib/lang/zh-TW/help_zh-TW.md ================================================ @[toc](目錄) Markdown 語法簡介 ============= > [語法詳解](http://commonmark.org/help/) ## **粗體** ``` **粗體** __粗體__ ``` ## *斜體* ``` *斜體* _斜體_ ``` ## 標題 ``` # 一級標題 # 一級標題 ==== ## 二級標題 ## 二級標題 ---- ### 三級標題 ### #### 四級標題 #### ##### 五級標題 ##### ###### 六級標題 ###### ``` ## 分割線 ``` *** --- ``` **** ## ^上^角~下~標 ``` 上角標 x^2^ 下角標 H~2~0 ``` ## ++下劃線++ ~~中劃線~~ ``` ++下劃線++ ~~中劃線~~ ``` ## ==標記== ``` ==標記== ``` ## 段落引用 ``` > 一級 >> 二級 >>> 三級 ... ``` ## 列表 ``` 有序列表 1. 2. 3. ... 無序列表 - - ... ``` ## 任務列表 - [x] 已完成任務 - [ ] 未完成任務 ``` - [x] 已完成任務 - [ ] 未完成任務 ``` ## 鏈接 ``` [鏈接](www.baidu.com) ![圖片描述](http://www.image.com) ``` ## 代碼段落 \``` type 代碼段落 \``` \` 代碼塊 \` ```c++ int main() { printf("hello world!"); } ``` `code` ## 表格(table) ``` | 標題1 | 標題2 | 標題3 | | :-- | :--: | ----: | | 左對齊 | 居中 | 右對齊 | | ---------------------- | ------------- | ----------------- | ``` | 標題1 | 標題2 | 標題3 | | :-- | :--: | ----: | | 左對齊 | 居中 | 右對齊 | | ---------------------- | ------------- | ----------------- | ## 腳註(footnote) ``` hello[^hello] ``` 見底部腳註[^hello] [^hello]: 一個註腳 ## 表情(emoji) [參考網站: https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/) ``` :laughing: :blush: :smiley: :) ... ``` :laughing::blush::smiley::) ## $\KaTeX$公式 我們可以渲染公式例如:$x_i + y_i = z_i$和$\sum_{i=1}^n a_i=0$ 我們也可以單行渲染 $$\sum_{i=1}^n a_i=0$$ 具體可參照[katex文檔](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex支持的函數](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex文檔](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) ## 布局 ::: hljs-left `::: hljs-left` `居左` `:::` ::: ::: hljs-center `::: hljs-center` `居中` `:::` ::: ::: hljs-right `::: hljs-right` `居右` `:::` ::: ## 定義 術語一 : 定義一 包含有*行內標記*的術語二 : 定義二 {一些定義二的文字或代碼} 定義二的第三段 ``` 術語一 : 定義一 包含有*行內標記*的術語二 : 定義二 {一些定義二的文字或代碼} 定義二的第三段 ``` ## abbr *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium HTML 規範由 W3C 維護 ``` *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium HTML 規範由 W3C 維護 ``` ================================================ FILE: src/lib/lang/zh-TW/words_zh-TW.json ================================================ { "start_editor": "開始編輯...", "navigation_title": "導航目錄", "tl_bold": "粗體", "tl_italic": "斜體", "tl_header": "標題", "tl_header_one": "一級標題", "tl_header_two": "二級標題", "tl_header_three": "三級標題", "tl_header_four": "四級標題", "tl_header_five": "五級標題", "tl_header_six": "六級標題", "tl_underline": "下劃線", "tl_strikethrough": "中劃線", "tl_mark": "標記", "tl_superscript": "上角標", "tl_subscript": "下角標", "tl_quote": "段落引用", "tl_ol": "有序列表", "tl_ul": "無序列表", "tl_link": "鏈接", "tl_image": "添加圖片鏈接", "tl_code": "代碼塊", "tl_table": "表格", "tl_undo": "上一步", "tl_redo": "下一步", "tl_trash": "清空", "tl_save": "保存", "tl_navigation_on": "開啟標題導航", "tl_navigation_off": "關閉標題導航", "tl_preview": "預覽", "tl_aligncenter": "居中", "tl_alignleft": "居左", "tl_alignright": "居右", "tl_edit": "編輯", "tl_single_column": "單欄", "tl_double_column": "雙欄", "tl_fullscreen_on": "全屏編輯", "tl_fullscreen_off": "退出全屏", "tl_read": "沈浸式閱讀", "tl_html_on": "查看html文本", "tl_html_off": "返回markdown文本", "tl_help": "markdown語法幫助", "tl_upload": "上傳圖片", "tl_upload_remove": "刪除", "tl_popup_link_title": "添加鏈接", "tl_popup_link_text": "鏈接描述", "tl_popup_link_addr": "鏈接地址", "tl_popup_img_link_title": "添加圖片", "tl_popup_img_link_text": "圖片描述", "tl_popup_img_link_addr": "圖片鏈接", "tl_popup_link_sure": "確定", "tl_popup_link_cancel": "取消" } ================================================ FILE: src/lib/mixins/markdown.js ================================================ import hljsLangs from '../core/hljs/lang.hljs.js' import { loadScript } from '../core/extra-function.js' import sanitizer from '../core/sanitizer.js' var markdown_config = { html: true, // Enable HTML tags in source xhtmlOut: true, // Use '/' to close single tags (
). breaks: true, // Convert '\n' in paragraphs into
langPrefix: 'lang-', // CSS language prefix for fenced blocks. Can be linkify: false, // 自动识别url typographer: true, quotes: '“”‘’' } var MarkdownIt = require('markdown-it'); // 表情 var emoji = require('markdown-it-emoji'); // 下标 var sub = require('markdown-it-sub') // 上标 var sup = require('markdown-it-sup') //
var deflist = require('markdown-it-deflist') // var abbr = require('markdown-it-abbr') // footnote var footnote = require('markdown-it-footnote') // insert 带有下划线 样式 ++ ++ var insert = require('markdown-it-ins') // mark var mark = require('markdown-it-mark') // taskLists var taskLists = require('markdown-it-task-lists') // container var container = require('markdown-it-container') // var toc = require('markdown-it-toc') var mihe = require('markdown-it-highlightjs-external'); // math katex var katex = require('markdown-it-katex-external'); var miip = require('markdown-it-images-preview'); var missLangs = {}; var needLangs = []; var hljs_opts = { hljs: 'auto', highlighted: true, langCheck: function (lang) { if (lang && hljsLangs[lang] && !missLangs[lang]) { missLangs[lang] = 1; needLangs.push(hljsLangs[lang]) } } }; export function initMarkdown() { const markdown = new MarkdownIt(markdown_config); // add target="_blank" to all link var defaultRender = markdown.renderer.rules.link_open || function (tokens, idx, options, env, self) { return self.renderToken(tokens, idx, options); }; markdown.renderer.rules.link_open = function (tokens, idx, options, env, self) { var hIndex = tokens[idx].attrIndex('href'); if (tokens[idx].attrs[hIndex][1].startsWith('#')) return defaultRender(tokens, idx, options, env, self); // If you are sure other plugins can't add `target` - drop check below var aIndex = tokens[idx].attrIndex('target'); if (aIndex < 0) { tokens[idx].attrPush(['target', '_blank']); // add new attribute } else { tokens[idx].attrs[aIndex][1] = '_blank'; // replace value of existing attr } // pass token to default renderer. return defaultRender(tokens, idx, options, env, self); }; markdown.use(mihe, hljs_opts) .use(emoji) .use(sup) .use(sub) .use(container) .use(container, 'hljs-left') /* align left */ .use(container, 'hljs-center')/* align center */ .use(container, 'hljs-right')/* align right */ .use(deflist) .use(abbr) .use(footnote) .use(insert) .use(mark) .use(container) .use(miip) .use(katex) .use(taskLists) .use(toc) return markdown; } export default { data() { return { markdownIt: null } }, created() { this.markdownIt = initMarkdown(); if (!this.html) { this.markdownIt.set({ html: false }); this.xssOptions = false; } else if (typeof this.xssOptions === 'object') { this.markdownIt.use(sanitizer, this.xssOptions); } }, mounted() { hljs_opts.highlighted = this.ishljs; }, methods: { $render(src, func) { var $vm = this; missLangs = {}; needLangs = []; var res = $vm.markdownIt.render(src); if (this.ishljs) { if (needLangs.length > 0) { $vm.$_render(src, func, res); } } func(res); }, $_render(src, func, res) { var $vm = this; var deal = 0; for (var i = 0; i < needLangs.length; i++) { var url = $vm.p_external_link.hljs_lang(needLangs[i]); loadScript(url, function () { deal = deal + 1; if (deal === needLangs.length) { res = $vm.markdownIt.render(src); func(res); } }) } } }, watch: { ishljs: function (val) { hljs_opts.highlighted = val; } } }; ================================================ FILE: src/lib/toolbar_left_click.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-05-03T01:23:38+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: toolbar_left_click.js * @Last modified by: CHC * @Last modified time: 2017-08-10T12:43:22+08:00 * @License: MIT * @Copyright: 2017 */ function $toolbar_left_undo_click($vm) { if ($vm.d_history_index > 0) { $vm.d_history_index-- } // $vm.$refs.vNoteDivEdit.innerHTML = $vm.s_markdown.render($vm.d_value) $vm.$nextTick(() => { // 光标操作 let start = $vm.textarea_selectionEnds[$vm.d_history_index]; $vm.getTextareaDom().selectionStart = start $vm.getTextareaDom().selectionEnd = start }) $vm.getTextareaDom().focus() } // redo function $toolbar_left_redo_click($vm) { if ($vm.d_history_index < $vm.d_history.length - 1) { $vm.d_history_index++ } $vm.$nextTick(() => { let start = $vm.textarea_selectionEnds[$vm.d_history_index]; $vm.getTextareaDom().selectionStart = start $vm.getTextareaDom().selectionEnd = start }) $vm.getTextareaDom().focus() // $vm.$refs.vNoteDivEdit.innerHTML = $vm.s_markdown.render($vm.d_value) } function $toolbar_left_trash_click($vm) { $vm.d_value = '' $vm.getTextareaDom().focus() // $vm.$refs.vNoteDivEdit.innerHTML = $vm.s_markdown.render($vm.d_value) } function $toolbar_left_save_click($vm) { $vm.save($vm.d_value, $vm.d_render) } // ol function $toolbar_left_ol_click($vm) { $vm.insertOl() } // ul function $toolbar_left_ul_click($vm) { $vm.insertUl() } function $toolbar_left_remove_line_click($vm) { $vm.removeLine() } function $toolbar_left_codeBlock_click($vm) { $vm.insertCodeBlock(); } // 直接添加链接 export const toolbar_left_addlink = (type, text, link, $vm) => { let insert_text = { prefix: type === 'link' ? `[${text}](` : `![${text}](`, subfix: ')', str: link }; $vm.insertText($vm.getTextareaDom(), insert_text); } export const toolbar_left_click = (_type, $vm) => { var _param_of_insert_text = { 'bold': { prefix: '**', subfix: '**', str: $vm.d_words.tl_bold }, 'italic': { prefix: '*', subfix: '*', str: $vm.d_words.tl_italic }, 'header': { prefix: '# ', subfix: '', str: $vm.d_words.tl_header }, 'header1': { prefix: '# ', subfix: '', str: $vm.d_words.tl_header_one }, 'header2': { prefix: '## ', subfix: '', str: $vm.d_words.tl_header_two }, 'header3': { prefix: '### ', subfix: '', str: $vm.d_words.tl_header_three }, 'header4': { prefix: '#### ', subfix: '', str: $vm.d_words.tl_header_four }, 'header5': { prefix: '##### ', subfix: '', str: $vm.d_words.tl_header_five }, 'header6': { prefix: '###### ', subfix: '', str: $vm.d_words.tl_header_six }, 'underline': { prefix: '++', subfix: '++', str: $vm.d_words.tl_underline }, 'strikethrough': { prefix: '~~', subfix: '~~', str: $vm.d_words.tl_strikethrough }, 'mark': { prefix: '==', subfix: '==', str: $vm.d_words.tl_mark }, 'superscript': { prefix: '^', subfix: '^', str: $vm.d_words.tl_superscript }, 'subscript': { prefix: '~', subfix: '~', str: $vm.d_words.tl_subscript }, 'quote': { prefix: '> ', subfix: '', str: $vm.d_words.tl_quote }, 'link': { prefix: '[](', subfix: ')', str: $vm.d_words.tl_link }, 'imagelink': { prefix: '![](', subfix: ')', str: $vm.d_words.tl_image }, 'table': { prefix: '', subfix: '', str: '|column1|column2|column3|\n|-|-|-|\n|content1|content2|content3|\n' }, 'aligncenter': { prefix: '::: hljs-center\n\n', subfix: '\n\n:::\n', str: $vm.d_words.tl_aligncenter }, 'alignright': { prefix: '::: hljs-right\n\n', subfix: '\n\n:::\n', str: $vm.d_words.tl_alignright }, 'alignleft': { prefix: '::: hljs-left\n\n', subfix: '\n\n:::\n', str: $vm.d_words.tl_alignleft } }; if (_param_of_insert_text.hasOwnProperty(_type)) { // 插入对应的内容 $vm.insertText($vm.getTextareaDom(), _param_of_insert_text[_type]); } var _other_left_click = { 'undo': $toolbar_left_undo_click, 'redo': $toolbar_left_redo_click, 'trash': $toolbar_left_trash_click, 'save': $toolbar_left_save_click, 'ol': $toolbar_left_ol_click, 'ul': $toolbar_left_ul_click, 'removeLine': $toolbar_left_remove_line_click, 'code': $toolbar_left_codeBlock_click }; if (_other_left_click.hasOwnProperty(_type)) { _other_left_click[_type]($vm); } } ================================================ FILE: src/lib/toolbar_right_click.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-05-03T01:39:47+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: toolbar_right_click.js * @Last modified by: chc * @Last modified time: 2017-06-08T12:44:50+08:00 * @License: MIT * @Copyright: 2017 */ function $toolbar_right_html_click($vm) { $vm.s_html_code = !$vm.s_html_code if ($vm.htmlcode) { $vm.htmlcode($vm.s_html_code, $vm.d_value) } } function $toolbar_right_help_click($vm) { $vm.s_help = !$vm.s_help if ($vm.helptoggle) { $vm.helptoggle($vm.s_help, $vm.d_value) } } // 导航 function $toolbar_right_read_click($vm) { let element = $vm.$refs.vReadModel // 单栏编辑 if (element.requestFullscreen) { element.requestFullscreen(); } else if (element.mozRequestFullScreen) { element.mozRequestFullScreen(); } else if (element.webkitRequestFullscreen) { element.webkitRequestFullscreen(); } else if (element.msRequestFullscreen) { element.msRequestFullscreen(); } } function $toolbar_right_preview_click($vm) { $vm.s_preview_switch = !$vm.s_preview_switch // $vm.$refs.vNoteDivEdit.innerHTML = $vm.s_markdown.render($vm.d_value) if ($vm.previewtoggle) { $vm.previewtoggle($vm.s_preview_switch, $vm.d_value) } } function $toolbar_right_fullscreen_click($vm) { $vm.s_fullScreen = !$vm.s_fullScreen if ($vm.fullscreen) { $vm.fullscreen($vm.s_fullScreen, $vm.d_value) } } function $toolbar_right_subfield_click ($vm) { $vm.s_subfield = !$vm.s_subfield $vm.s_preview_switch = $vm.s_subfield; // $vm.$refs.vNoteDivEdit.innerHTML = $vm.s_markdown.render($vm.d_value) if ($vm.previewtoggle) { $vm.previewtoggle($vm.s_preview_switch, $vm.d_value) } // $vm.$refs.vNoteDivEdit.innerHTML = $vm.s_markdown.render($vm.d_value) if ($vm.subfieldtoggle) { $vm.subfieldtoggle($vm.s_subfield, $vm.d_value) } } function $toolbar_right_navigation_click($vm) { $vm.s_navigation = !$vm.s_navigation if ($vm.s_navigation) { $vm.s_preview_switch = true; } if ($vm.navigationtoggle) { $vm.navigationtoggle($vm.s_navigation, $vm.d_value) } if ($vm.s_navigation) { // 绘制标题导航 $vm.getNavigation($vm, false) } } export const toolbar_right_click = (_type, $vm) => { var _other_right_click = { 'help': $toolbar_right_help_click, 'html': $toolbar_right_html_click, 'read': $toolbar_right_read_click, 'preview': $toolbar_right_preview_click, 'fullscreen': $toolbar_right_fullscreen_click, 'navigation': $toolbar_right_navigation_click, 'subfield': $toolbar_right_subfield_click } if (_other_right_click.hasOwnProperty(_type)) { _other_right_click[_type]($vm); } } ================================================ FILE: src/lib/util.js ================================================ /** * Created by zhy on 2016/12/25. */ /** * 深度拷贝对象 * @param target * @param arg * @returns {*} * @constructor */ export function p_ObjectCopy_DEEP(target, arg) { for (let arg_item in arg) { let type = typeof arg[arg_item]; if (!target[arg_item] || (type !== 'Object' && type !== 'object')) { target[arg_item] = arg[arg_item]; continue; } else { target[arg_item] = p_ObjectCopy_DEEP(target[arg_item], arg[arg_item]); } } return target; }; /** * 解析url参数 */ export function p_urlParse() { let url = window.location.search; let obj = {}; let reg = /[?&][^?&]+=[^?&]+/g; let arr = url.match(reg); if (arr) { arr.forEach((item) => { let tempArr = item.substring(1).split('='); let key = decodeURIComponent(tempArr[0]); let val = decodeURIComponent(tempArr[1]); obj[key] = val; }) } return obj; }; export function stopEvent(e) { if (!e) { return; } if (e.preventDefault) { e.preventDefault(); } if (e.stopPropagation) { e.stopPropagation(); } }; ================================================ FILE: src/mavon-editor.vue ================================================ ================================================ FILE: tests/unit/__snapshots__/mavon-editor.spec.js.snap ================================================ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`snapshot snapshot 1`] = `

`; ================================================ FILE: tests/unit/base.spec.js ================================================ import { mount } from '@vue/test-utils' import MavonEditor from '@/mavon-editor.vue' import autoTextarea from 'auto-textarea/auto-textarea.vue' /*eslint-disable */ const factory = (propsData, mocks) => { return mount(MavonEditor, { propsData: { ...propsData }, mocks: { ...mocks }, stubs: { "v-autoTextarea": autoTextarea } }) } let wrapper, buttonClass, textValue, htmlValue, textValueClass = '.auto-textarea-block', htmlValueClass = '.v-show-content-html.scroll-style.scroll-style-border-radius' function checkButton(buttonClass, textValue, htmlValue) { expect(wrapper.find(buttonClass).exists()).toBe(true) wrapper.find(buttonClass).trigger('click') wrapper.vm.$nextTick(() => { expect(wrapper.find(textValueClass).text()).toEqual(textValue) expect(wrapper.find(htmlValueClass).text()).toEqual(htmlValue) }) } describe('left-toolbars测试', () => { beforeEach(() => { wrapper = new factory({ d_words: null, value: " " }) }) afterEach(() => { wrapper.destroy() }) it('粗体按钮', async () => { buttonClass = '.op-icon.fa.fa-mavon-bold' textValue = '**粗体**' htmlValue = '

粗体

' expect.assertions(6) await checkButton(buttonClass, textValue, htmlValue) textValue = '粗体' htmlValue = '

粗体

' await checkButton(buttonClass, textValue, htmlValue) }) it('斜体按钮', async () => { let buttonClass = '.op-icon.fa.fa-mavon-italic' let textValue = '*斜体*' let htmlValue = '

斜体

' await checkButton(buttonClass, textValue, htmlValue) textValue = '斜体' htmlValue = '

斜体

' await checkButton(buttonClass, textValue, htmlValue) }) it('标题按钮', async () => { let buttonClass = '.op-header.popup-dropdown.transition span' let textValue = '# 一级标题' let htmlValue = '

一级标题

' await checkButton(buttonClass, textValue, htmlValue) }) it('下划线按钮', async () => { let buttonClass = '.op-icon.fa.fa-mavon-underline' let textValue = '++下划线++' let htmlValue = '

下划线

' await checkButton(buttonClass, textValue, htmlValue) textValue = '下划线' htmlValue = '

下划线

' await checkButton(buttonClass, textValue, htmlValue) }) it('下划线按钮', async () => { let buttonClass = '.op-icon.fa.fa-mavon-underline' let textValue = '++下划线++' let htmlValue = '

下划线

' await checkButton(buttonClass, textValue, htmlValue) }) it('中划线按钮', async () => { let buttonClass = '.op-icon.fa.fa-mavon-strikethrough' let textValue = '~~中划线~~' let htmlValue = '

中划线

' await checkButton(buttonClass, textValue, htmlValue) }) it('标记按钮', async () => { let buttonClass = '.op-icon.fa.fa-mavon-thumb-tack' let textValue = '==标记==' let htmlValue = '

标记

' await checkButton(buttonClass, textValue, htmlValue) }) it('上角标按钮', async () => { let buttonClass = '.op-icon.fa.fa-mavon-superscript' let textValue = '^上角标^' let htmlValue = '

上角标

' await checkButton(buttonClass, textValue, htmlValue) }) it('下角标按钮', async () => { let buttonClass = '.op-icon.fa.fa-mavon-subscript' let textValue = '~下角标~' let htmlValue = '

下角标

' await checkButton(buttonClass, textValue, htmlValue) }) it('居左按钮', async () => { let buttonClass = '.op-icon.fa.fa-mavon-align-left' let textValue = '::: hljs-left\n\n居左\n\n:::' let htmlValue = '
\n

居左

\n
' await checkButton(buttonClass, textValue, htmlValue) }) it('居中按钮', async () => { let buttonClass = '.op-icon.fa.fa-mavon-align-center' let textValue = '::: hljs-center\n\n居中\n\n:::' let htmlValue = '
\n

居中

\n
' await checkButton(buttonClass, textValue, htmlValue) }) it('居右按钮', async () => { let buttonClass = '.op-icon.fa.fa-mavon-align-right' let textValue = '::: hljs-right\n\n居右\n\n:::' let htmlValue = '
\n

居右

\n
' await checkButton(buttonClass, textValue, htmlValue) }) it('段落引用', async () => { let buttonClass = '.op-icon.fa.fa-mavon-quote-left' let textValue = '> 段落引用' let htmlValue = '
\n

段落引用

\n
' await checkButton(buttonClass, textValue, htmlValue) textValue = '段落引用' htmlValue = '

段落引用

' await checkButton(buttonClass, textValue, htmlValue) }) it('有序列表', async () => { let buttonClass = '.op-icon.fa.fa-mavon-list-ol' let textValue = '1.' let htmlValue = '
    \n
  1. \n
' await checkButton(buttonClass, textValue, htmlValue) }) it('无序列表', async () => { let buttonClass = '.op-icon.fa.fa-mavon-list-ul' let textValue = '-' let htmlValue = '
    \n
  • \n
' await checkButton(buttonClass, textValue, htmlValue) }) it('链接', async () => { let buttonClass = '.op-icon.fa.fa-mavon-link' let linktext = '.link-text.input-wrapper input' let linkaddr = '.link-addr.input-wrapper input' let surebutten = '.op-btn.sure' let textValue = '[mylink](http://xxx.com)' let htmlValue = '

mylink

' await wrapper.find(buttonClass).trigger('click') wrapper.find(linktext).setValue('mylink') wrapper.find(linkaddr).setValue('http://xxx.com') await wrapper.find(surebutten).trigger('click') expect(wrapper.find(textValueClass).text()).toEqual(textValue) expect(wrapper.find(htmlValueClass).text()).toEqual(htmlValue) }) it('图片链接添加', async () => { let buttonClass = '.op-icon.fa.fa-mavon-picture-o.dropdown.dropdown-wrapper' let addimagelink = '.op-image.popup-dropdown.transition div span' let linktext = '.link-text.input-wrapper input' let linkaddr = '.link-addr.input-wrapper input' let surebutten = '.op-btn.sure' let textValue = '![mylink](http://xxx.com)' let htmlValue = '

mylink

' await wrapper.find(buttonClass).trigger('click') await wrapper.find(addimagelink).trigger('click') wrapper.find(linktext).setValue('mylink') wrapper.find(linkaddr).setValue('http://xxx.com') await wrapper.find(surebutten).trigger('click') expect(wrapper.find(textValueClass).text()).toEqual(textValue) expect(wrapper.find(htmlValueClass).text()).toEqual(htmlValue) }) it('代码块', async () => { let buttonClass = '.op-icon.fa.fa-mavon-code' let textValue = '```language\n\n```' let htmlValue = '
\n
' await checkButton(buttonClass, textValue, htmlValue) }) it('表格', async () => { let buttonClass = '.op-icon.fa.fa-mavon-table' let textValue = `|column1|column2|column3|\n|-|-|-|\n|content1|content2|content3|` let htmlValue = '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '
column1column2column3
content1content2content3
' await checkButton(buttonClass, textValue, htmlValue) }) it('上一步/下一步', async () => { let buttonClass = '.op-icon.fa.fa-mavon-undo' let textValue = 'first' let htmlValue = '

first

' await wrapper.setData({ d_history: ['first', 'second', 'third'], d_history_index: 1 }) await checkButton(buttonClass, textValue, htmlValue) buttonClass = '.op-icon.fa.fa-mavon-repeat' textValue = 'second' htmlValue = '

second

' await checkButton(buttonClass, textValue, htmlValue) }) it('清空', async () => { let buttonClass = '.op-icon.fa.fa-mavon-trash-o' let textValue = '' let htmlValue = '' await wrapper.setData({ d_value: 'first' }) await checkButton(buttonClass, textValue, htmlValue) }) it('保存', () => { let buttonClass = '.op-icon.fa.fa-mavon-trash-o' expect(wrapper.find(buttonClass).exists()).toBe(true) }) }) describe('xssOptions test', () => { it('xssOptions is enabled by default', async () => { let xssCode = `#"> `; let htmlValue = `

<a$ #"> <a$
\n

` let wrapper = new factory({ d_words: null, value: '' }); const textInput = wrapper.find('textarea') await textInput.setValue(xssCode) expect(wrapper.find(textValueClass).text()).toEqual(xssCode); expect(wrapper.find(htmlValueClass).text()).toEqual(htmlValue); }); it('disable xssOptions', async () => { let xssCode = `#"> `; let htmlValue = `

<a$ #"> <a$
\n

` let wrapper = new factory({ d_words: null, value: '', xssOptions: false }); const textInput = wrapper.find('textarea') await textInput.setValue(xssCode) expect(wrapper.find(textValueClass).text()).toEqual(xssCode); expect(wrapper.find(htmlValueClass).text()).toEqual(htmlValue); }); }); describe('local images upload', () => { it('upload images', async () => { let textValue = `![gh.png](1)`; let htmlValue = `

\"gh.png\"

` let wrapper = new factory({ d_words: null, value: '' }); const textInput = wrapper.find('textarea') await textInput.setValue(textValue) expect(wrapper.find(textValueClass).text()).toEqual(textValue); expect(wrapper.find(htmlValueClass).text()).toEqual(htmlValue); }); }); ================================================ FILE: tests/unit/mavon-editor.spec.js ================================================ import { mount } from '@vue/test-utils' import MavonEditor from '@/mavon-editor.vue' import autoTextarea from 'auto-textarea/auto-textarea.vue' /*eslint-disable */ const factory = (propsData) => { return mount(MavonEditor, { propsData: { ...propsData }, stubs: { "v-autoTextarea": autoTextarea } }) } describe('snapshot', () => { it('snapshot', () => { const wrapper = new factory() expect(wrapper.html()).toMatchSnapshot() }) }) ================================================ FILE: webpack/webpack.base.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-05-07T20:11:11+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: webpack.base.js * @Last modified by: chc * @Last modified time: 2017-11-26T22:25:40+08:00 * @License: MIT * @Copyright: 2017 */ var path = require('path'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); var WebpackMd5Hash = require('webpack-md5-hash'); // 该插件是对“webpack-md5-hash”的改进:在主文件中获取到各异步模块的hash值,然后将这些hash值与主文件的代码内容一同作为计算hash的参数,这样就能保证主文件的hash值会跟随异步模块的修改而修改。 // var WebpackSplitHash = require('webpack-split-hash'); // 压缩css var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); var CopyWebpackPlugin = require('copy-webpack-plugin'); var fs = require("fs"); // var postcss = require('postcss-loader') const extractCSS = new ExtractTextPlugin('css/[name].css'); module.exports = { module: { rules: [ { test: /\.vue$/, loader: 'vue-loader', options: { esModule: false, postcss: [ require('autoprefixer')({ browsers: ['last 10 Chrome versions', 'last 5 Firefox versions', 'Safari >= 6', 'ie > 8'] }) ] } }, { test: /\.js$/, loader: 'babel-loader', // exclude: /.*node_modules((?!auto-textarea).)*$/ // exclude: /node_modules/ include: [ path.resolve(__dirname, '../src'), fs.realpathSync('node_modules/auto-textarea') ] }, { test: /\.(png|jpg|gif)$/, loader: 'file-loader', options: { name: '[name].[ext]?[hash]' } }, { test: /\.(woff|ttf|eot|svg)/, loader: 'file-loader?name=font/[name].[ext]&publicPath=../' }, { test: /\.styl$/, loader: 'style-loader!css-loader!stylus-loader' }, { // css代码分割打包 test: /\.css$/, // exclude: /node_modules/, use: extractCSS.extract({ fallback: 'style-loader', use: [ { loader: 'css-loader' }, { loader: 'postcss-loader', options: { plugins: function() { return [ // 允许在子中定义要放在最顶层的样式 require('postcss-atroot')({}), // 允许定义样式函数 require('postcss-mixins')({}), // import插件 require('postcss-nested-import')({}), // 类sass-import插件,但是没法嵌套导入 // require('postcss-partial-import')({}), // 嵌套解析插件 require('postcss-nested')({}), // 可以通过引用方式引用父/其他样式的属性值 require('postcss-nesting')({}), // 允许自定义选择器别名 require('postcss-custom-selectors')({}), // 可自定义属性块别名,后面可扩充 require('postcss-extend')({}), // 允许类sass的变量定义,for和each语法 require('postcss-advanced-variables')({}), // 支持颜色函数color require('postcss-color-function')({}), // 支持media的变量定义 require('postcss-custom-media')({}), // 支持属性自定义 require('postcss-custom-properties')({}), // 支持media的最大最小值定义 可以通过类似@media screen and (width >= 500px) and (width <= 1200px){}来书写 require('postcss-media-minmax')({}), // 支持通过@引用本属性块的属性 require('postcss-property-lookup')({}), // maches函数,p:matches(:first-child, .special)解析为p:first-child, p.special require('postcss-selector-matches')({}), // 支持not解析,p:not(:first-child, .special)解析为p:not(:first-child), p:not(.special) require('postcss-selector-not')({}) ]; } } } ] }) },{ test: /\.md$/, loader: 'raw-loader' },{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader' } ] }, performance: { hints: false }, plugins: [ // 分离css extractCSS, // 分离js可能引入的css的chunkhash计算 new WebpackMd5Hash(), // 对css文件进行压缩 new OptimizeCssAssetsPlugin({ assetNameRegExp: /\.css$/g, cssProcessor: require('cssnano'), cssProcessorOptions: { discardComments: { removeAll: true } }, canPrint: true }), new CopyWebpackPlugin([{ from: path.resolve(__dirname, '../resources/highlight.js-11.3.1'), to: path.resolve(__dirname, '../dist/highlightjs') }, { from: path.resolve(__dirname, '../resources/markdown'), to: path.resolve(__dirname, '../dist/markdown') }, { context: 'node_modules/katex/dist', from: { glob: `${path.resolve(__dirname, '../node_modules/katex/dist')}/**/*.+(min.js|min.css|ttf|woff|woff2)` }, to: path.resolve(__dirname, '../dist/katex') }]) ] } ================================================ FILE: webpack/webpack.build.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-05-04T23:21:48+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: webpack.dev.js * @Last modified by: CHC * @Last modified time: 2017-06-18T23:32:44+08:00 * @License: MIT * @Copyright: 2017 */ var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; var base = require('./webpack.base.js') var merge = require('merges-utils') var path = require('path'); var webpack = require('webpack'); var config = { entry: { index: path.resolve(__dirname, '../src/index.js') }, output: { path: path.resolve(__dirname, '../dist'), // publicPath: '/dist/', filename: 'mavon-editor.js', chunkFilename: 'js/[name].js', library: 'MavonEditor', libraryTarget: 'umd', umdNamedDefine: true }, resolve: { alias: { 'muse-components': 'muse-ui/src' }, extensions: ['.js', '.vue', '.less'] }, externals: { vue: { root: 'Vue', commonjs: 'vue', commonjs2: 'vue', amd: 'vue' } }, plugins: [ new BundleAnalyzerPlugin({ // Can be `server`, `static` or `disabled`. // In `server` mode analyzer will start HTTP server to show bundle report. // In `static` mode single HTML file with bundle report will be generated. // In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`. analyzerMode: 'server', // Host that will be used in `server` mode to start HTTP server. analyzerHost: '127.0.0.1', // Port that will be used in `server` mode to start HTTP server. analyzerPort: 8888, // Path to bundle report file that will be generated in `static` mode. // Relative to bundles output directory. reportFilename: 'report.html', // Module sizes to show in report by default. // Should be one of `stat`, `parsed` or `gzip`. // See "Definitions" section for more information. defaultSizes: 'parsed', // Automatically open report in default browser openAnalyzer: true, // If `true`, Webpack Stats JSON file will be generated in bundles output directory generateStatsFile: false, // Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`. // Relative to bundles output directory. statsFilename: 'stats.json', // Options for `stats.toJson()` method. // For example you can exclude sources of your modules from stats file with `source: false` option. // See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21 statsOptions: null, // Log level. Can be 'info', 'warn', 'error' or 'silent'. logLevel: 'info' }) ] } var res = merge([base, config]) res.plugins = res.plugins.concat([ new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false }, comments: false }) ]) module.exports = res ================================================ FILE: webpack/webpack.dev.js ================================================ /** * @Author: HuaChao Chen * @Date: 2017-05-04T23:21:48+08:00 * @Email: chenhuachaoxyz@gmail.com * @Filename: webpack.dev.js * @Last modified by: chc * @Last modified time: 2017-06-09T20:26:37+08:00 * @License: MIT * @Copyright: 2017 */ var merge = require('merges-utils') var base = require('./webpack.base.js') var path = require('path'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var config = { entry: { index: './src/dev/index.js', vue: ['vue'] }, output: { path: path.resolve(__dirname, '../dist'), // publicPath: '/dist/', filename: 'js/[name].[chunkhash:8].js', chunkFilename: 'js/[name].[chunkhash:8].js' }, resolve: { alias: { 'vue$': 'vue/dist/vue.esm.js', 'muse-components': 'muse-ui/src' }, extensions: ['.js', '.vue', '.less'] }, devServer: { historyApiFallback: true, disableHostCheck: true, host: 'localhost', port: '9090', stats: 'normal' }, devtool: 'source-map' } var res = merge([base, config]); res.plugins = [ new webpack.optimize.CommonsChunkPlugin({ names: ['vue', 'common'], filename: 'js/[name].[chunkhash:8].js', minChunks: Infinity }), new HtmlWebpackPlugin({ filename: 'index.html', template: 'src/dev/index.html', inject: true, hash: false, chunks: ['common', 'vue', 'index'] }) ].concat(res.plugins) module.exports = res