Skip to content

Commit

Permalink
🐛 fix Vanessa219#267
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 authored and stevapple committed Apr 8, 2020
1 parent b88c8f6 commit 7a107c2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -51,6 +51,7 @@

### v3.0.9 / 2020-04-0x

* [267](https://github.com/Vanessa219/vditor/issues/267) 设置 codeBlockPreview false, esc 后代码块消失 `修复缺陷`
* [270](https://github.com/Vanessa219/vditor/issues/270) 支持捂脸表情 `改进功能`
* [264](https://github.com/Vanessa219/vditor/issues/264) table at IR mdoe `修复缺陷`
* [253](https://github.com/Vanessa219/vditor/issues/253) 所见即所得复制粘贴问题 `修复缺陷`
Expand Down
25 changes: 20 additions & 5 deletions src/assets/scss/_ir.scss
Expand Up @@ -17,11 +17,15 @@
color: var(--second-color);
}


&:not(.vditor-ir__node--expand) .vditor-ir__marker {
padding: 0 !important;
}

&[data-type="link-ref"],
&[data-type="footnotes-ref"] {
color: $blurColor;
}

.vditor-ir__marker {
width: 0;
overflow: hidden;
Expand Down Expand Up @@ -190,14 +194,25 @@
content: 'H6';
}

div[data-type="link-ref-defs-block"]:before {
content: '"A"';
div[data-type="link-ref-defs-block"] {
&:before {
content: '"A"';
}

color: var(--blockquote-color);
}

div[data-type="footnotes-block"]:before {
content: '^F';
div[data-type="footnotes-block"] {
&:before {
content: '^F';
}

border-top: 2px solid var(--heading-border-color);
padding-top: 24px;
margin-top: 24px;
}


.vditor-toc {
&:before {
content: "ToC";
Expand Down
8 changes: 7 additions & 1 deletion src/ts/ir/input.ts
@@ -1,7 +1,7 @@
import {isHeadingMD, isHrMD, renderToc} from "../util/fixBrowserBehavior";
import {
getTopList,
hasClosestBlock,
hasClosestBlock, hasClosestByAttribute,
hasClosestByClassName,
hasClosestByTag,
} from "../util/hasClosest";
Expand Down Expand Up @@ -114,6 +114,12 @@ export const input = (vditor: IVditor, range: Range) => {
}
}

// 修改脚注
const footnoteElement = hasClosestByAttribute(blockElement, "data-type", "footnotes-block");
if (footnoteElement) {
blockElement = footnoteElement;
}

html = blockElement.outerHTML;

if (blockElement.tagName === "UL" || blockElement.tagName === "OL") {
Expand Down
2 changes: 1 addition & 1 deletion src/ts/wysiwyg/processKeydown.ts
Expand Up @@ -67,7 +67,7 @@ export const processKeydown = (vditor: IVditor, event: KeyboardEvent) => {
const codeRenderElement = hasClosestByClassName(startContainer, "vditor-wysiwyg__block");
if (codeRenderElement) {
// esc: 退出编辑,仅展示渲染
if (event.key === "Escape") {
if (event.key === "Escape" && codeRenderElement.children.length === 2) {
vditor.wysiwyg.popover.style.display = "none";
(codeRenderElement.firstElementChild as HTMLElement).style.display = "none";
vditor.wysiwyg.element.blur();
Expand Down

0 comments on commit 7a107c2

Please sign in to comment.