Skip to content

Commit

Permalink
📦 #225
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Mar 19, 2020
1 parent 33e8226 commit f3a7151
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 261 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
### v3.0.1 / 未发布

* [27](/~https://github.com/Vanessa219/vditor/issues/27) 支持类似 Typora 的及时渲染模式 `引入特性`
* [225](/~https://github.com/Vanessa219/vditor/pull/225) publish type declaration file `引入特性`

### v3.0.0 / 2020-03-19

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
"files": [
"dist/*",
"src/index.ts",
"src/method.ts",
"src/ts/*",
"src/assets/*"
],
"dependencies": {
"diff-match-patch": "^1.0.4"
},
"types": "dist/index.d.min.ts",
"types": "src/ts/types/index.d.ts",
"devDependencies": {
"@babel/core": "^7.8.7",
"@babel/preset-env": "^7.8.7",
Expand Down
236 changes: 0 additions & 236 deletions src/assets/index.d.min.ts

This file was deleted.

5 changes: 2 additions & 3 deletions src/ts/ir/input.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {getTopList, hasClosestBlock, hasClosestByTag} from "../util/hasClosest";
import {log} from "../util/log";
import {getSelectPosition} from "../util/selection";
import {setRangeByWbr} from "../wysiwyg/setRangeByWbr";
import {processAfterRender} from "./process";
import {getSelectPosition} from "../util/selection";

export const input = (vditor: IVditor, range: Range) => {
Array.from(vditor.ir.element.querySelectorAll(".vditor-ir__node--expand")).forEach((item) => {
Expand Down Expand Up @@ -42,11 +42,10 @@ export const input = (vditor: IVditor, range: Range) => {
}

if (startSpace || endSpace) {
return
return;
}
}


if (!blockElement) {
// 使用顶级块元素,应使用 innerHTML
blockElement = vditor.ir.element;
Expand Down
2 changes: 1 addition & 1 deletion src/ts/markdown/speechRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const speechRender = (element: HTMLElement, lang: (keyof II18nLang) = "zh
});
}

element.addEventListener("mouseup", (event: IHTMLInputEvent) => {
element.addEventListener("mouseup", (event: MouseEvent) => {
const text = getSelection().toString().trim();
speechSynthesis.cancel();
if (getSelection().toString().trim() === "") {
Expand Down
19 changes: 10 additions & 9 deletions src/ts/toolbar/Upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ export class Upload extends MenuItem {
}

public _bindEvent(vditor: IVditor) {
this.element.querySelector("input").addEventListener("change", (event: IHTMLInputEvent) => {
if (this.element.firstElementChild.classList.contains("vditor-menu--disabled")) {
return;
}
if (event.target.files.length === 0) {
return;
}
uploadFiles(vditor, event.target.files, event.target);
});
this.element.querySelector("input").addEventListener("change",
(event: InputEvent & { target: HTMLInputElement }) => {
if (this.element.firstElementChild.classList.contains("vditor-menu--disabled")) {
return;
}
if (event.target.files.length === 0) {
return;
}
uploadFiles(vditor, event.target.files, event.target);
});
}
}
Loading

0 comments on commit f3a7151

Please sign in to comment.