New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vditor

Package Overview
Dependencies
Maintainers
1
Versions
328
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vditor - npm Package Compare versions

Comparing version 0.1.8 to 0.2.0

src/ts/toolbar/MenuItem.ts

4

dist/index.min.js
/*!
* Vditor v0.1.8 - A markdown editor written in TypeScript.
* Vditor v0.2.0 - A markdown editor written in TypeScript.
*

@@ -27,2 +27,2 @@ * MIT License

*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Vditor=e():t.Vditor=e()}(window,function(){return function(t){function e(e){for(var n,i,r=e[0],s=e[1],l=0,c=[];l<r.length;l++)i=r[l],o[i]&&c.push(o[i][0]),o[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n]);for(a&&a(e);c.length;)c.shift()()}var n={},o={0:0};function i(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.e=function(t){var e=[],n=o[t];if(0!==n)if(n)e.push(n[2]);else{var r=new Promise(function(e,i){n=o[t]=[e,i]});e.push(n[2]=r);var s,l=document.createElement("script");l.charset="utf-8",l.timeout=120,i.nc&&l.setAttribute("nonce",i.nc),l.src=function(t){return i.p+""+({1:"vditor",2:"vendors~vditor"}[t]||t)+".bundle.js"}(t),s=function(e){l.onerror=l.onload=null,clearTimeout(a);var n=o[t];if(0!==n){if(n){var i=e&&("load"===e.type?"missing":e.type),r=e&&e.target&&e.target.src,s=new Error("Loading chunk "+t+" failed.\n("+i+": "+r+")");s.type=i,s.request=r,n[1](s)}o[t]=void 0}};var a=setTimeout(function(){s({type:"timeout",target:l})},12e4);l.onerror=l.onload=s,document.head.appendChild(l)}return Promise.all(e)},i.m=t,i.c=n,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="https://vditor.b3log.org/0.1.8/",i.oe=function(t){throw console.error(t),t};var r=window.webpackJsonpVditor=window.webpackJsonpVditor||[],s=r.push.bind(r);r.push=e,r=r.slice();for(var l=0;l<r.length;l++)e(r[l]);var a=s;return i(i.s=24)}([function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 32 32" width=32px height=32px> <path d="M32 0v13l-5-5-6 6-3-3 6-6-5-5zM14 21l-6 6 5 5h-13v-13l5 5 6-6z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 32 32" width=32px height=32px> <path d="M16 24.789c-3.756 0-6.911-2.254-8.188-5.559h16.376c-1.277 3.305-4.432 5.559-8.188 5.559zM10.366 14.423c-1.352 0-2.404-1.052-2.404-2.404s1.052-2.404 2.404-2.404 2.404 1.052 2.404 2.404-1.052 2.404-2.404 2.404zM21.634 14.423c-1.352 0-2.404-1.052-2.404-2.404s1.052-2.404 2.404-2.404 2.404 1.052 2.404 2.404-1.052 2.404-2.404 2.404zM16 28.845c7.061 0 12.845-5.784 12.845-12.845s-5.784-12.845-12.845-12.845-12.845 5.784-12.845 12.845 5.784 12.845 12.845 12.845zM16 0c8.864 0 16 7.136 16 16s-7.136 16-16 16-16-7.136-16-16 7.136-16 16-16z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 32 32" width=32px height=32px> <path d="M22.996 15.023c1.339-1.591 2.147-3.643 2.147-5.88 0-5.041-4.102-9.143-9.143-9.143h-11.429v32h13.714c5.041 0 9.143-4.102 9.143-9.143 0-3.32-1.779-6.232-4.433-7.834zM11.429 4.571h3.625c1.999 0 3.625 2.051 3.625 4.571s-1.626 4.571-3.625 4.571h-3.625v-9.143zM17.107 27.429h-5.679v-9.143h5.679c2.087 0 3.786 2.051 3.786 4.571s-1.698 4.571-3.786 4.571z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M4.45 0h3.594c0.595 0 1.078 0.384 1.078 0.858v30.284c0 0.474-0.482 0.858-1.078 0.858h-3.594c-0.595 0-1.078-0.384-1.078-0.858v-30.284c-0-0.474 0.482-0.858 1.078-0.858zM23.888 0h3.673c0.59 0 1.068 0.384 1.068 0.858v30.284c0 0.474-0.478 0.858-1.068 0.858h-3.673c-0.59 0-1.068-0.384-1.068-0.858v-30.284c0-0.474 0.478-0.858 1.068-0.858z"></path> <path d="M25.069 14.167v3.667c0 0.589-0.384 1.065-0.858 1.065h-15.655c-0.474 0-0.858-0.477-0.858-1.065v-3.667c0-0.589 0.384-1.065 0.858-1.065h15.655c0.474 0 0.858 0.477 0.858 1.065z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M29.714 0v2.286h-4.571l-11.429 27.429h4.571v2.286h-16v-2.286h4.571l11.429-27.429h-4.571v-2.286z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M32 16v2h-7.328c0.86 1.203 1.328 2.584 1.328 4 0 2.215-1.146 4.345-3.143 5.843-1.855 1.391-4.29 2.157-6.857 2.157s-5.002-0.766-6.857-2.157c-1.998-1.498-3.143-3.628-3.143-5.843h4c0 2.168 2.748 4 6 4s6-1.832 6-4c0-2.168-2.748-4-6-4h-16v-2h9.36c-0.073-0.052-0.146-0.104-0.217-0.157-1.998-1.498-3.143-3.628-3.143-5.843s1.146-4.345 3.143-5.843c1.855-1.391 4.29-2.157 6.857-2.157s5.002 0.766 6.857 2.157c1.997 1.498 3.143 3.628 3.143 5.843h-4c0-2.168-2.748-4-6-4s-6 1.832-6 4c0 2.168 2.748 4 6 4 2.468 0 4.814 0.709 6.64 2h9.36z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M31.68 14.56h-31.36c-0.176 0-0.32 0.144-0.32 0.32v2.24c0 0.176 0.144 0.32 0.32 0.32h31.36c0.176 0 0.32-0.144 0.32-0.32v-2.24c0-0.176-0.144-0.32-0.32-0.32z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M7.024 13.003c3.862 0 6.993 3.131 6.993 6.993s-3.131 6.993-6.993 6.993-6.993-3.131-6.993-6.993l-0.031-0.999c0-7.724 6.262-13.986 13.986-13.986v3.996c-2.668 0-5.177 1.039-7.064 2.926-0.363 0.363-0.695 0.75-0.994 1.156 0.357-0.056 0.723-0.086 1.096-0.086zM25.007 13.003c3.862 0 6.993 3.131 6.993 6.993s-3.131 6.993-6.993 6.993-6.993-3.131-6.993-6.993l-0.031-0.999c0-7.724 6.262-13.986 13.986-13.986v3.996c-2.668 0-5.177 1.039-7.064 2.926-0.363 0.363-0.695 0.75-0.994 1.156 0.357-0.056 0.723-0.086 1.096-0.086z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M12 2h20v4h-20v-4zM12 14h20v4h-20v-4zM12 26h20v4h-20v-4zM0 4c0 2.209 1.791 4 4 4s4-1.791 4-4c0-2.209-1.791-4-4-4s-4 1.791-4 4zM0 16c0 2.209 1.791 4 4 4s4-1.791 4-4c0-2.209-1.791-4-4-4s-4 1.791-4 4zM0 28c0 2.209 1.791 4 4 4s4-1.791 4-4c0-2.209-1.791-4-4-4s-4 1.791-4 4z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M11 26h20v4h-20zM11 14h20v4h-20zM11 2h20v4h-20zM5 0v8h-2v-6h-2v-2zM3 16.438v1.563h4v2h-6v-4.563l4-1.875v-1.563h-4v-2h6v4.563zM7 22v10h-6v-2h4v-2h-4v-2h4v-2h-4v-2z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M27.094 19.485v6.12c0 3.059-2.483 5.542-5.542 5.542h-16.010c-3.059 0-5.542-2.483-5.542-5.542v-16.010c0-3.059 2.483-5.542 5.542-5.542h16.010c0.769 0 1.54 0.154 2.251 0.481 0.174 0.077 0.308 0.25 0.346 0.443 0.039 0.211-0.019 0.404-0.174 0.558l-0.943 0.943c-0.115 0.115-0.289 0.193-0.443 0.193-0.058 0-0.115-0.019-0.174-0.039-0.289-0.077-0.578-0.115-0.866-0.115h-16.010c-1.693 0-3.079 1.386-3.079 3.079v16.010c0 1.693 1.386 3.079 3.079 3.079h16.010c1.693 0 3.079-1.386 3.079-3.079v-4.888c0-0.154 0.058-0.308 0.174-0.424l1.232-1.232c0.135-0.135 0.289-0.193 0.443-0.193 0.077 0 0.154 0.019 0.231 0.058 0.231 0.096 0.385 0.308 0.385 0.558zM31.54 10.076l-15.664 15.664c-0.615 0.615-1.578 0.615-2.194 0l-8.275-8.275c-0.615-0.615-0.615-1.578 0-2.194l2.116-2.116c0.615-0.615 1.578-0.615 2.194 0l5.060 5.060 12.451-12.451c0.615-0.615 1.578-0.615 2.194 0l2.116 2.116c0.615 0.615 0.615 1.578 0 2.194z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M12.417 9.75q8.667 1.25 13.375 6.625t6.208 12.958q-6.417-9.083-19.583-9.083v7.25l-12.417-12.417 12.417-12.417v7.083z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M19.583 9.75q-8.667 1.25-13.375 6.625t-6.208 12.958q6.417-9.083 19.583-9.083v7.25l12.417-12.417-12.417-12.417v7.083z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M18.133 23.467l3.2 3.2 10.667-10.667-10.667-10.667-3.2 3.2 7.467 7.467z"></path> <path d="M13.867 8.533l-3.2-3.2-10.667 10.667 10.667 10.667 3.2-3.2-7.467-7.467z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M21.053 21.895l2.526 2.526 8.421-8.421-8.421-8.421-2.526 2.526 5.895 5.895z"></path> <path d="M10.947 10.105l-2.526-2.526-8.421 8.421 8.421 8.421 2.526-2.526-5.895-5.895z"></path> <path d="M17.613 6.487l1.828 0.499-5.052 18.527-1.828-0.499 5.052-18.527z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M29.187 2.933l-0.12-0.121c-2.813-2.812-7.415-2.812-10.228 0l-6.516 6.517c-2.812 2.812-2.812 7.415 0 10.227l0.12 0.12c0.234 0.234 0.482 0.446 0.739 0.641l2.386-2.386c-0.278-0.164-0.542-0.361-0.78-0.599l-0.121-0.121c-1.527-1.527-1.527-4.012 0-5.539l6.517-6.516c1.527-1.527 4.012-1.527 5.539 0l0.121 0.12c1.527 1.527 1.527 4.012 0 5.539l-2.948 2.948c0.512 1.264 0.754 2.611 0.733 3.955l4.559-4.559c2.812-2.812 2.812-7.415-0-10.227zM19.557 12.323c-0.234-0.234-0.482-0.446-0.739-0.641l-2.386 2.385c0.278 0.164 0.542 0.361 0.78 0.599l0.121 0.121c1.527 1.527 1.527 4.012 0 5.539l-6.517 6.517c-1.527 1.527-4.012 1.527-5.539 0l-0.121-0.121c-1.527-1.527-1.527-4.012 0-5.539l2.948-2.948c-0.512-1.264-0.754-2.611-0.733-3.955l-4.559 4.559c-2.812 2.812-2.812 7.415 0 10.228l0.12 0.12c2.813 2.812 7.415 2.812 10.228 0l6.516-6.517c2.812-2.812 2.812-7.415 0-10.228l-0.12-0.12z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M19.652 25v6c0 0.55-0.45 1-1 1h-6c-0.55 0-1-0.45-1-1v-6c0-0.55 0.45-1 1-1h6c0.55 0 1 0.45 1 1zM27.552 10c0 4.75-3.225 6.575-5.6 7.9-1.475 0.85-2.4 2.575-2.4 3.3v0c0 0.55-0.425 1.2-1 1.2h-6c-0.55 0-0.9-0.85-0.9-1.4v-1.125c0-3.025 3-5.625 5.2-6.625 1.925-0.875 2.725-1.7 2.725-3.3 0-1.4-1.825-2.65-3.85-2.65-1.125 0-2.15 0.35-2.7 0.725-0.6 0.425-1.2 1.025-2.675 2.875-0.2 0.25-0.5 0.4-0.775 0.4-0.225 0-0.425-0.075-0.625-0.2l-4.1-3.125c-0.425-0.325-0.525-0.875-0.25-1.325 2.7-4.475 6.5-6.65 11.6-6.65 5.35 0 11.35 4.275 11.35 10z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M9.846 26.462v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM9.846 19.077v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM19.692 26.462v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM9.846 11.692v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM19.692 19.077v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM29.538 26.462v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM19.692 11.692v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM29.538 19.077v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM29.538 11.692v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM32 5.538v20.923c0 1.692-1.385 3.077-3.077 3.077h-25.846c-1.692 0-3.077-1.385-3.077-3.077v-20.923c0-1.692 1.385-3.077 3.077-3.077h25.846c1.692 0 3.077 1.385 3.077 3.077z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M0 16c3.037-5.864 9.058-9.802 16-9.802s12.963 3.938 15.953 9.703l0.047 0.1c-3.037 5.864-9.058 9.802-16 9.802s-12.963-3.938-15.953-9.703l-0.047-0.1zM16 22.531c3.607 0 6.531-2.924 6.531-6.531s-2.924-6.531-6.531-6.531v0c-3.607 0-6.531 2.924-6.531 6.531s2.924 6.531 6.531 6.531v0zM16 19.265c-1.804 0-3.265-1.461-3.265-3.265s1.461-3.265 3.265-3.265v0c1.804 0 3.265 1.461 3.265 3.265s-1.461 3.265-3.265 3.265v0z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 32 32" width=32px height=32px> <path d="M14 18v13l-5-5-6 6-3-3 6-6-5-5zM32 3l-6 6 5 5h-13v-13l5 5 6-6z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M21.334 16.532q0-0.233-0.15-0.384l-5.867-5.867q-0.15-0.15-0.384-0.15t-0.384 0.15l-5.85 5.85q-0.167 0.2-0.167 0.399 0 0.233 0.15 0.384t0.384 0.15h3.733v5.867q0 0.217 0.159 0.375t0.375 0.159h3.2q0.217 0 0.375-0.159t0.159-0.375v-5.867h3.734q0.217 0 0.375-0.159t0.159-0.375zM32 21.332q0 2.65-1.875 4.525t-4.525 1.875h-18.133q-3.083 0-5.275-2.192t-2.192-5.275q0-2.166 1.167-4t3.134-2.75q-0.034-0.5-0.034-0.717 0-3.533 2.5-6.033t6.033-2.5q2.6 0 4.759 1.45t3.142 3.849q1.184-1.033 2.767-1.033 1.767 0 3.017 1.25t1.25 3.017q0 1.267-0.683 2.3 2.166 0.516 3.558 2.258t1.392 3.975z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M4.571 16c0 6.312 5.117 11.429 11.429 11.429s11.429-5.117 11.429-11.429v0c0-6.312-5.117-11.429-11.429-11.429s-11.429 5.117-11.429 11.429v0z"></path> <path d="M16 30.857c-8.229 0-14.933-6.705-14.933-14.933s6.705-14.933 14.933-14.933 15.010 6.705 15.010 15.010c0 8.152-6.705 14.857-15.010 14.857zM16 0c-8.838 0-16 7.162-16 16s7.162 16 16 16 16-7.162 16-16-7.162-16-16-16z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M23.273 27.636v2.909c0 0.795-0.659 1.455-1.455 1.455h-11.636c-0.795 0-1.455-0.659-1.455-1.455v-2.909c0-0.795 0.659-1.455 1.455-1.455h1.455v-8.727h-1.455c-0.795 0-1.455-0.659-1.455-1.455v-2.909c0-0.795 0.659-1.455 1.455-1.455h8.727c0.795 0 1.455 0.659 1.455 1.455v13.091h1.455c0.795 0 1.455 0.659 1.455 1.455zM20.364 1.455v4.364c0 0.795-0.659 1.455-1.455 1.455h-5.818c-0.795 0-1.455-0.659-1.455-1.455v-4.364c0-0.795 0.659-1.455 1.455-1.455h5.818c0.795 0 1.455 0.659 1.455 1.455z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=128 height=32 viewBox="0 0 128 32"> <path d="M0 0h128v6.4h-128zM0 12.8h128v6.4h-128zM0 25.6h128v6.4h-128z"></path> </svg>'},function(t,e,n){"use strict";n.r(e);var o="0.1.8",i=n(1),r=n.n(i),s={en_US:{emoji:"Emoji",bold:"Blod",headings:"Headings",italic:"Italic",quote:"Quote",link:"Link","ordered-list":"Order List",list:"List",fullscreen:"Fullscreen",help:"Help",strike:"Strike",line:"Line",check:"Task List",code:"Code Block","inline-code":"Inline Code",redo:"Redo",undo:"Undo",table:"Table",record:"Start Record/End Record",upload:"Upload image or file",preview:"Preview",uploading:"uploading...",over:"over",recoding:"recoding...",info:"Info"},zh_CN:{emoji:"表情",bold:"粗体",headings:"标题",italic:"斜体",quote:"引用",link:"链接","ordered-list":"有序列表",list:"无序列表",fullscreen:"全屏",help:"帮助",strike:"删除线",line:"分隔线",check:"任务列表",code:"代码块","inline-code":"行内代码",redo:"重做",undo:"撤销",table:"表格",record:"开始录音/结束录音",upload:"上传图片或文件",preview:"预览",uploading:"上传中...",over:"超过",recoding:"录音中...",info:"关于"}},l=/highlight-(?:text|source)-([a-z0-9]+)/;function a(t){t.addRule("highlightedCodeBlock",{filter:function(t){var e=t.firstChild;return"DIV"===t.nodeName&&l.test(t.className)&&e&&"PRE"===e.nodeName},replacement:function(t,e,n){var o=((e.className||"").match(l)||[null,""])[1];return"\n\n"+n.fence+o+"\n"+e.firstChild.textContent+"\n"+n.fence+"\n\n"}})}function c(t){t.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return"~"+t+"~"}})}var p=Array.prototype.indexOf,u=Array.prototype.every,d={};function h(t){var e,n,o=t.parentNode;return"THEAD"===o.nodeName||o.firstChild===t&&("TABLE"===o.nodeName||(n=(e=o).previousSibling,"TBODY"===e.nodeName&&(!n||"THEAD"===n.nodeName&&/^\s*$/i.test(n.textContent))))&&u.call(t.childNodes,function(t){return"TH"===t.nodeName})}function f(t,e){var n=" ";return 0===p.call(e.parentNode.childNodes,e)&&(n="| "),n+t+" |"}function v(t){for(var e in t.keep(function(t){return"TABLE"===t.nodeName&&!h(t.rows[0])}),d)t.addRule(e,d[e])}function m(t){t.addRule("taskListItems",{filter:function(t){return"checkbox"===t.type&&"LI"===t.parentNode.nodeName},replacement:function(t,e){return(e.checked?"[x]":"[ ]")+" "}})}function g(t){t.use([a,c,v,m])}d.tableCell={filter:["th","td"],replacement:function(t,e){return f(t,e)}},d.tableRow={filter:"tr",replacement:function(t,e){var n="",o={left:":--",right:"--:",center:":-:"};if(h(e))for(var i=0;i<e.childNodes.length;i++){var r="---",s=(e.childNodes[i].getAttribute("align")||"").toLowerCase();s&&(r=o[s]||r),n+=f(r,e.childNodes[i])}return"\n"+t+(n?"\n"+n:"")}},d.table={filter:function(t){return"TABLE"===t.nodeName&&h(t.rows[0])},replacement:function(t){return"\n\n"+(t=t.replace("\n\n","\n"))+"\n\n"}},d.tableSection={filter:["thead","tbody","tfoot"],replacement:function(t){return t}};var y,w=function(){return function(){this.isUploading=!1,this.element=document.createElement("div"),this.element.className="vditor-upload",this.element.innerHTML='<div class="vditor-upload__progress"></div><div class="vditor-upload__close">x</div>',this.element.children[1].addEventListener("click",function(){this.parentElement.style.opacity=0,this.parentElement.className="vditor-upload"})}}(),b=function(t,e,n){for(var o=new FormData,i=[],r=0;r<e.length;r++){var l=e[r];l instanceof DataTransferItem&&(l=l.getAsFile()),l.size<=t.options.upload.max&&(o.append("file[]",l),i.push(l))}if(t.upload.element.className="vditor-upload",t.upload.element.children[0].innerHTML="",_(t.editor.element,function(t,e){for(var n="",o=e.length,i=0;i<o;i++){var r=e[i].getAsFile?e[i].getAsFile():e[i],l=-1===r.type.indexOf("image")?"":"!";if(!r.name)return"";var a=r.name.lastIndexOf("."),c=t.options.upload.filename(r.name.substr(0,a))+r.name.substr(a);r.size>t.options.upload.max?(t.upload.element.className="vditor-upload vditor-upload--tip",t.upload.element.children[0].innerHTML=r.name+" "+s[t.options.lang].over+" "+t.options.upload.max/1024/1024+"M"):n+=l+"["+c+"]("+s[t.options.lang].uploading+")\n"}return n}(t,e),""),0!==i.length){if(!t.options.upload.url||!t.upload)return n&&(n.value=""),void alert("please config: options.upload.url");var a=new XMLHttpRequest;a.open("POST",t.options.upload.url),t.options.upload.token&&a.setRequestHeader("X-Upload-Token",t.options.upload.token),t.upload.isUploading=!0,t.editor.element.setAttribute("disabled","disabled"),a.onreadystatechange=function(){a.readyState===XMLHttpRequest.DONE&&(t.upload.isUploading=!1,n&&(n.value=""),t.editor.element.removeAttribute("disabled"),200===a.status?(t.options.upload.success?t.options.upload.success(t.editor.element,a.responseText):function(t,e,n,o){t.focus();var i=JSON.parse(e);1===i.code&&(o.className="vditor-upload vditor-upload--tip",o.children[0].innerHTML=i.msg),i.data.errFiles.forEach(function(e){var o=e.lastIndexOf("."),i="["+(n.upload.filename(e.substr(0,o))+e.substr(o))+"]("+s[n.lang].uploading+")";t.selectionStart=t.value.split(i)[0].length,t.selectionEnd=t.selectionStart+i.length,_(t,"","",!0)}),Object.keys(i.data.succMap).forEach(function(e){var o=i.data.succMap[e];if(o.indexOf(".wav")!==o.length-4){var r=e.lastIndexOf("."),l=n.upload.filename(e.substr(0,r))+e.substr(r),a="["+l+"]("+s[n.lang].uploading+")";t.selectionStart=t.value.split(a)[0].length,t.selectionEnd=t.selectionStart+a.length,_(t,"["+l+"]("+o+")","",!0)}else _(t,'<audio controls="controls" src="'+o+'"></audio>\n',"")})}(t.editor.element,a.responseText,t.options,t.upload.element),t.upload.element.style.opacity=0):t.options.upload.error?t.options.upload.error(a.responseText):(t.upload.element.className="vditor-upload vditor-upload--tip",t.upload.element.children[0].innerHTML=a.responseText||"401"))},a.upload.onprogress=function(e){if(e.lengthComputable){var n=e.loaded/e.total*100;t.upload.element.style.opacity=1,t.upload.element.children[0].style.width=n+"%"}},a.send(o)}else n&&(n.value="")},E=function(){function t(t){this.element=document.createElement("textarea"),this.element.className="vditor-textarea",this.element.setAttribute("placeholder",t.options.placeholder),t.options.cache&&(this.element.value=localStorage.getItem("vditor"+t.id),t.options.counter>0&&t.counter.render(this.element.value.length,t.options.counter)),this.bindEvent(t)}return t.prototype.html2md=function(t,e,n,o){var i=!1;t.prototype.escape=function(t){return t};var r=new t;r.addRule("strikethrough",{filter:["pre","code"],replacement:function(t,e){return"PRE"===e.parentElement.tagName?t:t.split("\n").length>1?(i=!0,"```\n"+t+"\n```"):"`"+t+"`"}}),r.addRule("strikethrough",{filter:["img"],replacement:function(t,n){if(!n.getAttribute("src"))return"";if(e.options.upload.linkToImgUrl){var o=new XMLHttpRequest;o.open("POST",e.options.upload.linkToImgUrl),o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE&&200===o.status){var t=JSON.parse(o.responseText);if(0!==t.code)return void alert(t.msg);var i=n.getAttribute("src");e.editor.element.selectionStart=e.editor.element.value.split(i)[0].length,e.editor.element.selectionEnd=e.editor.element.selectionStart+i.length,_(e.editor.element,t.data.url,"",!0)}},o.send(JSON.stringify({url:n.getAttribute("src")}))}return"!["+n.getAttribute("alt")+"]("+n.getAttribute("src")+")"}}),r.use(g);var s=r.turndown(n);if(i){var l=document.createElement("div");l.innerHTML=n,l.querySelectorAll("pre").length>1?i=!1:"```"===s.substr(0,3)&&"```"===s.substr(s.length-3,3)||(i=!1)}_(e.editor.element,i?"```\n"+o+"\n```":s,"",!0)},t.prototype.bindEvent=function(t){var e,o=this;this.element.addEventListener("input",function(){t.options.counter>0&&t.counter.render(o.element.value.length,t.options.counter),t.options.input&&t.options.input(o.element.value,t.preview&&t.preview.element),t.hint&&t.hint.render(),t.options.cache&&localStorage.setItem("vditor"+t.id,t.editor.element.value),t.preview&&t.preview.render(t)}),this.element.addEventListener("focus",function(){t.options.focus&&t.options.focus(o.element.value),t.toolbar.elements.emoji&&t.toolbar.elements.emoji.children[1]&&(t.toolbar.elements.emoji.children[1].style.display="none"),t.toolbar.elements.headings&&t.toolbar.elements.headings.children[1]&&(t.toolbar.elements.headings.children[1].style.display="none")}),this.element.addEventListener("blur",function(){t.options.blur&&t.options.blur(o.element.value)}),t.options.select&&(this.element.onselect=function(){t.options.select(o.element.value.substring(o.element.selectionStart,o.element.selectionEnd))}),this.element.addEventListener("scroll",function(){if("none"!==t.preview.element.style.display||t.preview){var e=o.element.scrollTop,n=o.element.clientHeight,i=o.element.scrollHeight,r=t.preview.element;r.scrollTop=e/n>.5?(e+n)*r.scrollHeight/i-n:e*r.scrollHeight/i}}),t.options.upload.url&&this.element.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault();var n=e.dataTransfer.items;0!==n.length&&b(t,n)});var i=this.html2md;this.element.addEventListener("paste",function(o){if(o.stopPropagation(),o.preventDefault(),""!==o.clipboardData.getData("text/html").replace(/(^\s*)|(\s*)$/g,"")){var r=o.clipboardData.getData("text/html"),s=o.clipboardData.getData("text/plain");if(!e)return void n.e(1).then(n.bind(null,26)).then(function(n){e=n.default,i(e,t,r,s)}).catch(function(t){console.log("Failed to load turndown",t)});i(e,t,r,s)}else if(""!==o.clipboardData.getData("text/plain").replace(/(^\s*)|(\s*)$/g,"")&&0===o.clipboardData.files.length)_(o.target,o.clipboardData.getData("text/plain"),"",!0);else if(o.clipboardData.files.length>0){if(!t.options.upload.url)return;b(t,o.clipboardData.files)}})},t}(),_=function(t,e,n,o){if("number"==typeof t.selectionStart&&"number"==typeof t.selectionEnd){var i=t.selectionStart,r=t.selectionEnd,s=t.value;if(t.focus(),/firefox/i.test(navigator.userAgent)||/edge/i.test(navigator.userAgent)||/msie/i.test(navigator.userAgent)||/trident/i.test(navigator.userAgent)){i===r?(t.value=s.substring(0,i)+e+n+s.substring(r,s.length),t.selectionEnd=t.selectionStart=r+e.length):o?(t.value=s.substring(0,i)+e+n+s.substring(r,s.length),t.selectionEnd=i+e.length+n.length):s.substring(i-e.length,i)===e&&s.substring(r,r+n.length)===n?(t.value=s.substring(0,i-e.length)+s.substring(i,r)+s.substring(r+n.length,s.length),t.selectionStart=i-e.length,t.selectionEnd=r-e.length):(t.value=s.substring(0,i)+e+s.substring(i,r)+n+s.substring(r,s.length),t.selectionStart=i+e.length,t.selectionEnd=r+e.length);var l=document.createEvent("HTMLEvents");l.initEvent("input",!0,!1),t.dispatchEvent(l)}else if(i===r)document.execCommand("insertText",!1,e+n),t.selectionStart=t.selectionEnd=t.selectionStart-n.length;else if(o)document.execCommand("insertText",!1,e+n);else if(s.substring(i-e.length,i)===e&&s.substring(r,r+n.length)===n){document.execCommand("delete",!1);for(var a=0,c=e.length;a<c;a++)document.execCommand("delete",!1);for(var p=0,u=n.length;p<u;p++)document.execCommand("forwardDelete",!1);document.execCommand("insertText",!1,s.substring(i,r)),t.selectionStart=i-e.length,t.selectionEnd=r-e.length}else document.execCommand("insertText",!1,e+s.substring(i,r)+n),t.selectionStart=i+e.length,t.selectionEnd=r+e.length}},x=function(){function t(t,e){this.menuItem=e,this.editorElement=t.editor.element,this.element=document.createElement("div");var n=document.createElement("div");n.className="vditor-tooltipped vditor-tooltipped__"+e.tipPosition;var o=this.menuItem.hotkey?" <"+this.menuItem.hotkey+">":"";o=/Mac/.test(navigator.platform)?o.replace("ctrl","⌘"):o.replace("⌘","ctrl"),n.setAttribute("aria-label",this.menuItem.tip||s[t.options.lang][this.menuItem.name]+o),this.element.appendChild(n)}return t.prototype.bindEvent=function(){var t=this;this.element.children[0].addEventListener("click",function(){_(t.editorElement,t.menuItem.prefix||"",t.menuItem.suffix||"")})},t}(),O=(y=function(t,e){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}y(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),M=function(t){function e(e,n){var o=t.call(this,e,n)||this;o.element.children[0].innerHTML=n.icon||r.a;var i=document.createElement("div");i.className="vditor-panel";var s="";Object.keys(e.options.hint.emoji).forEach(function(t){var n=e.options.hint.emoji[t];n.indexOf(".")>-1?s+='<span data-value=":'+t+': " title=":'+t+':"><img data-value=":'+t+': " src="'+n+'"/></span>':s+='<span data-value="'+n+' " title="'+t+'">'+n+"</span>"});var l=e.options.hint.emojiTail?'<div class="vditor-emojis__tail">'+e.options.hint.emojiTail+"</div>":"";return i.innerHTML='<div class="vditor-emojis">'+s+"</div>"+l,o.element.appendChild(i),o._bindEvent(i,e),o}return O(e,t),e.prototype._bindEvent=function(t,e){this.element.children[0].addEventListener("click",function(){"block"===t.style.display?t.style.display="none":(t.style.display="block",e.toolbar.elements.headings&&(e.toolbar.elements.headings.children[1].style.display="none"))}),t.querySelectorAll(".vditor-emojis span").forEach(function(n){n.addEventListener("click",function(n){_(e.editor.element,n.target.getAttribute("data-value"),"",!0),t.style.display="none"})})},e}(x),k=n(2),T=n.n(k),L=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),A=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||T.a,o.bindEvent(),o}return L(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),P=n(3),j=n.n(P),z=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),S=function(t){function e(e,n){var o=t.call(this,e,n)||this;o.element.children[0].innerHTML=n.icon||j.a;var i=document.createElement("div");return i.className="vditor-panel",i.innerHTML='<h1 data-value="# ">Heading 1</h1>\n<h2 data-value="## ">Heading 2</h2>\n<h3 data-value="### ">Heading 3</h3>\n<h4 data-value="#### ">Heading 4</h4>\n<h5 data-value="##### ">Heading 5</h5>\n<h6 data-value="###### ">Heading 6</h6>',o.element.appendChild(i),o._bindEvent(i,e),o}return z(e,t),e.prototype._bindEvent=function(t,e){this.element.children[0].addEventListener("click",function(){"block"===t.style.display?t.style.display="none":(t.style.display="block",e.toolbar.elements.emoji&&(e.toolbar.elements.emoji.children[1].style.display="none"))});for(var n=0;n<6;n++)t.children.item(n).addEventListener("click",function(n){_(e.editor.element,n.target.getAttribute("data-value"),""),t.style.display="none"})},e}(x),C=function(){return function(){this.element=document.createElement("div"),this.element.className="vditor-menu__divider"}}(),H=function(){return function(){this.element=document.createElement("div"),this.element.className="vditor-menu__br"}}(),N=n(4),B=n.n(N),F=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),D=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||B.a,o.bindEvent(),o}return F(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),R=n(5),U=n.n(R),I=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),q=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||U.a,o.bindEvent(),o}return I(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),V=n(6),W=n.n(V),X=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),J=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||W.a,o.bindEvent(),o}return X(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),K=n(7),Y=n.n(K),$=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),G=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Y.a,o.bindEvent(),o}return $(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),Q=n(8),Z=n.n(Q),tt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),et=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Z.a,o.bindEvent(),o}return tt(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),nt=n(9),ot=n.n(nt),it=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),rt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||ot.a,o.bindEvent(),o}return it(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),st=n(10),lt=n.n(st),at=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ct=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||lt.a,o.bindEvent(),o}return at(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),pt=n(11),ut=n.n(pt),dt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ht=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||ut.a,o.bindEvent(),o}return dt(e,t),e.prototype.bindEvent=function(){this.element.children[0].addEventListener("click",function(){document.execCommand("undo")})},e}(x),ft=n(12),vt=n.n(ft),mt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),gt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||vt.a,o.bindEvent(),o}return mt(e,t),e.prototype.bindEvent=function(){this.element.children[0].addEventListener("click",function(){document.execCommand("redo")})},e}(x),yt=n(13),wt=n.n(yt),bt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Et=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||wt.a,o.bindEvent(),o}return bt(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),_t=n(14),xt=n.n(_t),Ot=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Mt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||xt.a,o.bindEvent(),o}return Ot(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),kt=n(15),Tt=n.n(kt),Lt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),At=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Tt.a,o.bindEvent(),o}return Lt(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),Pt=n(16),jt=n.n(Pt),zt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),St=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||jt.a,o.bindEvent(),o}return zt(e,t),e.prototype.bindEvent=function(){this.element.children[0].addEventListener("click",function(){window.open("https://hacpai.com/guide/markdown")})},e}(x),Ct=n(17),Ht=n.n(Ct),Nt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Bt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Ht.a,o.bindEvent(),o}return Nt(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(x),Ft=n(18),Dt=n.n(Ft),Rt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ut=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Dt.a,e.options.preview.show&&(o.element.children[0].className="vditor-tooltipped vditor-tooltipped__"+n.tipPosition+" vditor-menu--current"),o._bindEvent(e,n),o}return Rt(e,t),e.prototype._bindEvent=function(t,e){this.element.children[0].addEventListener("click",function(){var n,o=document.getElementById(t.id);"block"===t.preview.element.style.display?(t.preview.element.style.display="none",n="vditor-tooltipped vditor-tooltipped__"+e.tipPosition):(t.preview.element.style.display="block",n="vditor-tooltipped vditor-tooltipped__"+e.tipPosition+" vditor-menu--current",t.preview.render(t)),o.className.indexOf("vditor--fullscreen")>-1&&(n=n.replace("__n","__s")),this.className=n})},e}(x),It=n(0),qt=n.n(It),Vt=n(19),Wt=n.n(Vt),Xt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Jt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||qt.a,o._bindEvent(e,n),o}return Xt(e,t),e.prototype._bindEvent=function(t,e){this.element.children[0].addEventListener("click",function(){var n=document.getElementById(t.id);n.className.indexOf("vditor--fullscreen")>-1?(this.innerHTML=e.icon||qt.a,n.className=n.className.replace(" vditor--fullscreen",""),Object.keys(t.toolbar.elements).forEach(function(e){var n=t.toolbar.elements[e].firstChild;n&&(n.className=n.className.replace("__s","__n"))})):(this.innerHTML=e.icon||Wt.a,n.className=n.className+" vditor--fullscreen",Object.keys(t.toolbar.elements).forEach(function(e){var n=t.toolbar.elements[e].firstChild;n&&(n.className=n.className.replace("__n","__s"))}))})},e}(x),Kt=n(20),Yt=n.n(Kt),$t=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Gt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML="<label>"+(n.icon||Yt.a)+'<input multiple="multiple" type="file"></label>',o._bindEvent(e),o}return $t(e,t),e.prototype._bindEvent=function(t){this.element.querySelector("input").addEventListener("change",function(e){0!==e.target.files.length&&b(t,e.target.files,e.target)})},e}(x),Qt=n(21),Zt=n.n(Qt),te=function(){function t(t){var e;if(this.SAMPLE_RATE=5e3,this.isRecording=!1,this.readyFlag=!1,this.leftChannel=[],this.rightChannel=[],this.recordingLength=0,"undefined"!=typeof AudioContext)e=new AudioContext;else{if(!webkitAudioContext)return;e=new webkitAudioContext}this.DEFAULT_SAMPLE_RATE=e.sampleRate;var n=e.createGain();e.createMediaStreamSource(t).connect(n),this.recorder=e.createScriptProcessor(2048,2,1),this.recorder.onaudioprocess=null,n.connect(this.recorder),this.recorder.connect(e.destination),this.readyFlag=!0}return t.prototype.cloneChannelData=function(t,e){this.leftChannel.push(new Float32Array(t)),this.rightChannel.push(new Float32Array(e)),this.recordingLength+=2048},t.prototype.startRecordingNewWavFile=function(){this.readyFlag&&(this.isRecording=!0,this.leftChannel.length=this.rightChannel.length=0,this.recordingLength=0)},t.prototype.stopRecording=function(){this.isRecording=!1},t.prototype.buildWavFileBlob=function(){for(var t=this.mergeBuffers(this.leftChannel),e=this.mergeBuffers(this.rightChannel),n=new Float32Array(t.length),o=0;o<t.length;++o)n[o]=.5*(t[o]+e[o]);this.DEFAULT_SAMPLE_RATE>this.SAMPLE_RATE&&(n=this.downsampleBuffer(n,this.SAMPLE_RATE));var i=44+2*n.length,r=new ArrayBuffer(i),s=new DataView(r);this.writeUTFBytes(s,0,"RIFF"),s.setUint32(4,i,!0),this.writeUTFBytes(s,8,"WAVE"),this.writeUTFBytes(s,12,"fmt "),s.setUint32(16,16,!0),s.setUint16(20,1,!0),s.setUint16(22,1,!0),s.setUint32(24,this.SAMPLE_RATE,!0),s.setUint32(28,2*this.SAMPLE_RATE,!0),s.setUint16(32,2,!0),s.setUint16(34,16,!0);var l=2*n.length;this.writeUTFBytes(s,36,"data"),s.setUint32(40,l,!0);for(var a=n.length,c=44,p=0;p<a;p++)s.setInt16(c,32767*n[p],!0),c+=2;return new Blob([s],{type:"audio/wav"})},t.prototype.downsampleBuffer=function(t,e){if(e==this.DEFAULT_SAMPLE_RATE)return t;if(e>this.DEFAULT_SAMPLE_RATE)return t;for(var n=this.DEFAULT_SAMPLE_RATE/e,o=Math.round(t.length/n),i=new Float32Array(o),r=0,s=0;r<i.length;){for(var l=Math.round((r+1)*n),a=0,c=0,p=s;p<l&&p<t.length;p++)a+=t[p],c++;i[r]=a/c,r++,s=l}return i},t.prototype.mergeBuffers=function(t){for(var e=new Float32Array(this.recordingLength),n=0,o=t.length,i=0;i<o;++i){var r=t[i];e.set(r,n),n+=r.length}return e},t.prototype.writeUTFBytes=function(t,e,n){for(var o=n.length,i=0;i<o;i++)t.setUint8(e+i,n.charCodeAt(i))},t}(),ee=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ne=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Zt.a,o._bindEvent(e),o}return ee(e,t),e.prototype._bindEvent=function(t){var e;this.element.children[0].addEventListener("click",function(){if(e)if(e.isRecording){e.stopRecording(),t.upload.element.className="vditor-upload";var n=new File([e.buildWavFileBlob()],"record"+(new Date).getTime()+".wav",{type:"video/webm"});b(t,[n])}else t.upload.element.children[0].innerHTML=s[t.options.lang].recoding,t.upload.element.style.opacity=1,t.upload.element.className="vditor-upload vditor-upload--tip",t.editor.element.setAttribute("disabled","disabled"),e.startRecordingNewWavFile();else navigator.mediaDevices.getUserMedia({audio:!0}).then(function(n){(e=new te(n)).recorder.onaudioprocess=function(t){if(e.isRecording){var n=t.inputBuffer.getChannelData(0),o=t.inputBuffer.getChannelData(1);e.cloneChannelData(n,o)}},e.startRecordingNewWavFile(),t.upload.element.children[0].innerHTML=s[t.options.lang].recoding,t.upload.element.style.opacity=1,t.upload.element.className="vditor-upload vditor-upload--tip",t.editor.element.setAttribute("disabled","disabled")}).catch(function(t){console.log("init media error:",t)})})},e}(x),oe=n(22),ie=n.n(oe),re=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),se=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||ie.a,o.bindEvent(),o}return re(e,t),e.prototype.bindEvent=function(){this.element.children[0].addEventListener("click",function(){window.open("https://github.com/b3log/vditor")})},e}(x),le=function(){return function(t){var e=this,n=t.options;this.elements={},n.toolbar.forEach(function(n,o){var i;switch(n.name){case"emoji":i=new M(t,n);break;case"bold":i=new A(t,n);break;case"headings":i=new S(t,n);break;case"|":i=new C;break;case"br":i=new H;break;case"italic":i=new D(t,n);break;case"strike":i=new q(t,n);break;case"line":i=new J(t,n);break;case"quote":i=new G(t,n);break;case"list":i=new et(t,n);break;case"ordered-list":i=new rt(t,n);break;case"check":i=new ct(t,n);break;case"undo":i=new ht(t,n);break;case"redo":i=new gt(t,n);break;case"code":i=new Mt(t,n);break;case"inline-code":i=new Et(t,n);break;case"link":i=new At(t,n);break;case"help":i=new St(t,n);break;case"table":i=new Bt(t,n);break;case"preview":i=new Ut(t,n);break;case"fullscreen":i=new Jt(t,n);break;case"upload":i=new Gt(t,n);break;case"record":i=new ne(t,n);break;case"info":i=new se(t,n);break;default:console.log("menu item no matched")}var r=n.name;"br"!==r&&"|"!==r||(r+=o),e.elements[r]=i.element})}}(),ae=function(){function t(t){this.defaultOptions={cache:!0,height:"auto",width:"auto",placeholder:"",lang:"zh_CN",resize:{enable:!1,position:"bottom"},preview:{delay:1e3,show:!1},hint:{delay:200,emoji:{"+1":"👍","-1":"👎",heart:"❤️",cold_sweat:"😰"}},counter:0,upload:{url:"",max:10485760,linkToImgUrl:"",filename:function(t){return t.replace(/\W/g,"")}},classes:{preview:""},toolbar:[{name:"emoji",hotkey:"⌘-e",tipPosition:"ne"},{name:"headings",hotkey:"⌘-h",tipPosition:"ne"},{name:"bold",prefix:"**",suffix:"**",hotkey:"⌘-b",tipPosition:"ne"},{name:"italic",prefix:"*",suffix:"*",hotkey:"⌘-i",tipPosition:"ne"},{name:"strike",prefix:"~~",suffix:"~~",hotkey:"⌘-s",tipPosition:"ne"},{name:"|"},{name:"line",prefix:"---\n",hotkey:"⌘-d",tipPosition:"n"},{name:"quote",prefix:"> ",hotkey:"⌘-.",tipPosition:"n"},{name:"|"},{name:"list",prefix:"* ",hotkey:"⌘-l",tipPosition:"n"},{name:"ordered-list",prefix:"1. ",hotkey:"⌘-o",tipPosition:"n"},{name:"check",prefix:"* [ ] ",hotkey:"⌘-j",tipPosition:"n"},{name:"|"},{name:"code",prefix:"```\n",suffix:"\n```",hotkey:"⌘-u",tipPosition:"n"},{name:"inline-code",prefix:"`",suffix:"`",hotkey:"⌘-g",tipPosition:"n"},{name:"|"},{name:"undo",hotkey:"⌘-z",tipPosition:"n"},{name:"redo",hotkey:"⌘-y",tipPosition:"n"},{name:"|"},{name:"upload",tipPosition:"n"},{name:"link",prefix:"[",suffix:"](https://)",hotkey:"⌘-k",tipPosition:"n"},{name:"table",prefix:"| col1",suffix:" | col2 | col3 |\n| --- | --- | --- |\n| | | |\n| | | |",hotkey:"⌘-m",tipPosition:"n"},{name:"record",tipPosition:"n"},{name:"|"},{name:"preview",hotkey:"⌘-p",tipPosition:"nw"},{name:"fullscreen",hotkey:"⌘-f",tipPosition:"nw"},{name:"info",tipPosition:"nw"},{name:"help",tipPosition:"nw"},{name:"br"}]},this.options=t}return t.prototype.merge=function(){var t=this,e=[];this.options&&(this.options.toolbar&&this.options.toolbar.forEach(function(n){var o;t.defaultOptions.toolbar.forEach(function(t){"string"==typeof n&&t.name===n&&(o=t),"object"==typeof n&&t.name===n.name&&(o=Object.assign({},t,n))}),e.push(o)}),this.options.upload&&(this.options.upload=Object.assign({},this.defaultOptions.upload,this.options.upload)),this.options.classes&&(this.options.classes=Object.assign({},this.defaultOptions.classes,this.options.classes)),this.options.preview&&(this.options.preview=Object.assign({},this.defaultOptions.preview,this.options.preview)),this.options.hint&&(this.options.hint=Object.assign({},this.defaultOptions.hint,this.options.hint)),this.options.resize&&(this.options.resize=Object.assign({},this.defaultOptions.resize,this.options.resize)));var n=Object.assign({},this.defaultOptions,this.options);return e.length>0&&(n.toolbar=e),n},t}(),ce=function(){return function(t){var e=document.getElementById(t.id);e.className="vditor"+(e.className?" "+e.className:""),"number"==typeof t.options.height&&(e.style.height=t.options.height+"px"),"number"==typeof t.options.width?e.style.width=t.options.width+"px":e.style.width=t.options.width;var n=document.createElement("div");n.className="vditor-toolbar",Object.keys(t.toolbar.elements).forEach(function(e){n.appendChild(t.toolbar.elements[e])}),e.appendChild(n),t.options.resize.enable&&"top"===t.options.resize.position&&e.appendChild(t.resize.element);var o=document.createElement("div");o.className="vditor-content",o.appendChild(t.editor.element),t.preview&&o.appendChild(t.preview.element),t.options.counter>0&&o.appendChild(t.counter.element),t.upload&&o.appendChild(t.upload.element),e.appendChild(o),t.options.resize.enable&&"bottom"===t.options.resize.position&&e.appendChild(t.resize.element),document.onclick=function(t){var e=t.target.closest(".vditor-tooltipped");e&&e.nextSibling&&"vditor-panel"===e.nextSibling.className||(document.querySelectorAll(".vditor-hint").forEach(function(t){t.style.display="none"}),document.querySelectorAll(".vditor-panel").forEach(function(t){t.style.display="none"}))}}}(),pe=function(){function t(t){this.editorElement=t.editor.element,this.toolbarElements=t.toolbar.elements,this.options=t.options,this.hintElement=t.hint.element,this.bindHotkey()}return t.prototype.bindHotkey=function(){var t=this;this.editorElement.addEventListener("keydown",function(e){t.options.esc&&e.key.toLowerCase()==="Escape".toLowerCase()&&t.options.esc(t.editorElement.value),t.options.ctrlEnter&&(e.metaKey||e.ctrlKey)&&"enter"===e.key.toLowerCase()&&t.options.ctrlEnter(t.editorElement.value),t.options.toolbar.forEach(function(n){if(n.hotkey){var o=n.hotkey.split("-");"ctrl"!==o[0]&&"⌘"!==o[0]||!e.metaKey&&!e.ctrlKey||e.key===o[1]&&(t.toolbarElements[n.name].children[0].click(),e.preventDefault(),e.stopPropagation())}}),(t.options.hint.at||t.toolbarElements.emoji)&&t.hint(e)})},t.prototype.hint=function(t){if(0!==this.hintElement.querySelectorAll("li").length&&"none"!==this.hintElement.style.display){var e=this.hintElement.querySelector(".vditor-hint--current");if("arrowdown"===t.key.toLowerCase())t.preventDefault(),t.stopPropagation(),e.nextElementSibling?e.nextElementSibling.className="vditor-hint--current":this.hintElement.children[0].className="vditor-hint--current",e.removeAttribute("class");else if("arrowup"===t.key.toLowerCase()){if(t.preventDefault(),t.stopPropagation(),e.previousElementSibling)e.previousElementSibling.className="vditor-hint--current";else{var n=this.hintElement.children.length;this.hintElement.children[n-1].className="vditor-hint--current"}e.removeAttribute("class")}else if("enter"===t.key.toLowerCase()){t.preventDefault(),t.stopPropagation(),this.hintElement.style.display="none";var o=e.getAttribute("data-value"),i=0===o.indexOf("@")?"@":":";this.editorElement.selectionStart=this.editorElement.value.substr(0,this.editorElement.selectionEnd).lastIndexOf(i),_(this.editorElement,o,"",!0)}}},t}(),ue=function(){function t(t){this.element=document.createElement("div"),this.element.className="vditor-preview"+(t.options.classes.preview?" "+t.options.classes.preview:""),t.options.preview.show||(this.element.style.display="none"),"none"!==this.element.style.display&&this.render(t)}return t.prototype.render=function(t,e){var n=this;"none"!==this.element.style.display&&(e?this.element.innerHTML=e:""!==t.editor.element.value.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")?t.options.preview.url?(clearTimeout(t.mdTimeoutId),t.mdTimeoutId=setTimeout(function(){var e=new XMLHttpRequest;e.open("POST",t.options.preview.url),e.onreadystatechange=function(){if(e.readyState===XMLHttpRequest.DONE&&200===e.status){var o=JSON.parse(e.responseText);if(0!==o.code)return void alert(o.msg);n.element.innerHTML=o.data,t.options.preview.parse&&t.options.preview.parse(n.element)}},e.send(JSON.stringify({markdownText:t.editor.element.value}))},t.options.preview.delay)):this.element.innerHTML=t.editor.element.value:this.element.innerHTML="")},t}(),de=function(){function t(t){this.element=document.createElement("div"),this.element.className="vditor-counter",this.render(0,t.options.counter)}return t.prototype.render=function(t,e){this.element.className=t>e?"vditor-counter vditor-counter--error":"vditor-counter",this.element.innerHTML=t+"/"+e},t}(),he=n(23),fe=n.n(he),ve=function(){function t(t){this.element=document.createElement("div"),this.element.className="vditor-resize",this.element.innerHTML=fe.a,this.bindEvent(t)}return t.prototype.bindEvent=function(t){this.element.addEventListener("mousedown",function(e){var n=document,o=document.getElementById(t.id);e||(e=window.event);var i=e.clientY,r=o.offsetHeight;n.ondragstart="return false;",n.onselectstart="return false;",n.onselect="document.selection.empty();",this.setCapture?this.setCapture():window.captureEvents&&window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP),n.onmousemove=function(e){e||(e=window.event),"top"===t.options.resize.position?o.style.height=Math.max(100,r+(i-e.clientY))+"px":o.style.height=Math.max(100,r+(e.clientY-i))+"px"},n.onmouseup=function(){t.options.resize.after&&t.options.resize.after(o.offsetHeight-r),this.releaseCapture?this.releaseCapture():window.captureEvents&&window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP),n.onmousemove=null,n.onmouseup=null,n.ondragstart=null,n.onselectstart=null,n.onselect=null}})},t}(),me=function(t){var e=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n=document.querySelector(".vditor-position");n||((n=document.createElement("div")).className="vditor-position",document.body.appendChild(n));var o=n.style;o.whiteSpace="pre-wrap",o.wordWrap="break-word",o.position="absolute",o.overflow="hidden",o.left="-100%",["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"].forEach(function(t){o[t]=e[t]}),n.textContent=t.value.substring(0,t.selectionEnd);var i=document.createElement("span");return i.textContent=t.value.substring(t.selectionEnd)||".",n.appendChild(i),{top:i.offsetTop-t.scrollTop+parseInt(e.lineHeight),left:i.offsetLeft-t.scrollLeft}},ge=function(){function t(t){this.timeId=-1,this.hintDelay=t.options.hint.delay,this.editorElement=t.editor.element,this.atUser=t.options.hint.at,this.commonEmoji=t.options.hint.emoji,this.element=document.createElement("ul"),this.element.className="vditor-hint",this.editorElement.parentElement.appendChild(this.element)}return t.prototype.render=function(){var t=this,e=this.editorElement.value.substr(0,this.editorElement.selectionStart).split("\n").slice(-1).pop(),o=this.getKey(e,"@"),i=this.getKey(e,":");void 0===o&&void 0===i?(this.element.style.display="none",clearTimeout(this.timeId)):(void 0!==o&&this.atUser&&(clearTimeout(this.timeId),this.timeId=setTimeout(function(){t.genHTML(t.atUser(o),o)},this.hintDelay)),void 0!==i&&n.e(2).then(n.bind(null,27)).then(function(e){var n=""===i?t.commonEmoji:e.allEmoji,o=[];Object.keys(n).forEach(function(t){0===t.indexOf(i.toLowerCase())&&(n[t].indexOf(".")>-1?o.push({value:":"+t+":",html:'<img src="'+n[t]+'" title=":'+t+':"/> :'+t+":"}):o.push({value:n[t],html:n[t]+" "+t}))}),t.genHTML(o,i)}).catch(function(t){console.log("Failed to load emoji",t)}))},t.prototype.getKey=function(t,e){String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")});var n=t.split(e),o=void 0;if(n.length>1)if(2===n.length&&""===n[0])(""===n[1]||""!==n[1].trim())&&-1===n[1].indexOf(" ")&&n[1].length<33&&(o=n[1]);else{var i=n[n.length-2],r=n.slice(-1).pop();" "===i.slice(-1)&&-1===r.indexOf(" ")&&(""===r||""!==r.trim())&&r.length<33&&(o=r)}return o},t.prototype.genHTML=function(t,e){var n=this;if(0!==t.length){var o=me(this.editorElement),i=o.left,r=o.top-4,s="";t.forEach(function(t,n){if(!(n>7)){var o=t.html;if(""!==e){var i=o.lastIndexOf(">")+1,r=o.substr(i),l=r.toLowerCase().indexOf(e.toLowerCase());l>-1&&(r=r.substring(0,l)+"<b>"+r.substring(l,l+e.length)+"</b>"+r.substring(l+e.length),o=o.substr(0,i)+r)}s+='<li data-value="'+t.value+' " class="'+(n||"vditor-hint--current")+'"> '+o+"</li>"}}),this.element.innerHTML=s,this.element.style.top=r+"px",this.element.style.left=i+"px",this.element.style.display="block",this.element.querySelectorAll("li").forEach(function(t){t.addEventListener("click",function(){n.element.style.display="none";var e=t.getAttribute("data-value"),o=0===e.indexOf("@")?"@":":";n.editorElement.selectionStart=n.editorElement.value.substr(0,n.editorElement.selectionEnd).lastIndexOf(o),_(n.editorElement,e,"",!0)})}),r+this.element.offsetHeight-this.editorElement.offsetHeight>window.innerHeight-(this.editorElement.parentElement.offsetHeight+this.editorElement.parentElement.offsetTop-document.documentElement.scrollTop)&&(this.element.style.top=r-this.element.offsetHeight+"px")}else this.element.style.display="none"},t}(),ye=function(){function t(t,e){this.version=o;var n=new ae(e).merge();if(this.vditor={id:t,options:n,mdTimeoutId:-1},n.counter>0){var i=new de(this.vditor);this.vditor.counter=i}var r=new E(this.vditor);if(this.vditor.editor=r,n.resize.enable){var s=new ve(this.vditor);this.vditor.resize=s}var l=new le(this.vditor);if(this.vditor.toolbar=l,l.elements.preview){var a=new ue(this.vditor);this.vditor.preview=a}if(n.upload.url){var c=new w;this.vditor.upload=c}if(new ce(this.vditor),this.vditor.options.atUser||this.vditor.toolbar.elements.emoji){var p=new ge(this.vditor);this.vditor.hint=p}new pe(this.vditor)}return t.prototype.getValue=function(){return this.vditor.editor.element.value},t.prototype.insertValue=function(t){_(this.vditor.editor.element,t,"")},t.prototype.focus=function(){this.vditor.editor.element.focus()},t.prototype.blur=function(){this.vditor.editor.element.blur()},t.prototype.disabled=function(){this.vditor.editor.element.setAttribute("disabled","disabled")},t.prototype.enable=function(){this.vditor.editor.element.removeAttribute("disabled")},t.prototype.setSelection=function(t,e){this.vditor.editor.element.selectionStart=t,this.vditor.editor.element.selectionEnd=e,this.vditor.editor.element.focus()},t.prototype.getSelection=function(){return this.vditor.editor.element.value.substring(this.vditor.editor.element.selectionStart,this.vditor.editor.element.selectionEnd)},t.prototype.setValue=function(t){this.vditor.editor.element.selectionStart=0,this.vditor.editor.element.selectionEnd=this.vditor.editor.element.value.length,_(this.vditor.editor.element,t,"",!0),t||localStorage.removeItem("vditor"+this.vditor.id)},t.prototype.renderPreview=function(t){this.vditor.preview.render(this.vditor,t)},t.prototype.getCursorPosition=function(){return me(this.vditor.editor.element)},t.prototype.deleteValue=function(){_(this.vditor.editor.element,"","",!0)},t.prototype.updateValue=function(t){_(this.vditor.editor.element,t,"",!0)},t.prototype.isUploading=function(){return this.vditor.upload.isUploading},t.prototype.clearCache=function(){localStorage.removeItem("vditor"+this.vditor.id)},t.prototype.disabledCache=function(){this.vditor.options.cache=!1},t.prototype.enableCache=function(){this.vditor.options.cache=!0},t}();e.default=ye}]).default});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Vditor=e():t.Vditor=e()}(window,function(){return function(t){function e(e){for(var n,i,r=e[0],s=e[1],l=0,c=[];l<r.length;l++)i=r[l],o[i]&&c.push(o[i][0]),o[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n]);for(a&&a(e);c.length;)c.shift()()}var n={},o={0:0};function i(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.e=function(t){var e=[],n=o[t];if(0!==n)if(n)e.push(n[2]);else{var r=new Promise(function(e,i){n=o[t]=[e,i]});e.push(n[2]=r);var s,l=document.createElement("script");l.charset="utf-8",l.timeout=120,i.nc&&l.setAttribute("nonce",i.nc),l.src=function(t){return i.p+""+({1:"vditor",2:"vendors~vditor"}[t]||t)+".bundle.js"}(t),s=function(e){l.onerror=l.onload=null,clearTimeout(a);var n=o[t];if(0!==n){if(n){var i=e&&("load"===e.type?"missing":e.type),r=e&&e.target&&e.target.src,s=new Error("Loading chunk "+t+" failed.\n("+i+": "+r+")");s.type=i,s.request=r,n[1](s)}o[t]=void 0}};var a=setTimeout(function(){s({type:"timeout",target:l})},12e4);l.onerror=l.onload=s,document.head.appendChild(l)}return Promise.all(e)},i.m=t,i.c=n,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="https://vditor.b3log.org/0.2.0/",i.oe=function(t){throw console.error(t),t};var r=window.webpackJsonpVditor=window.webpackJsonpVditor||[],s=r.push.bind(r);r.push=e,r=r.slice();for(var l=0;l<r.length;l++)e(r[l]);var a=s;return i(i.s=24)}([function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 32 32" width=32px height=32px> <path d="M32 0v13l-5-5-6 6-3-3 6-6-5-5zM14 21l-6 6 5 5h-13v-13l5 5 6-6z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=128 height=32 viewBox="0 0 128 32"> <path d="M0 0h128v6.4h-128zM0 12.8h128v6.4h-128zM0 25.6h128v6.4h-128z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 32 32" width=32px height=32px> <path d="M22.996 15.023c1.339-1.591 2.147-3.643 2.147-5.88 0-5.041-4.102-9.143-9.143-9.143h-11.429v32h13.714c5.041 0 9.143-4.102 9.143-9.143 0-3.32-1.779-6.232-4.433-7.834zM11.429 4.571h3.625c1.999 0 3.625 2.051 3.625 4.571s-1.626 4.571-3.625 4.571h-3.625v-9.143zM17.107 27.429h-5.679v-9.143h5.679c2.087 0 3.786 2.051 3.786 4.571s-1.698 4.571-3.786 4.571z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M27.094 19.485v6.12c0 3.059-2.483 5.542-5.542 5.542h-16.010c-3.059 0-5.542-2.483-5.542-5.542v-16.010c0-3.059 2.483-5.542 5.542-5.542h16.010c0.769 0 1.54 0.154 2.251 0.481 0.174 0.077 0.308 0.25 0.346 0.443 0.039 0.211-0.019 0.404-0.174 0.558l-0.943 0.943c-0.115 0.115-0.289 0.193-0.443 0.193-0.058 0-0.115-0.019-0.174-0.039-0.289-0.077-0.578-0.115-0.866-0.115h-16.010c-1.693 0-3.079 1.386-3.079 3.079v16.010c0 1.693 1.386 3.079 3.079 3.079h16.010c1.693 0 3.079-1.386 3.079-3.079v-4.888c0-0.154 0.058-0.308 0.174-0.424l1.232-1.232c0.135-0.135 0.289-0.193 0.443-0.193 0.077 0 0.154 0.019 0.231 0.058 0.231 0.096 0.385 0.308 0.385 0.558zM31.54 10.076l-15.664 15.664c-0.615 0.615-1.578 0.615-2.194 0l-8.275-8.275c-0.615-0.615-0.615-1.578 0-2.194l2.116-2.116c0.615-0.615 1.578-0.615 2.194 0l5.060 5.060 12.451-12.451c0.615-0.615 1.578-0.615 2.194 0l2.116 2.116c0.615 0.615 0.615 1.578 0 2.194z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M21.053 21.895l2.526 2.526 8.421-8.421-8.421-8.421-2.526 2.526 5.895 5.895z"></path> <path d="M10.947 10.105l-2.526-2.526-8.421 8.421 8.421 8.421 2.526-2.526-5.895-5.895z"></path> <path d="M17.613 6.487l1.828 0.499-5.052 18.527-1.828-0.499 5.052-18.527z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 32 32" width=32px height=32px> <path d="M16 24.789c-3.756 0-6.911-2.254-8.188-5.559h16.376c-1.277 3.305-4.432 5.559-8.188 5.559zM10.366 14.423c-1.352 0-2.404-1.052-2.404-2.404s1.052-2.404 2.404-2.404 2.404 1.052 2.404 2.404-1.052 2.404-2.404 2.404zM21.634 14.423c-1.352 0-2.404-1.052-2.404-2.404s1.052-2.404 2.404-2.404 2.404 1.052 2.404 2.404-1.052 2.404-2.404 2.404zM16 28.845c7.061 0 12.845-5.784 12.845-12.845s-5.784-12.845-12.845-12.845-12.845 5.784-12.845 12.845 5.784 12.845 12.845 12.845zM16 0c8.864 0 16 7.136 16 16s-7.136 16-16 16-16-7.136-16-16 7.136-16 16-16z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 32 32" width=32px height=32px> <path d="M14 18v13l-5-5-6 6-3-3 6-6-5-5zM32 3l-6 6 5 5h-13v-13l5 5 6-6z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M4.45 0h3.594c0.595 0 1.078 0.384 1.078 0.858v30.284c0 0.474-0.482 0.858-1.078 0.858h-3.594c-0.595 0-1.078-0.384-1.078-0.858v-30.284c-0-0.474 0.482-0.858 1.078-0.858zM23.888 0h3.673c0.59 0 1.068 0.384 1.068 0.858v30.284c0 0.474-0.478 0.858-1.068 0.858h-3.673c-0.59 0-1.068-0.384-1.068-0.858v-30.284c0-0.474 0.478-0.858 1.068-0.858z"></path> <path d="M25.069 14.167v3.667c0 0.589-0.384 1.065-0.858 1.065h-15.655c-0.474 0-0.858-0.477-0.858-1.065v-3.667c0-0.589 0.384-1.065 0.858-1.065h15.655c0.474 0 0.858 0.477 0.858 1.065z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M19.652 25v6c0 0.55-0.45 1-1 1h-6c-0.55 0-1-0.45-1-1v-6c0-0.55 0.45-1 1-1h6c0.55 0 1 0.45 1 1zM27.552 10c0 4.75-3.225 6.575-5.6 7.9-1.475 0.85-2.4 2.575-2.4 3.3v0c0 0.55-0.425 1.2-1 1.2h-6c-0.55 0-0.9-0.85-0.9-1.4v-1.125c0-3.025 3-5.625 5.2-6.625 1.925-0.875 2.725-1.7 2.725-3.3 0-1.4-1.825-2.65-3.85-2.65-1.125 0-2.15 0.35-2.7 0.725-0.6 0.425-1.2 1.025-2.675 2.875-0.2 0.25-0.5 0.4-0.775 0.4-0.225 0-0.425-0.075-0.625-0.2l-4.1-3.125c-0.425-0.325-0.525-0.875-0.25-1.325 2.7-4.475 6.5-6.65 11.6-6.65 5.35 0 11.35 4.275 11.35 10z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M23.273 27.636v2.909c0 0.795-0.659 1.455-1.455 1.455h-11.636c-0.795 0-1.455-0.659-1.455-1.455v-2.909c0-0.795 0.659-1.455 1.455-1.455h1.455v-8.727h-1.455c-0.795 0-1.455-0.659-1.455-1.455v-2.909c0-0.795 0.659-1.455 1.455-1.455h8.727c0.795 0 1.455 0.659 1.455 1.455v13.091h1.455c0.795 0 1.455 0.659 1.455 1.455zM20.364 1.455v4.364c0 0.795-0.659 1.455-1.455 1.455h-5.818c-0.795 0-1.455-0.659-1.455-1.455v-4.364c0-0.795 0.659-1.455 1.455-1.455h5.818c0.795 0 1.455 0.659 1.455 1.455z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M18.133 23.467l3.2 3.2 10.667-10.667-10.667-10.667-3.2 3.2 7.467 7.467z"></path> <path d="M13.867 8.533l-3.2-3.2-10.667 10.667 10.667 10.667 3.2-3.2-7.467-7.467z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M29.714 0v2.286h-4.571l-11.429 27.429h4.571v2.286h-16v-2.286h4.571l11.429-27.429h-4.571v-2.286z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M31.68 14.56h-31.36c-0.176 0-0.32 0.144-0.32 0.32v2.24c0 0.176 0.144 0.32 0.32 0.32h31.36c0.176 0 0.32-0.144 0.32-0.32v-2.24c0-0.176-0.144-0.32-0.32-0.32z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M29.187 2.933l-0.12-0.121c-2.813-2.812-7.415-2.812-10.228 0l-6.516 6.517c-2.812 2.812-2.812 7.415 0 10.227l0.12 0.12c0.234 0.234 0.482 0.446 0.739 0.641l2.386-2.386c-0.278-0.164-0.542-0.361-0.78-0.599l-0.121-0.121c-1.527-1.527-1.527-4.012 0-5.539l6.517-6.516c1.527-1.527 4.012-1.527 5.539 0l0.121 0.12c1.527 1.527 1.527 4.012 0 5.539l-2.948 2.948c0.512 1.264 0.754 2.611 0.733 3.955l4.559-4.559c2.812-2.812 2.812-7.415-0-10.227zM19.557 12.323c-0.234-0.234-0.482-0.446-0.739-0.641l-2.386 2.385c0.278 0.164 0.542 0.361 0.78 0.599l0.121 0.121c1.527 1.527 1.527 4.012 0 5.539l-6.517 6.517c-1.527 1.527-4.012 1.527-5.539 0l-0.121-0.121c-1.527-1.527-1.527-4.012 0-5.539l2.948-2.948c-0.512-1.264-0.754-2.611-0.733-3.955l-4.559 4.559c-2.812 2.812-2.812 7.415 0 10.228l0.12 0.12c2.813 2.812 7.415 2.812 10.228 0l6.516-6.517c2.812-2.812 2.812-7.415 0-10.228l-0.12-0.12z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M12 2h20v4h-20v-4zM12 14h20v4h-20v-4zM12 26h20v4h-20v-4zM0 4c0 2.209 1.791 4 4 4s4-1.791 4-4c0-2.209-1.791-4-4-4s-4 1.791-4 4zM0 16c0 2.209 1.791 4 4 4s4-1.791 4-4c0-2.209-1.791-4-4-4s-4 1.791-4 4zM0 28c0 2.209 1.791 4 4 4s4-1.791 4-4c0-2.209-1.791-4-4-4s-4 1.791-4 4z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M11 26h20v4h-20zM11 14h20v4h-20zM11 2h20v4h-20zM5 0v8h-2v-6h-2v-2zM3 16.438v1.563h4v2h-6v-4.563l4-1.875v-1.563h-4v-2h6v4.563zM7 22v10h-6v-2h4v-2h-4v-2h4v-2h-4v-2z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M0 16c3.037-5.864 9.058-9.802 16-9.802s12.963 3.938 15.953 9.703l0.047 0.1c-3.037 5.864-9.058 9.802-16 9.802s-12.963-3.938-15.953-9.703l-0.047-0.1zM16 22.531c3.607 0 6.531-2.924 6.531-6.531s-2.924-6.531-6.531-6.531v0c-3.607 0-6.531 2.924-6.531 6.531s2.924 6.531 6.531 6.531v0zM16 19.265c-1.804 0-3.265-1.461-3.265-3.265s1.461-3.265 3.265-3.265v0c1.804 0 3.265 1.461 3.265 3.265s-1.461 3.265-3.265 3.265v0z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M7.024 13.003c3.862 0 6.993 3.131 6.993 6.993s-3.131 6.993-6.993 6.993-6.993-3.131-6.993-6.993l-0.031-0.999c0-7.724 6.262-13.986 13.986-13.986v3.996c-2.668 0-5.177 1.039-7.064 2.926-0.363 0.363-0.695 0.75-0.994 1.156 0.357-0.056 0.723-0.086 1.096-0.086zM25.007 13.003c3.862 0 6.993 3.131 6.993 6.993s-3.131 6.993-6.993 6.993-6.993-3.131-6.993-6.993l-0.031-0.999c0-7.724 6.262-13.986 13.986-13.986v3.996c-2.668 0-5.177 1.039-7.064 2.926-0.363 0.363-0.695 0.75-0.994 1.156 0.357-0.056 0.723-0.086 1.096-0.086z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M4.571 16c0 6.312 5.117 11.429 11.429 11.429s11.429-5.117 11.429-11.429v0c0-6.312-5.117-11.429-11.429-11.429s-11.429 5.117-11.429 11.429v0z"></path> <path d="M16 30.857c-8.229 0-14.933-6.705-14.933-14.933s6.705-14.933 14.933-14.933 15.010 6.705 15.010 15.010c0 8.152-6.705 14.857-15.010 14.857zM16 0c-8.838 0-16 7.162-16 16s7.162 16 16 16 16-7.162 16-16-7.162-16-16-16z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M19.583 9.75q-8.667 1.25-13.375 6.625t-6.208 12.958q6.417-9.083 19.583-9.083v7.25l12.417-12.417-12.417-12.417v7.083z"></path> </svg>'},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M32 16v2h-7.328c0.86 1.203 1.328 2.584 1.328 4 0 2.215-1.146 4.345-3.143 5.843-1.855 1.391-4.29 2.157-6.857 2.157s-5.002-0.766-6.857-2.157c-1.998-1.498-3.143-3.628-3.143-5.843h4c0 2.168 2.748 4 6 4s6-1.832 6-4c0-2.168-2.748-4-6-4h-16v-2h9.36c-0.073-0.052-0.146-0.104-0.217-0.157-1.998-1.498-3.143-3.628-3.143-5.843s1.146-4.345 3.143-5.843c1.855-1.391 4.29-2.157 6.857-2.157s5.002 0.766 6.857 2.157c1.997 1.498 3.143 3.628 3.143 5.843h-4c0-2.168-2.748-4-6-4s-6 1.832-6 4c0 2.168 2.748 4 6 4 2.468 0 4.814 0.709 6.64 2h9.36z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M9.846 26.462v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM9.846 19.077v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM19.692 26.462v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM9.846 11.692v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM19.692 19.077v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM29.538 26.462v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM19.692 11.692v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM29.538 19.077v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM29.538 11.692v-3.692c0-0.346-0.269-0.615-0.615-0.615h-6.154c-0.346 0-0.615 0.269-0.615 0.615v3.692c0 0.346 0.269 0.615 0.615 0.615h6.154c0.346 0 0.615-0.269 0.615-0.615zM32 5.538v20.923c0 1.692-1.385 3.077-3.077 3.077h-25.846c-1.692 0-3.077-1.385-3.077-3.077v-20.923c0-1.692 1.385-3.077 3.077-3.077h25.846c1.692 0 3.077 1.385 3.077 3.077z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M12.417 9.75q8.667 1.25 13.375 6.625t6.208 12.958q-6.417-9.083-19.583-9.083v7.25l-12.417-12.417 12.417-12.417v7.083z"></path> </svg> '},function(t,e){t.exports='<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 32 32"> <path d="M21.334 16.532q0-0.233-0.15-0.384l-5.867-5.867q-0.15-0.15-0.384-0.15t-0.384 0.15l-5.85 5.85q-0.167 0.2-0.167 0.399 0 0.233 0.15 0.384t0.384 0.15h3.733v5.867q0 0.217 0.159 0.375t0.375 0.159h3.2q0.217 0 0.375-0.159t0.159-0.375v-5.867h3.734q0.217 0 0.375-0.159t0.159-0.375zM32 21.332q0 2.65-1.875 4.525t-4.525 1.875h-18.133q-3.083 0-5.275-2.192t-2.192-5.275q0-2.166 1.167-4t3.134-2.75q-0.034-0.5-0.034-0.717 0-3.533 2.5-6.033t6.033-2.5q2.6 0 4.759 1.45t3.142 3.849q1.184-1.033 2.767-1.033 1.767 0 3.017 1.25t1.25 3.017q0 1.267-0.683 2.3 2.166 0.516 3.558 2.258t1.392 3.975z"></path> </svg>'},function(t,e,n){"use strict";n.r(e);var o="0.2.0",i=function(){function t(t){this.element=document.createElement("div"),this.element.className="vditor-counter",this.render(0,t.options.counter)}return t.prototype.render=function(t,e){this.element.className=t>e?"vditor-counter vditor-counter--error":"vditor-counter",this.element.innerHTML=t+"/"+e},t}(),r=/highlight-(?:text|source)-([a-z0-9]+)/;function s(t){t.addRule("highlightedCodeBlock",{filter:function(t){var e=t.firstChild;return"DIV"===t.nodeName&&r.test(t.className)&&e&&"PRE"===e.nodeName},replacement:function(t,e,n){var o=((e.className||"").match(r)||[null,""])[1];return"\n\n"+n.fence+o+"\n"+e.firstChild.textContent+"\n"+n.fence+"\n\n"}})}function l(t){t.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return"~"+t+"~"}})}var a=Array.prototype.indexOf,c=Array.prototype.every,p={};function u(t){var e,n,o=t.parentNode;return"THEAD"===o.nodeName||o.firstChild===t&&("TABLE"===o.nodeName||(n=(e=o).previousSibling,"TBODY"===e.nodeName&&(!n||"THEAD"===n.nodeName&&/^\s*$/i.test(n.textContent))))&&c.call(t.childNodes,function(t){return"TH"===t.nodeName})}function d(t,e){var n=" ";return 0===a.call(e.parentNode.childNodes,e)&&(n="| "),n+t+" |"}function h(t){for(var e in t.keep(function(t){return"TABLE"===t.nodeName&&!u(t.rows[0])}),p)t.addRule(e,p[e])}function f(t){t.addRule("taskListItems",{filter:function(t){return"checkbox"===t.type&&"LI"===t.parentNode.nodeName},replacement:function(t,e){return(e.checked?"[x]":"[ ]")+" "}})}function v(t){t.use([s,l,h,f])}p.tableCell={filter:["th","td"],replacement:function(t,e){return d(t,e)}},p.tableRow={filter:"tr",replacement:function(t,e){var n="",o={left:":--",right:"--:",center:":-:"};if(u(e))for(var i=0;i<e.childNodes.length;i++){var r="---",s=(e.childNodes[i].getAttribute("align")||"").toLowerCase();s&&(r=o[s]||r),n+=d(r,e.childNodes[i])}return"\n"+t+(n?"\n"+n:"")}},p.table={filter:function(t){return"TABLE"===t.nodeName&&u(t.rows[0])},replacement:function(t){return"\n\n"+(t=t.replace("\n\n","\n"))+"\n\n"}},p.tableSection={filter:["thead","tbody","tfoot"],replacement:function(t){return t}};var m,g={en_US:{bold:"Blod",check:"Task List",code:"Code Block",emoji:"Emoji",fullscreen:"Fullscreen",headings:"Headings",help:"Help",info:"Info","inline-code":"Inline Code",italic:"Italic",line:"Line",link:"Link",list:"List","ordered-list":"Order List",over:"over",preview:"Preview",quote:"Quote",record:"Start Record/End Record",recording:"recording...",redo:"Redo",strike:"Strike",table:"Table",undo:"Undo",upload:"Upload image or file",uploading:"uploading..."},zh_CN:{bold:"粗体",check:"任务列表",code:"代码块",emoji:"表情",fullscreen:"全屏",headings:"标题",help:"帮助",info:"关于","inline-code":"行内代码",italic:"斜体",line:"分隔线",link:"链接",list:"无序列表","ordered-list":"有序列表",over:"超过",preview:"预览",quote:"引用",record:"开始录音/结束录音",recording:"录音中...",redo:"重做",strike:"删除线",table:"表格",undo:"撤销",upload:"上传图片或文件",uploading:"上传中..."}},y=function(){return function(){this.isUploading=!1,this.element=document.createElement("div"),this.element.className="vditor-upload",this.element.innerHTML='<div class="vditor-upload__progress"></div><div class="vditor-upload__close">x</div>',this.element.children[1].addEventListener("click",function(){this.parentElement.style.opacity=0,this.parentElement.className="vditor-upload"})}}(),w=function(t,e,n){for(var o=new FormData,i=[],r=0,s=e.length;r<s;r++){var l=e[r];l instanceof DataTransferItem&&(l=l.getAsFile()),l.size<=t.options.upload.max&&(o.append("file[]",l),i.push(l))}if(t.upload.element.className="vditor-upload",t.upload.element.children[0].innerHTML="",_(t.editor.element,function(t,e){for(var n="",o=e.length,i=0;i<o;i++){var r=e[i];r instanceof DataTransferItem&&(r=r.getAsFile());var s=-1===r.type.indexOf("image")?"":"!";if(!r.name)return"";var l=r.name.lastIndexOf("."),a=t.options.upload.filename(r.name.substr(0,l))+r.name.substr(l),c=t.options.lang;r.size>t.options.upload.max?(t.upload.element.className="vditor-upload vditor-upload--tip",t.upload.element.children[0].innerHTML=r.name+" "+g[c].over+" "+t.options.upload.max/1024/1024+"M"):n+=s+"["+a+"]("+g[c].uploading+")\n"}return n}(t,e),""),0!==i.length){if(!t.options.upload.url||!t.upload)return n&&(n.value=""),void alert("please config: options.upload.url");var a=new XMLHttpRequest;a.open("POST",t.options.upload.url),t.options.upload.token&&a.setRequestHeader("X-Upload-Token",t.options.upload.token),t.upload.isUploading=!0,t.editor.element.setAttribute("disabled","disabled"),a.onreadystatechange=function(){a.readyState===XMLHttpRequest.DONE&&(t.upload.isUploading=!1,n&&(n.value=""),t.editor.element.removeAttribute("disabled"),200===a.status?(t.options.upload.success?t.options.upload.success(t.editor.element,a.responseText):function(t,e,n,o){t.focus();var i=JSON.parse(e);1===i.code&&(o.className="vditor-upload vditor-upload--tip",o.children[0].innerHTML=i.msg),i.data.errFiles.forEach(function(e){var o=e.lastIndexOf("."),i="["+(n.upload.filename(e.substr(0,o))+e.substr(o))+"]("+g[n.lang].uploading+")";t.selectionStart=t.value.split(i)[0].length,t.selectionEnd=t.selectionStart+i.length,_(t,"","",!0)}),Object.keys(i.data.succMap).forEach(function(e){var o=i.data.succMap[e];if(o.indexOf(".wav")!==o.length-4){var r=e.lastIndexOf("."),s=n.upload.filename(e.substr(0,r))+e.substr(r),l="["+s+"]("+g[n.lang].uploading+")";t.selectionStart=t.value.split(l)[0].length,t.selectionEnd=t.selectionStart+l.length,_(t,"["+s+"]("+o+")","",!0)}else _(t,'<audio controls="controls" src="'+o+'"></audio>\n',"")})}(t.editor.element,a.responseText,t.options,t.upload.element),t.upload.element.style.opacity="0"):t.options.upload.error?t.options.upload.error(a.responseText):(t.upload.element.className="vditor-upload vditor-upload--tip",t.upload.element.children[0].innerHTML=a.responseText||"401"))},a.upload.onprogress=function(e){if(e.lengthComputable){var n=e.loaded/e.total*100;t.upload.element.style.opacity="1",t.upload.element.children[0].style.width=n+"%"}},a.send(o)}else n&&(n.value="")},b=function(){function t(t){this.element=document.createElement("textarea"),this.element.className="vditor-textarea",this.element.setAttribute("placeholder",t.options.placeholder),t.options.cache&&(this.element.value=localStorage.getItem("vditor"+t.id),t.options.counter>0&&t.counter.render(this.element.value.length,t.options.counter)),this.bindEvent(t)}return t.prototype.html2md=function(t,e,n,o){var i=!1;t.prototype.escape=function(t){return t};var r=new t;r.addRule("strikethrough",{filter:["pre","code"],replacement:function(t,e){return"PRE"===e.parentElement.tagName?t:t.split("\n").length>1?(i=!0,"```\n"+t+"\n```"):"`"+t+"`"}}),r.addRule("strikethrough",{filter:["img"],replacement:function(t,n){if(!n.getAttribute("src"))return"";if(e.options.upload.linkToImgUrl){var o=new XMLHttpRequest;o.open("POST",e.options.upload.linkToImgUrl),o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE&&200===o.status){var t=JSON.parse(o.responseText);if(0!==t.code)return void alert(t.msg);var i=n.getAttribute("src");e.editor.element.selectionStart=e.editor.element.value.split(i)[0].length,e.editor.element.selectionEnd=e.editor.element.selectionStart+i.length,_(e.editor.element,t.data.url,"",!0)}},o.send(JSON.stringify({url:n.getAttribute("src")}))}return"!["+n.getAttribute("alt")+"]("+n.getAttribute("src")+")"}}),r.use(v);var s=r.turndown(n);if(i){var l=document.createElement("div");l.innerHTML=n,l.querySelectorAll("pre").length>1?i=!1:"```"===s.substr(0,3)&&"```"===s.substr(s.length-3,3)||(i=!1)}_(e.editor.element,i?"```\n"+o+"\n```":s,"",!0)},t.prototype.bindEvent=function(t){var e,o=this;this.element.addEventListener("input",function(){t.options.counter>0&&t.counter.render(o.element.value.length,t.options.counter),"function"==typeof t.options.input&&t.options.input(o.element.value,t.preview&&t.preview.element),t.hint&&t.hint.render(),t.options.cache&&localStorage.setItem("vditor"+t.id,t.editor.element.value),t.preview&&t.preview.render(t)}),this.element.addEventListener("focus",function(){(t.options.focus&&t.options.focus(o.element.value),t.toolbar.elements.emoji&&t.toolbar.elements.emoji.children[1])&&(t.toolbar.elements.emoji.children[1].style.display="none");t.toolbar.elements.headings&&t.toolbar.elements.headings.children[1]&&(t.toolbar.elements.headings.children[1].style.display="none")}),this.element.addEventListener("blur",function(){t.options.blur&&t.options.blur(o.element.value)}),t.options.select&&(this.element.onselect=function(){t.options.select(o.element.value.substring(o.element.selectionStart,o.element.selectionEnd))}),this.element.addEventListener("scroll",function(){if("none"!==t.preview.element.style.display||t.preview){var e=o.element.scrollTop,n=o.element.clientHeight,i=o.element.scrollHeight,r=t.preview.element;r.scrollTop=e/n>.5?(e+n)*r.scrollHeight/i-n:e*r.scrollHeight/i}}),t.options.upload.url&&this.element.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault();var n=e.dataTransfer.items;0!==n.length&&w(t,n)});var i=this.html2md;this.element.addEventListener("paste",function(o){o.stopPropagation(),o.preventDefault();var r=o;if(""!==r.clipboardData.getData("text/html").replace(/(^\s*)|(\s*)$/g,"")){var s=r.clipboardData.getData("text/html"),l=r.clipboardData.getData("text/plain");if(!e)return void n.e(1).then(n.bind(null,26)).then(function(n){e=n.default,i(e,t,s,l)}).catch(function(t){console.error("Failed to load turndown",t)});i(e,t,s,l)}else if(""!==r.clipboardData.getData("text/plain").replace(/(^\s*)|(\s*)$/g,"")&&0===r.clipboardData.files.length)_(o.target,r.clipboardData.getData("text/plain"),"",!0);else if(r.clipboardData.files.length>0){if(!t.options.upload.url)return;w(t,r.clipboardData.files)}})},t}(),_=function(t,e,n,o){if("number"==typeof t.selectionStart&&"number"==typeof t.selectionEnd){var i=t.selectionStart,r=t.selectionEnd,s=t.value;if(t.focus(),/firefox/i.test(navigator.userAgent)||/edge/i.test(navigator.userAgent)||/msie/i.test(navigator.userAgent)||/trident/i.test(navigator.userAgent)){i===r?(t.value=s.substring(0,i)+e+n+s.substring(r,s.length),t.selectionEnd=t.selectionStart=r+e.length):o?(t.value=s.substring(0,i)+e+n+s.substring(r,s.length),t.selectionEnd=i+e.length+n.length):s.substring(i-e.length,i)===e&&s.substring(r,r+n.length)===n?(t.value=s.substring(0,i-e.length)+s.substring(i,r)+s.substring(r+n.length,s.length),t.selectionStart=i-e.length,t.selectionEnd=r-e.length):(t.value=s.substring(0,i)+e+s.substring(i,r)+n+s.substring(r,s.length),t.selectionStart=i+e.length,t.selectionEnd=r+e.length);var l=document.createEvent("HTMLEvents");l.initEvent("input",!0,!1),t.dispatchEvent(l)}else if(i===r)document.execCommand("insertText",!1,e+n),t.selectionStart=t.selectionEnd=t.selectionStart-n.length;else if(o)document.execCommand("insertText",!1,e+n);else if(s.substring(i-e.length,i)===e&&s.substring(r,r+n.length)===n){document.execCommand("delete",!1);for(var a=0,c=e.length;a<c;a++)document.execCommand("delete",!1);for(var p=0,u=n.length;p<u;p++)document.execCommand("forwardDelete",!1);document.execCommand("insertText",!1,s.substring(i,r)),t.selectionStart=i-e.length,t.selectionEnd=r-e.length}else document.execCommand("insertText",!1,e+s.substring(i,r)+n),t.selectionStart=i+e.length,t.selectionEnd=r+e.length}},E=function(t){var e=window.getComputedStyle(t),n=document.querySelector(".vditor-position");n||((n=document.createElement("div")).className="vditor-position",document.body.appendChild(n));var o=n.style;o.whiteSpace="pre-wrap",o.wordWrap="break-word",o.position="absolute",o.overflow="hidden",o.left="-100%",["direction","box-sizing","width","height","overflow-x","overflow-y","border-top-width","border-right-width","border-bottom-width","border-left-width","border-style","padding-top","padding-right","padding-bottom","padding-left","font-style","font-variant","font-weight","font-stretch","font-size","text-size-adjust","line-height","font-family","text-align","text-transform","text-indent","text-decoration","letter-spacing","word-spacing","tab-size","tab-size"].forEach(function(t){o.setProperty(t,e.getPropertyValue(t))}),n.textContent=t.value.substring(0,t.selectionEnd);var i=document.createElement("span");return i.textContent=t.value.substring(t.selectionEnd)||".",n.appendChild(i),{left:i.offsetLeft-t.scrollLeft,top:i.offsetTop-t.scrollTop+parseInt(e.lineHeight,10)}},x=function(){function t(t){this.timeId=-1,this.hint=t.options.hint,this.editorElement=t.editor.element,this.element=document.createElement("ul"),this.element.className="vditor-hint",this.editorElement.parentElement.appendChild(this.element)}return t.prototype.render=function(){var t=this,e=this.editorElement.value.substr(0,this.editorElement.selectionStart).split("\n").slice(-1).pop(),o=this.getKey(e,"@"),i=this.getKey(e,":");void 0===o&&void 0===i?(this.element.style.display="none",clearTimeout(this.timeId)):(void 0!==o&&this.hint.at&&(clearTimeout(this.timeId),this.timeId=setTimeout(function(){t.genHTML(t.hint.at(o),o)},this.hint.delay)),void 0!==i&&n.e(2).then(n.bind(null,27)).then(function(e){var n=""===i?t.hint.emoji:e.getAllEmoji(t.hint.emojiPath),o=[];Object.keys(n).forEach(function(t){0===t.indexOf(i.toLowerCase())&&(n[t].indexOf(".")>-1?o.push({html:'<img src="'+n[t]+'" title=":'+t+':"/> :'+t+":",value:":"+t+":"}):o.push({html:n[t]+" "+t,value:n[t]}))}),t.genHTML(o,i)}).catch(function(t){console.error("Failed to load emoji",t)}))},t.prototype.getKey=function(t,e){String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")});var n,o=t.split(e);if(o.length>1)if(2===o.length&&""===o[0])(""===o[1]||""!==o[1].trim())&&-1===o[1].indexOf(" ")&&o[1].length<33&&(n=o[1]);else{var i=o[o.length-2],r=o.slice(-1).pop();" "===i.slice(-1)&&-1===r.indexOf(" ")&&(""===r||""!==r.trim())&&r.length<33&&(n=r)}return n},t.prototype.genHTML=function(t,e){var n=this;if(0!==t.length){var o=E(this.editorElement),i=o.left,r=o.top-4,s="";t.forEach(function(t,n){if(!(n>7)){var o=t.html;if(""!==e){var i=o.lastIndexOf(">")+1,r=o.substr(i),l=r.toLowerCase().indexOf(e.toLowerCase());l>-1&&(r=r.substring(0,l)+"<b>"+r.substring(l,l+e.length)+"</b>"+r.substring(l+e.length),o=o.substr(0,i)+r)}s+='<li data-value="'+t.value+' " class="'+(n||"vditor-hint--current")+'"> '+o+"</li>"}}),this.element.innerHTML=s,this.element.style.top=r+"px",this.element.style.left=i+"px",this.element.style.display="block",this.element.querySelectorAll("li").forEach(function(t){t.addEventListener("click",function(){n.element.style.display="none";var e=t.getAttribute("data-value"),o=0===e.indexOf("@")?"@":":";n.editorElement.selectionStart=n.editorElement.value.substr(0,n.editorElement.selectionEnd).lastIndexOf(o),_(n.editorElement,e,"",!0)})}),r+this.element.offsetHeight-this.editorElement.offsetHeight>window.innerHeight-(this.editorElement.parentElement.offsetHeight+this.editorElement.parentElement.offsetTop-document.documentElement.scrollTop)&&(this.element.style.top=r-this.element.offsetHeight+"px")}else this.element.style.display="none"},t}(),O=function(){function t(t){this.editorElement=t.editor.element,this.toolbarElements=t.toolbar.elements,this.options=t.options,this.hintElement=t.hint.element,this.bindHotkey()}return t.prototype.bindHotkey=function(){var t=this;this.editorElement.addEventListener("keydown",function(e){t.options.esc&&e.key.toLowerCase()==="Escape".toLowerCase()&&t.options.esc(t.editorElement.value),t.options.ctrlEnter&&(e.metaKey||e.ctrlKey)&&"enter"===e.key.toLowerCase()&&t.options.ctrlEnter(t.editorElement.value),t.options.toolbar.forEach(function(n){if(n.hotkey){var o=n.hotkey.split("-");"ctrl"!==o[0]&&"⌘"!==o[0]||!e.metaKey&&!e.ctrlKey||e.key===o[1]&&(t.toolbarElements[n.name].children[0].click(),e.preventDefault(),e.stopPropagation())}}),(t.options.hint.at||t.toolbarElements.emoji)&&t.hint(e)})},t.prototype.hint=function(t){if(0!==this.hintElement.querySelectorAll("li").length&&"none"!==this.hintElement.style.display){var e=this.hintElement.querySelector(".vditor-hint--current");if("arrowdown"===t.key.toLowerCase())t.preventDefault(),t.stopPropagation(),e.nextElementSibling?e.nextElementSibling.className="vditor-hint--current":this.hintElement.children[0].className="vditor-hint--current",e.removeAttribute("class");else if("arrowup"===t.key.toLowerCase()){if(t.preventDefault(),t.stopPropagation(),e.previousElementSibling)e.previousElementSibling.className="vditor-hint--current";else{var n=this.hintElement.children.length;this.hintElement.children[n-1].className="vditor-hint--current"}e.removeAttribute("class")}else if("enter"===t.key.toLowerCase()){t.preventDefault(),t.stopPropagation(),this.hintElement.style.display="none";var o=e.getAttribute("data-value"),i=0===o.indexOf("@")?"@":":";this.editorElement.selectionStart=this.editorElement.value.substr(0,this.editorElement.selectionEnd).lastIndexOf(i),_(this.editorElement,o,"",!0)}}},t}(),M=function(){function t(t){this.element=document.createElement("div"),this.element.className="vditor-preview"+(t.options.classes.preview?" "+t.options.classes.preview:""),t.options.preview.show||(this.element.style.display="none"),"none"!==this.element.style.display&&this.render(t)}return t.prototype.render=function(t,e){var n=this;"none"!==this.element.style.display&&(e?this.element.innerHTML=e:""!==t.editor.element.value.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")?t.options.preview.url?(clearTimeout(t.mdTimeoutId),t.mdTimeoutId=setTimeout(function(){var e=new XMLHttpRequest;e.open("POST",t.options.preview.url),e.onreadystatechange=function(){if(e.readyState===XMLHttpRequest.DONE&&200===e.status){var o=JSON.parse(e.responseText);if(0!==o.code)return void alert(o.msg);n.element.innerHTML=o.data,t.options.preview.parse&&t.options.preview.parse(n.element)}},e.send(JSON.stringify({markdownText:t.editor.element.value}))},t.options.preview.delay)):this.element.innerHTML=t.editor.element.value:this.element.innerHTML="")},t}(),k=n(1),L=n.n(k),T=function(){function t(t){this.element=document.createElement("div"),this.element.className="vditor-resize",this.element.innerHTML=L.a,this.bindEvent(t)}return t.prototype.bindEvent=function(t){this.element.addEventListener("mousedown",function(e){var n=document,o=document.getElementById(t.id),i=e.clientY,r=o.offsetHeight;n.ondragstart=function(){return!1},n.onselectstart="return false;",n.onselect=function(){document.selection.empty()},window.captureEvents&&window.captureEvents(),n.onmousemove=function(e){"top"===t.options.resize.position?o.style.height=Math.max(100,r+(i-e.clientY))+"px":o.style.height=Math.max(100,r+(e.clientY-i))+"px"},n.onmouseup=function(){t.options.resize.after&&t.options.resize.after(o.offsetHeight-r),window.captureEvents&&window.captureEvents(),n.onmousemove=null,n.onmouseup=null,n.ondragstart=null,n.onselectstart=null,n.onselect=null}})},t}(),P=n(2),A=n.n(P),j=function(){function t(t,e){this.menuItem=e,this.editorElement=t.editor.element,this.element=document.createElement("div");var n=document.createElement("div");n.className="vditor-tooltipped vditor-tooltipped__"+e.tipPosition;var o=this.menuItem.hotkey?" <"+this.menuItem.hotkey+">":"";o=/Mac/.test(navigator.platform)?o.replace("ctrl","⌘"):o.replace("⌘","ctrl"),n.setAttribute("aria-label",this.menuItem.tip||g[t.options.lang][this.menuItem.name]+o),this.element.appendChild(n)}return t.prototype.bindEvent=function(){var t=this;this.element.children[0].addEventListener("click",function(){_(t.editorElement,t.menuItem.prefix||"",t.menuItem.suffix||"")})},t}(),z=(m=function(t,e){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}m(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),S=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||A.a,o.bindEvent(),o}return z(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),H=function(){return function(){this.element=document.createElement("div"),this.element.className="vditor-menu__br"}}(),N=n(3),C=n.n(N),B=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),F=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||C.a,o.bindEvent(),o}return B(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),D=n(4),I=n.n(D),R=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),q=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||I.a,o.bindEvent(),o}return R(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),U=function(){return function(){this.element=document.createElement("div"),this.element.className="vditor-menu__divider"}}(),V=n(5),W=n.n(V),J=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),K=function(t){function e(e,n){var o=t.call(this,e,n)||this;o.element.children[0].innerHTML=n.icon||W.a;var i=document.createElement("div");i.className="vditor-panel";var r="";Object.keys(e.options.hint.emoji).forEach(function(t){var n=e.options.hint.emoji[t];n.indexOf(".")>-1?r+='<span data-value=":'+t+': " title=":'+t+':"><img data-value=":'+t+': "\nsrc="'+n+'"/></span>':r+='<span data-value="'+n+' " title="'+t+'">'+n+"</span>"});var s=e.options.hint.emojiTail?'<div class="vditor-emojis__tail">'+e.options.hint.emojiTail+"</div>":"";return i.innerHTML='<div class="vditor-emojis">'+r+"</div>"+s,o.element.appendChild(i),o._bindEvent(i,e),o}return J(e,t),e.prototype._bindEvent=function(t,e){this.element.children[0].addEventListener("click",function(){"block"===t.style.display?t.style.display="none":(t.style.display="block",e.toolbar.elements.headings&&(e.toolbar.elements.headings.children[1].style.display="none"))}),t.querySelectorAll(".vditor-emojis span").forEach(function(n){n.addEventListener("click",function(n){_(e.editor.element,n.target.getAttribute("data-value"),"",!0),t.style.display="none"})})},e}(j),X=n(6),$=n.n(X),Y=n(0),G=n.n(Y),Q=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Z=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||G.a,o._bindEvent(e,n),o}return Q(e,t),e.prototype._bindEvent=function(t,e){this.element.children[0].addEventListener("click",function(){var n=document.getElementById(t.id);n.className.indexOf("vditor--fullscreen")>-1?(this.innerHTML=e.icon||G.a,n.className=n.className.replace(" vditor--fullscreen",""),Object.keys(t.toolbar.elements).forEach(function(e){var n=t.toolbar.elements[e].firstChild;n&&(n.className=n.className.replace("__s","__n"))})):(this.innerHTML=e.icon||$.a,n.className=n.className+" vditor--fullscreen",Object.keys(t.toolbar.elements).forEach(function(e){var n=t.toolbar.elements[e].firstChild;n&&(n.className=n.className.replace("__n","__s"))}))})},e}(j),tt=n(7),et=n.n(tt),nt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ot=function(t){function e(e,n){var o=t.call(this,e,n)||this;o.element.children[0].innerHTML=n.icon||et.a;var i=document.createElement("div");return i.className="vditor-panel",i.innerHTML='<h1 data-value="# ">Heading 1</h1>\n<h2 data-value="## ">Heading 2</h2>\n<h3 data-value="### ">Heading 3</h3>\n<h4 data-value="#### ">Heading 4</h4>\n<h5 data-value="##### ">Heading 5</h5>\n<h6 data-value="###### ">Heading 6</h6>',o.element.appendChild(i),o._bindEvent(i,e),o}return nt(e,t),e.prototype._bindEvent=function(t,e){this.element.children[0].addEventListener("click",function(){"block"===t.style.display?t.style.display="none":(t.style.display="block",e.toolbar.elements.emoji&&(e.toolbar.elements.emoji.children[1].style.display="none"))});for(var n=0;n<6;n++)t.children.item(n).addEventListener("click",function(n){_(e.editor.element,n.target.getAttribute("data-value"),""),t.style.display="none"})},e}(j),it=n(8),rt=n.n(it),st=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),lt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||rt.a,o.bindEvent(),o}return st(e,t),e.prototype.bindEvent=function(){this.element.children[0].addEventListener("click",function(){window.open("https://hacpai.com/guide/markdown")})},e}(j),at=n(9),ct=n.n(at),pt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ut=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||ct.a,o.bindEvent(),o}return pt(e,t),e.prototype.bindEvent=function(){this.element.children[0].addEventListener("click",function(){window.open("https://github.com/b3log/vditor")})},e}(j),dt=n(10),ht=n.n(dt),ft=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),vt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||ht.a,o.bindEvent(),o}return ft(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),mt=n(11),gt=n.n(mt),yt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),wt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||gt.a,o.bindEvent(),o}return yt(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),bt=n(12),_t=n.n(bt),Et=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),xt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||_t.a,o.bindEvent(),o}return Et(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),Ot=n(13),Mt=n.n(Ot),kt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Lt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Mt.a,o.bindEvent(),o}return kt(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),Tt=n(14),Pt=n.n(Tt),At=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),jt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Pt.a,o.bindEvent(),o}return At(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),zt=n(15),St=n.n(zt),Ht=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Nt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||St.a,o.bindEvent(),o}return Ht(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),Ct=n(16),Bt=n.n(Ct),Ft=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Dt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Bt.a,e.options.preview.show&&(o.element.children[0].className="vditor-tooltipped vditor-tooltipped__"+n.tipPosition+" vditor-menu--current"),o._bindEvent(e,n),o}return Ft(e,t),e.prototype._bindEvent=function(t,e){this.element.children[0].addEventListener("click",function(){var n,o=document.getElementById(t.id);"block"===t.preview.element.style.display?(t.preview.element.style.display="none",n="vditor-tooltipped vditor-tooltipped__"+e.tipPosition):(t.preview.element.style.display="block",n="vditor-tooltipped vditor-tooltipped__"+e.tipPosition+" vditor-menu--current",t.preview.render(t)),o.className.indexOf("vditor--fullscreen")>-1&&(n=n.replace("__n","__s")),this.className=n})},e}(j),It=n(17),Rt=n.n(It),qt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ut=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Rt.a,o.bindEvent(),o}return qt(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),Vt=n(18),Wt=n.n(Vt),Jt=function(){function t(t){var e;if(this.SAMPLE_RATE=5e3,this.isRecording=!1,this.readyFlag=!1,this.leftChannel=[],this.rightChannel=[],this.recordingLength=0,"undefined"!=typeof AudioContext)e=new AudioContext;else{if(!webkitAudioContext)return;e=new webkitAudioContext}this.DEFAULT_SAMPLE_RATE=e.sampleRate;var n=e.createGain();e.createMediaStreamSource(t).connect(n),this.recorder=e.createScriptProcessor(2048,2,1),this.recorder.onaudioprocess=null,n.connect(this.recorder),this.recorder.connect(e.destination),this.readyFlag=!0}return t.prototype.cloneChannelData=function(t,e){this.leftChannel.push(new Float32Array(t)),this.rightChannel.push(new Float32Array(e)),this.recordingLength+=2048},t.prototype.startRecordingNewWavFile=function(){this.readyFlag&&(this.isRecording=!0,this.leftChannel.length=this.rightChannel.length=0,this.recordingLength=0)},t.prototype.stopRecording=function(){this.isRecording=!1},t.prototype.buildWavFileBlob=function(){for(var t=this.mergeBuffers(this.leftChannel),e=this.mergeBuffers(this.rightChannel),n=new Float32Array(t.length),o=0;o<t.length;++o)n[o]=.5*(t[o]+e[o]);this.DEFAULT_SAMPLE_RATE>this.SAMPLE_RATE&&(n=this.downSampleBuffer(n,this.SAMPLE_RATE));var i=44+2*n.length,r=new ArrayBuffer(i),s=new DataView(r);this.writeUTFBytes(s,0,"RIFF"),s.setUint32(4,i,!0),this.writeUTFBytes(s,8,"WAVE"),this.writeUTFBytes(s,12,"fmt "),s.setUint32(16,16,!0),s.setUint16(20,1,!0),s.setUint16(22,1,!0),s.setUint32(24,this.SAMPLE_RATE,!0),s.setUint32(28,2*this.SAMPLE_RATE,!0),s.setUint16(32,2,!0),s.setUint16(34,16,!0);var l=2*n.length;this.writeUTFBytes(s,36,"data"),s.setUint32(40,l,!0);for(var a=n.length,c=44,p=0;p<a;p++)s.setInt16(c,32767*n[p],!0),c+=2;return new Blob([s],{type:"audio/wav"})},t.prototype.downSampleBuffer=function(t,e){if(e===this.DEFAULT_SAMPLE_RATE)return t;if(e>this.DEFAULT_SAMPLE_RATE)return t;for(var n=this.DEFAULT_SAMPLE_RATE/e,o=Math.round(t.length/n),i=new Float32Array(o),r=0,s=0;r<i.length;){for(var l=Math.round((r+1)*n),a=0,c=0,p=s;p<l&&p<t.length;p++)a+=t[p],c++;i[r]=a/c,r++,s=l}return i},t.prototype.mergeBuffers=function(t){for(var e=new Float32Array(this.recordingLength),n=0,o=t.length,i=0;i<o;++i){var r=t[i];e.set(r,n),n+=r.length}return e},t.prototype.writeUTFBytes=function(t,e,n){for(var o=n.length,i=0;i<o;i++)t.setUint8(e+i,n.charCodeAt(i))},t}(),Kt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Xt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Wt.a,o._bindEvent(e),o}return Kt(e,t),e.prototype._bindEvent=function(t){var e;this.element.children[0].addEventListener("click",function(){if(e)if(e.isRecording){e.stopRecording(),t.upload.element.className="vditor-upload";var n=new File([e.buildWavFileBlob()],"record"+(new Date).getTime()+".wav",{type:"video/webm"});w(t,[n])}else t.upload.element.children[0].innerHTML=g[t.options.lang].recording,t.upload.element.style.opacity="1",t.upload.element.className="vditor-upload vditor-upload--tip",t.editor.element.setAttribute("disabled","disabled"),e.startRecordingNewWavFile();else navigator.mediaDevices.getUserMedia({audio:!0}).then(function(n){(e=new Jt(n)).recorder.onaudioprocess=function(t){if(e.isRecording){var n=t.inputBuffer.getChannelData(0),o=t.inputBuffer.getChannelData(1);e.cloneChannelData(n,o)}},e.startRecordingNewWavFile(),t.upload.element.children[0].innerHTML=g[t.options.lang].recording,t.upload.element.style.opacity="1",t.upload.element.className="vditor-upload vditor-upload--tip",t.editor.element.setAttribute("disabled","disabled")}).catch(function(t){console.error("init media error:",t)})})},e}(j),$t=n(19),Yt=n.n($t),Gt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Qt=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||Yt.a,o.bindEvent(),o}return Gt(e,t),e.prototype.bindEvent=function(){this.element.children[0].addEventListener("click",function(){document.execCommand("redo")})},e}(j),Zt=n(20),te=n.n(Zt),ee=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ne=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||te.a,o.bindEvent(),o}return ee(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),oe=n(21),ie=n.n(oe),re=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),se=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||ie.a,o.bindEvent(),o}return re(e,t),e.prototype.bindEvent=function(){t.prototype.bindEvent.call(this)},e}(j),le=n(22),ae=n.n(le),ce=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),pe=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML=n.icon||ae.a,o.bindEvent(),o}return ce(e,t),e.prototype.bindEvent=function(){this.element.children[0].addEventListener("click",function(){document.execCommand("undo")})},e}(j),ue=n(23),de=n.n(ue),he=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),fe=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.element.children[0].innerHTML="<label>"+(n.icon||de.a)+'<input multiple="multiple" type="file"></label>',o._bindEvent(e),o}return he(e,t),e.prototype._bindEvent=function(t){this.element.querySelector("input").addEventListener("change",function(e){0!==e.target.files.length&&w(t,e.target.files,e.target)})},e}(j),ve=function(){return function(t){var e=this,n=t.options;this.elements={},n.toolbar.forEach(function(n,o){var i;switch(n.name){case"emoji":i=new K(t,n);break;case"bold":i=new S(t,n);break;case"headings":i=new ot(t,n);break;case"|":i=new U;break;case"br":i=new H;break;case"italic":i=new wt(t,n);break;case"strike":i=new ne(t,n);break;case"line":i=new xt(t,n);break;case"quote":i=new Ut(t,n);break;case"list":i=new jt(t,n);break;case"ordered-list":i=new Nt(t,n);break;case"check":i=new F(t,n);break;case"undo":i=new pe(t,n);break;case"redo":i=new Qt(t,n);break;case"code":i=new q(t,n);break;case"inline-code":i=new vt(t,n);break;case"link":i=new Lt(t,n);break;case"help":i=new lt(t,n);break;case"table":i=new se(t,n);break;case"preview":i=new Dt(t,n);break;case"fullscreen":i=new Z(t,n);break;case"upload":i=new fe(t,n);break;case"record":i=new Xt(t,n);break;case"info":i=new ut(t,n);break;default:console.error("menu item no matched")}var r=n.name;"br"!==r&&"|"!==r||(r+=o),e.elements[r]=i.element})}}(),me=function(){return function(t){var e=document.getElementById(t.id);e.className="vditor"+(e.className?" "+e.className:""),"number"==typeof t.options.height&&(e.style.height=t.options.height+"px"),"number"==typeof t.options.width?e.style.width=t.options.width+"px":e.style.width=t.options.width;var n=document.createElement("div");n.className="vditor-toolbar",Object.keys(t.toolbar.elements).forEach(function(e){n.appendChild(t.toolbar.elements[e])}),e.appendChild(n),t.options.resize.enable&&"top"===t.options.resize.position&&e.appendChild(t.resize.element);var o=document.createElement("div");o.className="vditor-content",o.appendChild(t.editor.element),t.preview&&o.appendChild(t.preview.element),t.options.counter>0&&o.appendChild(t.counter.element),t.upload&&o.appendChild(t.upload.element),e.appendChild(o),t.options.resize.enable&&"bottom"===t.options.resize.position&&e.appendChild(t.resize.element),document.onclick=function(t){var e=t.target.closest(".vditor-tooltipped");e&&e.nextSibling&&"vditor-panel"===e.nextSibling.className||(document.querySelectorAll(".vditor-hint").forEach(function(t){t.style.display="none"}),document.querySelectorAll(".vditor-panel").forEach(function(t){t.style.display="none"}))}}}(),ge=function(){function t(t){this.defaultOptions={cache:!0,classes:{preview:""},counter:0,height:"auto",hint:{delay:200,emoji:{"+1":"👍","-1":"👎",cold_sweat:"😰",heart:"❤️"},emojiPath:"https://vditor.b3log.org/images"},lang:"zh_CN",placeholder:"",preview:{delay:1e3,show:!1},resize:{enable:!1,position:"bottom"},toolbar:[{hotkey:"⌘-e",name:"emoji",tipPosition:"ne"},{hotkey:"⌘-h",name:"headings",tipPosition:"ne"},{hotkey:"⌘-b",name:"bold",prefix:"**",suffix:"**",tipPosition:"ne"},{hotkey:"⌘-i",name:"italic",prefix:"*",suffix:"*",tipPosition:"ne"},{hotkey:"⌘-s",name:"strike",prefix:"~~",suffix:"~~",tipPosition:"ne"},{name:"|"},{hotkey:"⌘-d",name:"line",prefix:"---\n",tipPosition:"n"},{hotkey:"⌘-.",name:"quote",prefix:"> ",tipPosition:"n"},{name:"|"},{hotkey:"⌘-l",name:"list",prefix:"* ",tipPosition:"n"},{hotkey:"⌘-o",name:"ordered-list",prefix:"1. ",tipPosition:"n"},{hotkey:"⌘-j",name:"check",prefix:"* [ ] ",tipPosition:"n"},{name:"|"},{hotkey:"⌘-u",name:"code",prefix:"```\n",suffix:"\n```",tipPosition:"n"},{hotkey:"⌘-g",name:"inline-code",prefix:"`",suffix:"`",tipPosition:"n"},{name:"|"},{hotkey:"⌘-z",name:"undo",tipPosition:"n"},{hotkey:"⌘-y",name:"redo",tipPosition:"n"},{name:"|"},{name:"upload",tipPosition:"n"},{hotkey:"⌘-k",name:"link",prefix:"[",suffix:"](https://)",tipPosition:"n"},{hotkey:"⌘-m",name:"table",prefix:"| col1",suffix:" | col2 | col3 |\n| --- | --- | --- |\n| | | |\n| | | |",tipPosition:"n"},{name:"record",tipPosition:"n"},{name:"|"},{hotkey:"⌘-p",name:"preview",tipPosition:"nw"},{hotkey:"⌘-f",name:"fullscreen",tipPosition:"nw"},{name:"info",tipPosition:"nw"},{name:"help",tipPosition:"nw"},{name:"br"}],upload:{filename:function(t){return t.replace(/\W/g,"")},linkToImgUrl:"",max:10485760,url:""},width:"auto"},this.options=t}return t.prototype.merge=function(){var t=this,e=[];this.options&&(this.options.toolbar&&this.options.toolbar.forEach(function(n){var o;t.defaultOptions.toolbar.forEach(function(t){"string"==typeof n&&t.name===n&&(o=t),"object"==typeof n&&t.name===n.name&&(o=Object.assign({},t,n))}),e.push(o)}),this.options.upload&&(this.options.upload=Object.assign({},this.defaultOptions.upload,this.options.upload)),this.options.classes&&(this.options.classes=Object.assign({},this.defaultOptions.classes,this.options.classes)),this.options.preview&&(this.options.preview=Object.assign({},this.defaultOptions.preview,this.options.preview)),this.options.hint&&(this.options.hint=Object.assign({},this.defaultOptions.hint,this.options.hint)),this.options.resize&&(this.options.resize=Object.assign({},this.defaultOptions.resize,this.options.resize)));var n=Object.assign({},this.defaultOptions,this.options);return e.length>0&&(n.toolbar=e),n},t}(),ye=function(){function t(t,e){this.version=o;var n=new ge(e).merge();if(this.vditor={id:t,mdTimeoutId:-1,options:n},n.counter>0){var r=new i(this.vditor);this.vditor.counter=r}var s=new b(this.vditor);if(this.vditor.editor=s,n.resize.enable){var l=new T(this.vditor);this.vditor.resize=l}if(n.toolbar){var a=new ve(this.vditor);this.vditor.toolbar=a}if(this.vditor.toolbar.elements.preview){var c=new M(this.vditor);this.vditor.preview=c}if(n.upload.url){var p=new y;this.vditor.upload=p}new me(this.vditor);if(this.vditor.options.hint.at||this.vditor.toolbar.elements.emoji){var u=new x(this.vditor);this.vditor.hint=u}new O(this.vditor)}return t.prototype.getValue=function(){return this.vditor.editor.element.value},t.prototype.insertValue=function(t){_(this.vditor.editor.element,t,"")},t.prototype.focus=function(){this.vditor.editor.element.focus()},t.prototype.blur=function(){this.vditor.editor.element.blur()},t.prototype.disabled=function(){this.vditor.editor.element.setAttribute("disabled","disabled")},t.prototype.enable=function(){this.vditor.editor.element.removeAttribute("disabled")},t.prototype.setSelection=function(t,e){this.vditor.editor.element.selectionStart=t,this.vditor.editor.element.selectionEnd=e,this.vditor.editor.element.focus()},t.prototype.getSelection=function(){return this.vditor.editor.element.value.substring(this.vditor.editor.element.selectionStart,this.vditor.editor.element.selectionEnd)},t.prototype.setValue=function(t){this.vditor.editor.element.selectionStart=0,this.vditor.editor.element.selectionEnd=this.vditor.editor.element.value.length,_(this.vditor.editor.element,t,"",!0),t||localStorage.removeItem("vditor"+this.vditor.id)},t.prototype.renderPreview=function(t){this.vditor.preview.render(this.vditor,t)},t.prototype.getCursorPosition=function(){return E(this.vditor.editor.element)},t.prototype.deleteValue=function(){_(this.vditor.editor.element,"","",!0)},t.prototype.updateValue=function(t){_(this.vditor.editor.element,t,"",!0)},t.prototype.isUploading=function(){return this.vditor.upload.isUploading},t.prototype.clearCache=function(){localStorage.removeItem("vditor"+this.vditor.id)},t.prototype.disabledCache=function(){this.vditor.options.cache=!1},t.prototype.enableCache=function(){this.vditor.options.cache=!0},t}();e.default=ye}]).default});

@@ -1,1 +0,1 @@

(window.webpackJsonpVditor=window.webpackJsonpVditor||[]).push([[2],{27:function(e,a,o){"use strict";o.r(a),o.d(a,"allEmoji",function(){return i});var r="https://vditor.b3log.org/images",i={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","8ball":"🎱",a:"🅰",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈",alarm_clock:"⏰",alien:"👽",ambulance:"🚑",anchor:"⚓",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒",aries:"♈",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",arrow_backward:"◀",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇",arrow_down_small:"🔽",arrow_forward:"▶",arrow_heading_down:"⤵",arrow_heading_up:"⤴",arrow_left:"⬅",arrow_lower_left:"↙",arrow_lower_right:"↘",arrow_right:"➡",arrow_right_hook:"↪",arrow_up:"⬆",arrow_upper_left:"↖",arrow_upper_right:"↗",arrow_up_down:"↕",arrow_up_small:"🔼",art:"🎨",articulated_lorry:"🚛",astonished:"😲",atm:"🏧",b:"🅱",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",baggage_claim:"🛄",balloon:"🎈",ballot_box_with_check:"☑",bamboo:"🎍",banana:"🍌",bangbang:"‼",bank:"🏦",barber:"💈",bar_chart:"📊",baseball:"⚾",basketball:"🏀",bath:"🛀",bathtub:"🛁",battery:"🔋",bear:"🐻",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bento:"🍱",bicyclist:"🚴",bike:"🚲",bikini:"👙",bird:"🐦",birthday:"🎂",black_circle:"⚫",black_joker:"🃏",black_large_square:"⬛",black_medium_small_square:"◾",black_medium_square:"◼",black_nib:"✒",black_small_square:"▪",black_square_button:"🔲",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bow:"🙇",bowling:"🎳",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",bus:"🚌",busstop:"🚏",busts_in_silhouette:"👥",bust_in_silhouette:"👤",c:r+"/c.png",cactus:"🌵",cake:"🍰",calendar:"📆",calling:"📲",camel:"🐫",camera:"📷",cancer:"🦀",candy:"🍬",capital_abcd:"🔠",capricorn:"♑",car:"🚗",card_index:"📇",carousel_horse:"🎠",cat:"🐱",cat2:"🐈",cd:"🇨🇩",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cl:"🇨🇱",clap:"👏",clapper:"🎬",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁",clubs:"♣",cn:"🇨🇳",cocktail:"🍸",coffee:"☕",cold_sweat:"😰",collision:"💥",computer:"💻",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗",construction:"🚧",construction_worker:"👷",convenience_store:"🏪",cookie:"🍪",cool:"🆒",cop:"👮",copyright:"©",corn:"🌽",couple:"👫",couplekiss:"💏",couple_with_heart:"💑",cow:"🐮",cow2:"🐄",credit_card:"💳",crescent_moon:"🌙",crocodile:"🐊",crossed_flags:"🎌",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",d:r+"/d.png",dancer:"💃",dancers:"👯",dango:"🍡",dart:"🎯",dash:"💨",date:"📅",de:"🇩🇪",deciduous_tree:"🌳",department_store:"🏬",diamonds:"♦",diamond_shape_with_a_dot_inside:"💠",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",do_not_litter:"🚯",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",droplet:"💧",dvd:"📀","e-mail":"📧",e50a:r+"/e50a.png",ear:"👂",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",ear_of_rice:"🌾",egg:"🥚",eggplant:"🍆",eight:"8⃣",eight_pointed_black_star:"✴",eight_spoked_asterisk:"✳",electric_plug:"🔌",elephant:"🐘",email:"✉",end:"🔚",envelope:"✉",es:"🇪🇸",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗",expressionless:"😑",eyeglasses:"👓",eyes:"👀",f:r+"/f.png",facepunch:"👊",factory:"🏭",fallen_leaf:"🍂",family:"👪",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",ferris_wheel:"🎡",file_folder:"📁",fire:"🔥",fireworks:"🎆",fire_engine:"🚒",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fishing_pole_and_fish:"🎣",fish_cake:"🍥",fist:"✊",five:"5⃣",flags:"🎏",flashlight:"🔦",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",foggy:"🌁",football:"🏈",fork_and_knife:"🍴",fountain:"⛲",four:"4⃣",four_leaf_clover:"🍀",fr:"🇫🇷",free:"🆓",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",fuelpump:"⛽",full_moon:"🌕",full_moon_with_face:"🌝",g:r+"/g.png",game_die:"🎲",gb:"🇬🇧",gem:"💎",gemini:"♊",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goat:"🐐",golf:"⛳",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guitar:"🎸",gun:"🔫",haircut:"💇",hamburger:"🍔",hammer:"🔨",hamster:"🐹",hand:"✋",handbag:"👜",hankey:"💩",hash:"#⃣",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",heart:"❤️",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",hear_no_evil:"🙉",heavy_check_mark:"✔",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_exclamation_mark:"❗",heavy_minus_sign:"➖",heavy_multiplication_x:"✖",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",honeybee:"🐝",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hotel:"🏨",hotsprings:"♨",hourglass:"⌛",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",hushed:"😯",i:r+"/i.png",icecream:"🍦",ice_cream:"🍨",id:"🇮🇩",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",information_desk_person:"💁",information_source:"ℹ",innocent:"😇",interrobang:"⁉",iphone:"📱",it:"🇮🇹",izakaya_lantern:"🏮",j:r+"/j.png",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",jp:"🇯🇵",k:r+"/k.png",key:"🔑",keycap_ten:"🔟",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",koala:"🐨",koko:"🈁",kr:"🇰🇷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",laughing:"😆",leaves:"🍃",ledger:"📒",leftwards_arrow_with_hook:"↩",left_luggage:"🛅",left_right_arrow:"↔",lemon:"🍋",leo:"♌",leopard:"🐆",libra:"♎",light_rail:"🚈",link:"🔗",lips:"👄",lipstick:"💄",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",m:"Ⓜ",mag:"🔍",mag_right:"🔎",mahjong:"🀄",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",mans_shoe:"👞",man_with_gua_pi_mao:"👲",man_with_turban:"👳",maple_leaf:"🍁",mask:"😷",massage:"💆",meat_on_bone:"🍖",mega:"📣",melon:"🍈",memo:"📝",mens:"🚹",metro:"🚇",microphone:"🎤",microscope:"🔬",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",moneybag:"💰",money_with_wings:"💸",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",mortar_board:"🎓",mountain_bicyclist:"🚵",mountain_cableway:"🚠",mountain_railway:"🚞",mount_fuji:"🗻",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",necktie:"👔",negative_squared_cross_mark:"❎",neutral_face:"😐",new:"🆕",newspaper:"📰",new_moon:"🌑",new_moon_with_face:"🌚",ng:"🇳🇬",nine:"9⃣","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔",no_entry_sign:"🚫",no_good:"🙅",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭",nut_and_bolt:"🔩",o:"⭕",o2:"🅾",ocean:"🌊",octocat:r+"/octocat.png",octopus:"🐙",oden:"🍢",office:"🏢",ok:"🆗",ok_hand:"👌",ok_woman:"🙆",older_man:"👴",older_woman:"👵",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",one:"1⃣",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",ophiuchus:"⛎",orange_book:"📙",outbox_tray:"📤",ox:"🐂",package:"📦",pager:"📟",page_facing_up:"📄",page_with_curl:"📃",palm_tree:"🌴",panda_face:"🐼",paperclip:"📎",parking:"🅿",partly_sunny:"⛅",part_alternation_mark:"〽",passport_control:"🛂",paw_prints:"🐾",peach:"🍑",pear:"🍐",pencil:"📝",pencil2:"✏",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_frowning:"🙍",person_with_blond_hair:"👱",person_with_pouting_face:"🙎",phone:"☎",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",pisces:"♓",pizza:"🍕",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝",point_up_2:"👆",police_car:"🚓",poodle:"🐩",poop:"💩",postal_horn:"📯",postbox:"📮",potable_water:"🚰",pouch:"👝",poultry_leg:"🍗",pound:"💷",pouting_cat:"😾",pray:"🙏",princess:"👸",punch:"👊",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",r:r+"/r.png",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",radio:"📻",radio_button:"🔘",rage:"😡",railway_car:"🚃",rainbow:"🌈",raised_hand:"✋",raised_hands:"🙌",raising_hand:"🙋",ram:"🐏",ramen:"🍜",rat:"🐀",recycle:"♻",red_car:"🚗",red_circle:"🔴",registered:"®",relaxed:"☺",relieved:"😌",repeat:"🔁",repeat_one:"🔂",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",ring:"💍",rocket:"🚀",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rotating_light:"🚨",round_pushpin:"📍",rowboat:"🚣",ru:"🇷🇺",rugby_football:"🏉",running:"🏃",running_shirt_with_sash:"🎽",sa:"🇸🇦",sagittarius:"♐",sailboat:"⛵",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"🛰",satisfied:"😆",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂",scorpius:"♏",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙",seedling:"🌱",see_no_evil:"🙈",seven:"7⃣",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",ship:"🚢",shirt:"👕",shoe:"👞",shower:"🚿",signal_strength:"📶",six:"6⃣",six_pointed_star:"🔯",ski:"🎿",skull:"💀",sleeping:"😴",sleepy:"😪",slot_machine:"🎰",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smiley:"😃",smiley_cat:"😺",smile_cat:"😸",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",snowboarder:"🏂",snowflake:"❄",snowman:"⛄",sob:"😭",soccer:"⚽",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠",spaghetti:"🍝",sparkle:"❇",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speaker:"🔈",speak_no_evil:"🙊",speech_balloon:"💬",speedboat:"🚤",squirrel:"🐿",star:"⭐",star2:"🌟",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",sunflower:"🌻",sunglasses:"😎",sunny:"☀",sunrise:"🌅",sunrise_over_mountains:"🌄",sun_with_face:"🌞",surfer:"🏄",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimmer:"🏊",symbols:"🔣",syringe:"💉",tada:"🎉",tanabata_tree:"🎋",tangerine:"🍊",taurus:"♉",taxi:"🚕",tea:"🍵",telephone:"☎",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"🏕",thought_balloon:"💭",three:"3⃣",thumbsdown:"👎",thumbsup:"👍",ticket:"🎫",tiger:"🐯",tiger2:"🐅",tired_face:"😫",tm:"🇹🇲",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trollface:r+"/trollface.png",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tshirt:"👕",tulip:"🌷",turtle:"🐢",tv:"🇹🇻",twisted_rightwards_arrows:"🔀",two:"2⃣",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u:r+"/u.png",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯",u6708:"🈷",u6709:"🈶",u6e80:"🈵",u7121:"🈚",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔",unamused:"😒",underage:"🔞",unicorn_face:"🦄",unlock:"🔓",up:"🆙",us:"🇺🇸",v:"✌",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍",volcano:"🌋",vs:"🆚",walking:"🚶",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠",watch:"⌚",watermelon:"🍉",water_buffalo:"🐃",wave:"👋",wavy_dash:"〰",waxing_crescent_moon:"🌒",waxing_gibbous_moon:"🌔",wc:"🚾",weary:"😩",wedding:"💒",whale:"🐳",whale2:"🐋",wheelchair:"♿",white_check_mark:"✅",white_circle:"⚪",white_flower:"💮",white_large_square:"⬜",white_medium_small_square:"◽",white_medium_square:"◻",white_small_square:"▫",white_square_button:"🔳",wind_chime:"🎐",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",womans_clothes:"👚",womans_hat:"👒",womens:"🚺",worried:"😟",wrench:"🔧",x:"❌",yellow_heart:"💛",yen:"💴",yum:"😋",zap:"⚡",zero:"0⃣",zzz:"💤"}}}]);
(window.webpackJsonpVditor=window.webpackJsonpVditor||[]).push([[2],{27:function(e,a,o){"use strict";o.r(a),o.d(a,"getAllEmoji",function(){return r});var r=function(e){return{"+1":"👍","-1":"👎",100:"💯",1234:"🔢","8ball":"🎱",a:"🅰",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈",alarm_clock:"⏰",alien:"👽",ambulance:"🚑",anchor:"⚓",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒",aries:"♈",arrow_backward:"◀",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇",arrow_down_small:"🔽",arrow_forward:"▶",arrow_heading_down:"⤵",arrow_heading_up:"⤴",arrow_left:"⬅",arrow_lower_left:"↙",arrow_lower_right:"↘",arrow_right:"➡",arrow_right_hook:"↪",arrow_up:"⬆",arrow_up_down:"↕",arrow_up_small:"🔼",arrow_upper_left:"↖",arrow_upper_right:"↗",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",astonished:"😲",atm:"🏧",b:"🅱",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",baggage_claim:"🛄",balloon:"🎈",ballot_box_with_check:"☑",bamboo:"🎍",banana:"🍌",bangbang:"‼",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾",basketball:"🏀",bath:"🛀",bathtub:"🛁",battery:"🔋",bear:"🐻",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bento:"🍱",bicyclist:"🚴",bike:"🚲",bikini:"👙",bird:"🐦",birthday:"🎂",black_circle:"⚫",black_joker:"🃏",black_large_square:"⬛",black_medium_small_square:"◾",black_medium_square:"◼",black_nib:"✒",black_small_square:"▪",black_square_button:"🔲",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bow:"🙇",bowling:"🎳",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",bus:"🚌",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",c:e+"/c.png",cactus:"🌵",cake:"🍰",calendar:"📆",calling:"📲",camel:"🐫",camera:"📷",cancer:"🦀",candy:"🍬",capital_abcd:"🔠",capricorn:"♑",car:"🚗",card_index:"📇",carousel_horse:"🎠",cat:"🐱",cat2:"🐈",cd:"🇨🇩",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cl:"🇨🇱",clap:"👏",clapper:"🎬",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁",clubs:"♣",cn:"🇨🇳",cocktail:"🍸",coffee:"☕",cold_sweat:"😰",collision:"💥",computer:"💻",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗",construction:"🚧",construction_worker:"👷",convenience_store:"🏪",cookie:"🍪",cool:"🆒",cop:"👮",copyright:"©",corn:"🌽",couple:"👫",couple_with_heart:"💑",couplekiss:"💏",cow:"🐮",cow2:"🐄",credit_card:"💳",crescent_moon:"🌙",crocodile:"🐊",crossed_flags:"🎌",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",d:e+"/d.png",dancer:"💃",dancers:"👯",dango:"🍡",dart:"🎯",dash:"💨",date:"📅",de:"🇩🇪",deciduous_tree:"🌳",department_store:"🏬",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",droplet:"💧",dvd:"📀","e-mail":"📧",e50a:e+"/e50a.png",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight:"8⃣",eight_pointed_black_star:"✴",eight_spoked_asterisk:"✳",electric_plug:"🔌",elephant:"🐘",email:"✉",end:"🔚",envelope:"✉",es:"🇪🇸",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗",expressionless:"😑",eyeglasses:"👓",eyes:"👀",f:e+"/f.png",facepunch:"👊",factory:"🏭",fallen_leaf:"🍂",family:"👪",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",ferris_wheel:"🎡",file_folder:"📁",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist:"✊",five:"5⃣",flags:"🎏",flashlight:"🔦",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",foggy:"🌁",football:"🏈",fork_and_knife:"🍴",fountain:"⛲",four:"4⃣",four_leaf_clover:"🍀",fr:"🇫🇷",free:"🆓",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",fuelpump:"⛽",full_moon:"🌕",full_moon_with_face:"🌝",g:e+"/g.png",game_die:"🎲",gb:"🇬🇧",gem:"💎",gemini:"♊",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goat:"🐐",golf:"⛳",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guitar:"🎸",gun:"🔫",haircut:"💇",hamburger:"🍔",hammer:"🔨",hamster:"🐹",hand:"✋",handbag:"👜",hankey:"💩",hash:"#⃣",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_exclamation_mark:"❗",heavy_minus_sign:"➖",heavy_multiplication_x:"✖",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",honey_pot:"🍯",honeybee:"🐝",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hotel:"🏨",hotsprings:"♨",hourglass:"⌛",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",huaji:e+"/huaji.gif",hushed:"😯",i:e+"/i.png",ice_cream:"🍨",icecream:"🍦",id:"🇮🇩",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",information_desk_person:"💁",information_source:"ℹ",innocent:"😇",interrobang:"⁉",iphone:"📱",it:"🇮🇹",izakaya_lantern:"🏮",j:e+"/j.png",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",jp:"🇯🇵",k:e+"/k.png",key:"🔑",keycap_ten:"🔟",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",koala:"🐨",koko:"🈁",kr:"🇰🇷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔",leftwards_arrow_with_hook:"↩",lemon:"🍋",leo:"♌",leopard:"🐆",libra:"♎",light_rail:"🚈",link:"🔗",lips:"👄",lipstick:"💄",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",m:"Ⓜ",mag:"🔍",mag_right:"🔎",mahjong:"🀄",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_with_gua_pi_mao:"👲",man_with_turban:"👳",mans_shoe:"👞",maple_leaf:"🍁",mask:"😷",massage:"💆",meat_on_bone:"🍖",mega:"📣",melon:"🍈",memo:"📝",mens:"🚹",metro:"🚇",microphone:"🎤",microscope:"🔬",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",mortar_board:"🎓",mount_fuji:"🗻",mountain_bicyclist:"🚵",mountain_cableway:"🚠",mountain_railway:"🚞",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",necktie:"👔",negative_squared_cross_mark:"❎",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",ng:"🇳🇬",nine:"9⃣",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔",no_entry_sign:"🚫",no_good:"🙅",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕",o2:"🅾",ocean:"🌊",octocat:e+"/octocat.png",octopus:"🐙",oden:"🍢",office:"🏢",ok:"🆗",ok_hand:"👌",ok_woman:"🙆",older_man:"👴",older_woman:"👵",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",one:"1⃣",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",ophiuchus:"⛎",orange_book:"📙",outbox_tray:"📤",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",palm_tree:"🌴",panda_face:"🐼",paperclip:"📎",parking:"🅿",part_alternation_mark:"〽",partly_sunny:"⛅",passport_control:"🛂",paw_prints:"🐾",peach:"🍑",pear:"🍐",pencil:"📝",pencil2:"✏",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_frowning:"🙍",person_with_blond_hair:"👱",person_with_pouting_face:"🙎",phone:"☎",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",pisces:"♓",pizza:"🍕",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝",point_up_2:"👆",police_car:"🚓",poodle:"🐩",poop:"💩",postal_horn:"📯",postbox:"📮",potable_water:"🚰",pouch:"👝",poultry_leg:"🍗",pound:"💷",pouting_cat:"😾",pray:"🙏",princess:"👸",punch:"👊",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",r:e+"/r.png",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",radio:"📻",radio_button:"🔘",rage:"😡",railway_car:"🚃",rainbow:"🌈",raised_hand:"✋",raised_hands:"🙌",raising_hand:"🙋",ram:"🐏",ramen:"🍜",rat:"🐀",recycle:"♻",red_car:"🚗",red_circle:"🔴",registered:"®",relaxed:"☺",relieved:"😌",repeat:"🔁",repeat_one:"🔂",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",ring:"💍",rocket:"🚀",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rotating_light:"🚨",round_pushpin:"📍",rowboat:"🚣",ru:"🇷🇺",rugby_football:"🏉",running:"🏃",running_shirt_with_sash:"🎽",sa:"🇸🇦",sagittarius:"♐",sailboat:"⛵",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"🛰",satisfied:"😆",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂",scorpius:"♏",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙",see_no_evil:"🙈",seedling:"🌱",seven:"7⃣",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",ship:"🚢",shirt:"👕",shoe:"👞",shower:"🚿",signal_strength:"📶",six:"6⃣",six_pointed_star:"🔯",ski:"🎿",skull:"💀",sleeping:"😴",sleepy:"😪",slot_machine:"🎰",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",snowboarder:"🏂",snowflake:"❄",snowman:"⛄",sob:"😭",soccer:"⚽",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠",spaghetti:"🍝",sparkle:"❇",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speech_balloon:"💬",speedboat:"🚤",squirrel:"🐿",star:"⭐",star2:"🌟",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀",sunrise:"🌅",sunrise_over_mountains:"🌄",surfer:"🏄",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimmer:"🏊",symbols:"🔣",syringe:"💉",tada:"🎉",tanabata_tree:"🎋",tangerine:"🍊",taurus:"♉",taxi:"🚕",tea:"🍵",telephone:"☎",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"🏕",thought_balloon:"💭",three:"3⃣",thumbsdown:"👎",thumbsup:"👍",ticket:"🎫",tiger:"🐯",tiger2:"🐅",tired_face:"😫",tm:"🇹🇲",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trollface:e+"/trollface.png",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tshirt:"👕",tulip:"🌷",turtle:"🐢",tv:"🇹🇻",twisted_rightwards_arrows:"🔀",two:"2⃣",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u:e+"/u.png",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯",u6708:"🈷",u6709:"🈶",u6e80:"🈵",u7121:"🈚",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔",unamused:"😒",underage:"🔞",unicorn_face:"🦄",unlock:"🔓",up:"🆙",us:"🇺🇸",v:"✌",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍",volcano:"🌋",vs:"🆚",walking:"🚶",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠",watch:"⌚",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰",waxing_crescent_moon:"🌒",waxing_gibbous_moon:"🌔",wc:"🚾",weary:"😩",wedding:"💒",whale:"🐳",whale2:"🐋",wheelchair:"♿",white_check_mark:"✅",white_circle:"⚪",white_flower:"💮",white_large_square:"⬜",white_medium_small_square:"◽",white_medium_square:"◻",white_small_square:"▫",white_square_button:"🔳",wind_chime:"🎐",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",womans_clothes:"👚",womans_hat:"👒",womens:"🚺",worried:"😟",wrench:"🔧",x:"❌",yellow_heart:"💛",yen:"💴",yum:"😋",zap:"⚡",zero:"0⃣",zzz:"💤"}}}}]);
{
"name": "vditor",
"version": "0.1.8",
"version": "0.2.0",
"description": "A markdown editor written in TypeScript",

@@ -33,2 +33,3 @@ "author": " Vanessa <v@b3log.org> (http://vanessa.b3log.org)",

"ts-loader": "^5.3.3",
"tslint": "^5.12.1",
"typescript": "^3.2.4",

@@ -50,5 +51,6 @@ "webpack": "^4.29.0",

"build": "webpack",
"dev": "webpack --config webpack.demo.js",
"lint": "tslint --fix -c tslint.json 'src/**/*.ts'",
"dev": "webpack --config webpack.dev.js",
"start": "webpack-dev-server --config webpack.start.js",
"release": "npm run build && cp -r dist deploy/0.1.8"
"release": "npm run build && cp -r dist deploy/0.2.0"
},

