Liyuan Li 5 роки тому
батько
коміт
6ca920538f
2 змінених файлів з 8 додано та 8 видалено
  1. 2 0
      CHANGELOG.md
  2. 6 8
      src/ts/wysiwyg/processKeydown.ts

+ 2 - 0
CHANGELOG.md

@@ -66,6 +66,8 @@
 
 ### v3.2.3 / 2020-05-0x
 
+* [384](https://github.com/Vanessa219/vditor/issues/384) ctrl_+, ctrl_- at heading(wysiwyg) `修复缺陷`
+* [321](https://github.com/Vanessa219/vditor/issues/321) 移动端如何调用toolbar的方法 `咨询提问`
 * [382](https://github.com/Vanessa219/vditor/issues/382) sometimes the keyboard is hidden at smartphone `修复缺陷`
 * [378](https://github.com/Vanessa219/vditor/issues/378) hover style in Mobile `修复缺陷`
 * [379](https://github.com/Vanessa219/vditor/issues/379) Not sticky at IOS `修复缺陷`

+ 6 - 8
src/ts/wysiwyg/processKeydown.ts

@@ -147,11 +147,10 @@ export const processKeydown = (vditor: IVditor, event: KeyboardEvent) => {
         // enter++: 标题变大
         if (matchHotKey("⌘-=", event)) {
             const index = parseInt((headingElement as HTMLElement).tagName.substr(1), 10) - 1;
-            if (index < 1) {
-                return;
+            if (index > 0) {
+                setHeading(vditor, `h${index}`);
+                afterRenderEvent(vditor);
             }
-            setHeading(vditor, `h${index}`);
-            afterRenderEvent(vditor);
             event.preventDefault();
             return true;
         }
@@ -159,11 +158,10 @@ export const processKeydown = (vditor: IVditor, event: KeyboardEvent) => {
         // enter++: 标题变小
         if (matchHotKey("⌘--", event)) {
             const index = parseInt((headingElement as HTMLElement).tagName.substr(1), 10) + 1;
-            if (index > 6) {
-                return;
+            if (index < 7) {
+                setHeading(vditor, `h${index}`);
+                afterRenderEvent(vditor);
             }
-            setHeading(vditor, `h${index}`);
-            afterRenderEvent(vditor);
             event.preventDefault();
             return true;
         }