Skip to content

Commit

Permalink
🐛 fix #144
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Feb 21, 2020
1 parent f0aafc1 commit 3e8d67e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ts/wysiwyg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class WYSIWYG {
} else {
event.target.removeAttribute("checked");
}
this.preventInput = true
this.preventInput = true;
afterRenderEvent(vditor);
return;
}
Expand Down
15 changes: 9 additions & 6 deletions src/ts/wysiwyg/processKeydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,15 @@ export const processKeydown = (vditor: IVditor, event: KeyboardEvent) => {

if (isCtrl(event) && event.shiftKey && event.key === ".") {
// 插入 blockquote
range.insertNode(document.createElement("wbr"));
blockquoteElement.innerHTML = `<blockquote data-block="0">${blockquoteElement.innerHTML}</blockquote>`;
setRangeByWbr(vditor.wysiwyg.element, range);
afterRenderEvent(vditor);
event.preventDefault();
return true;
const blockElement = hasClosestByAttribute(startContainer, "data-block", "0");
if (blockElement) {
range.insertNode(document.createElement("wbr"));
blockElement.outerHTML = `<blockquote data-block="0">${blockElement.outerHTML}</blockquote>`;
setRangeByWbr(vditor.wysiwyg.element, range);
afterRenderEvent(vditor);
event.preventDefault();
return true;
}
}
}

Expand Down

0 comments on commit 3e8d67e

Please sign in to comment.