Skip to content

Commit

Permalink
🎨 fix #386
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed May 12, 2020
1 parent 5056f3e commit 4fad218
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@

### v3.2.4 / 2020-05-xx

* [386](https://github.com/Vanessa219/vditor/issues/386) [wysiwyg] 在代码块尾部按 arrowdown 插入空行 `改进功能`
* [396](https://github.com/Vanessa219/vditor/issues/396) click empty, append empty block `改进功能`
* [385](https://github.com/Vanessa219/vditor/issues/385) image title at wysiwyg `修复缺陷`
* [390](https://github.com/Vanessa219/vditor/issues/390) no data-marker(editing mode) `修复缺陷`
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ class Vditor extends VditorMethod {
this.vditor.upload = new Upload();
}

const lutePath = `http://192.168.2.248:9090/lute.min.js?${new Date().getTime()}`;
// const lutePath = `http://192.168.2.248:9090/lute.min.js?${new Date().getTime()}`;
// const lutePath = "src/js/lute/lute.min.js";
// const lutePath = `${mergedOptions.cdn}/dist/js/lute/lute.min.js`;
const lutePath = `${mergedOptions.cdn}/dist/js/lute/lute.min.js`;
addScript(lutePath, "vditorLuteScript").then(() => {
this.vditor.lute = setLute({
autoSpace: this.vditor.options.preview.markdown.autoSpace,
Expand Down
2 changes: 1 addition & 1 deletion src/ts/ir/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {Constants} from "../constants";
import {uploadFiles} from "../upload";
import {isCtrl, isFirefox} from "../util/compatibility";
import {focusEvent, hotkeyEvent, scrollCenter, selectEvent} from "../util/editorCommonEvent";
Expand All @@ -11,7 +12,6 @@ import {expandMarker} from "./expandMarker";
import {highlightToolbar} from "./highlightToolbar";
import {input} from "./input";
import {processAfterRender, processHint} from "./process";
import {Constants} from "../constants";

class IR {
public element: HTMLPreElement;
Expand Down
2 changes: 1 addition & 1 deletion src/ts/util/fixBrowserBehavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const insertAfterBlock = (vditor: IVditor, event: KeyboardEvent, range: R
(nextElement && (nextElement.tagName === "TABLE" || nextElement.getAttribute("data-type")))) {
blockElement.insertAdjacentHTML("afterend",
`<p data-block="0">${Constants.ZWSP}<wbr></p>`);
setRangeByWbr(vditor.ir.element, range);
setRangeByWbr(vditor[vditor.currentMode].element, range);
} else {
range.selectNodeContents(nextElement);
range.collapse(true);
Expand Down
13 changes: 9 additions & 4 deletions src/ts/wysiwyg/processKeydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
fixMarkdown,
fixTab,
fixTable,
fixTask,
fixTask, insertAfterBlock,
} from "../util/fixBrowserBehavior";
import {
hasClosestBlock,
Expand Down Expand Up @@ -90,9 +90,14 @@ export const processKeydown = (vditor: IVditor, event: KeyboardEvent) => {
return true;
}

if (codeRenderElement.getAttribute("data-block") === "0" &&
fixCodeBlock(vditor, event, codeRenderElement.firstElementChild as HTMLElement, range)) {
return true;
if (codeRenderElement.getAttribute("data-block") === "0") {
if (fixCodeBlock(vditor, event, codeRenderElement.firstElementChild as HTMLElement, range)) {
return true;
}
if (insertAfterBlock(vditor, event, range, codeRenderElement.firstElementChild as HTMLElement,
codeRenderElement)) {
return true;
}
}
}

Expand Down

0 comments on commit 4fad218

Please sign in to comment.