@@ -55,0 +57,0 @@ "keywords": [

@@ -8,2 +8,3 @@ <p align="center">

<a title="Code Size" target="_blank" href="https://github.com/b3log/vditor"><img src="https://img.shields.io/github/languages/code-size/b3log/vditor.svg?style=flat-square"></a>
<a title="Dependencies" target="_blank" href="https://github.com/b3log/vditor"><img src="https://img.shields.io/david/b3log/vditor.svg?style=flat-square"></a>
<a title="Version" target="_blank" href="https://www.npmjs.com/package/vditor"><img src="https://img.shields.io/npm/v/vditor.svg?style=flat-square"></a>

@@ -20,3 +21,3 @@ <a title="Downloads" target="_blank" href="https://www.npmjs.com/package/vditor"><img src="https://img.shields.io/npm/dt/vditor.svg?style=flat-square"></a>

<details>
<summary>有点啰嗦。</summary>
<summary>太长不看。</summary>
<br>

@@ -72,3 +73,3 @@

* [讨论区](https://hacpai.com/tag/vditor)
* [报告问题](https://github.com/b3log/viditor/issues/new/choose)
* [报告问题](https://github.com/b3log/vditor/issues/new/choose)

@@ -79,2 +80,2 @@ ## 鸣谢

* [TypeScript](https://github.com/Microsoft/TypeScript):类型化的 JavaScript 超集
* [Turndown](https://github.com/domchristie/turndown):HTML 到 Markdown 的转换器
* [Turndown](https://github.com/domchristie/turndown):HTML 到 Markdown 的转换器
import {VDITOR_VERSION} from "./ts/constants";
import {Toolbar} from "./ts/toolbar/index";
import {OptionsClass} from "./ts/util/OptionsClass";
import {Ui} from "./ts/ui/index";
import {Counter} from "./ts/counter/index";
import {Editor, insertText} from "./ts/editor/index";
import {Hint} from "./ts/hint/index";
import {Hotkey} from "./ts/hotkey/index";
import {Preview} from "./ts/preview/index";
import {Counter} from "./ts/counter/index";
import {Resize} from "./ts/resize/index";
import {Hint} from "./ts/hint/index";
import {Toolbar} from "./ts/toolbar/index";
import {Ui} from "./ts/ui/index";
import {Upload} from "./ts/upload/index";
import {Options} from "./ts/util/Options";
import {getTextareaPosition} from "./ts/util/textareaPosition";
import {UploadClass} from "./ts/upload/index";
class VditorClass {
readonly version: string;
vditor: any
class Vditor {
public readonly version: string;
public vditor: IVditor;
constructor(id: string, options?: Options) {
constructor(id: string, options?: IOptions) {
this.version = VDITOR_VERSION;
const getOptions = new OptionsClass(options)
const mergedOptions = getOptions.merge()
const getOptions = new Options(options);
const mergedOptions = getOptions.merge();
this.vditor = {
id,
mdTimeoutId: -1,
options: mergedOptions,
mdTimeoutId: -1
}
};
if (mergedOptions.counter > 0) {
const counter = new Counter(this.vditor)
this.vditor.counter = counter
const counter = new Counter(this.vditor);
this.vditor.counter = counter;
}
const editor = new Editor(this.vditor)
this.vditor.editor = editor
const editor = new Editor(this.vditor);
this.vditor.editor = editor;
if (mergedOptions.resize.enable) {
const resize = new Resize(this.vditor)
this.vditor.resize = resize
const resize = new Resize(this.vditor);
this.vditor.resize = resize;
}
const toolbar = new Toolbar(this.vditor)
this.vditor.toolbar = toolbar
if (mergedOptions.toolbar) {
const toolbar: Toolbar = new Toolbar(this.vditor);
this.vditor.toolbar = toolbar;
}
if (toolbar.elements.preview) {
const preview = new Preview(this.vditor)
this.vditor.preview = preview
if (this.vditor.toolbar.elements.preview) {
const preview = new Preview(this.vditor);
this.vditor.preview = preview;
}
if (mergedOptions.upload.url) {
const upload = new UploadClass()
this.vditor.upload = upload
const upload = new Upload();
this.vditor.upload = upload;
}
new Ui(this.vditor)
const ui = new Ui(this.vditor);
if (this.vditor.options.atUser || this.vditor.toolbar.elements.emoji) {
const hint = new Hint(this.vditor)
this.vditor.hint = hint
if (this.vditor.options.hint.at || this.vditor.toolbar.elements.emoji) {
const hint = new Hint(this.vditor);
this.vditor.hint = hint;
}
new Hotkey(this.vditor)
const hotkey = new Hotkey(this.vditor);
}
getValue() {
return this.vditor.editor.element.value
public getValue() {
return this.vditor.editor.element.value;
}
insertValue(value: string) {
insertText(this.vditor.editor.element, value, '')
public insertValue(value: string) {
insertText(this.vditor.editor.element, value, "");
}
focus() {
this.vditor.editor.element.focus()
public focus() {
this.vditor.editor.element.focus();
}
blur() {
this.vditor.editor.element.blur()
public blur() {
this.vditor.editor.element.blur();
}
disabled() {
this.vditor.editor.element.setAttribute('disabled', 'disabled')
public disabled() {
this.vditor.editor.element.setAttribute("disabled", "disabled");
}
enable() {
this.vditor.editor.element.removeAttribute('disabled')
public enable() {
this.vditor.editor.element.removeAttribute("disabled");
}
setSelection(start: number, end: number) {
this.vditor.editor.element.selectionStart = start
this.vditor.editor.element.selectionEnd = end
this.vditor.editor.element.focus()
public setSelection(start: number, end: number) {
this.vditor.editor.element.selectionStart = start;
this.vditor.editor.element.selectionEnd = end;
this.vditor.editor.element.focus();
}
getSelection() {
return this.vditor.editor.element.value.substring(this.vditor.editor.element.selectionStart, this.vditor.editor.element.selectionEnd)
public getSelection() {
return this.vditor.editor.element.value.substring(this.vditor.editor.element.selectionStart,
this.vditor.editor.element.selectionEnd);
}
setValue(value: string) {
this.vditor.editor.element.selectionStart = 0
this.vditor.editor.element.selectionEnd = this.vditor.editor.element.value.length
insertText(this.vditor.editor.element, value, '', true)
public setValue(value: string) {
this.vditor.editor.element.selectionStart = 0;
this.vditor.editor.element.selectionEnd = this.vditor.editor.element.value.length;
insertText(this.vditor.editor.element, value, "", true);
if (!value) {
localStorage.removeItem('vditor' + this.vditor.id)
localStorage.removeItem("vditor" + this.vditor.id);
}
}
renderPreview(value?: string) {
this.vditor.preview.render(this.vditor, value)
public renderPreview(value?: string) {
this.vditor.preview.render(this.vditor, value);
}
getCursorPosition() {
return getTextareaPosition(this.vditor.editor.element)
public getCursorPosition() {
return getTextareaPosition(this.vditor.editor.element);
}
deleteValue() {
insertText(this.vditor.editor.element, '', '', true)
public deleteValue() {
insertText(this.vditor.editor.element, "", "", true);
}
updateValue(value: string) {
insertText(this.vditor.editor.element, value, '', true)
public updateValue(value: string) {
insertText(this.vditor.editor.element, value, "", true);
}
isUploading() {
return this.vditor.upload.isUploading
public isUploading() {
return this.vditor.upload.isUploading;
}
clearCache() {
localStorage.removeItem('vditor' + this.vditor.id)
public clearCache() {
localStorage.removeItem("vditor" + this.vditor.id);
}
disabledCache() {
this.vditor.options.cache = false
public disabledCache() {
this.vditor.options.cache = false;
}
enableCache() {
this.vditor.options.cache = true
public enableCache() {
this.vditor.options.cache = true;
}
}
export default VditorClass
export default Vditor;

@@ -5,2 +5,2 @@ declare const VDITOR_VERSION: string;

export {_VDITOR_VERSION as VDITOR_VERSION};
export {_VDITOR_VERSION as VDITOR_VERSION};
export class Counter {
element: HTMLElement
public element: HTMLElement;
constructor(vditor: Vditor) {
this.element = document.createElement('div')
this.element.className = 'vditor-counter'
constructor(vditor: IVditor) {
this.element = document.createElement("div");
this.element.className = "vditor-counter";
this.render(0, vditor.options.counter)
this.render(0, vditor.options.counter);
}
render(length: number, counter: number) {
public render(length: number, counter: number) {
if (length > counter) {
this.element.className = 'vditor-counter vditor-counter--error'
this.element.className = "vditor-counter vditor-counter--error";
} else {
this.element.className = 'vditor-counter'
this.element.className = "vditor-counter";
}
this.element.innerHTML = `${length}/${counter}`
this.element.innerHTML = `${length}/${counter}`;
}
}
}

@@ -1,86 +0,88 @@

import {gfm} from 'turndown-plugin-gfm/lib/turndown-plugin-gfm.es.js'
import {commandable} from '../util/commandable'
import {gfm} from "turndown-plugin-gfm/lib/turndown-plugin-gfm.es.js";
import {uploadFiles} from "../upload/index";
import {commandable} from "../util/commandable";
class Editor {
element: HTMLTextAreaElement
public element: HTMLTextAreaElement;
constructor(vditor: Vditor) {
this.element = document.createElement('textarea')
this.element.className = 'vditor-textarea'
this.element.setAttribute('placeholder', vditor.options.placeholder)
constructor(vditor: IVditor) {
this.element = document.createElement("textarea");
this.element.className = "vditor-textarea";
this.element.setAttribute("placeholder", vditor.options.placeholder);
if (vditor.options.cache) {
this.element.value = localStorage.getItem('vditor' + vditor.id)
this.element.value = localStorage.getItem("vditor" + vditor.id);
if (vditor.options.counter > 0) {
vditor.counter.render(this.element.value.length, vditor.options.counter)
vditor.counter.render(this.element.value.length, vditor.options.counter);
}
}
this.bindEvent(vditor)
this.bindEvent(vditor);
}
private html2md(TurndownService: any, vditor: Vditor, textHTML: string, textPlain: string) {
let onlyMultiCode = false
private html2md(TurndownService: ITurndown, vditor: IVditor, textHTML: string, textPlain: string) {
let onlyMultiCode = false;
// no escape
TurndownService.prototype.escape = (string: string) => {
return string
}
TurndownService.prototype.escape = (name: string) => {
return name;
};
const turndownService = new TurndownService()
const turndownService = new TurndownService();
turndownService.addRule('strikethrough', {
filter: ['pre', 'code'],
turndownService.addRule("strikethrough", {
filter: ["pre", "code"],
replacement: (content: string, node: HTMLElement) => {
if (node.parentElement.tagName === 'PRE') {
return content
if (node.parentElement.tagName === "PRE") {
return content;
}
if (content.split('\n').length > 1) {
onlyMultiCode = true
return '```\n' + content + '\n```'
if (content.split("\n").length > 1) {
onlyMultiCode = true;
return "```\n" + content + "\n```";
}
return '`' + content + '`'
return "`" + content + "`";
},
})
turndownService.addRule('strikethrough', {
filter: ['img'],
});
turndownService.addRule("strikethrough", {
filter: ["img"],
replacement: (content: string, target: HTMLElement) => {
if (!target.getAttribute('src')) {
return ''
if (!target.getAttribute("src")) {
return "";
}
if (vditor.options.upload.linkToImgUrl) {
const xhr = new XMLHttpRequest()
xhr.open('POST', vditor.options.upload.linkToImgUrl)
const xhr = new XMLHttpRequest();
xhr.open("POST", vditor.options.upload.linkToImgUrl);
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
const responseJSON = JSON.parse(xhr.responseText)
const responseJSON = JSON.parse(xhr.responseText);
if (responseJSON.code !== 0) {
alert(responseJSON.msg)
return
alert(responseJSON.msg);
return;
}
const original = target.getAttribute('src')
vditor.editor.element.selectionStart = vditor.editor.element.value.split(original)[0].length
vditor.editor.element.selectionEnd = vditor.editor.element.selectionStart + original.length
insertText(vditor.editor.element, responseJSON.data.url, '', true)
const original = target.getAttribute("src");
vditor.editor.element.selectionStart =
vditor.editor.element.value.split(original)[0].length;
vditor.editor.element.selectionEnd =
vditor.editor.element.selectionStart + original.length;
insertText(vditor.editor.element, responseJSON.data.url, "", true);
}
}
}
xhr.send(JSON.stringify({url: target.getAttribute('src')}))
};
xhr.send(JSON.stringify({url: target.getAttribute("src")}));
}
return `![${target.getAttribute('alt')}](${target.getAttribute('src')})`
return `![${target.getAttribute("alt")}](${target.getAttribute("src")})`;
},
})
});
turndownService.use(gfm)
turndownService.use(gfm);
let markdownStr = turndownService.turndown(textHTML)
const markdownStr = turndownService.turndown(textHTML);
if (onlyMultiCode) {
const tempElement = document.createElement('div')
tempElement.innerHTML = textHTML
if (tempElement.querySelectorAll('pre').length > 1) {
onlyMultiCode = false
} else if (markdownStr.substr(0, 3) !== '```' ||
markdownStr.substr(markdownStr.length - 3, 3) !== '```') {
onlyMultiCode = false
const tempElement = document.createElement("div");
tempElement.innerHTML = textHTML;
if (tempElement.querySelectorAll("pre").length > 1) {
onlyMultiCode = false;
} else if (markdownStr.substr(0, 3) !== "```" ||
markdownStr.substr(markdownStr.length - 3, 3) !== "```") {
onlyMultiCode = false;
}

@@ -90,44 +92,51 @@ }

insertText(vditor.editor.element,
'```\n' + textPlain + '\n```',
'', true)
"```\n" + textPlain + "\n```",
"", true);
} else {
insertText(vditor.editor.element, markdownStr, '', true)
insertText(vditor.editor.element, markdownStr, "", true);
}
}
private bindEvent(vditor: Vditor) {
this.element.addEventListener('input', () => {
private bindEvent(vditor: IVditor) {
this.element.addEventListener("input", () => {
if (vditor.options.counter > 0) {
vditor.counter.render(this.element.value.length, vditor.options.counter)
vditor.counter.render(this.element.value.length, vditor.options.counter);
}
vditor.options.input && vditor.options.input(this.element.value, vditor.preview && vditor.preview.element)
if (typeof vditor.options.input === "function") {
vditor.options.input(this.element.value, vditor.preview && vditor.preview.element);
}
vditor.hint && vditor.hint.render()
if (vditor.hint) {
vditor.hint.render();
}
if (vditor.options.cache) {
localStorage.setItem(`vditor${vditor.id}`, vditor.editor.element.value)
localStorage.setItem(`vditor${vditor.id}`, vditor.editor.element.value);
}
vditor.preview && vditor.preview.render(vditor)
})
if (vditor.preview) {
vditor.preview.render(vditor);
}
});
this.element.addEventListener('focus', () => {
this.element.addEventListener("focus", () => {
if (vditor.options.focus) {
vditor.options.focus(this.element.value)
vditor.options.focus(this.element.value);
}
if (vditor.toolbar.elements.emoji && vditor.toolbar.elements.emoji.children[1]) {
vditor.toolbar.elements.emoji.children[1].style.display = 'none'
const emojiPanel = vditor.toolbar.elements.emoji.children[1] as HTMLElement;
emojiPanel.style.display = "none";
}
if (vditor.toolbar.elements.headings && vditor.toolbar.elements.headings.children[1]) {
vditor.toolbar.elements.headings.children[1].style.display = 'none'
const headingsPanel = vditor.toolbar.elements.headings.children[1] as HTMLElement;
headingsPanel.style.display = "none";
}
})
});
this.element.addEventListener('blur', () => {
this.element.addEventListener("blur", () => {
if (vditor.options.blur) {
vditor.options.blur(this.element.value)
vditor.options.blur(this.element.value);
}
})
});

@@ -137,79 +146,79 @@ if (vditor.options.select) {

vditor.options.select(this.element.value.substring(
this.element.selectionStart, this.element.selectionEnd))
}
this.element.selectionStart, this.element.selectionEnd));
};
}
this.element.addEventListener('scroll', () => {
if (vditor.preview.element.style.display === 'none' && !vditor.preview) {
return
this.element.addEventListener("scroll", () => {
if (vditor.preview.element.style.display === "none" && !vditor.preview) {
return;
}
const textScrollTop = this.element.scrollTop
const textHeight = this.element.clientHeight
const textScrollHeight = this.element.scrollHeight
const preview = vditor.preview.element
const textScrollTop = this.element.scrollTop;
const textHeight = this.element.clientHeight;
const textScrollHeight = this.element.scrollHeight;
const preview = vditor.preview.element;
if ((textScrollTop / textHeight > 0.5)) {
preview.scrollTop = (textScrollTop + textHeight) *
preview.scrollHeight / textScrollHeight - textHeight
preview.scrollHeight / textScrollHeight - textHeight;
} else {
preview.scrollTop = textScrollTop *
preview.scrollHeight / textScrollHeight
preview.scrollHeight / textScrollHeight;
}
})
});
if (vditor.options.upload.url) {
this.element.addEventListener('drop', (event: any) => {
event.stopPropagation()
event.preventDefault()
this.element.addEventListener("drop", (event: CustomEvent & { dataTransfer?: DataTransfer }) => {
event.stopPropagation();
event.preventDefault();
const files = event.dataTransfer.items
const files = event.dataTransfer.items;
if (files.length === 0) {
return
return;
}
uploadFiles(vditor, files)
})
uploadFiles(vditor, files);
});
}
let TurndownService: any
const html2md = this.html2md
this.element.addEventListener('paste', (event: any) => {
event.stopPropagation()
event.preventDefault()
if (event.clipboardData.getData('text/html').replace(/(^\s*)|(\s*)$/g, '') !== '') {
const textHTML = event.clipboardData.getData('text/html')
const textPlain = event.clipboardData.getData('text/plain')
let TurndownService: ITurndown;
const html2md = this.html2md;
this.element.addEventListener("paste", (event: Event) => {
event.stopPropagation();
event.preventDefault();
const clipboardEvent: ClipboardEvent = event as ClipboardEvent;
if (clipboardEvent.clipboardData.getData("text/html").replace(/(^\s*)|(\s*)$/g, "") !== "") {
const textHTML = clipboardEvent.clipboardData.getData("text/html");
const textPlain = clipboardEvent.clipboardData.getData("text/plain");
if (!TurndownService) {
import(/* webpackChunkName: "vditor" */ 'turndown').then(turndown => {
TurndownService = turndown.default
html2md(TurndownService, vditor, textHTML, textPlain)
}).catch(err => {
console.log('Failed to load turndown', err);
import(/* webpackChunkName: "vditor" */ "turndown").then((turndown) => {
TurndownService = turndown.default;
html2md(TurndownService, vditor, textHTML, textPlain);
}).catch((err) => {
console.error("Failed to load turndown", err);
});
return
return;
}
html2md(TurndownService, vditor, textHTML, textPlain)
html2md(TurndownService, vditor, textHTML, textPlain);
} else if (event.clipboardData.getData('text/plain').replace(/(^\s*)|(\s*)$/g, '') !== '' &&
event.clipboardData.files.length === 0) {
insertText(event.target,
event.clipboardData.getData('text/plain'), '', true)
} else if (event.clipboardData.files.length > 0) {
} else if (clipboardEvent.clipboardData.getData("text/plain").replace(/(^\s*)|(\s*)$/g, "") !== "" &&
clipboardEvent.clipboardData.files.length === 0) {
insertText(event.target as HTMLTextAreaElement,
clipboardEvent.clipboardData.getData("text/plain"), "", true);
} else if (clipboardEvent.clipboardData.files.length > 0) {
// upload file
if (!vditor.options.upload.url) {
return
return;
}
// NOTE: not work in Safari. maybe the browser considered local filesystem as the same domain as the pasted data
uploadFiles(vditor, event.clipboardData.files)
// NOTE: not work in Safari.
// maybe the browser considered local filesystem as the same domain as the pasted data
uploadFiles(vditor, clipboardEvent.clipboardData.files);
}
})
});
}
}
const insertText = (textarea: HTMLTextAreaElement, prefix: string, suffix: string, replace?: boolean) => {
if (typeof textarea.selectionStart === 'number' && typeof textarea.selectionEnd === 'number') {
const startPos = textarea.selectionStart
const endPos = textarea.selectionEnd
const tmpStr = textarea.value
textarea.focus()
if (typeof textarea.selectionStart === "number" && typeof textarea.selectionEnd === "number") {
const startPos = textarea.selectionStart;
const endPos = textarea.selectionEnd;
const tmpStr = textarea.value;
textarea.focus();
if (!commandable()) {

@@ -219,9 +228,9 @@ if (startPos === endPos) {

textarea.value = tmpStr.substring(0, startPos) + prefix + suffix +
tmpStr.substring(endPos, tmpStr.length)
textarea.selectionEnd = textarea.selectionStart = endPos + prefix.length
tmpStr.substring(endPos, tmpStr.length);
textarea.selectionEnd = textarea.selectionStart = endPos + prefix.length;
} else {
if (replace) {
textarea.value = tmpStr.substring(0, startPos) + prefix + suffix +
tmpStr.substring(endPos, tmpStr.length)
textarea.selectionEnd = startPos + prefix.length + suffix.length
tmpStr.substring(endPos, tmpStr.length);
textarea.selectionEnd = startPos + prefix.length + suffix.length;
} else {

@@ -233,5 +242,5 @@ if (tmpStr.substring(startPos - prefix.length, startPos) === prefix &&

tmpStr.substring(startPos, endPos) +
tmpStr.substring(endPos + suffix.length, tmpStr.length)
textarea.selectionStart = startPos - prefix.length
textarea.selectionEnd = endPos - prefix.length
tmpStr.substring(endPos + suffix.length, tmpStr.length);
textarea.selectionStart = startPos - prefix.length;
textarea.selectionEnd = endPos - prefix.length;
} else {

@@ -241,5 +250,5 @@ // insert

tmpStr.substring(startPos, endPos) +
suffix + tmpStr.substring(endPos, tmpStr.length)
textarea.selectionStart = startPos + prefix.length
textarea.selectionEnd = endPos + prefix.length
suffix + tmpStr.substring(endPos, tmpStr.length);
textarea.selectionStart = startPos + prefix.length;
textarea.selectionEnd = endPos + prefix.length;
}

@@ -249,4 +258,4 @@ }

const event = document.createEvent('HTMLEvents');
event.initEvent('input', true, false);
const event = document.createEvent("HTMLEvents");
event.initEvent("input", true, false);
textarea.dispatchEvent(event);

@@ -256,7 +265,7 @@ } else {

// no selection
document.execCommand('insertText', false, prefix + suffix)
textarea.selectionStart = textarea.selectionEnd = textarea.selectionStart - suffix.length
document.execCommand("insertText", false, prefix + suffix);
textarea.selectionStart = textarea.selectionEnd = textarea.selectionStart - suffix.length;
} else {
if (replace) {
document.execCommand('insertText', false, prefix + suffix)
document.execCommand("insertText", false, prefix + suffix);
} else {

@@ -266,19 +275,19 @@ if (tmpStr.substring(startPos - prefix.length, startPos) === prefix &&

// broke circle, avoid repeat
document.execCommand('delete', false)
document.execCommand("delete", false);
for (let i = 0, iMax = prefix.length; i < iMax; i++) {
document.execCommand('delete', false)
document.execCommand("delete", false);
}
for (let j = 0, jMax = suffix.length; j < jMax; j++) {
document.execCommand('forwardDelete', false)
document.execCommand("forwardDelete", false);
}
document.execCommand('insertText', false,
tmpStr.substring(startPos, endPos))
textarea.selectionStart = startPos - prefix.length
textarea.selectionEnd = endPos - prefix.length
document.execCommand("insertText", false,
tmpStr.substring(startPos, endPos));
textarea.selectionStart = startPos - prefix.length;
textarea.selectionEnd = endPos - prefix.length;
} else {
// insert
document.execCommand('insertText', false,
prefix + tmpStr.substring(startPos, endPos) + suffix)
textarea.selectionStart = startPos + prefix.length
textarea.selectionEnd = endPos + prefix.length
document.execCommand("insertText", false,
prefix + tmpStr.substring(startPos, endPos) + suffix);
textarea.selectionStart = startPos + prefix.length;
textarea.selectionEnd = endPos + prefix.length;
}

@@ -289,4 +298,4 @@ }

}
}
};
export {Editor, insertText}
export {Editor, insertText};

@@ -5,878 +5,879 @@ /**

* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 0.1.0.0, Jan 28, 2019
* @version 0.2.0.0, Feb 18, 2019
*/
const imgStaticPath = 'https://vditor.b3log.org/images'
export const allEmoji: any = {
'+1': '👍',
'-1': '👎',
'100': '💯',
'1234': '🔢',
'8ball': '🎱',
'a': '🅰',
'ab': '🆎',
'abc': '🔤',
'abcd': '🔡',
'accept': '🉑',
'aerial_tramway': '🚡',
'airplane': '✈',
'alarm_clock': '⏰',
'alien': '👽',
'ambulance': '🚑',
'anchor': '⚓',
'angel': '👼',
'anger': '💢',
'angry': '😠',
'anguished': '😧',
'ant': '🐜',
'apple': '🍎',
'aquarius': '♒',
'aries': '♈',
'arrows_clockwise': '🔃',
'arrows_counterclockwise': '🔄',
'arrow_backward': '◀',
'arrow_double_down': '⏬',
'arrow_double_up': '⏫',
'arrow_down': '⬇',
'arrow_down_small': '🔽',
'arrow_forward': '▶',
'arrow_heading_down': '⤵',
'arrow_heading_up': '⤴',
'arrow_left': '⬅',
'arrow_lower_left': '↙',
'arrow_lower_right': '↘',
'arrow_right': '➡',
'arrow_right_hook': '↪',
'arrow_up': '⬆',
'arrow_upper_left': '↖',
'arrow_upper_right': '↗',
'arrow_up_down': '↕',
'arrow_up_small': '🔼',
'art': '🎨',
'articulated_lorry': '🚛',
'astonished': '😲',
'atm': '🏧',
'b': '🅱',
'baby': '👶',
'baby_bottle': '🍼',
'baby_chick': '🐤',
'baby_symbol': '🚼',
'back': '🔙',
'baggage_claim': '🛄',
'balloon': '🎈',
'ballot_box_with_check': '☑',
'bamboo': '🎍',
'banana': '🍌',
'bangbang': '‼',
'bank': '🏦',
'barber': '💈',
'bar_chart': '📊',
'baseball': '⚾',
'basketball': '🏀',
'bath': '🛀',
'bathtub': '🛁',
'battery': '🔋',
'bear': '🐻',
'bee': '🐝',
'beer': '🍺',
'beers': '🍻',
'beetle': '🐞',
'beginner': '🔰',
'bell': '🔔',
'bento': '🍱',
'bicyclist': '🚴',
'bike': '🚲',
'bikini': '👙',
'bird': '🐦',
'birthday': '🎂',
'black_circle': '⚫',
'black_joker': '🃏',
'black_large_square': '⬛',
'black_medium_small_square': '◾',
'black_medium_square': '◼',
'black_nib': '✒',
'black_small_square': '▪',
'black_square_button': '🔲',
'blossom': '🌼',
'blowfish': '🐡',
'blue_book': '📘',
'blue_car': '🚙',
'blue_heart': '💙',
'blush': '😊',
'boar': '🐗',
'boat': '⛵',
'bomb': '💣',
'book': '📖',
'bookmark': '🔖',
'bookmark_tabs': '📑',
'books': '📚',
'boom': '💥',
'boot': '👢',
'bouquet': '💐',
'bow': '🙇',
'bowling': '🎳',
'boy': '👦',
'bread': '🍞',
'bride_with_veil': '👰',
'bridge_at_night': '🌉',
'briefcase': '💼',
'broken_heart': '💔',
'bug': '🐛',
'bulb': '💡',
'bullettrain_front': '🚅',
'bullettrain_side': '🚄',
'bus': '🚌',
'busstop': '🚏',
'busts_in_silhouette': '👥',
'bust_in_silhouette': '👤',
'c': `${imgStaticPath}/c.png`,
'cactus': '🌵',
'cake': '🍰',
'calendar': '📆',
'calling': '📲',
'camel': '🐫',
'camera': '📷',
'cancer': '🦀',
'candy': '🍬',
'capital_abcd': '🔠',
'capricorn': '♑',
'car': '🚗',
'card_index': '📇',
'carousel_horse': '🎠',
'cat': '🐱',
'cat2': '🐈',
'cd': '🇨🇩',
'chart': '💹',
'chart_with_downwards_trend': '📉',
'chart_with_upwards_trend': '📈',
'checkered_flag': '🏁',
'cherries': '🍒',
'cherry_blossom': '🌸',
'chestnut': '🌰',
'chicken': '🐔',
'children_crossing': '🚸',
'chocolate_bar': '🍫',
'christmas_tree': '🎄',
'church': '⛪',
'cinema': '🎦',
'circus_tent': '🎪',
'city_sunrise': '🌇',
'city_sunset': '🌆',
'cl': '🇨🇱',
'clap': '👏',
'clapper': '🎬',
'clipboard': '📋',
'clock1': '🕐',
'clock10': '🕙',
'clock1030': '🕥',
'clock11': '🕚',
'clock1130': '🕦',
'clock12': '🕛',
'clock1230': '🕧',
'clock130': '🕜',
'clock2': '🕑',
'clock230': '🕝',
'clock3': '🕒',
'clock330': '🕞',
'clock4': '🕓',
'clock430': '🕟',
'clock5': '🕔',
'clock530': '🕠',
'clock6': '🕕',
'clock630': '🕡',
'clock7': '🕖',
'clock730': '🕢',
'clock8': '🕗',
'clock830': '🕣',
'clock9': '🕘',
'clock930': '🕤',
'closed_book': '📕',
'closed_lock_with_key': '🔐',
'closed_umbrella': '🌂',
'cloud': '☁',
'clubs': '♣',
'cn': '🇨🇳',
'cocktail': '🍸',
'coffee': '☕',
'cold_sweat': '😰',
'collision': '💥',
'computer': '💻',
'confetti_ball': '🎊',
'confounded': '😖',
'confused': '😕',
'congratulations': '㊗',
'construction': '🚧',
'construction_worker': '👷',
'convenience_store': '🏪',
'cookie': '🍪',
'cool': '🆒',
'cop': '👮',
'copyright': '©',
'corn': '🌽',
'couple': '👫',
'couplekiss': '💏',
'couple_with_heart': '💑',
'cow': '🐮',
'cow2': '🐄',
'credit_card': '💳',
'crescent_moon': '🌙',
'crocodile': '🐊',
'crossed_flags': '🎌',
'crown': '👑',
'cry': '😢',
'crying_cat_face': '😿',
'crystal_ball': '🔮',
'cupid': '💘',
'curly_loop': '➰',
'currency_exchange': '💱',
'curry': '🍛',
'custard': '🍮',
'customs': '🛃',
'cyclone': '🌀',
'd': `${imgStaticPath}/d.png`,
'dancer': '💃',
'dancers': '👯',
'dango': '🍡',
'dart': '🎯',
'dash': '💨',
'date': '📅',
'de': '🇩🇪',
'deciduous_tree': '🌳',
'department_store': '🏬',
'diamonds': '♦',
'diamond_shape_with_a_dot_inside': '💠',
'disappointed': '😞',
'disappointed_relieved': '😥',
'dizzy': '💫',
'dizzy_face': '😵',
'dog': '🐶',
'dog2': '🐕',
'dollar': '💵',
'dolls': '🎎',
'dolphin': '🐬',
'door': '🚪',
'doughnut': '🍩',
'do_not_litter': '🚯',
'dragon': '🐉',
'dragon_face': '🐲',
'dress': '👗',
'dromedary_camel': '🐪',
'droplet': '💧',
'dvd': '📀',
'e-mail': '📧',
'e50a': `${imgStaticPath}/e50a.png`,
'ear': '👂',
'earth_africa': '🌍',
'earth_americas': '🌎',
'earth_asia': '🌏',
'ear_of_rice': '🌾',
'egg': '🥚',
'eggplant': '🍆',
'eight': '8⃣',
'eight_pointed_black_star': '✴',
'eight_spoked_asterisk': '✳',
'electric_plug': '🔌',
'elephant': '🐘',
'email': '✉',
'end': '🔚',
'envelope': '✉',
'es': '🇪🇸',
'euro': '💶',
'european_castle': '🏰',
'european_post_office': '🏤',
'evergreen_tree': '🌲',
'exclamation': '❗',
'expressionless': '😑',
'eyeglasses': '👓',
'eyes': '👀',
'f': `${imgStaticPath}/f.png`,
'facepunch': '👊',
'factory': '🏭',
'fallen_leaf': '🍂',
'family': '👪',
'fast_forward': '⏩',
'fax': '📠',
'fearful': '😨',
'feet': '🐾',
'ferris_wheel': '🎡',
'file_folder': '📁',
'fire': '🔥',
'fireworks': '🎆',
'fire_engine': '🚒',
'first_quarter_moon': '🌓',
'first_quarter_moon_with_face': '🌛',
'fish': '🐟',
'fishing_pole_and_fish': '🎣',
'fish_cake': '🍥',
'fist': '✊',
'five': '5⃣',
'flags': '🎏',
'flashlight': '🔦',
'floppy_disk': '💾',
'flower_playing_cards': '🎴',
'flushed': '😳',
'foggy': '🌁',
'football': '🏈',
'fork_and_knife': '🍴',
'fountain': '⛲',
'four': '4⃣',
'four_leaf_clover': '🍀',
'fr': '🇫🇷',
'free': '🆓',
'fried_shrimp': '🍤',
'fries': '🍟',
'frog': '🐸',
'frowning': '😦',
'fuelpump': '⛽',
'full_moon': '🌕',
'full_moon_with_face': '🌝',
'g': `${imgStaticPath}/g.png`,
'game_die': '🎲',
'gb': '🇬🇧',
'gem': '💎',
'gemini': '♊',
'ghost': '👻',
'gift': '🎁',
'gift_heart': '💝',
'girl': '👧',
'globe_with_meridians': '🌐',
'goat': '🐐',
'golf': '⛳',
'grapes': '🍇',
'green_apple': '🍏',
'green_book': '📗',
'green_heart': '💚',
'grey_exclamation': '❕',
'grey_question': '❔',
'grimacing': '😬',
'grin': '😁',
'grinning': '😀',
'guardsman': '💂',
'guitar': '🎸',
'gun': '🔫',
'haircut': '💇',
'hamburger': '🍔',
'hammer': '🔨',
'hamster': '🐹',
'hand': '✋',
'handbag': '👜',
'hankey': '💩',
'hash': '#⃣',
'hatched_chick': '🐥',
'hatching_chick': '🐣',
'headphones': '🎧',
'heart': '❤️',
'heartbeat': '💓',
'heartpulse': '💗',
'hearts': '♥️',
'heart_decoration': '💟',
'heart_eyes': '😍',
'heart_eyes_cat': '😻',
'hear_no_evil': '🙉',
'heavy_check_mark': '✔',
'heavy_division_sign': '➗',
'heavy_dollar_sign': '💲',
'heavy_exclamation_mark': '❗',
'heavy_minus_sign': '➖',
'heavy_multiplication_x': '✖',
'heavy_plus_sign': '➕',
'helicopter': '🚁',
'herb': '🌿',
'hibiscus': '🌺',
'high_brightness': '🔆',
'high_heel': '👠',
'hocho': '🔪',
'honeybee': '🐝',
'honey_pot': '🍯',
'horse': '🐴',
'horse_racing': '🏇',
'hospital': '🏥',
'hotel': '🏨',
'hotsprings': '♨',
'hourglass': '⌛',
'hourglass_flowing_sand': '⏳',
'house': '🏠',
'house_with_garden': '🏡',
'hushed': '😯',
'i': `${imgStaticPath}/i.png`,
'icecream': '🍦',
'ice_cream': '🍨',
'id': '🇮🇩',
'ideograph_advantage': '🉐',
'imp': '👿',
'inbox_tray': '📥',
'incoming_envelope': '📨',
'information_desk_person': '💁',
'information_source': 'ℹ',
'innocent': '😇',
'interrobang': '⁉',
'iphone': '📱',
'it': '🇮🇹',
'izakaya_lantern': '🏮',
'j': `${imgStaticPath}/j.png`,
'jack_o_lantern': '🎃',
'japan': '🗾',
'japanese_castle': '🏯',
'japanese_goblin': '👺',
'japanese_ogre': '👹',
'jeans': '👖',
'joy': '😂',
'joy_cat': '😹',
'jp': '🇯🇵',
'k': `${imgStaticPath}/k.png`,
'key': '🔑',
'keycap_ten': '🔟',
'kimono': '👘',
'kiss': '💋',
'kissing': '😗',
'kissing_cat': '😽',
'kissing_closed_eyes': '😚',
'kissing_heart': '😘',
'kissing_smiling_eyes': '😙',
'koala': '🐨',
'koko': '🈁',
'kr': '🇰🇷',
'large_blue_circle': '🔵',
'large_blue_diamond': '🔷',
'large_orange_diamond': '🔶',
'last_quarter_moon': '🌗',
'last_quarter_moon_with_face': '🌜',
'laughing': '😆',
'leaves': '🍃',
'ledger': '📒',
'leftwards_arrow_with_hook': '↩',
'left_luggage': '🛅',
'left_right_arrow': '↔',
'lemon': '🍋',
'leo': '♌',
'leopard': '🐆',
'libra': '♎',
'light_rail': '🚈',
'link': '🔗',
'lips': '👄',
'lipstick': '💄',
'lock': '🔒',
'lock_with_ink_pen': '🔏',
'lollipop': '🍭',
'loop': '➿',
'loudspeaker': '📢',
'love_hotel': '🏩',
'love_letter': '💌',
'low_brightness': '🔅',
'm': 'Ⓜ',
'mag': '🔍',
'mag_right': '🔎',
'mahjong': '🀄',
'mailbox': '📫',
'mailbox_closed': '📪',
'mailbox_with_mail': '📬',
'mailbox_with_no_mail': '📭',
'man': '👨',
'mans_shoe': '👞',
'man_with_gua_pi_mao': '👲',
'man_with_turban': '👳',
'maple_leaf': '🍁',
'mask': '😷',
'massage': '💆',
'meat_on_bone': '🍖',
'mega': '📣',
'melon': '🍈',
'memo': '📝',
'mens': '🚹',
'metro': '🚇',
'microphone': '🎤',
'microscope': '🔬',
'milky_way': '🌌',
'minibus': '🚐',
'minidisc': '💽',
'mobile_phone_off': '📴',
'moneybag': '💰',
'money_with_wings': '💸',
'monkey': '🐒',
'monkey_face': '🐵',
'monorail': '🚝',
'mortar_board': '🎓',
'mountain_bicyclist': '🚵',
'mountain_cableway': '🚠',
'mountain_railway': '🚞',
'mount_fuji': '🗻',
'mouse': '🐭',
'mouse2': '🐁',
'movie_camera': '🎥',
'moyai': '🗿',
'muscle': '💪',
'mushroom': '🍄',
'musical_keyboard': '🎹',
'musical_note': '🎵',
'musical_score': '🎼',
'mute': '🔇',
'nail_care': '💅',
'name_badge': '📛',
'necktie': '👔',
'negative_squared_cross_mark': '❎',
'neutral_face': '😐',
'new': '🆕',
'newspaper': '📰',
'new_moon': '🌑',
'new_moon_with_face': '🌚',
'ng': '🇳🇬',
'nine': '9⃣',
'non-potable_water': '🚱',
'nose': '👃',
'notebook': '📓',
'notebook_with_decorative_cover': '📔',
'notes': '🎶',
'no_bell': '🔕',
'no_bicycles': '🚳',
'no_entry': '⛔',
'no_entry_sign': '🚫',
'no_good': '🙅',
'no_mobile_phones': '📵',
'no_mouth': '😶',
'no_pedestrians': '🚷',
'no_smoking': '🚭',
'nut_and_bolt': '🔩',
'o': '⭕',
'o2': '🅾',
'ocean': '🌊',
'octocat': `${imgStaticPath}/octocat.png`,
'octopus': '🐙',
'oden': '🍢',
'office': '🏢',
'ok': '🆗',
'ok_hand': '👌',
'ok_woman': '🙆',
'older_man': '👴',
'older_woman': '👵',
'on': '🔛',
'oncoming_automobile': '🚘',
'oncoming_bus': '🚍',
'oncoming_police_car': '🚔',
'oncoming_taxi': '🚖',
'one': '1⃣',
'open_file_folder': '📂',
'open_hands': '👐',
'open_mouth': '😮',
'ophiuchus': '⛎',
'orange_book': '📙',
'outbox_tray': '📤',
'ox': '🐂',
'package': '📦',
'pager': '📟',
'page_facing_up': '📄',
'page_with_curl': '📃',
'palm_tree': '🌴',
'panda_face': '🐼',
'paperclip': '📎',
'parking': '🅿',
'partly_sunny': '⛅',
'part_alternation_mark': '〽',
'passport_control': '🛂',
'paw_prints': '🐾',
'peach': '🍑',
'pear': '🍐',
'pencil': '📝',
'pencil2': '✏',
'penguin': '🐧',
'pensive': '😔',
'performing_arts': '🎭',
'persevere': '😣',
'person_frowning': '🙍',
'person_with_blond_hair': '👱',
'person_with_pouting_face': '🙎',
'phone': '☎',
'pig': '🐷',
'pig2': '🐖',
'pig_nose': '🐽',
'pill': '💊',
'pineapple': '🍍',
'pisces': '♓',
'pizza': '🍕',
'point_down': '👇',
'point_left': '👈',
'point_right': '👉',
'point_up': '☝',
'point_up_2': '👆',
'police_car': '🚓',
'poodle': '🐩',
'poop': '💩',
'postal_horn': '📯',
'postbox': '📮',
'potable_water': '🚰',
'pouch': '👝',
'poultry_leg': '🍗',
'pound': '💷',
'pouting_cat': '😾',
'pray': '🙏',
'princess': '👸',
'punch': '👊',
'purple_heart': '💜',
'purse': '👛',
'pushpin': '📌',
'put_litter_in_its_place': '🚮',
'question': '❓',
'r': `${imgStaticPath}/r.png`,
'rabbit': '🐰',
'rabbit2': '🐇',
'racehorse': '🐎',
'radio': '📻',
'radio_button': '🔘',
'rage': '😡',
'railway_car': '🚃',
'rainbow': '🌈',
'raised_hand': '✋',
'raised_hands': '🙌',
'raising_hand': '🙋',
'ram': '🐏',
'ramen': '🍜',
'rat': '🐀',
'recycle': '♻',
'red_car': '🚗',
'red_circle': '🔴',
'registered': '®',
'relaxed': '☺',
'relieved': '😌',
'repeat': '🔁',
'repeat_one': '🔂',
'restroom': '🚻',
'revolving_hearts': '💞',
'rewind': '⏪',
'ribbon': '🎀',
'rice': '🍚',
'rice_ball': '🍙',
'rice_cracker': '🍘',
'rice_scene': '🎑',
'ring': '💍',
'rocket': '🚀',
'roller_coaster': '🎢',
'rooster': '🐓',
'rose': '🌹',
'rotating_light': '🚨',
'round_pushpin': '📍',
'rowboat': '🚣',
'ru': '🇷🇺',
'rugby_football': '🏉',
'running': '🏃',
'running_shirt_with_sash': '🎽',
'sa': '🇸🇦',
'sagittarius': '♐',
'sailboat': '⛵',
'sake': '🍶',
'sandal': '👡',
'santa': '🎅',
'satellite': '🛰',
'satisfied': '😆',
'saxophone': '🎷',
'school': '🏫',
'school_satchel': '🎒',
'scissors': '✂',
'scorpius': '♏',
'scream': '😱',
'scream_cat': '🙀',
'scroll': '📜',
'seat': '💺',
'secret': '㊙',
'seedling': '🌱',
'see_no_evil': '🙈',
'seven': '7⃣',
'shaved_ice': '🍧',
'sheep': '🐑',
'shell': '🐚',
'ship': '🚢',
'shirt': '👕',
'shoe': '👞',
'shower': '🚿',
'signal_strength': '📶',
'six': '6⃣',
'six_pointed_star': '🔯',
'ski': '🎿',
'skull': '💀',
'sleeping': '😴',
'sleepy': '😪',
'slot_machine': '🎰',
'small_blue_diamond': '🔹',
'small_orange_diamond': '🔸',
'small_red_triangle': '🔺',
'small_red_triangle_down': '🔻',
'smile': '😄',
'smiley': '😃',
'smiley_cat': '😺',
'smile_cat': '😸',
'smiling_imp': '😈',
'smirk': '😏',
'smirk_cat': '😼',
'smoking': '🚬',
'snail': '🐌',
'snake': '🐍',
'snowboarder': '🏂',
'snowflake': '❄',
'snowman': '⛄',
'sob': '😭',
'soccer': '⚽',
'soon': '🔜',
'sos': '🆘',
'sound': '🔉',
'space_invader': '👾',
'spades': '♠',
'spaghetti': '🍝',
'sparkle': '❇',
'sparkler': '🎇',
'sparkles': '✨',
'sparkling_heart': '💖',
'speaker': '🔈',
'speak_no_evil': '🙊',
'speech_balloon': '💬',
'speedboat': '🚤',
'squirrel': '🐿',
'star': '⭐',
'star2': '🌟',
'stars': '🌠',
'station': '🚉',
'statue_of_liberty': '🗽',
'steam_locomotive': '🚂',
'stew': '🍲',
'straight_ruler': '📏',
'strawberry': '🍓',
'stuck_out_tongue': '😛',
'stuck_out_tongue_closed_eyes': '😝',
'stuck_out_tongue_winking_eye': '😜',
'sunflower': '🌻',
'sunglasses': '😎',
'sunny': '☀',
'sunrise': '🌅',
'sunrise_over_mountains': '🌄',
'sun_with_face': '🌞',
'surfer': '🏄',
'sushi': '🍣',
'suspension_railway': '🚟',
'sweat': '😓',
'sweat_drops': '💦',
'sweat_smile': '😅',
'sweet_potato': '🍠',
'swimmer': '🏊',
'symbols': '🔣',
'syringe': '💉',
'tada': '🎉',
'tanabata_tree': '🎋',
'tangerine': '🍊',
'taurus': '♉',
'taxi': '🚕',
'tea': '🍵',
'telephone': '☎',
'telephone_receiver': '📞',
'telescope': '🔭',
'tennis': '🎾',
'tent': '🏕',
'thought_balloon': '💭',
'three': '3⃣',
'thumbsdown': '👎',
'thumbsup': '👍',
'ticket': '🎫',
'tiger': '🐯',
'tiger2': '🐅',
'tired_face': '😫',
'tm': '🇹🇲',
'toilet': '🚽',
'tokyo_tower': '🗼',
'tomato': '🍅',
'tongue': '👅',
'top': '🔝',
'tophat': '🎩',
'tractor': '🚜',
'traffic_light': '🚥',
'train': '🚋',
'train2': '🚆',
'tram': '🚊',
'triangular_flag_on_post': '🚩',
'triangular_ruler': '📐',
'trident': '🔱',
'triumph': '😤',
'trolleybus': '🚎',
'trollface': `${imgStaticPath}/trollface.png`,
'trophy': '🏆',
'tropical_drink': '🍹',
'tropical_fish': '🐠',
'truck': '🚚',
'trumpet': '🎺',
'tshirt': '👕',
'tulip': '🌷',
'turtle': '🐢',
'tv': '🇹🇻',
'twisted_rightwards_arrows': '🔀',
'two': '2⃣',
'two_hearts': '💕',
'two_men_holding_hands': '👬',
'two_women_holding_hands': '👭',
'u': `${imgStaticPath}/u.png`,
'u5272': '🈹',
'u5408': '🈴',
'u55b6': '🈺',
'u6307': '🈯',
'u6708': '🈷',
'u6709': '🈶',
'u6e80': '🈵',
'u7121': '🈚',
'u7533': '🈸',
'u7981': '🈲',
'u7a7a': '🈳',
'umbrella': '☔',
'unamused': '😒',
'underage': '🔞',
'unicorn_face': '🦄',
'unlock': '🔓',
'up': '🆙',
'us': '🇺🇸',
'v': '✌',
'vertical_traffic_light': '🚦',
'vhs': '📼',
'vibration_mode': '📳',
'video_camera': '📹',
'video_game': '🎮',
'violin': '🎻',
'virgo': '♍',
'volcano': '🌋',
'vs': '🆚',
'walking': '🚶',
'waning_crescent_moon': '🌘',
'waning_gibbous_moon': '🌖',
'warning': '⚠',
'watch': '⌚',
'watermelon': '🍉',
'water_buffalo': '🐃',
'wave': '👋',
'wavy_dash': '〰',
'waxing_crescent_moon': '🌒',
'waxing_gibbous_moon': '🌔',
'wc': '🚾',
'weary': '😩',
'wedding': '💒',
'whale': '🐳',
'whale2': '🐋',
'wheelchair': '♿',
'white_check_mark': '✅',
'white_circle': '⚪',
'white_flower': '💮',
'white_large_square': '⬜',
'white_medium_small_square': '◽',
'white_medium_square': '◻',
'white_small_square': '▫',
'white_square_button': '🔳',
'wind_chime': '🎐',
'wine_glass': '🍷',
'wink': '😉',
'wolf': '🐺',
'woman': '👩',
'womans_clothes': '👚',
'womans_hat': '👒',
'womens': '🚺',
'worried': '😟',
'wrench': '🔧',
'x': '❌',
'yellow_heart': '💛',
'yen': '💴',
'yum': '😋',
'zap': '⚡',
'zero': '0⃣',
'zzz': '💤',
}
export const getAllEmoji = (imgStaticPath: string) => {
return {
"+1": "👍",
"-1": "👎",
"100": "💯",
"1234": "🔢",
"8ball": "🎱",
"a": "🅰",
"ab": "🆎",
"abc": "🔤",
"abcd": "🔡",
"accept": "🉑",
"aerial_tramway": "🚡",
"airplane": "✈",
"alarm_clock": "⏰",
"alien": "👽",
"ambulance": "🚑",
"anchor": "⚓",
"angel": "👼",
"anger": "💢",
"angry": "😠",
"anguished": "😧",
"ant": "🐜",
"apple": "🍎",
"aquarius": "♒",
"aries": "♈",
"arrow_backward": "◀",
"arrow_double_down": "⏬",
"arrow_double_up": "⏫",
"arrow_down": "⬇",
"arrow_down_small": "🔽",
"arrow_forward": "▶",
"arrow_heading_down": "⤵",
"arrow_heading_up": "⤴",
"arrow_left": "⬅",
"arrow_lower_left": "↙",
"arrow_lower_right": "↘",
"arrow_right": "➡",
"arrow_right_hook": "↪",
"arrow_up": "⬆",
"arrow_up_down": "↕",
"arrow_up_small": "🔼",
"arrow_upper_left": "↖",
"arrow_upper_right": "↗",
"arrows_clockwise": "🔃",
"arrows_counterclockwise": "🔄",
"art": "🎨",
"articulated_lorry": "🚛",
"astonished": "😲",
"atm": "🏧",
"b": "🅱",
"baby": "👶",
"baby_bottle": "🍼",
"baby_chick": "🐤",
"baby_symbol": "🚼",
"back": "🔙",
"baggage_claim": "🛄",
"balloon": "🎈",
"ballot_box_with_check": "☑",
"bamboo": "🎍",
"banana": "🍌",
"bangbang": "‼",
"bank": "🏦",
"bar_chart": "📊",
"barber": "💈",
"baseball": "⚾",
"basketball": "🏀",
"bath": "🛀",
"bathtub": "🛁",
"battery": "🔋",
"bear": "🐻",
"bee": "🐝",
"beer": "🍺",
"beers": "🍻",
"beetle": "🐞",
"beginner": "🔰",
"bell": "🔔",
"bento": "🍱",
"bicyclist": "🚴",
"bike": "🚲",
"bikini": "👙",
"bird": "🐦",
"birthday": "🎂",
"black_circle": "⚫",
"black_joker": "🃏",
"black_large_square": "⬛",
"black_medium_small_square": "◾",
"black_medium_square": "◼",
"black_nib": "✒",
"black_small_square": "▪",
"black_square_button": "🔲",
"blossom": "🌼",
"blowfish": "🐡",
"blue_book": "📘",
"blue_car": "🚙",
"blue_heart": "💙",
"blush": "😊",
"boar": "🐗",
"boat": "⛵",
"bomb": "💣",
"book": "📖",
"bookmark": "🔖",
"bookmark_tabs": "📑",
"books": "📚",
"boom": "💥",
"boot": "👢",
"bouquet": "💐",
"bow": "🙇",
"bowling": "🎳",
"boy": "👦",
"bread": "🍞",
"bride_with_veil": "👰",
"bridge_at_night": "🌉",
"briefcase": "💼",
"broken_heart": "💔",
"bug": "🐛",
"bulb": "💡",
"bullettrain_front": "🚅",
"bullettrain_side": "🚄",
"bus": "🚌",
"busstop": "🚏",
"bust_in_silhouette": "👤",
"busts_in_silhouette": "👥",
"c": `${imgStaticPath}/c.png`,
"cactus": "🌵",
"cake": "🍰",
"calendar": "📆",
"calling": "📲",
"camel": "🐫",
"camera": "📷",
"cancer": "🦀",
"candy": "🍬",
"capital_abcd": "🔠",
"capricorn": "♑",
"car": "🚗",
"card_index": "📇",
"carousel_horse": "🎠",
"cat": "🐱",
"cat2": "🐈",
"cd": "🇨🇩",
"chart": "💹",
"chart_with_downwards_trend": "📉",
"chart_with_upwards_trend": "📈",
"checkered_flag": "🏁",
"cherries": "🍒",
"cherry_blossom": "🌸",
"chestnut": "🌰",
"chicken": "🐔",
"children_crossing": "🚸",
"chocolate_bar": "🍫",
"christmas_tree": "🎄",
"church": "⛪",
"cinema": "🎦",
"circus_tent": "🎪",
"city_sunrise": "🌇",
"city_sunset": "🌆",
"cl": "🇨🇱",
"clap": "👏",
"clapper": "🎬",
"clipboard": "📋",
"clock1": "🕐",
"clock10": "🕙",
"clock1030": "🕥",
"clock11": "🕚",
"clock1130": "🕦",
"clock12": "🕛",
"clock1230": "🕧",
"clock130": "🕜",
"clock2": "🕑",
"clock230": "🕝",
"clock3": "🕒",
"clock330": "🕞",
"clock4": "🕓",
"clock430": "🕟",
"clock5": "🕔",
"clock530": "🕠",
"clock6": "🕕",
"clock630": "🕡",
"clock7": "🕖",
"clock730": "🕢",
"clock8": "🕗",
"clock830": "🕣",
"clock9": "🕘",
"clock930": "🕤",
"closed_book": "📕",
"closed_lock_with_key": "🔐",
"closed_umbrella": "🌂",
"cloud": "☁",
"clubs": "♣",
"cn": "🇨🇳",
"cocktail": "🍸",
"coffee": "☕",
"cold_sweat": "😰",
"collision": "💥",
"computer": "💻",
"confetti_ball": "🎊",
"confounded": "😖",
"confused": "😕",
"congratulations": "㊗",
"construction": "🚧",
"construction_worker": "👷",
"convenience_store": "🏪",
"cookie": "🍪",
"cool": "🆒",
"cop": "👮",
"copyright": "©",
"corn": "🌽",
"couple": "👫",
"couple_with_heart": "💑",
"couplekiss": "💏",
"cow": "🐮",
"cow2": "🐄",
"credit_card": "💳",
"crescent_moon": "🌙",
"crocodile": "🐊",
"crossed_flags": "🎌",
"crown": "👑",
"cry": "😢",
"crying_cat_face": "😿",
"crystal_ball": "🔮",
"cupid": "💘",
"curly_loop": "➰",
"currency_exchange": "💱",
"curry": "🍛",
"custard": "🍮",
"customs": "🛃",
"cyclone": "🌀",
"d": `${imgStaticPath}/d.png`,
"dancer": "💃",
"dancers": "👯",
"dango": "🍡",
"dart": "🎯",
"dash": "💨",
"date": "📅",
"de": "🇩🇪",
"deciduous_tree": "🌳",
"department_store": "🏬",
"diamond_shape_with_a_dot_inside": "💠",
"diamonds": "♦",
"disappointed": "😞",
"disappointed_relieved": "😥",
"dizzy": "💫",
"dizzy_face": "😵",
"do_not_litter": "🚯",
"dog": "🐶",
"dog2": "🐕",
"dollar": "💵",
"dolls": "🎎",
"dolphin": "🐬",
"door": "🚪",
"doughnut": "🍩",
"dragon": "🐉",
"dragon_face": "🐲",
"dress": "👗",
"dromedary_camel": "🐪",
"droplet": "💧",
"dvd": "📀",
"e-mail": "📧",
"e50a": `${imgStaticPath}/e50a.png`,
"ear": "👂",
"ear_of_rice": "🌾",
"earth_africa": "🌍",
"earth_americas": "🌎",
"earth_asia": "🌏",
"egg": "🥚",
"eggplant": "🍆",
"eight": "8⃣",
"eight_pointed_black_star": "✴",
"eight_spoked_asterisk": "✳",
"electric_plug": "🔌",
"elephant": "🐘",
"email": "✉",
"end": "🔚",
"envelope": "✉",
"es": "🇪🇸",
"euro": "💶",
"european_castle": "🏰",
"european_post_office": "🏤",
"evergreen_tree": "🌲",
"exclamation": "❗",
"expressionless": "😑",
"eyeglasses": "👓",
"eyes": "👀",
"f": `${imgStaticPath}/f.png`,
"facepunch": "👊",
"factory": "🏭",
"fallen_leaf": "🍂",
"family": "👪",
"fast_forward": "⏩",
"fax": "📠",
"fearful": "😨",
"feet": "🐾",
"ferris_wheel": "🎡",
"file_folder": "📁",
"fire": "🔥",
"fire_engine": "🚒",
"fireworks": "🎆",
"first_quarter_moon": "🌓",
"first_quarter_moon_with_face": "🌛",
"fish": "🐟",
"fish_cake": "🍥",
"fishing_pole_and_fish": "🎣",
"fist": "✊",
"five": "5⃣",
"flags": "🎏",
"flashlight": "🔦",
"floppy_disk": "💾",
"flower_playing_cards": "🎴",
"flushed": "😳",
"foggy": "🌁",
"football": "🏈",
"fork_and_knife": "🍴",
"fountain": "⛲",
"four": "4⃣",
"four_leaf_clover": "🍀",
"fr": "🇫🇷",
"free": "🆓",
"fried_shrimp": "🍤",
"fries": "🍟",
"frog": "🐸",
"frowning": "😦",
"fuelpump": "⛽",
"full_moon": "🌕",
"full_moon_with_face": "🌝",
"g": `${imgStaticPath}/g.png`,
"game_die": "🎲",
"gb": "🇬🇧",
"gem": "💎",
"gemini": "♊",
"ghost": "👻",
"gift": "🎁",
"gift_heart": "💝",
"girl": "👧",
"globe_with_meridians": "🌐",
"goat": "🐐",
"golf": "⛳",
"grapes": "🍇",
"green_apple": "🍏",
"green_book": "📗",
"green_heart": "💚",
"grey_exclamation": "❕",
"grey_question": "❔",
"grimacing": "😬",
"grin": "😁",
"grinning": "😀",
"guardsman": "💂",
"guitar": "🎸",
"gun": "🔫",
"haircut": "💇",
"hamburger": "🍔",
"hammer": "🔨",
"hamster": "🐹",
"hand": "✋",
"handbag": "👜",
"hankey": "💩",
"hash": "#⃣",
"hatched_chick": "🐥",
"hatching_chick": "🐣",
"headphones": "🎧",
"hear_no_evil": "🙉",
"heart": "❤️",
"heart_decoration": "💟",
"heart_eyes": "😍",
"heart_eyes_cat": "😻",
"heartbeat": "💓",
"heartpulse": "💗",
"hearts": "♥️",
"heavy_check_mark": "✔",
"heavy_division_sign": "➗",
"heavy_dollar_sign": "💲",
"heavy_exclamation_mark": "❗",
"heavy_minus_sign": "➖",
"heavy_multiplication_x": "✖",
"heavy_plus_sign": "➕",
"helicopter": "🚁",
"herb": "🌿",
"hibiscus": "🌺",
"high_brightness": "🔆",
"high_heel": "👠",
"hocho": "🔪",
"honey_pot": "🍯",
"honeybee": "🐝",
"horse": "🐴",
"horse_racing": "🏇",
"hospital": "🏥",
"hotel": "🏨",
"hotsprings": "♨",
"hourglass": "⌛",
"hourglass_flowing_sand": "⏳",
"house": "🏠",
"house_with_garden": "🏡",
"huaji": `${imgStaticPath}/huaji.gif`,
"hushed": "😯",
"i": `${imgStaticPath}/i.png`,
"ice_cream": "🍨",
"icecream": "🍦",
"id": "🇮🇩",
"ideograph_advantage": "🉐",
"imp": "👿",
"inbox_tray": "📥",
"incoming_envelope": "📨",
"information_desk_person": "💁",
"information_source": "ℹ",
"innocent": "😇",
"interrobang": "⁉",
"iphone": "📱",
"it": "🇮🇹",
"izakaya_lantern": "🏮",
"j": `${imgStaticPath}/j.png`,
"jack_o_lantern": "🎃",
"japan": "🗾",
"japanese_castle": "🏯",
"japanese_goblin": "👺",
"japanese_ogre": "👹",
"jeans": "👖",
"joy": "😂",
"joy_cat": "😹",
"jp": "🇯🇵",
"k": `${imgStaticPath}/k.png`,
"key": "🔑",
"keycap_ten": "🔟",
"kimono": "👘",
"kiss": "💋",
"kissing": "😗",
"kissing_cat": "😽",
"kissing_closed_eyes": "😚",
"kissing_heart": "😘",
"kissing_smiling_eyes": "😙",
"koala": "🐨",
"koko": "🈁",
"kr": "🇰🇷",
"large_blue_circle": "🔵",
"large_blue_diamond": "🔷",
"large_orange_diamond": "🔶",
"last_quarter_moon": "🌗",
"last_quarter_moon_with_face": "🌜",
"laughing": "😆",
"leaves": "🍃",
"ledger": "📒",
"left_luggage": "🛅",
"left_right_arrow": "↔",
"leftwards_arrow_with_hook": "↩",
"lemon": "🍋",
"leo": "♌",
"leopard": "🐆",
"libra": "♎",
"light_rail": "🚈",
"link": "🔗",
"lips": "👄",
"lipstick": "💄",
"lock": "🔒",
"lock_with_ink_pen": "🔏",
"lollipop": "🍭",
"loop": "➿",
"loudspeaker": "📢",
"love_hotel": "🏩",
"love_letter": "💌",
"low_brightness": "🔅",
"m": "Ⓜ",
"mag": "🔍",
"mag_right": "🔎",
"mahjong": "🀄",
"mailbox": "📫",
"mailbox_closed": "📪",
"mailbox_with_mail": "📬",
"mailbox_with_no_mail": "📭",
"man": "👨",
"man_with_gua_pi_mao": "👲",
"man_with_turban": "👳",
"mans_shoe": "👞",
"maple_leaf": "🍁",
"mask": "😷",
"massage": "💆",
"meat_on_bone": "🍖",
"mega": "📣",
"melon": "🍈",
"memo": "📝",
"mens": "🚹",
"metro": "🚇",
"microphone": "🎤",
"microscope": "🔬",
"milky_way": "🌌",
"minibus": "🚐",
"minidisc": "💽",
"mobile_phone_off": "📴",
"money_with_wings": "💸",
"moneybag": "💰",
"monkey": "🐒",
"monkey_face": "🐵",
"monorail": "🚝",
"mortar_board": "🎓",
"mount_fuji": "🗻",
"mountain_bicyclist": "🚵",
"mountain_cableway": "🚠",
"mountain_railway": "🚞",
"mouse": "🐭",
"mouse2": "🐁",
"movie_camera": "🎥",
"moyai": "🗿",
"muscle": "💪",
"mushroom": "🍄",
"musical_keyboard": "🎹",
"musical_note": "🎵",
"musical_score": "🎼",
"mute": "🔇",
"nail_care": "💅",
"name_badge": "📛",
"necktie": "👔",
"negative_squared_cross_mark": "❎",
"neutral_face": "😐",
"new": "🆕",
"new_moon": "🌑",
"new_moon_with_face": "🌚",
"newspaper": "📰",
"ng": "🇳🇬",
"nine": "9⃣",
"no_bell": "🔕",
"no_bicycles": "🚳",
"no_entry": "⛔",
"no_entry_sign": "🚫",
"no_good": "🙅",
"no_mobile_phones": "📵",
"no_mouth": "😶",
"no_pedestrians": "🚷",
"no_smoking": "🚭",
"non-potable_water": "🚱",
"nose": "👃",
"notebook": "📓",
"notebook_with_decorative_cover": "📔",
"notes": "🎶",
"nut_and_bolt": "🔩",
"o": "⭕",
"o2": "🅾",
"ocean": "🌊",
"octocat": `${imgStaticPath}/octocat.png`,
"octopus": "🐙",
"oden": "🍢",
"office": "🏢",
"ok": "🆗",
"ok_hand": "👌",
"ok_woman": "🙆",
"older_man": "👴",
"older_woman": "👵",
"on": "🔛",
"oncoming_automobile": "🚘",
"oncoming_bus": "🚍",
"oncoming_police_car": "🚔",
"oncoming_taxi": "🚖",
"one": "1⃣",
"open_file_folder": "📂",
"open_hands": "👐",
"open_mouth": "😮",
"ophiuchus": "⛎",
"orange_book": "📙",
"outbox_tray": "📤",
"ox": "🐂",
"package": "📦",
"page_facing_up": "📄",
"page_with_curl": "📃",
"pager": "📟",
"palm_tree": "🌴",
"panda_face": "🐼",
"paperclip": "📎",
"parking": "🅿",
"part_alternation_mark": "〽",
"partly_sunny": "⛅",
"passport_control": "🛂",
"paw_prints": "🐾",
"peach": "🍑",
"pear": "🍐",
"pencil": "📝",
"pencil2": "✏",
"penguin": "🐧",
"pensive": "😔",
"performing_arts": "🎭",
"persevere": "😣",
"person_frowning": "🙍",
"person_with_blond_hair": "👱",
"person_with_pouting_face": "🙎",
"phone": "☎",
"pig": "🐷",
"pig2": "🐖",
"pig_nose": "🐽",
"pill": "💊",
"pineapple": "🍍",
"pisces": "♓",
"pizza": "🍕",
"point_down": "👇",
"point_left": "👈",
"point_right": "👉",
"point_up": "☝",
"point_up_2": "👆",
"police_car": "🚓",
"poodle": "🐩",
"poop": "💩",
"postal_horn": "📯",
"postbox": "📮",
"potable_water": "🚰",
"pouch": "👝",
"poultry_leg": "🍗",
"pound": "💷",
"pouting_cat": "😾",
"pray": "🙏",
"princess": "👸",
"punch": "👊",
"purple_heart": "💜",
"purse": "👛",
"pushpin": "📌",
"put_litter_in_its_place": "🚮",
"question": "❓",
"r": `${imgStaticPath}/r.png`,
"rabbit": "🐰",
"rabbit2": "🐇",
"racehorse": "🐎",
"radio": "📻",
"radio_button": "🔘",
"rage": "😡",
"railway_car": "🚃",
"rainbow": "🌈",
"raised_hand": "✋",
"raised_hands": "🙌",
"raising_hand": "🙋",
"ram": "🐏",
"ramen": "🍜",
"rat": "🐀",
"recycle": "♻",
"red_car": "🚗",
"red_circle": "🔴",
"registered": "®",
"relaxed": "☺",
"relieved": "😌",
"repeat": "🔁",
"repeat_one": "🔂",
"restroom": "🚻",
"revolving_hearts": "💞",
"rewind": "⏪",
"ribbon": "🎀",
"rice": "🍚",
"rice_ball": "🍙",
"rice_cracker": "🍘",
"rice_scene": "🎑",
"ring": "💍",
"rocket": "🚀",
"roller_coaster": "🎢",
"rooster": "🐓",
"rose": "🌹",
"rotating_light": "🚨",
"round_pushpin": "📍",
"rowboat": "🚣",
"ru": "🇷🇺",
"rugby_football": "🏉",
"running": "🏃",
"running_shirt_with_sash": "🎽",
"sa": "🇸🇦",
"sagittarius": "♐",
"sailboat": "⛵",
"sake": "🍶",
"sandal": "👡",
"santa": "🎅",
"satellite": "🛰",
"satisfied": "😆",
"saxophone": "🎷",
"school": "🏫",
"school_satchel": "🎒",
"scissors": "✂",
"scorpius": "♏",
"scream": "😱",
"scream_cat": "🙀",
"scroll": "📜",
"seat": "💺",
"secret": "㊙",
"see_no_evil": "🙈",
"seedling": "🌱",
"seven": "7⃣",
"shaved_ice": "🍧",
"sheep": "🐑",
"shell": "🐚",
"ship": "🚢",
"shirt": "👕",
"shoe": "👞",
"shower": "🚿",
"signal_strength": "📶",
"six": "6⃣",
"six_pointed_star": "🔯",
"ski": "🎿",
"skull": "💀",
"sleeping": "😴",
"sleepy": "😪",
"slot_machine": "🎰",
"small_blue_diamond": "🔹",
"small_orange_diamond": "🔸",
"small_red_triangle": "🔺",
"small_red_triangle_down": "🔻",
"smile": "😄",
"smile_cat": "😸",
"smiley": "😃",
"smiley_cat": "😺",
"smiling_imp": "😈",
"smirk": "😏",
"smirk_cat": "😼",
"smoking": "🚬",
"snail": "🐌",
"snake": "🐍",
"snowboarder": "🏂",
"snowflake": "❄",
"snowman": "⛄",
"sob": "😭",
"soccer": "⚽",
"soon": "🔜",
"sos": "🆘",
"sound": "🔉",
"space_invader": "👾",
"spades": "♠",
"spaghetti": "🍝",
"sparkle": "❇",
"sparkler": "🎇",
"sparkles": "✨",
"sparkling_heart": "💖",
"speak_no_evil": "🙊",
"speaker": "🔈",
"speech_balloon": "💬",
"speedboat": "🚤",
"squirrel": "🐿",
"star": "⭐",
"star2": "🌟",
"stars": "🌠",
"station": "🚉",
"statue_of_liberty": "🗽",
"steam_locomotive": "🚂",
"stew": "🍲",
"straight_ruler": "📏",
"strawberry": "🍓",
"stuck_out_tongue": "😛",
"stuck_out_tongue_closed_eyes": "😝",
"stuck_out_tongue_winking_eye": "😜",
"sun_with_face": "🌞",
"sunflower": "🌻",
"sunglasses": "😎",
"sunny": "☀",
"sunrise": "🌅",
"sunrise_over_mountains": "🌄",
"surfer": "🏄",
"sushi": "🍣",
"suspension_railway": "🚟",
"sweat": "😓",
"sweat_drops": "💦",
"sweat_smile": "😅",
"sweet_potato": "🍠",
"swimmer": "🏊",
"symbols": "🔣",
"syringe": "💉",
"tada": "🎉",
"tanabata_tree": "🎋",
"tangerine": "🍊",
"taurus": "♉",
"taxi": "🚕",
"tea": "🍵",
"telephone": "☎",
"telephone_receiver": "📞",
"telescope": "🔭",
"tennis": "🎾",
"tent": "🏕",
"thought_balloon": "💭",
"three": "3⃣",
"thumbsdown": "👎",
"thumbsup": "👍",
"ticket": "🎫",
"tiger": "🐯",
"tiger2": "🐅",
"tired_face": "😫",
"tm": "🇹🇲",
"toilet": "🚽",
"tokyo_tower": "🗼",
"tomato": "🍅",
"tongue": "👅",
"top": "🔝",
"tophat": "🎩",
"tractor": "🚜",
"traffic_light": "🚥",
"train": "🚋",
"train2": "🚆",
"tram": "🚊",
"triangular_flag_on_post": "🚩",
"triangular_ruler": "📐",
"trident": "🔱",
"triumph": "😤",
"trolleybus": "🚎",
"trollface": `${imgStaticPath}/trollface.png`,
"trophy": "🏆",
"tropical_drink": "🍹",
"tropical_fish": "🐠",
"truck": "🚚",
"trumpet": "🎺",
"tshirt": "👕",
"tulip": "🌷",
"turtle": "🐢",
"tv": "🇹🇻",
"twisted_rightwards_arrows": "🔀",
"two": "2⃣",
"two_hearts": "💕",
"two_men_holding_hands": "👬",
"two_women_holding_hands": "👭",
"u": `${imgStaticPath}/u.png`,
"u5272": "🈹",
"u5408": "🈴",
"u55b6": "🈺",
"u6307": "🈯",
"u6708": "🈷",
"u6709": "🈶",
"u6e80": "🈵",
"u7121": "🈚",
"u7533": "🈸",
"u7981": "🈲",
"u7a7a": "🈳",
"umbrella": "☔",
"unamused": "😒",
"underage": "🔞",
"unicorn_face": "🦄",
"unlock": "🔓",
"up": "🆙",
"us": "🇺🇸",
"v": "✌",
"vertical_traffic_light": "🚦",
"vhs": "📼",
"vibration_mode": "📳",
"video_camera": "📹",
"video_game": "🎮",
"violin": "🎻",
"virgo": "♍",
"volcano": "🌋",
"vs": "🆚",
"walking": "🚶",
"waning_crescent_moon": "🌘",
"waning_gibbous_moon": "🌖",
"warning": "⚠",
"watch": "⌚",
"water_buffalo": "🐃",
"watermelon": "🍉",
"wave": "👋",
"wavy_dash": "〰",
"waxing_crescent_moon": "🌒",
"waxing_gibbous_moon": "🌔",
"wc": "🚾",
"weary": "😩",
"wedding": "💒",
"whale": "🐳",
"whale2": "🐋",
"wheelchair": "♿",
"white_check_mark": "✅",
"white_circle": "⚪",
"white_flower": "💮",
"white_large_square": "⬜",
"white_medium_small_square": "◽",
"white_medium_square": "◻",
"white_small_square": "▫",
"white_square_button": "🔳",
"wind_chime": "🎐",
"wine_glass": "🍷",
"wink": "😉",
"wolf": "🐺",
"woman": "👩",
"womans_clothes": "👚",
"womans_hat": "👒",
"womens": "🚺",
"worried": "😟",
"wrench": "🔧",
"x": "❌",
"yellow_heart": "💛",
"yen": "💴",
"yum": "😋",
"zap": "⚡",
"zero": "0⃣",
"zzz": "💤",
};
};

@@ -0,22 +1,17 @@

import {insertText} from "../editor/index";
import {getTextareaPosition} from "../util/textareaPosition";
import {insertText} from "../editor/index";
import {allEmoji} from "../emoji/allEmoji";
export class Hint {
timeId: number
editorElement: HTMLTextAreaElement
element: HTMLUListElement
atUser: { (value: string): Array<any> }
commonEmoji: any
hintDelay: number
public timeId: number;
public editorElement: HTMLTextAreaElement;
public element: HTMLUListElement;
public hint: IHint;
constructor(vditor: Vditor) {
this.timeId = -1
this.hintDelay = vditor.options.hint.delay
this.editorElement = vditor.editor.element
this.atUser = vditor.options.hint.at
this.commonEmoji = vditor.options.hint.emoji
constructor(vditor: IVditor) {
this.timeId = -1;
this.hint = vditor.options.hint;
this.editorElement = vditor.editor.element;
this.element = document.createElement('ul')
this.element.className = 'vditor-hint'
this.element = document.createElement("ul");
this.element.className = "vditor-hint";

@@ -26,43 +21,43 @@ this.editorElement.parentElement.appendChild(this.element);

render() {
const valueArray = this.editorElement.value.substr(0, this.editorElement.selectionStart).split('\n')
const currentLineValue = valueArray.slice(-1).pop()
const atKey = this.getKey(currentLineValue, '@')
const emojiKey = this.getKey(currentLineValue, ':')
public render() {
const valueArray = this.editorElement.value.substr(0, this.editorElement.selectionStart).split("\n");
const currentLineValue = valueArray.slice(-1).pop();
const atKey = this.getKey(currentLineValue, "@");
const emojiKey = this.getKey(currentLineValue, ":");
if (atKey === undefined && emojiKey === undefined) {
this.element.style.display = 'none'
clearTimeout(this.timeId)
this.element.style.display = "none";
clearTimeout(this.timeId);
} else {
if (atKey !== undefined && this.atUser) {
clearTimeout(this.timeId)
if (atKey !== undefined && this.hint.at) {
clearTimeout(this.timeId);
this.timeId = setTimeout(() => {
this.genHTML(this.atUser(atKey), atKey)
}, this.hintDelay)
this.genHTML(this.hint.at(atKey), atKey);
}, this.hint.delay);
}
if (emojiKey !== undefined) {
import(/* webpackChunkName: "vendors~vditor" */ '../emoji/allEmoji')
.then(allEmoji => {
let emojiHint = emojiKey === '' ? this.commonEmoji : allEmoji.allEmoji
let matchEmojiData: Array<any> = []
import(/* webpackChunkName: "vendors~vditor" */ "../emoji/allEmoji")
.then((allEmoji) => {
const emojiHint = emojiKey === "" ? this.hint.emoji : allEmoji.getAllEmoji(this.hint.emojiPath);
const matchEmojiData: IHintData[] = [];
Object.keys(emojiHint).forEach((key) => {
if (key.indexOf(emojiKey.toLowerCase()) === 0) {
if (emojiHint[key].indexOf('.') > -1) {
if (emojiHint[key].indexOf(".") > -1) {
matchEmojiData.push({
html: `<img src="${emojiHint[key]}" title=":${key}:"/> :${key}:`,
value: `:${key}:`,
html: `<img src="${emojiHint[key]}" title=":${key}:"/> :${key}:`
})
});
} else {
matchEmojiData.push({
html: `${emojiHint[key]} ${key}`,
value: emojiHint[key],
html: `${emojiHint[key]} ${key}`
})
});
}
}
})
this.genHTML(matchEmojiData, emojiKey)
});
this.genHTML(matchEmojiData, emojiKey);
})
.catch(err => {
console.log('Failed to load emoji', err)
})
.catch((err) => {
console.error("Failed to load emoji", err);
});
}

@@ -74,82 +69,84 @@ }

if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
String.prototype.trim = function() {
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
};
}
const lineArray = currentLineValue.split(splitChar)
const lineArray = currentLineValue.split(splitChar);
let key = undefined
let key;
if (lineArray.length > 1) {
if (lineArray.length === 2 && lineArray[0] === '') {
if ((lineArray[1] === '' || lineArray[1].trim() !== '') &&
lineArray[1].indexOf(' ') === -1 &&
if (lineArray.length === 2 && lineArray[0] === "") {
if ((lineArray[1] === "" || lineArray[1].trim() !== "") &&
lineArray[1].indexOf(" ") === -1 &&
lineArray[1].length < 33) {
key = lineArray[1]
key = lineArray[1];
}
} else {
const prefAt = lineArray[lineArray.length - 2]
const currentAt = lineArray.slice(-1).pop()
if (prefAt.slice(-1) === ' ' && currentAt.indexOf(' ') === -1 &&
((currentAt === '' || currentAt.trim() !== '') &&
const prefAt = lineArray[lineArray.length - 2];
const currentAt = lineArray.slice(-1).pop();
if (prefAt.slice(-1) === " " && currentAt.indexOf(" ") === -1 &&
((currentAt === "" || currentAt.trim() !== "") &&
currentAt.length < 33)) {
key = currentAt
key = currentAt;
}
}
}
return key
return key;
}
private genHTML(data: Array<any>, key: string) {
private genHTML(data: IHintData[], key: string) {
if (data.length === 0) {
this.element.style.display = 'none'
return
this.element.style.display = "none";
return;
}
const textareaPosition = getTextareaPosition(this.editorElement)
const x = textareaPosition.left
const y = textareaPosition.top - 4
let hintsHTML = ''
const textareaPosition = getTextareaPosition(this.editorElement);
const x = textareaPosition.left;
const y = textareaPosition.top - 4;
let hintsHTML = "";
data.forEach((hintData, i) => {
if (i > 7) {
return
return;
}
// process high light
let html = hintData.html
if (key !== '') {
const lastIndex = html.lastIndexOf('>') + 1
let replaceHtml = html.substr(lastIndex)
const replaceIndex = replaceHtml.toLowerCase().indexOf(key.toLowerCase())
let html = hintData.html;
if (key !== "") {
const lastIndex = html.lastIndexOf(">") + 1;
let replaceHtml = html.substr(lastIndex);
const replaceIndex = replaceHtml.toLowerCase().indexOf(key.toLowerCase());
if (replaceIndex > -1) {
replaceHtml = replaceHtml.substring(0, replaceIndex) + '<b>' +
replaceHtml.substring(replaceIndex, replaceIndex + key.length) + '</b>' +
replaceHtml.substring(replaceIndex + key.length)
html = html.substr(0, lastIndex) + replaceHtml
replaceHtml = replaceHtml.substring(0, replaceIndex) + "<b>" +
replaceHtml.substring(replaceIndex, replaceIndex + key.length) + "</b>" +
replaceHtml.substring(replaceIndex + key.length);
html = html.substr(0, lastIndex) + replaceHtml;
}
}
hintsHTML += `<li data-value="${hintData.value} " class="${i || 'vditor-hint--current'}"> ${html}</li>`
})
hintsHTML += `<li data-value="${hintData.value} " class="${i || "vditor-hint--current"}"> ${html}</li>`;
});
this.element.innerHTML = hintsHTML
this.element.style.top = `${y}px`
this.element.style.left = `${x}px`
this.element.style.display = 'block'
this.element.innerHTML = hintsHTML;
this.element.style.top = `${y}px`;
this.element.style.left = `${x}px`;
this.element.style.display = "block";
this.element.querySelectorAll('li').forEach((element) => {
element.addEventListener('click', () => {
this.element.style.display = 'none'
this.element.querySelectorAll("li").forEach((element) => {
element.addEventListener("click", () => {
this.element.style.display = "none";
const value = element.getAttribute('data-value')
const splitChar = value.indexOf('@') === 0 ? '@' : ':'
const value = element.getAttribute("data-value");
const splitChar = value.indexOf("@") === 0 ? "@" : ":";
this.editorElement.selectionStart = this.editorElement.value.substr(0, this.editorElement.selectionEnd).lastIndexOf(splitChar)
insertText(this.editorElement, value, '', true)
})
})
this.editorElement.selectionStart = this.editorElement.value.substr(0, this.editorElement.selectionEnd).
lastIndexOf(splitChar);
insertText(this.editorElement, value, "", true);
});
});
// hint 展现在上部
if (y + this.element.offsetHeight - this.editorElement.offsetHeight >
window.innerHeight - (this.editorElement.parentElement.offsetHeight + this.editorElement.parentElement.offsetTop - document.documentElement.scrollTop)) {
this.element.style.top = `${y - this.element.offsetHeight}px`
window.innerHeight - (this.editorElement.parentElement.offsetHeight +
this.editorElement.parentElement.offsetTop - document.documentElement.scrollTop)) {
this.element.style.top = `${y - this.element.offsetHeight}px`;
}
}
}
}
import {insertText} from "../editor/index";
export class Hotkey {
editorElement: HTMLTextAreaElement
toolbarElements: any
options: Options
hintElement: HTMLElement
public editorElement: HTMLTextAreaElement;
public toolbarElements: { [key: string]: HTMLElement };
public options: IOptions;
public hintElement: HTMLElement;
constructor(vditor: Vditor) {
this.editorElement = vditor.editor.element
this.toolbarElements = vditor.toolbar.elements
this.options = vditor.options
this.hintElement = vditor.hint.element
this.bindHotkey()
constructor(vditor: IVditor) {
this.editorElement = vditor.editor.element;
this.toolbarElements = vditor.toolbar.elements;
this.options = vditor.options;
this.hintElement = vditor.hint.element;
this.bindHotkey();
}
private bindHotkey(): void {
this.editorElement.addEventListener('keydown', (event) => {
this.editorElement.addEventListener("keydown", (event) => {
if (this.options.esc) {
if (event.key.toLowerCase() === 'Escape'.toLowerCase()) {
this.options.esc(this.editorElement.value)
if (event.key.toLowerCase() === "Escape".toLowerCase()) {
this.options.esc(this.editorElement.value);
}

@@ -26,66 +26,67 @@ }

if (this.options.ctrlEnter) {
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'enter') {
this.options.ctrlEnter(this.editorElement.value)
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "enter") {
this.options.ctrlEnter(this.editorElement.value);
}
}
this.options.toolbar.forEach((menuItem: MenuItem) => {
this.options.toolbar.forEach((menuItem: IMenuItem) => {
if (!menuItem.hotkey) {
return
return;
}
const hotkeys = menuItem.hotkey.split('-')
if ((hotkeys[0] === 'ctrl' || hotkeys[0] === '⌘') && (event.metaKey || event.ctrlKey)) {
const hotkeys = menuItem.hotkey.split("-");
if ((hotkeys[0] === "ctrl" || hotkeys[0] === "⌘") && (event.metaKey || event.ctrlKey)) {
if (event.key === hotkeys[1]) {
this.toolbarElements[menuItem.name].children[0].click()
event.preventDefault()
event.stopPropagation()
(this.toolbarElements[menuItem.name].children[0] as HTMLElement).click();
event.preventDefault();
event.stopPropagation();
}
}
})
});
if (this.options.hint.at || this.toolbarElements.emoji) {
this.hint(event)
this.hint(event);
}
})
});
}
private hint(event: KeyboardEvent) {
if (this.hintElement.querySelectorAll('li').length === 0 ||
this.hintElement.style.display === 'none') {
return
if (this.hintElement.querySelectorAll("li").length === 0 ||
this.hintElement.style.display === "none") {
return;
}
const currentHintElement = this.hintElement.querySelector('.vditor-hint--current')
const currentHintElement = this.hintElement.querySelector(".vditor-hint--current");
if (event.key.toLowerCase() === 'arrowdown') {
event.preventDefault()
event.stopPropagation()
if (event.key.toLowerCase() === "arrowdown") {
event.preventDefault();
event.stopPropagation();
if (!currentHintElement.nextElementSibling) {
this.hintElement.children[0].className = 'vditor-hint--current'
this.hintElement.children[0].className = "vditor-hint--current";
} else {
currentHintElement.nextElementSibling.className = 'vditor-hint--current'
currentHintElement.nextElementSibling.className = "vditor-hint--current";
}
currentHintElement.removeAttribute('class')
} else if (event.key.toLowerCase() === 'arrowup') {
event.preventDefault()
event.stopPropagation()
currentHintElement.removeAttribute("class");
} else if (event.key.toLowerCase() === "arrowup") {
event.preventDefault();
event.stopPropagation();
if (!currentHintElement.previousElementSibling) {
const length = this.hintElement.children.length
this.hintElement.children[length - 1].className = 'vditor-hint--current'
const length = this.hintElement.children.length;
this.hintElement.children[length - 1].className = "vditor-hint--current";
} else {
currentHintElement.previousElementSibling.className = 'vditor-hint--current'
currentHintElement.previousElementSibling.className = "vditor-hint--current";
}
currentHintElement.removeAttribute('class')
} else if (event.key.toLowerCase() === 'enter') {
event.preventDefault()
event.stopPropagation()
this.hintElement.style.display = 'none'
currentHintElement.removeAttribute("class");
} else if (event.key.toLowerCase() === "enter") {
event.preventDefault();
event.stopPropagation();
this.hintElement.style.display = "none";
const value = currentHintElement.getAttribute('data-value')
const splitChar = value.indexOf('@') === 0 ? '@' : ':'
const value = currentHintElement.getAttribute("data-value");
const splitChar = value.indexOf("@") === 0 ? "@" : ":";
this.editorElement.selectionStart = this.editorElement.value.substr(0, this.editorElement.selectionEnd).lastIndexOf(splitChar)
insertText(this.editorElement, value, '', true)
this.editorElement.selectionStart = this.editorElement.value.substr(0, this.editorElement.selectionEnd).
lastIndexOf(splitChar);
insertText(this.editorElement, value, "", true);
}
}
}
}

@@ -1,56 +0,56 @@

export const i18n: any = {
export const i18n: II18n = {
en_US: {
emoji: 'Emoji',
bold: 'Blod',
headings: 'Headings',
italic: 'Italic',
quote: 'Quote',
link: 'Link',
'ordered-list': 'Order List',
list: 'List',
fullscreen: 'Fullscreen',
help: 'Help',
strike: 'Strike',
line: 'Line',
check: 'Task List',
code: 'Code Block',
'inline-code': 'Inline Code',
redo: 'Redo',
undo: 'Undo',
table: 'Table',
record: 'Start Record/End Record',
upload: 'Upload image or file',
preview: 'Preview',
uploading: 'uploading...',
over: 'over',
recoding: 'recoding...',
info: 'Info'
"bold": "Blod",
"check": "Task List",
"code": "Code Block",
"emoji": "Emoji",
"fullscreen": "Fullscreen",
"headings": "Headings",
"help": "Help",
"info": "Info",
"inline-code": "Inline Code",
"italic": "Italic",
"line": "Line",
"link": "Link",
"list": "List",
"ordered-list": "Order List",
"over": "over",
"preview": "Preview",
"quote": "Quote",
"record": "Start Record/End Record",
"recording": "recording...",
"redo": "Redo",
"strike": "Strike",
"table": "Table",
"undo": "Undo",
"upload": "Upload image or file",
"uploading": "uploading...",
},
zh_CN: {
emoji: '表情',
bold: '粗体',
headings: '标题',
italic: '斜体',
quote: '引用',
link: '链接',
'ordered-list': '有序列表',
list: '无序列表',
fullscreen: '全屏',
help: '帮助',
strike: '删除线',
line: '分隔线',
check: '任务列表',
code: '代码块',
'inline-code': '行内代码',
redo: '重做',
undo: '撤销',
table: '表格',
record: '开始录音/结束录音',
upload: '上传图片或文件',
preview: '预览',
uploading: '上传中...',
over: '超过',
recoding: '录音中...',
info: '关于'
}
}
"bold": "粗体",
"check": "任务列表",
"code": "代码块",
"emoji": "表情",
"fullscreen": "全屏",
"headings": "标题",
"help": "帮助",
"info": "关于",
"inline-code": "行内代码",
"italic": "斜体",
"line": "分隔线",
"link": "链接",
"list": "无序列表",
"ordered-list": "有序列表",
"over": "超过",
"preview": "预览",
"quote": "引用",
"record": "开始录音/结束录音",
"recording": "录音中...",
"redo": "重做",
"strike": "删除线",
"table": "表格",
"undo": "撤销",
"upload": "上传图片或文件",
"uploading": "上传中...",
},
};
export class Preview {
element: HTMLElement
public element: HTMLElement;
constructor(vditor: Vditor) {
this.element = document.createElement('div')
this.element.className = 'vditor-preview' +
(vditor.options.classes.preview ? ' ' + vditor.options.classes.preview : '')
constructor(vditor: IVditor) {
this.element = document.createElement("div");
this.element.className = "vditor-preview" +
(vditor.options.classes.preview ? " " + vditor.options.classes.preview : "");
if (!vditor.options.preview.show) {
this.element.style.display = 'none'
this.element.style.display = "none";
}
if (this.element.style.display !== 'none') {
this.render(vditor)
if (this.element.style.display !== "none") {
this.render(vditor);
}
}
render(vditor: Vditor, value?: string) {
if (this.element.style.display === 'none') {
return
public render(vditor: IVditor, value?: string) {
if (this.element.style.display === "none") {
return;
}
if (value) {
this.element.innerHTML = value
return
this.element.innerHTML = value;
return;
}
if (vditor.editor.element.value.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '') === '') {
this.element.innerHTML = ''
return
if (vditor.editor.element.value.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "") === "") {
this.element.innerHTML = "";
return;
}
if (vditor.options.preview.url) {
clearTimeout(vditor.mdTimeoutId)
clearTimeout(vditor.mdTimeoutId);
vditor.mdTimeoutId = setTimeout(() => {
const xhr = new XMLHttpRequest()
xhr.open('POST', vditor.options.preview.url)
const xhr = new XMLHttpRequest();
xhr.open("POST", vditor.options.preview.url);
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
const responseJSON = JSON.parse(xhr.responseText)
const responseJSON = JSON.parse(xhr.responseText);
if (responseJSON.code !== 0) {
alert(responseJSON.msg)
return
alert(responseJSON.msg);
return;
}
this.element.innerHTML = responseJSON.data
this.element.innerHTML = responseJSON.data;
if (vditor.options.preview.parse) {
vditor.options.preview.parse(this.element)
vditor.options.preview.parse(this.element);
}
}
}
}
};
xhr.send(JSON.stringify({
markdownText: vditor.editor.element.value,
}))
}, vditor.options.preview.delay)
}));
}, vditor.options.preview.delay);
} else {
this.element.innerHTML = vditor.editor.element.value
this.element.innerHTML = vditor.editor.element.value;
}
}
}
}

@@ -1,67 +0,55 @@

import resizeSVG from '../../assets/icons/resize.svg'
import resizeSVG from "../../assets/icons/resize.svg";
export class Resize {
element: HTMLElement
public element: HTMLElement;
constructor(vditor: Vditor) {
this.element = document.createElement('div')
this.element.className = 'vditor-resize'
this.element.innerHTML = resizeSVG
constructor(vditor: IVditor) {
this.element = document.createElement("div");
this.element.className = "vditor-resize";
this.element.innerHTML = resizeSVG;
this.bindEvent(vditor)
this.bindEvent(vditor);
}
private bindEvent(vditor: Vditor) {
this.element.addEventListener('mousedown', function (event: any) {
private bindEvent(vditor: IVditor) {
this.element.addEventListener("mousedown", (event: MouseEvent) => {
const _document: any = document;
const vditorElement = document.getElementById(vditor.id)
if (!event) {
event = window.event;
}
const documentSelf = document as IDocument;
const vditorElement = document.getElementById(vditor.id);
const y = event.clientY;
const height = vditorElement.offsetHeight
_document.ondragstart = "return false;";
_document.onselectstart = "return false;";
_document.onselect = "document.selection.empty();";
const height = vditorElement.offsetHeight;
documentSelf.ondragstart = () => false;
documentSelf.onselectstart = "return false;";
documentSelf.onselect = () => {
(document as IDocument).selection.empty();
};
// @ts-ignore
if (this.setCapture) {
// @ts-ignore
this.setCapture()
} else if (window.captureEvents) {
// @ts-ignore
window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
if (window.captureEvents) {
window.captureEvents();
}
_document.onmousemove = function (event: any) {
if (!event) {
event = window.event
}
if (vditor.options.resize.position === 'top') {
vditorElement.style.height = Math.max(100, height + (y - event.clientY)) + 'px'
documentSelf.onmousemove = (moveEvent: MouseEvent) => {
if (vditor.options.resize.position === "top") {
vditorElement.style.height = Math.max(100, height + (y - moveEvent.clientY)) + "px";
} else {
vditorElement.style.height = Math.max(100, height + (event.clientY - y)) + 'px'
vditorElement.style.height = Math.max(100, height + (moveEvent.clientY - y)) + "px";
}
};
_document.onmouseup = function () {
documentSelf.onmouseup = () => {
if (vditor.options.resize.after) {
vditor.options.resize.after(vditorElement.offsetHeight - height)
vditor.options.resize.after(vditorElement.offsetHeight - height);
}
if (this.releaseCapture) {
this.releaseCapture();
} else if (window.captureEvents) {
// @ts-ignore
window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
if (window.captureEvents) {
window.captureEvents();
}
_document.onmousemove = null;
_document.onmouseup = null;
_document.ondragstart = null;
_document.onselectstart = null;
_document.onselect = null;
}
})
documentSelf.onmousemove = null;
documentSelf.onmouseup = null;
documentSelf.ondragstart = null;
documentSelf.onselectstart = null;
documentSelf.onselect = null;
};
});
}
}
}
import boldSVG from "../../assets/icons/bold.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Bold extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || boldSVG
this.bindEvent()
export class Bold extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || boldSVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
export class Br {
element: HTMLElement
public element: HTMLElement;
constructor() {
this.element = document.createElement('div')
this.element.className = 'vditor-menu__br'
this.element = document.createElement("div");
this.element.className = "vditor-menu__br";
}
}
}
import checkSVG from "../../assets/icons/check.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Check extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || checkSVG
this.bindEvent()
export class Check extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || checkSVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
import codeSVG from "../../assets/icons/code.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Code extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || codeSVG
this.bindEvent()
export class Code extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || codeSVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
export class Divider {
element: HTMLElement
public element: HTMLElement;
constructor() {
this.element = document.createElement('div')
this.element.className = 'vditor-menu__divider'
this.element = document.createElement("div");
this.element.className = "vditor-menu__divider";
}
}
}
import emojiSVG from "../../assets/icons/emoji.svg";
import {MenuItemClass} from "./MenuItemClass";
import {insertText} from "../editor/index";
import {MenuItem} from "./MenuItem";
export class Emoji extends MenuItemClass {
element: HTMLElement
export class Emoji extends MenuItem {
public element: HTMLElement;
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || emojiSVG
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || emojiSVG;
const emojiPanelElement = document.createElement('div')
emojiPanelElement.className = 'vditor-panel'
const emojiPanelElement = document.createElement("div");
emojiPanelElement.className = "vditor-panel";
let commonEmojiHTML = ''
let commonEmojiHTML = "";
Object.keys(vditor.options.hint.emoji).forEach((key) => {
const emojiValue = vditor.options.hint.emoji[key]
if (emojiValue.indexOf('.') > -1) {
commonEmojiHTML += `<span data-value=":${key}: " title=":${key}:"><img data-value=":${key}: " src="${emojiValue}"/></span>`
const emojiValue = vditor.options.hint.emoji[key];
if (emojiValue.indexOf(".") > -1) {
commonEmojiHTML += `<span data-value=":${key}: " title=":${key}:"><img data-value=":${key}: "
src="${emojiValue}"/></span>`;
} else {
commonEmojiHTML += `<span data-value="${emojiValue} " title="${key}">${emojiValue}</span>`
commonEmojiHTML += `<span data-value="${emojiValue} " title="${key}">${emojiValue}</span>`;
}
})
});
const tailHTML = vditor.options.hint.emojiTail ? `<div class="vditor-emojis__tail">${vditor.options.hint.emojiTail}</div>` : ''
const tailHTML = vditor.options.hint.emojiTail ?
`<div class="vditor-emojis__tail">${vditor.options.hint.emojiTail}</div>` : "";
emojiPanelElement.innerHTML = `<div class="vditor-emojis">${commonEmojiHTML}</div>${tailHTML}`
emojiPanelElement.innerHTML = `<div class="vditor-emojis">${commonEmojiHTML}</div>${tailHTML}`;
this.element.appendChild(emojiPanelElement)
this.element.appendChild(emojiPanelElement);
this._bindEvent(emojiPanelElement, vditor)
this._bindEvent(emojiPanelElement, vditor);
}
_bindEvent(emojiPanelElement: HTMLElement, vditor: Vditor) {
this.element.children[0].addEventListener('click', () => {
if (emojiPanelElement.style.display === 'block') {
emojiPanelElement.style.display = 'none'
public _bindEvent(emojiPanelElement: HTMLElement, vditor: IVditor) {
this.element.children[0].addEventListener("click", () => {
if (emojiPanelElement.style.display === "block") {
emojiPanelElement.style.display = "none";
} else {
emojiPanelElement.style.display = 'block'
emojiPanelElement.style.display = "block";
if (vditor.toolbar.elements.headings) {
vditor.toolbar.elements.headings.children[1].style.display = 'none'
const headingsPanel = vditor.toolbar.elements.headings.children[1] as HTMLElement;
headingsPanel.style.display = "none";
}
}
})
});
emojiPanelElement.querySelectorAll('.vditor-emojis span').forEach((element) => {
element.addEventListener('click', (event: any) => {
insertText(vditor.editor.element, event.target.getAttribute('data-value'), '', true)
emojiPanelElement.style.display = 'none'
})
})
emojiPanelElement.querySelectorAll(".vditor-emojis span").forEach((element) => {
element.addEventListener("click", (event: Event) => {
insertText(vditor.editor.element, (event.target as HTMLElement).
getAttribute("data-value"), "", true);
emojiPanelElement.style.display = "none";
});
});
}
}
}

@@ -0,36 +1,36 @@

import contractSVG from "../../assets/icons/contract.svg";
import fullscreenSVG from "../../assets/icons/fullscreen.svg";
import contractSVG from "../../assets/icons/contract.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Fullscreen extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || fullscreenSVG
this._bindEvent(vditor, menuItem)
export class Fullscreen extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || fullscreenSVG;
this._bindEvent(vditor, menuItem);
}
_bindEvent(vditor: Vditor, menuItem:MenuItem) {
this.element.children[0].addEventListener('click', function() {
const vditorElement = document.getElementById(vditor.id)
if (vditorElement.className.indexOf('vditor--fullscreen') > -1) {
this.innerHTML = menuItem.icon || fullscreenSVG
vditorElement.className = vditorElement.className.replace(' vditor--fullscreen', '')
public _bindEvent(vditor: IVditor, menuItem: IMenuItem) {
this.element.children[0].addEventListener("click", function() {
const vditorElement = document.getElementById(vditor.id);
if (vditorElement.className.indexOf("vditor--fullscreen") > -1) {
this.innerHTML = menuItem.icon || fullscreenSVG;
vditorElement.className = vditorElement.className.replace(" vditor--fullscreen", "");
Object.keys(vditor.toolbar.elements).forEach((key) => {
const svgElement = vditor.toolbar.elements[key].firstChild
const svgElement = vditor.toolbar.elements[key].firstChild as HTMLElement;
if (svgElement) {
svgElement.className = svgElement.className.replace('__s', '__n')
svgElement.className = svgElement.className.replace("__s", "__n");
}
})
});
} else {
this.innerHTML = menuItem.icon || contractSVG
vditorElement.className = vditorElement.className + ' vditor--fullscreen'
this.innerHTML = menuItem.icon || contractSVG;
vditorElement.className = vditorElement.className + " vditor--fullscreen";
Object.keys(vditor.toolbar.elements).forEach((key) => {
const svgElement = vditor.toolbar.elements[key].firstChild
const svgElement = vditor.toolbar.elements[key].firstChild as HTMLElement;
if (svgElement) {
svgElement.className = svgElement.className.replace('__n', '__s')
svgElement.className = svgElement.className.replace("__n", "__s");
}
})
});
}
})
});
}
}
}
import headingsSVG from "../../assets/icons/headings.svg";
import {MenuItemClass} from "./MenuItemClass";
import {insertText} from "../editor/index";
import {MenuItem} from "./MenuItem";
export class Headings extends MenuItemClass {
element: HTMLElement
export class Headings extends MenuItem {
public element: HTMLElement;
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || headingsSVG
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || headingsSVG;
const headingsPanelElement = document.createElement('div')
headingsPanelElement.className = 'vditor-panel'
const headingsPanelElement = document.createElement("div");
headingsPanelElement.className = "vditor-panel";
headingsPanelElement.innerHTML = `<h1 data-value="# ">Heading 1</h1>

@@ -19,28 +19,29 @@ <h2 data-value="## ">Heading 2</h2>

<h5 data-value="##### ">Heading 5</h5>
<h6 data-value="###### ">Heading 6</h6>`
<h6 data-value="###### ">Heading 6</h6>`;
this.element.appendChild(headingsPanelElement)
this.element.appendChild(headingsPanelElement);
this._bindEvent(headingsPanelElement, vditor)
this._bindEvent(headingsPanelElement, vditor);
}
_bindEvent(headingsPanelElement: HTMLElement, vditor: Vditor) {
this.element.children[0].addEventListener('click', () => {
if (headingsPanelElement.style.display === 'block') {
headingsPanelElement.style.display = 'none'
public _bindEvent(headingsPanelElement: HTMLElement, vditor: IVditor) {
this.element.children[0].addEventListener("click", () => {
if (headingsPanelElement.style.display === "block") {
headingsPanelElement.style.display = "none";
} else {
headingsPanelElement.style.display = 'block'
headingsPanelElement.style.display = "block";
if (vditor.toolbar.elements.emoji) {
vditor.toolbar.elements.emoji.children[1].style.display = 'none'
const panel = vditor.toolbar.elements.emoji.children[1] as HTMLElement;
panel.style.display = "none";
}
}
})
});
for (let i = 0; i < 6; i++) {
headingsPanelElement.children.item(i).addEventListener('click', (event: any) => {
insertText(vditor.editor.element, event.target.getAttribute('data-value'), '')
headingsPanelElement.style.display = 'none'
})
headingsPanelElement.children.item(i).addEventListener("click", (event: Event) => {
insertText(vditor.editor.element, (event.target as HTMLElement).getAttribute("data-value"), "");
headingsPanelElement.style.display = "none";
});
}
}
}
}
import helpSVG from "../../assets/icons/help.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Help extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || helpSVG
this.bindEvent()
export class Help extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || helpSVG;
this.bindEvent();
}
bindEvent() {
this.element.children[0].addEventListener('click', () => {
window.open('https://hacpai.com/guide/markdown')
})
public bindEvent() {
this.element.children[0].addEventListener("click", () => {
window.open("https://hacpai.com/guide/markdown");
});
}
}
}

@@ -1,121 +0,121 @@

import {Emoji} from './Emoji'
import {Bold} from './Bold'
import {Bold} from "./Bold";
import {Br} from "./Br";
import {Check} from "./Check";
import {Code} from "./Code";
import {Divider} from "./Divider";
import {Emoji} from "./Emoji";
import {Fullscreen} from "./Fullscreen";
import {Headings} from "./Headings";
import {Divider} from "./Divider";
import {Br} from "./Br";
import {Help} from "./Help";
import {Info} from "./Info";
import {InlineCode} from "./InlineCode";
import {Italic} from "./Italic";
import {Strike} from "./Strike";
import {Line} from "./Line";
import {Quote} from "./Quote";
import {Link} from "./Link";
import {List} from "./List";
import {OrderedList} from "./OrderedList";
import {Check} from "./Check";
import {Undo} from "./Undo";
import {Preview} from "./Preview";
import {Quote} from "./Quote";
import {Record} from "./Record";
import {Redo} from "./Redo";
import {InlineCode} from "./InlineCode";
import {Code} from "./Code";
import {Link} from "./Link";
import {Help} from "./Help";
import {Strike} from "./Strike";
import {Table} from "./Table";
import {Preview} from "./Preview";
import {Fullscreen} from "./Fullscreen";
import {Undo} from "./Undo";
import {Upload} from "./Upload";
import {Record} from "./Record";
import {Info} from "./Info";
export class Toolbar {
elements: any
public elements: { [key: string]: HTMLElement };
constructor(vditor: Vditor) {
const options = vditor.options
this.elements = {}
constructor(vditor: IVditor) {
const options = vditor.options;
this.elements = {};
options.toolbar.forEach((menuItem: MenuItem, i: number) => {
let menuItemObj
options.toolbar.forEach((menuItem: IMenuItem, i: number) => {
let menuItemObj;
switch (menuItem.name) {
case 'emoji':
menuItemObj = new Emoji(vditor, menuItem)
break
case 'bold':
menuItemObj = new Bold(vditor, menuItem)
break
case 'headings':
menuItemObj = new Headings(vditor, menuItem)
break
case '|':
menuItemObj = new Divider()
break
case 'br':
menuItemObj = new Br()
break
case 'italic':
menuItemObj = new Italic(vditor, menuItem)
break
case 'strike':
menuItemObj = new Strike(vditor, menuItem)
break
case 'line':
menuItemObj = new Line(vditor, menuItem)
break
case 'quote':
menuItemObj = new Quote(vditor, menuItem)
break
case 'list':
menuItemObj = new List(vditor, menuItem)
break
case 'ordered-list':
menuItemObj = new OrderedList(vditor, menuItem)
break
case 'check':
menuItemObj = new Check(vditor, menuItem)
break
case 'undo':
menuItemObj = new Undo(vditor, menuItem)
break
case 'redo':
menuItemObj = new Redo(vditor, menuItem)
break
case 'code':
menuItemObj = new Code(vditor, menuItem)
break
case 'inline-code':
menuItemObj = new InlineCode(vditor, menuItem)
break
case 'link':
menuItemObj = new Link(vditor, menuItem)
break
case 'help':
menuItemObj = new Help(vditor, menuItem)
break
case 'table':
menuItemObj = new Table(vditor, menuItem)
break
case 'preview':
menuItemObj = new Preview(vditor, menuItem)
break
case 'fullscreen':
menuItemObj = new Fullscreen(vditor, menuItem)
break
case 'upload':
menuItemObj = new Upload(vditor, menuItem)
break
case 'record':
menuItemObj = new Record(vditor, menuItem)
break
case 'info':
menuItemObj = new Info(vditor, menuItem)
break
case "emoji":
menuItemObj = new Emoji(vditor, menuItem);
break;
case "bold":
menuItemObj = new Bold(vditor, menuItem);
break;
case "headings":
menuItemObj = new Headings(vditor, menuItem);
break;
case "|":
menuItemObj = new Divider();
break;
case "br":
menuItemObj = new Br();
break;
case "italic":
menuItemObj = new Italic(vditor, menuItem);
break;
case "strike":
menuItemObj = new Strike(vditor, menuItem);
break;
case "line":
menuItemObj = new Line(vditor, menuItem);
break;
case "quote":
menuItemObj = new Quote(vditor, menuItem);
break;
case "list":
menuItemObj = new List(vditor, menuItem);
break;
case "ordered-list":
menuItemObj = new OrderedList(vditor, menuItem);
break;
case "check":
menuItemObj = new Check(vditor, menuItem);
break;
case "undo":
menuItemObj = new Undo(vditor, menuItem);
break;
case "redo":
menuItemObj = new Redo(vditor, menuItem);
break;
case "code":
menuItemObj = new Code(vditor, menuItem);
break;
case "inline-code":
menuItemObj = new InlineCode(vditor, menuItem);
break;
case "link":
menuItemObj = new Link(vditor, menuItem);
break;
case "help":
menuItemObj = new Help(vditor, menuItem);
break;
case "table":
menuItemObj = new Table(vditor, menuItem);
break;
case "preview":
menuItemObj = new Preview(vditor, menuItem);
break;
case "fullscreen":
menuItemObj = new Fullscreen(vditor, menuItem);
break;
case "upload":
menuItemObj = new Upload(vditor, menuItem);
break;
case "record":
menuItemObj = new Record(vditor, menuItem);
break;
case "info":
menuItemObj = new Info(vditor, menuItem);
break;
default:
console.log('menu item no matched')
break
console.error("menu item no matched");
break;
}
let key = menuItem.name
if (key === 'br' || key === '|') {
key = key + i
let key = menuItem.name;
if (key === "br" || key === "|") {
key = key + i;
}
this.elements[key] = menuItemObj.element
})
this.elements[key] = menuItemObj.element;
});
}
}
}
import infoSVG from "../../assets/icons/info.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Info extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || infoSVG
this.bindEvent()
export class Info extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || infoSVG;
this.bindEvent();
}
bindEvent() {
this.element.children[0].addEventListener('click', () => {
window.open('https://github.com/b3log/vditor')
})
public bindEvent() {
this.element.children[0].addEventListener("click", () => {
window.open("https://github.com/b3log/vditor");
});
}
}
}
import inlineCodeSVG from "../../assets/icons/inline-code.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class InlineCode extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || inlineCodeSVG
this.bindEvent()
export class InlineCode extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || inlineCodeSVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
import italicSVG from "../../assets/icons/italic.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Italic extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || italicSVG
this.bindEvent()
export class Italic extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || italicSVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
import lineSVG from "../../assets/icons/line.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Line extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || lineSVG
this.bindEvent()
export class Line extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || lineSVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
import linkSVG from "../../assets/icons/link.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Link extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || linkSVG
this.bindEvent()
export class Link extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || linkSVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
import listSVG from "../../assets/icons/list.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class List extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || listSVG
this.bindEvent()
export class List extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || listSVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
import orderedListVG from "../../assets/icons/ordered-list.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class OrderedList extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || orderedListVG
this.bindEvent()
export class OrderedList extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || orderedListVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
import previewSVG from "../../assets/icons/preview.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Preview extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || previewSVG
export class Preview extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || previewSVG;
if (vditor.options.preview.show) {
this.element.children[0].className = `vditor-tooltipped vditor-tooltipped__${menuItem.tipPosition} vditor-menu--current`
this.element.children[0].className =
`vditor-tooltipped vditor-tooltipped__${menuItem.tipPosition} vditor-menu--current`;
}
this._bindEvent(vditor, menuItem)
this._bindEvent(vditor, menuItem);
}
_bindEvent(vditor: Vditor, menuItem: MenuItem) {
this.element.children[0].addEventListener('click', function () {
const vditorElement = document.getElementById(vditor.id)
let className
if (vditor.preview.element.style.display === 'block') {
vditor.preview.element.style.display = 'none'
className = `vditor-tooltipped vditor-tooltipped__${menuItem.tipPosition}`
public _bindEvent(vditor: IVditor, menuItem: IMenuItem) {
this.element.children[0].addEventListener("click", function() {
const vditorElement = document.getElementById(vditor.id);
let className;
if (vditor.preview.element.style.display === "block") {
vditor.preview.element.style.display = "none";
className = `vditor-tooltipped vditor-tooltipped__${menuItem.tipPosition}`;
} else {
vditor.preview.element.style.display = 'block'
className = `vditor-tooltipped vditor-tooltipped__${menuItem.tipPosition} vditor-menu--current`
vditor.preview.render(vditor)
vditor.preview.element.style.display = "block";
className = `vditor-tooltipped vditor-tooltipped__${menuItem.tipPosition} vditor-menu--current`;
vditor.preview.render(vditor);
}
if (vditorElement.className.indexOf('vditor--fullscreen') > -1) {
className = className.replace('__n', '__s')
if (vditorElement.className.indexOf("vditor--fullscreen") > -1) {
className = className.replace("__n", "__s");
}
this.className = className
})
this.className = className;
});
}
}
}
import quoteSVG from "../../assets/icons/quote.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Quote extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || quoteSVG
this.bindEvent()
export class Quote extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || quoteSVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
import recordSVG from "../../assets/icons/record.svg";
import {MenuItemClass} from "./MenuItemClass";
import {i18n} from "../i18n/index";
import {uploadFiles} from "../upload/index";
import {i18n} from "../i18n/index";
import {MediaRecorder} from "../util/MediaRecorder";
import {MenuItem} from "./MenuItem";
export class Record extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || recordSVG
export class Record extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || recordSVG;
this._bindEvent(vditor)
this._bindEvent(vditor);
}
_bindEvent(vditor: Vditor) {
let mediaRecorder: any
this.element.children[0].addEventListener('click', () => {
public _bindEvent(vditor: IVditor) {
let mediaRecorder: MediaRecorder;
this.element.children[0].addEventListener("click", () => {
if (!mediaRecorder) {
navigator.mediaDevices.getUserMedia({audio: true}).then((mediaStream: MediaStream) => {
mediaRecorder = new MediaRecorder(mediaStream)
mediaRecorder.recorder.onaudioprocess = (e: any) => {
//Do nothing if not recording:
mediaRecorder = new MediaRecorder(mediaStream);
mediaRecorder.recorder.onaudioprocess = (e: AudioProcessingEvent) => {
// Do nothing if not recording:
if (!mediaRecorder.isRecording) {
return
return;
}
// Copy the data from the input buffers;
var left = e.inputBuffer.getChannelData(0)
var right = e.inputBuffer.getChannelData(1)
mediaRecorder.cloneChannelData(left, right)
}
mediaRecorder.startRecordingNewWavFile()
vditor.upload.element.children[0].innerHTML = i18n[vditor.options.lang].recoding
vditor.upload.element.style.opacity = 1
vditor.upload.element.className = 'vditor-upload vditor-upload--tip'
vditor.editor.element.setAttribute('disabled', 'disabled')
const left = e.inputBuffer.getChannelData(0);
const right = e.inputBuffer.getChannelData(1);
mediaRecorder.cloneChannelData(left, right);
};
mediaRecorder.startRecordingNewWavFile();
vditor.upload.element.children[0].innerHTML = i18n[vditor.options.lang].recording;
vditor.upload.element.style.opacity = "1";
vditor.upload.element.className = "vditor-upload vditor-upload--tip";
vditor.editor.element.setAttribute("disabled", "disabled");
}).catch((err: ErrorEvent) => {
console.log('init media error:', err);
console.error("init media error:", err);
});
return
return;
}
if (mediaRecorder.isRecording) {
mediaRecorder.stopRecording()
vditor.upload.element.className = 'vditor-upload'
const file = new File([mediaRecorder.buildWavFileBlob()],
`record${(new Date()).getTime()}.wav`, {type: 'video/webm'})
uploadFiles(vditor, [file])
mediaRecorder.stopRecording();
vditor.upload.element.className = "vditor-upload";
const file: File = new File([mediaRecorder.buildWavFileBlob()],
`record${(new Date()).getTime()}.wav`, {type: "video/webm"});
uploadFiles(vditor, [file]);
} else {
vditor.upload.element.children[0].innerHTML = i18n[vditor.options.lang].recoding
vditor.upload.element.style.opacity = 1
vditor.upload.element.className = 'vditor-upload vditor-upload--tip'
vditor.editor.element.setAttribute('disabled', 'disabled')
mediaRecorder.startRecordingNewWavFile()
vditor.upload.element.children[0].innerHTML = i18n[vditor.options.lang].recording;
vditor.upload.element.style.opacity = "1";
vditor.upload.element.className = "vditor-upload vditor-upload--tip";
vditor.editor.element.setAttribute("disabled", "disabled");
mediaRecorder.startRecordingNewWavFile();
}
})
});
}
}
}
import redoSVG from "../../assets/icons/redo.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Redo extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || redoSVG
this.bindEvent()
export class Redo extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || redoSVG;
this.bindEvent();
}
bindEvent() {
this.element.children[0].addEventListener('click', () => {
document.execCommand('redo')
})
public bindEvent() {
this.element.children[0].addEventListener("click", () => {
document.execCommand("redo");
});
}
}
}
import strikekSVG from "../../assets/icons/strike.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Strike extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || strikekSVG
this.bindEvent()
export class Strike extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || strikekSVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
import tableSVG from "../../assets/icons/table.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Table extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || tableSVG
this.bindEvent()
export class Table extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || tableSVG;
this.bindEvent();
}
bindEvent() {
super.bindEvent()
public bindEvent() {
super.bindEvent();
}
}
}
import undoSVG from "../../assets/icons/undo.svg";
import {MenuItemClass} from "./MenuItemClass";
import {MenuItem} from "./MenuItem";
export class Undo extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = menuItem.icon || undoSVG
this.bindEvent()
export class Undo extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = menuItem.icon || undoSVG;
this.bindEvent();
}
bindEvent() {
this.element.children[0].addEventListener('click', () => {
document.execCommand('undo')
})
public bindEvent() {
this.element.children[0].addEventListener("click", () => {
document.execCommand("undo");
});
}
}
}
import uploadSVG from "../../assets/icons/upload.svg";
import {MenuItemClass} from "./MenuItemClass";
import {uploadFiles} from "../upload/index"
import {uploadFiles} from "../upload/index";
import {MenuItem} from "./MenuItem";
export class Upload extends MenuItemClass {
constructor(vditor: Vditor, menuItem: MenuItem) {
super(vditor, menuItem)
this.element.children[0].innerHTML = '<label>' + (menuItem.icon || uploadSVG) +
'<input multiple="multiple" type="file"></label>'
this._bindEvent(vditor)
export class Upload extends MenuItem {
constructor(vditor: IVditor, menuItem: IMenuItem) {
super(vditor, menuItem);
this.element.children[0].innerHTML = "<label>" + (menuItem.icon || uploadSVG) +
'<input multiple="multiple" type="file"></label>';
this._bindEvent(vditor);
}
_bindEvent(vditor: Vditor) {
this.element.querySelector('input').addEventListener('change', (event: any) => {
public _bindEvent(vditor: IVditor) {
this.element.querySelector("input").addEventListener("change", (event: IHTMLInputEvent) => {
if (event.target.files.length === 0) {
return
return;
}
uploadFiles(vditor, event.target.files, event.target)
})
uploadFiles(vditor, event.target.files, event.target);
});
}
}
}
declare module "*.svg" {
const content: string
export default content
const content: string;
export default content;
}
declare module '*.png'
declare module "*.png";
declare module 'turndown'
declare module "turndown";
declare module 'turndown-plugin-gfm/lib/turndown-plugin-gfm.es.js'
declare module "turndown-plugin-gfm/lib/turndown-plugin-gfm.es.js";
declare var webkitAudioContext: {
prototype: AudioContext;
new(contextOptions?: AudioContextOptions): AudioContext;
prototype: AudioContext
new(contextOptions?: AudioContextOptions): AudioContext,
};
interface Classes {
preview?: string
declare interface ITurndown {
prototype: {
escape(name: string): string,
};
new(): {
addRule(name: string, options: {}): void
use(plugin: ITurndown): void
turndown(text: string): string,
};
}
interface Upload {
url: string
max?: number
linkToImgUrl?: string
success?: { (textarea: HTMLTextAreaElement, msg: string): void }
error?: { (msg: string): void }
token?: string
filename?: { (name: string): string }
interface IHTMLInputEvent extends Event {
target: HTMLInputElement & EventTarget;
}
interface MenuItem {
name: string
icon?: string
tip?: string
hotkey?: string
suffix?: string
prefix?: string
tipPosition?: string
interface IDocument extends Document {
onselectstart: string | null;
selection: { empty(): void };
}
interface Preview {
delay?: number
show?: boolean
parse?: { (element: HTMLElement): void }
url?: string
interface II18nLang {
en_US: string;
zh_CN: string;
}
interface Hint {
emojiTail?: string
delay?: number
emoji?: any
at?: { (value: string): Array<any> }
interface II18n {
en_US: { [key: string]: string };
zh_CN: { [key: string]: string };
}
interface Resize {
position?: string
enable?: boolean
after?: { (height: number): void }
interface IClasses {
preview?: string;
}
interface Options {
height?: number | string
width?: number | string
placeholder?: string
lang?: string
toolbar?: Array<string | MenuItem>
resize?: Resize
counter?: number
cache?: boolean
preview?: Preview
hint?: Hint
upload?: Upload
classes?: Classes
input?: { (value: string, previewElement?: HTMLElement): void }
focus?: { (value: string): void }
blur?: { (value: string): void }
esc?: { (value: string): void }
ctrlEnter?: { (value: string): void }
select?: { (value: string): void }
interface IUpload {
url: string;
max?: number;
linkToImgUrl?: string;
success?: (textarea: HTMLTextAreaElement, msg: string) => void;
error?: (msg: string) => void;
token?: string;
filename?: (name: string) => string;
}
interface Vditor {
id: string
mdTimeoutId: number
options: Options
timeId: number
toolbar?: any
preview?: any
editor?: any
counter?: any
resize?: any
hint?: any
upload?: any
}
interface IMenuItem {
name: string;
icon?: string;
tip?: string;
hotkey?: string;
suffix?: string;
prefix?: string;
tipPosition?: string;
}
interface IPreview {
delay?: number;
show?: boolean;
parse?: (element: HTMLElement) => void;
url?: string;
}
interface IHintData {
html: string;
value: string;
}
interface IHint {
emojiTail?: string;
delay?: number;
emoji?: { [key: string]: string };
emojiPath?: string;
at?: (value: string) => IHintData[];
}
interface IResize {
position?: string;
enable?: boolean;
after?: (height: number) => void;
}
interface IOptions {
height?: number | string;
width?: number | string;
placeholder?: string;
lang?: (keyof II18nLang);
toolbar?: Array<string | IMenuItem>;
resize?: IResize;
counter?: number;
cache?: boolean;
preview?: IPreview;
hint?: IHint;
upload?: IUpload;
classes?: IClasses;
input?: (value: string, previewElement?: HTMLElement) => void;
focus?: (value: string) => void;
blur?: (value: string) => void;
esc?: (value: string) => void;
ctrlEnter?: (value: string) => void;
select?: (value: string) => void;
}
interface IVditor {
id: string;
mdTimeoutId: number;
options: IOptions;
toolbar?: {
elements?: { [key: string]: HTMLElement },
};
preview?: {
element: HTMLElement
render: (vditor: IVditor, value?: string) => void,
};
editor?: {
element: HTMLTextAreaElement,
};
counter?: {
element: HTMLElement
render: (length: number, counter: number) => void,
};
resize?: {
element: HTMLElement,
};
hint?: {
timeId: number
editorElement: HTMLTextAreaElement
element: HTMLUListElement
hint: IHint
render(): void,
};
upload?: {
element: HTMLElement
isUploading: boolean,
};
}
export class Ui {
constructor(vditor: Vditor) {
const vditorElement = document.getElementById(vditor.id)
vditorElement.className = 'vditor' + (vditorElement.className ? ' ' + vditorElement.className : '')
if (typeof vditor.options.height == 'number') {
vditorElement.style.height = vditor.options.height + 'px'
constructor(vditor: IVditor) {
const vditorElement = document.getElementById(vditor.id);
vditorElement.className = "vditor" + (vditorElement.className ? " " + vditorElement.className : "");
if (typeof vditor.options.height === "number") {
vditorElement.style.height = vditor.options.height + "px";
}
if (typeof vditor.options.width == 'number') {
vditorElement.style.width = vditor.options.width + 'px'
if (typeof vditor.options.width === "number") {
vditorElement.style.width = vditor.options.width + "px";
} else {
vditorElement.style.width = vditor.options.width
vditorElement.style.width = vditor.options.width;
}
const toolbarElement = document.createElement('div')
toolbarElement.className = 'vditor-toolbar'
const toolbarElement = document.createElement("div");
toolbarElement.className = "vditor-toolbar";
Object.keys(vditor.toolbar.elements).forEach((key) => {
toolbarElement.appendChild(vditor.toolbar.elements[key])
})
toolbarElement.appendChild(vditor.toolbar.elements[key]);
});
vditorElement.appendChild(toolbarElement)
vditorElement.appendChild(toolbarElement);
if (vditor.options.resize.enable && vditor.options.resize.position === 'top') {
vditorElement.appendChild(vditor.resize.element)
if (vditor.options.resize.enable && vditor.options.resize.position === "top") {
vditorElement.appendChild(vditor.resize.element);
}
const contentElement = document.createElement('div')
contentElement.className = 'vditor-content'
contentElement.appendChild(vditor.editor.element)
const contentElement = document.createElement("div");
contentElement.className = "vditor-content";
contentElement.appendChild(vditor.editor.element);
if (vditor.preview) {
contentElement.appendChild(vditor.preview.element)
contentElement.appendChild(vditor.preview.element);
}
if (vditor.options.counter > 0) {
contentElement.appendChild(vditor.counter.element)
contentElement.appendChild(vditor.counter.element);
}
if (vditor.upload) {
contentElement.appendChild(vditor.upload.element)
contentElement.appendChild(vditor.upload.element);
}
vditorElement.appendChild(contentElement)
vditorElement.appendChild(contentElement);
if (vditor.options.resize.enable && vditor.options.resize.position === 'bottom') {
vditorElement.appendChild(vditor.resize.element)
if (vditor.options.resize.enable && vditor.options.resize.position === "bottom") {
vditorElement.appendChild(vditor.resize.element);
}
document.onclick = (event: any) => {
const menuItem = event.target.closest('.vditor-tooltipped')
if (menuItem && menuItem.nextSibling && menuItem.nextSibling.className === 'vditor-panel') {
return
document.onclick = (event: Event) => {
const menuItem = (event.target as HTMLElement).closest(".vditor-tooltipped");
if (menuItem && menuItem.nextSibling &&
(menuItem.nextSibling as HTMLElement).className === "vditor-panel") {
return;
}
document.querySelectorAll('.vditor-hint').forEach((element: HTMLElement) => {
element.style.display = 'none'
})
document.querySelectorAll('.vditor-panel').forEach((element: HTMLElement) => {
element.style.display = 'none'
})
}
document.querySelectorAll(".vditor-hint").forEach((element: HTMLElement) => {
element.style.display = "none";
});
document.querySelectorAll(".vditor-panel").forEach((element: HTMLElement) => {
element.style.display = "none";
});
};
}
}
}
import {insertText} from "../editor/index";
import {i18n} from "../i18n/index";
class UploadClass {
element: HTMLElement
isUploading: boolean
class Upload {
public element: HTMLElement;
public isUploading: boolean;
constructor() {
this.isUploading = false
this.element = document.createElement('div')
this.element.className = 'vditor-upload'
this.element.innerHTML = '<div class="vditor-upload__progress"></div><div class="vditor-upload__close">x</div>'
this.isUploading = false;
this.element = document.createElement("div");
this.element.className = "vditor-upload";
this.element.innerHTML = '<div class="vditor-upload__progress"></div><div class="vditor-upload__close">x</div>';
this.element.children[1].addEventListener('click', function () {
this.parentElement.style.opacity = 0
this.parentElement.className = 'vditor-upload'
})
this.element.children[1].addEventListener("click", function() {
this.parentElement.style.opacity = 0;
this.parentElement.className = "vditor-upload";
});
}
}
const genUploadingLabel = (vditor: Vditor, files: any): string => {
let uploadingStr = ''
const genUploadingLabel = (vditor: IVditor, files: DataTransferItemList | FileList | File[]): string => {
let uploadingStr = "";
for (let iMax = files.length, i = 0; i < iMax; i++) {
const file = files[i].getAsFile ? files[i].getAsFile() : files[i]
const tag = file.type.indexOf('image') === -1 ? '' : '!'
let file = files[i];
if (file instanceof DataTransferItem) {
file = file.getAsFile();
}
const tag = file.type.indexOf("image") === -1 ? "" : "!";
if (!file.name) {
return ''
return "";
}
const lastIndex = file.name.lastIndexOf('.')
const filename = vditor.options.upload.filename(file.name.substr(0, lastIndex)) + file.name.substr(lastIndex)
const lastIndex = file.name.lastIndexOf(".");
const filename = vditor.options.upload.filename(file.name.substr(0, lastIndex)) + file.name.substr(lastIndex);
const lang: (keyof II18nLang) = vditor.options.lang;
if (file.size > vditor.options.upload.max) {
vditor.upload.element.className = 'vditor-upload vditor-upload--tip'
vditor.upload.element.children[0].innerHTML = `${file.name} ${i18n[vditor.options.lang].over} ${vditor.options.upload.max / 1024 / 1024}M`
vditor.upload.element.className = "vditor-upload vditor-upload--tip";
vditor.upload.element.children[0].innerHTML =
`${file.name} ${i18n[lang].over} ${vditor.options.upload.max / 1024 / 1024}M`;
} else {
uploadingStr += `${tag}[${filename}](${i18n[vditor.options.lang].uploading})\n`
uploadingStr += `${tag}[${filename}](${i18n[lang].uploading})\n`;
}
}
return uploadingStr
}
return uploadingStr;
};
const genUploadedLabel = (editorElement: HTMLTextAreaElement, responseText: string, options: Options, uploadElement: HTMLElement) => {
editorElement.focus()
const response = JSON.parse(responseText)
const genUploadedLabel =
(editorElement: HTMLTextAreaElement, responseText: string, options: IOptions, uploadElement: HTMLElement) => {
editorElement.focus();
const response = JSON.parse(responseText);
if (response.code === 1) {
uploadElement.className = 'vditor-upload vditor-upload--tip'
uploadElement.children[0].innerHTML = response.msg
uploadElement.className = "vditor-upload vditor-upload--tip";
uploadElement.children[0].innerHTML = response.msg;
}
response.data.errFiles.forEach((data: string) => {
const lastIndex = data.lastIndexOf('.')
const filename = options.upload.filename(data.substr(0, lastIndex)) + data.substr(lastIndex)
const original = `[${filename}](${i18n[options.lang].uploading})`
editorElement.selectionStart = editorElement.value.split(original)[0].length
editorElement.selectionEnd = editorElement.selectionStart + original.length
insertText(editorElement, '', '', true)
})
const lastIndex = data.lastIndexOf(".");
const filename = options.upload.filename(data.substr(0, lastIndex)) + data.substr(lastIndex);
const original = `[${filename}](${i18n[options.lang].uploading})`;
editorElement.selectionStart = editorElement.value.split(original)[0].length;
editorElement.selectionEnd = editorElement.selectionStart + original.length;
insertText(editorElement, "", "", true);
});
Object.keys(response.data.succMap).forEach((key) => {
const path = response.data.succMap[key]
if (path.indexOf('.wav') === path.length - 4) {
insertText(editorElement, `<audio controls="controls" src="${path}"></audio>\n`, '')
return
const path = response.data.succMap[key];
if (path.indexOf(".wav") === path.length - 4) {
insertText(editorElement, `<audio controls="controls" src="${path}"></audio>\n`, "");
return;
}
const lastIndex = key.lastIndexOf('.')
const filename = options.upload.filename(key.substr(0, lastIndex)) + key.substr(lastIndex)
const original = `[${filename}](${i18n[options.lang].uploading})`
editorElement.selectionStart = editorElement.value.split(original)[0].length
editorElement.selectionEnd = editorElement.selectionStart + original.length
insertText(editorElement, `[${filename}](${path})`, '', true)
})
}
const lastIndex = key.lastIndexOf(".");
const filename = options.upload.filename(key.substr(0, lastIndex)) + key.substr(lastIndex);
const original = `[${filename}](${i18n[options.lang].uploading})`;
editorElement.selectionStart = editorElement.value.split(original)[0].length;
editorElement.selectionEnd = editorElement.selectionStart + original.length;
insertText(editorElement, `[${filename}](${path})`, "", true);
});
};
const uploadFiles = (vditor: Vditor, files: any, element?: HTMLInputElement) => {
const formData = new FormData()
const uploadFiles = []
for (let i = 0; i < files.length; i++) {
let file = files[i]
const uploadFiles = (vditor: IVditor, files: FileList | DataTransferItemList | File[], element?: HTMLInputElement) => {
const formData = new FormData();
const uploadFileList = [];
for (let i = 0, iMax = files.length; i < iMax; i++) {
let file = files[i];
if (file instanceof DataTransferItem) {
file = file.getAsFile()
file = file.getAsFile();
}
if (file.size <= vditor.options.upload.max) {
formData.append('file[]', file)
uploadFiles.push(file)
formData.append("file[]", file);
uploadFileList.push(file);
}
}
vditor.upload.element.className = 'vditor-upload'
vditor.upload.element.children[0].innerHTML = ''
vditor.upload.element.className = "vditor-upload";
vditor.upload.element.children[0].innerHTML = "";
insertText(vditor.editor.element, genUploadingLabel(vditor, files), '')
insertText(vditor.editor.element, genUploadingLabel(vditor, files), "");
if (uploadFiles.length === 0) {
element ? element.value = '' : ''
return
if (uploadFileList.length === 0) {
if (element) {
element.value = "";
}
return;
}
if (!vditor.options.upload.url || !vditor.upload) {
element ? element.value = '' : ''
alert('please config: options.upload.url')
return
if (element) {
element.value = "";
}
alert("please config: options.upload.url");
return;
}
const xhr = new XMLHttpRequest()
xhr.open('POST', vditor.options.upload.url)
const xhr = new XMLHttpRequest();
xhr.open("POST", vditor.options.upload.url);
if (vditor.options.upload.token) {
xhr.setRequestHeader("X-Upload-Token", vditor.options.upload.token);
}
vditor.upload.isUploading = true
vditor.editor.element.setAttribute('disabled', 'disabled')
vditor.upload.isUploading = true;
vditor.editor.element.setAttribute("disabled", "disabled");
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
vditor.upload.isUploading = false
element ? element.value = '' : ''
vditor.editor.element.removeAttribute('disabled')
vditor.upload.isUploading = false;
if (element) {
element.value = "";
}
vditor.editor.element.removeAttribute("disabled");
if (xhr.status === 200) {
if (vditor.options.upload.success) {
vditor.options.upload.success(vditor.editor.element, xhr.responseText)
vditor.options.upload.success(vditor.editor.element, xhr.responseText);
} else {
genUploadedLabel(vditor.editor.element, xhr.responseText, vditor.options, vditor.upload.element)
genUploadedLabel(vditor.editor.element, xhr.responseText, vditor.options, vditor.upload.element);
}
vditor.upload.element.style.opacity = 0
vditor.upload.element.style.opacity = "0";
} else {
if (vditor.options.upload.error) {
vditor.options.upload.error(xhr.responseText)
vditor.options.upload.error(xhr.responseText);
} else {
vditor.upload.element.className = 'vditor-upload vditor-upload--tip'
vditor.upload.element.children[0].innerHTML = xhr.responseText || '401'
vditor.upload.element.className = "vditor-upload vditor-upload--tip";
vditor.upload.element.children[0].innerHTML = xhr.responseText || "401";
}
}
}
}
};
xhr.upload.onprogress = (event: ProgressEvent) => {
if (!event.lengthComputable) {
return
return;
}
const progress = event.loaded / event.total * 100
vditor.upload.element.style.opacity = 1
vditor.upload.element.children[0].style.width = progress + '%'
}
xhr.send(formData)
}
const progress = event.loaded / event.total * 100;
vditor.upload.element.style.opacity = "1";
const progressBar = vditor.upload.element.children[0] as HTMLElement;
progressBar.style.width = progress + "%";
};
xhr.send(formData);
};
export {UploadClass, uploadFiles}
export {Upload, uploadFiles};
export const commandable = (): boolean => {
if (/firefox/i.test(navigator.userAgent) || /edge/i.test(navigator.userAgent)
|| /msie/i.test(navigator.userAgent) || /trident/i.test(navigator.userAgent)) {
return false
return false;
}
return true
}
return true;
};
export class MediaRecorder {
SAMPLE_RATE = 5000 // 44100 suggested by demos;
DEFAULT_SAMPLE_RATE: any
isRecording = false
readyFlag = false
leftChannel: Array<Float32List> = []
rightChannel: Array<Float32List> = []
recordingLength = 0
recorder: any //This needs to be public so the 'onaudioprocess' event handler can be defined externally.
public SAMPLE_RATE = 5000; // 44100 suggested by demos;
public DEFAULT_SAMPLE_RATE: number;
public isRecording = false;
public readyFlag = false;
public leftChannel: Float32List[] = [];
public rightChannel: Float32List[] = [];
public recordingLength = 0;
// This needs to be public so the 'onaudioprocess' event handler can be defined externally.
public recorder: ScriptProcessorNode;
constructor(e: MediaStream) {
let context
let context;
// creates the audio context
if (typeof AudioContext !== 'undefined') {
context = new AudioContext()
if (typeof AudioContext !== "undefined") {
context = new AudioContext();
} else if (webkitAudioContext) {
context = new webkitAudioContext()
context = new webkitAudioContext();
} else {
return
return;
}
this.DEFAULT_SAMPLE_RATE = context.sampleRate
this.DEFAULT_SAMPLE_RATE = context.sampleRate;
// creates a gain node
const volume = context.createGain()
const volume = context.createGain();
// creates an audio node from the microphone incoming stream
const audioInput = context.createMediaStreamSource(e)
const audioInput = context.createMediaStreamSource(e);
// connect the stream to the gain node
audioInput.connect(volume)
audioInput.connect(volume);

@@ -37,133 +38,134 @@ /* From the spec: The size of the buffer controls how frequently the audioprocess event is

Higher values will be necessary to avoid audio breakup and glitches */
this.recorder = context.createScriptProcessor(2048, 2, 1)
this.recorder = context.createScriptProcessor(2048, 2, 1);
//The onaudioprocess event needs to be defined externally, so make sure it is not set:
this.recorder.onaudioprocess = null
// The onaudioprocess event needs to be defined externally, so make sure it is not set:
this.recorder.onaudioprocess = null;
// we connect the recorder
volume.connect(this.recorder)
this.recorder.connect(context.destination)
this.readyFlag = true
volume.connect(this.recorder);
this.recorder.connect(context.destination);
this.readyFlag = true;
}
//Publicly accessible methods:
cloneChannelData(leftChannelData: Float32List, rightChannelData: Float32List) {
this.leftChannel.push(new Float32Array(leftChannelData))
this.rightChannel.push(new Float32Array(rightChannelData))
this.recordingLength += 2048
// Publicly accessible methods:
public cloneChannelData(leftChannelData: Float32List, rightChannelData: Float32List) {
this.leftChannel.push(new Float32Array(leftChannelData));
this.rightChannel.push(new Float32Array(rightChannelData));
this.recordingLength += 2048;
}
startRecordingNewWavFile() {
public startRecordingNewWavFile() {
if (this.readyFlag) {
this.isRecording = true
this.leftChannel.length = this.rightChannel.length = 0
this.recordingLength = 0
this.isRecording = true;
this.leftChannel.length = this.rightChannel.length = 0;
this.recordingLength = 0;
}
}
stopRecording() {
this.isRecording = false
public stopRecording() {
this.isRecording = false;
}
buildWavFileBlob() {
public buildWavFileBlob() {
// we flat the left and right channels down
const leftBuffer = this.mergeBuffers(this.leftChannel)
const rightBuffer = this.mergeBuffers(this.rightChannel)
const leftBuffer = this.mergeBuffers(this.leftChannel);
const rightBuffer = this.mergeBuffers(this.rightChannel);
// Interleave the left and right channels together:
let interleaved: Float32Array = new Float32Array(leftBuffer.length)
let interleaved: Float32Array = new Float32Array(leftBuffer.length);
for (let i = 0; i < leftBuffer.length; ++i) {
interleaved[i] = 0.5 * (leftBuffer[i] + rightBuffer[i])
interleaved[i] = 0.5 * (leftBuffer[i] + rightBuffer[i]);
}
//Downsample the audio data if necessary:
// Downsample the audio data if necessary:
if (this.DEFAULT_SAMPLE_RATE > this.SAMPLE_RATE) {
interleaved = this.downsampleBuffer(interleaved, this.SAMPLE_RATE)
interleaved = this.downSampleBuffer(interleaved, this.SAMPLE_RATE);
}
const totalByteCount = (44 + interleaved.length * 2)
const buffer = new ArrayBuffer(totalByteCount)
const view = new DataView(buffer)
const totalByteCount = (44 + interleaved.length * 2);
const buffer = new ArrayBuffer(totalByteCount);
const view = new DataView(buffer);
// Build the RIFF chunk descriptor:
this.writeUTFBytes(view, 0, 'RIFF')
view.setUint32(4, totalByteCount, true)
this.writeUTFBytes(view, 8, 'WAVE')
this.writeUTFBytes(view, 0, "RIFF");
view.setUint32(4, totalByteCount, true);
this.writeUTFBytes(view, 8, "WAVE");
// Build the FMT sub-chunk:
this.writeUTFBytes(view, 12, 'fmt ') //subchunk1 ID is format
view.setUint32(16, 16, true)//The sub-chunk size is 16.
view.setUint16(20, 1, true)//The audio format is 1.
view.setUint16(22, 1, true)//Number of interleaved channels.
view.setUint32(24, this.SAMPLE_RATE, true)//Sample rate.
view.setUint32(28, this.SAMPLE_RATE * 2, true)//Byte rate.
view.setUint16(32, 2, true)//Block align
view.setUint16(34, 16, true)//Bits per sample.
this.writeUTFBytes(view, 12, "fmt "); // subchunk1 ID is format
view.setUint32(16, 16, true); // The sub-chunk size is 16.
view.setUint16(20, 1, true); // The audio format is 1.
view.setUint16(22, 1, true); // Number of interleaved channels.
view.setUint32(24, this.SAMPLE_RATE, true); // Sample rate.
view.setUint32(28, this.SAMPLE_RATE * 2, true); // Byte rate.
view.setUint16(32, 2, true); // Block align
view.setUint16(34, 16, true); // Bits per sample.
// Build the data sub-chunk:
const subChunk2ByteCount = interleaved.length * 2
this.writeUTFBytes(view, 36, 'data')
view.setUint32(40, subChunk2ByteCount, true)
const subChunk2ByteCount = interleaved.length * 2;
this.writeUTFBytes(view, 36, "data");
view.setUint32(40, subChunk2ByteCount, true);
// Write the PCM samples to the view:
const lng = interleaved.length
let index = 44
const volume = 1
const lng = interleaved.length;
let index = 44;
const volume = 1;
for (let j = 0; j < lng; j++) {
view.setInt16(index, interleaved[j] * (0x7FFF * volume), true)
index += 2
view.setInt16(index, interleaved[j] * (0x7FFF * volume), true);
index += 2;
}
return new Blob([view], {type: 'audio/wav'})
return new Blob([view], {type: "audio/wav"});
}
private downsampleBuffer(buffer: Float32Array, rate: number) {
if (rate == this.DEFAULT_SAMPLE_RATE) {
return buffer
private downSampleBuffer(buffer: Float32Array, rate: number) {
if (rate === this.DEFAULT_SAMPLE_RATE) {
return buffer;
}
if (rate > this.DEFAULT_SAMPLE_RATE) {
//throw "downsampling rate show be smaller than original sample rate";
return buffer
// throw "downsampling rate show be smaller than original sample rate";
return buffer;
}
const sampleRateRatio = this.DEFAULT_SAMPLE_RATE / rate
const newLength = Math.round(buffer.length / sampleRateRatio)
const result = new Float32Array(newLength)
let offsetResult = 0
let offsetBuffer = 0
const sampleRateRatio = this.DEFAULT_SAMPLE_RATE / rate;
const newLength = Math.round(buffer.length / sampleRateRatio);
const result = new Float32Array(newLength);
let offsetResult = 0;
let offsetBuffer = 0;
while (offsetResult < result.length) {
const nextOffsetBuffer = Math.round((offsetResult + 1) * sampleRateRatio)
let accum = 0, count = 0
const nextOffsetBuffer = Math.round((offsetResult + 1) * sampleRateRatio);
let accum = 0;
let count = 0;
for (let i = offsetBuffer; i < nextOffsetBuffer && i < buffer.length; i++) {
accum += buffer[i]
count++
accum += buffer[i];
count++;
}
result[offsetResult] = accum / count
offsetResult++
offsetBuffer = nextOffsetBuffer
result[offsetResult] = accum / count;
offsetResult++;
offsetBuffer = nextOffsetBuffer;
}
return result
return result;
}
private mergeBuffers(desiredChannelBuffer: any) {
const result = new Float32Array(this.recordingLength)
let offset = 0
const lng = desiredChannelBuffer.length
private mergeBuffers(desiredChannelBuffer: Float32List[]) {
const result = new Float32Array(this.recordingLength);
let offset = 0;
const lng = desiredChannelBuffer.length;
for (let i = 0; i < lng; ++i) {
const buffer = desiredChannelBuffer[i]
result.set(buffer, offset)
offset += buffer.length
const buffer = desiredChannelBuffer[i];
result.set(buffer, offset);
offset += buffer.length;
}
return result
return result;
}
private writeUTFBytes(view: any, offset: number, string: string) {
const lng = string.length
private writeUTFBytes(view: DataView, offset: number, value: string) {
const lng = value.length;
for (let i = 0; i < lng; i++) {
view.setUint8(offset + i, string.charCodeAt(i))
view.setUint8(offset + i, value.charCodeAt(i));
}
}
}
}

@@ -1,62 +0,60 @@

export const getTextareaPosition = (element:any) => {
export const getTextareaPosition = (element: HTMLTextAreaElement) => {
const styleProperties = [
'direction',
'boxSizing',
'width',
'height',
'overflowX',
'overflowY',
'borderTopWidth',
'borderRightWidth',
'borderBottomWidth',
'borderLeftWidth',
'borderStyle',
'paddingTop',
'paddingRight',
'paddingBottom',
'paddingLeft',
'fontStyle',
'fontVariant',
'fontWeight',
'fontStretch',
'fontSize',
'fontSizeAdjust',
'lineHeight',
'fontFamily',
'textAlign',
'textTransform',
'textIndent',
'textDecoration',
'letterSpacing',
'wordSpacing',
'tabSize',
'MozTabSize',
]
const computed = window.getComputedStyle
? window.getComputedStyle(element)
: element.currentStyle
let div:HTMLElement = document.querySelector('.vditor-position')
"direction",
"box-sizing",
"width",
"height",
"overflow-x",
"overflow-y",
"border-top-width",
"border-right-width",
"border-bottom-width",
"border-left-width",
"border-style",
"padding-top",
"padding-right",
"padding-bottom",
"padding-left",
"font-style",
"font-variant",
"font-weight",
"font-stretch",
"font-size",
"text-size-adjust",
"line-height",
"font-family",
"text-align",
"text-transform",
"text-indent",
"text-decoration",
"letter-spacing",
"word-spacing",
"tab-size",
"tab-size",
];
const computed = window.getComputedStyle(element);
let div: HTMLElement = document.querySelector(".vditor-position");
if (!div) {
div = document.createElement('div')
div.className = 'vditor-position'
document.body.appendChild(div)
div = document.createElement("div");
div.className = "vditor-position";
document.body.appendChild(div);
}
let style:any = div.style
style.whiteSpace = 'pre-wrap'
style.wordWrap = 'break-word'
style.position = 'absolute'
style.overflow = 'hidden'
style.left = '-100%'
styleProperties.forEach(function (prop) {
style[prop] = computed[prop]
})
div.textContent = element.value.substring(0, element.selectionEnd)
const span = document.createElement('span')
span.textContent = element.value.substring(element.selectionEnd) || '.'
div.appendChild(span)
const style = div.style;
style.whiteSpace = "pre-wrap";
style.wordWrap = "break-word";
style.position = "absolute";
style.overflow = "hidden";
style.left = "-100%";
styleProperties.forEach((prop) => {
style.setProperty(prop, computed.getPropertyValue(prop));
});
div.textContent = element.value.substring(0, element.selectionEnd);
const span = document.createElement("span");
span.textContent = element.value.substring(element.selectionEnd) || ".";
div.appendChild(span);
return {
top: span.offsetTop - element.scrollTop + parseInt(computed['lineHeight']),
left: span.offsetLeft - element.scrollLeft,
}
}
top: span.offsetTop - element.scrollTop + parseInt(computed.lineHeight, 10),
};
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc