Van 5 年之前
父节点
当前提交
a635274486
共有 2 个文件被更改,包括 8 次插入6 次删除
  1. 2 1
      CHANGELOG.md
  2. 6 5
      src/ts/wysiwyg/highlightToolbar.ts

+ 2 - 1
CHANGELOG.md

@@ -40,8 +40,9 @@
 * [55](https://github.com/Vanessa219/vditor/issues/55) 链接引用不转换为内联链接 `改进功能`
 * [81](https://github.com/Vanessa219/vditor/issues/81) 链接和图片嵌套问题 `修复缺陷`
 
-### v2.1.8 / 2020-02-03
+### v2.1.9 / 2020-02-03
 
+* [99](https://github.com/Vanessa219/vditor/issues/99) a 中斜体/粗体时 toolbar 不显示 `修复缺陷`
 * [96](https://github.com/Vanessa219/vditor/issues/96) 所见即所得模式下的任务列表Bug `修复缺陷`
 * [95](https://github.com/Vanessa219/vditor/issues/95) setVaule 和 初始化时,不触发 input 事件 `改进功能`
 * [93](https://github.com/Vanessa219/vditor/issues/93) Headers with = and - `修复缺陷`

+ 6 - 5
src/ts/wysiwyg/highlightToolbar.ts

@@ -72,7 +72,8 @@ export const highlightToolbar = (vditor: IVditor) => {
             setCurrentToolbar(vditor.toolbar.elements, ["strike"]);
         }
 
-        if (hasClosestByMatchTag(typeElement, "A")) {
+        const aElement = hasClosestByMatchTag(typeElement, "A")
+        if (aElement) {
             setCurrentToolbar(vditor.toolbar.elements, ["link"]);
         }
         const tableElement = hasClosestByMatchTag(typeElement, "TABLE") as HTMLTableElement;
@@ -376,9 +377,9 @@ export const highlightToolbar = (vditor: IVditor) => {
         }
 
         // a popover
-        if (typeElement.nodeName === "A") {
-            genAPopover(vditor, typeElement);
-            setPopoverPosition(vditor, typeElement);
+        if (aElement) {
+            genAPopover(vditor, aElement);
+            setPopoverPosition(vditor, aElement);
         }
 
         // img popover
@@ -522,7 +523,7 @@ export const highlightToolbar = (vditor: IVditor) => {
         }
 
         if (!blockquoteElement && !imgElement && !topListElement && !tableElement && !blockRenderElement
-            && typeElement.nodeName !== "A" && !hasClosestByClassName(typeElement, "vditor-panel")) {
+            && !aElement && !hasClosestByClassName(typeElement, "vditor-panel")) {
             vditor.wysiwyg.popover.style.display = "none";
         }