Skip to content

Commit

Permalink
#70 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Jan 14, 2020
1 parent beeea7a commit a6c608b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
### v2.1.0 / 2020-01-14

* [73](https://github.com/Vanessa219/vditor/issues/73) 添加链接卡片样式 `引入特性`
* [70](https://github.com/Vanessa219/vditor/issues/70) 所见即所得模式下Table按钮重复点击会导致table嵌套,另外希望标题支持快捷键调整大小 `引入特性`
* [69](https://github.com/Vanessa219/vditor/issues/69) 渲染块按 esc 可以进行退出代码块进行预览 `改进功能`

### v2.0.15 / 2020-01-11
Expand Down
9 changes: 5 additions & 4 deletions src/ts/wysiwyg/highlightToolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export const highlightToolbar = (vditor: IVditor) => {
if (hasClosestByMatchTag(typeElement, "A")) {
setCurrentToolbar(vditor.toolbar.elements, ["link"]);
}
const ulElement = hasClosestByMatchTag(typeElement, "UL");
const topUlElement = hasClosestByMatchTag(typeElement, "UL");
const tableElement = hasClosestByMatchTag(typeElement, "TABLE") as HTMLTableElement;
if (hasClosestByMatchTag(typeElement, "CODE")) {
if (hasClosestByMatchTag(typeElement, "PRE")) {
disableToolbar(vditor.toolbar.elements, ["headings", "bold", "italic", "strike", "line", "quote",
Expand All @@ -78,14 +79,15 @@ export const highlightToolbar = (vditor: IVditor) => {
} else if (hasClosestByTag(typeElement, "H")) {
disableToolbar(vditor.toolbar.elements, ["bold"]);
setCurrentToolbar(vditor.toolbar.elements, ["headings"]);
} else if (ulElement && !ulElement.querySelector("input")) {
} else if (topUlElement && !topUlElement.querySelector("input")) {
setCurrentToolbar(vditor.toolbar.elements, ["list"]);
} else if (hasClosestByMatchTag(typeElement, "OL")) {
setCurrentToolbar(vditor.toolbar.elements, ["ordered-list"]);
} else if (tableElement) {
disableToolbar(vditor.toolbar.elements, ["table"]);
}

// list popover
const topUlElement = hasTopClosestByTag(typeElement, "UL");
const topOlElement = hasTopClosestByTag(typeElement, "OL");
let topListElement = topUlElement;
if (topOlElement && (!topUlElement || (topUlElement && topOlElement.contains(topUlElement)))) {
Expand Down Expand Up @@ -143,7 +145,6 @@ export const highlightToolbar = (vditor: IVditor) => {
}

// table popover
const tableElement = hasClosestByMatchTag(typeElement, "TABLE") as HTMLTableElement;
if (tableElement) {
vditor.wysiwyg.popover.innerHTML = "";
const updateTable = () => {
Expand Down

0 comments on commit a6c608b

Please sign in to comment.