Browse Source

:bug: icon 无法切换

Liyuan Li 5 years ago
parent
commit
50276aef1d
5 changed files with 9 additions and 9 deletions
  1. 1 0
      CHANGELOG.md
  2. 3 3
      demo/index.js
  3. 1 0
      src/index.ts
  4. 2 3
      src/js/icons/ant.js
  5. 2 3
      src/js/icons/material.js

+ 1 - 0
CHANGELOG.md

@@ -79,6 +79,7 @@
 
 ### v3.4.0 / 2020-07-xx
 
+* [636](https://github.com/Vanessa219/vditor/issues/636) SV 模式 Setext 标题问题 `修复缺陷`
 
 ### v3.3.12 / 2020-07-28
 

+ 3 - 3
demo/index.js

@@ -50,10 +50,10 @@ if (window.innerWidth < 768) {
 }
 
 window.vditor = new Vditor('vditor', {
-  // _lutePath: `http://192.168.0.107:9090/lute.min.js?${new Date().getTime()}`,
-  _lutePath: 'src/js/lute/lute.min.js',
+  _lutePath: `http://192.168.0.107:9090/lute.min.js?${new Date().getTime()}`,
+  // _lutePath: 'src/js/lute/lute.min.js',
   toolbar,
-  mode: 'ir',
+  mode: 'sv',
   height: window.innerHeight + 100,
   outline: true,
   debugger: true,

+ 1 - 0
src/index.ts

@@ -346,6 +346,7 @@ class Vditor extends VditorMethod {
         this.vditor.element.innerHTML = this.vditor.originalInnerHTML;
         this.vditor.element.classList.remove("vditor");
         this.vditor.element.removeAttribute("style");
+        document.getElementById("vditorIconScript").remove();
         this.clearCache();
     }
 }

+ 2 - 3
src/js/icons/ant.js

@@ -1,4 +1,4 @@
-const svg = `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg">
+document.body.insertAdjacentHTML('afterBegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg">
   <defs>
     <symbol id="vditor-icon-mp-wechat" viewBox="0 0 32 32">
       <path d="M6.927 17.719s-3.040-3.431-2.915-6.942c0.16-4.453 4.738-10.257 11.359-10.257 1.884 0 5.653 0 10.328 5.52 0.249 0.302-15.075-3.84-18.772 11.679z"></path>
@@ -160,5 +160,4 @@ const svg = `<svg style="position: absolute; width: 0; height: 0; overflow: hidd
       <path d="M18.245 3.993v24.401h2.555l1.073 3.041 4.532-3.041h5.601v-24.401h-13.761zM28.795 25.162h-2.551l-3.199 2.147-0.758-2.147h-0.767v-17.837h7.27v17.837zM16.601 14.931h-5.656c0.089-1.912 0.183-4.442 0.281-7.364h5.575l-0.004-0.345c0-0.026-0.009-0.626-0.098-1.239-0.089-0.639-0.281-1.486-0.894-1.486h-9.353c0.187-0.877 0.669-2.969 1.252-3.995l0.273-0.477-0.549-0.030c-0.034 0-0.835-0.038-1.763 0.451-1.521 0.809-2.202 2.402-2.5 3.595-0.784 3.113-1.9 5.277-2.372 6.201-0.141 0.273-0.226 0.434-0.264 0.545-0.077 0.209-0.034 0.417 0.119 0.554 0.447 0.405 1.627-0.124 1.64-0.128 0.026-0.013 0.055-0.026 0.094-0.043 0.592-0.268 2.347-1.065 2.973-3.599h2.415c0.030 1.371 0.132 5.895 0.124 7.364h-6.005l-0.089 0.064c-0.984 0.72-1.299 2.692-1.312 2.777l-0.060 0.392h7.113c-0.524 3.335-1.129 4.83-1.448 5.426-0.158 0.298-0.311 0.596-0.456 0.886-0.907 1.797-1.849 3.654-5.379 6.542-0.153 0.119-0.298 0.341-0.204 0.584 0.102 0.268 0.396 0.388 1.048 0.388 0.23 0 0.503-0.013 0.826-0.043 2.125-0.187 4.293-0.767 5.754-3.731 0.724-1.495 1.35-3.054 1.87-4.638l5.814 6.815 0.213-0.511c0.034-0.081 0.809-1.972 0.217-4.085l-0.021-0.077-4.604-5.239-0.937 0.707c0.273-1.112 0.451-2.125 0.532-3.028h6.759v-0.341c0-1.708-0.788-2.722-0.818-2.764l-0.102-0.128z"></path>
     </symbol>
   </defs>
-</svg>`
-document.body.insertAdjacentHTML('afterBegin', svg)
+</svg>`)

+ 2 - 3
src/js/icons/material.js

@@ -1,4 +1,4 @@
-const svg = `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg">
+document.body.insertAdjacentHTML('afterBegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg">
   <defs>
     <symbol id="vditor-icon-headings" viewBox="0 0 32 32">
 <path d="M1.050 0.007h6.279v31.993h-6.279v-31.993z"></path>
@@ -171,5 +171,4 @@ const svg = `<svg style="position: absolute; width: 0; height: 0; overflow: hidd
 <path d="M17.167 17.769s0-2.583-1.25-2.667c-1.25-0.167-5.167 0-5.167 0v-8h5.833s-0.083-2.667-1.167-2.667h-9.5l1.583-4.25s-2.333 0.167-3.25 1.667c-0.833 1.5-3.5 9.167-3.5 9.167s0.917 0.417 2.417-0.75c1.5-1.083 2-3.083 2-3.083l2.75-0.167 0.083 8.083s-4.917-0.083-5.833 0c-1 0.083-1.5 2.667-1.5 2.667h7.417s-0.667 4.583-2.5 7.75c-1.917 3.333-5.583 5.917-5.583 5.917s2.583 1.083 5.167-0.417 4.417-8.083 4.417-8.083l5.917 7.417s0.5-3.5-0.083-4.583c-0.667-1-4.167-5-4.167-5l-1.5 1.333 1.083-4.417 6.333 0.083zM18.667 4.269l-0.083 23.999h2.417l0.833 2.917 4.25-2.917h5.917v-23.999h-13.333zM29.333 25.602h-2.75l-3.5 2.667-0.75-2.667h-0.75v-18.582h7.75v18.582z"></path>
 </symbol>
   </defs>
-</svg>`
-document.body.insertAdjacentHTML('afterBegin', svg)
+</svg>`)