Skip to content

Commit

Permalink
🐛 fix #266
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Apr 4, 2020
1 parent 40a9407 commit 180ee01
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@

* [open issues](https://github.com/Vanessa219/vditor/issues)

### v3.0.10 / 2020-04-0x
### v3.0.11 / 2020-04-0x

### v3.0.10 / 2020-04-04

* [266](https://github.com/Vanessa219/vditor/issues/266) linkToImgUrl 图片重复上传 `修复缺陷`
* [208](https://github.com/Vanessa219/vditor/issues/208) hr in Firefox `修复缺陷`
* [274](https://github.com/Vanessa219/vditor/issues/274) Toc demo at Preview `文档相关`
* [269](https://github.com/Vanessa219/vditor/issues/269) 分屏预览支持 list-style-type CSS `引入特性`

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

* [265](https://github.com/Vanessa219/vditor/issues/265) ir 模式中 toc, 链接引用,脚注 `引入特性`
* [271](https://github.com/Vanessa219/vditor/issues/271) options.toolbar支持自定义绑定class `引入特性`
* [267](https://github.com/Vanessa219/vditor/issues/267) 设置 codeBlockPreview false, esc 后代码块消失 `修复缺陷`
Expand Down
10 changes: 6 additions & 4 deletions src/ts/ir/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,28 @@ class IR {
setHeaders(vditor, xhr);
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
const responseJSON = JSON.parse(xhr.responseText);
if (xhr.status === 200) {
const responseJSON = JSON.parse(xhr.responseText);
if (responseJSON.code !== 0) {
vditor.tip.show(responseJSON.msg);
return;
}
// TODO
const original = responseJSON.data.originalURL;
const imgElement: HTMLImageElement =
this.element.querySelector(`img[src="${original}"]`);
imgElement.src = responseJSON.data.url;
imgElement.previousElementSibling.previousElementSibling.innerHTML =
responseJSON.data.url;
processAfterRender(vditor);
} else {
vditor.tip.show(responseJSON.msg);
vditor.tip.show(xhr.responseText);
}
}
};
xhr.send(JSON.stringify({url: src}));
}
return ["", Lute.WalkStop];
return [`<span class="vditor-ir__marker vditor-ir__marker--link">${src}</span>`,
Lute.WalkStop];
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions src/ts/sv/html2md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export const html2md = (vditor: IVditor, textHTML: string, textPlain?: string) =
setHeaders(vditor, xhr);
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
const responseJSON = JSON.parse(xhr.responseText);
if (xhr.status === 200) {
const responseJSON = JSON.parse(xhr.responseText);
if (responseJSON.code !== 0) {
vditor.tip.show(responseJSON.msg);
return;
Expand All @@ -41,7 +41,7 @@ export const html2md = (vditor: IVditor, textHTML: string, textPlain?: string) =
setSelectionByInlineText(original, vditor.sv.element.childNodes);
insertText(vditor, responseJSON.data.url, "", true);
} else {
vditor.tip.show(responseJSON.msg);
vditor.tip.show(xhr.responseText);
}
}
};
Expand Down
6 changes: 3 additions & 3 deletions src/ts/util/fixBrowserBehavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,8 @@ export const fixTask = (vditor: IVditor, range: Range, event: KeyboardEvent) =>
export const fixDelete = (vditor: IVditor, range: Range, event: KeyboardEvent, pElement: HTMLElement | false) => {
if (range.startContainer.nodeType !== 3) {
// 光标位于 hr 前,hr 前有内容
const rangeElement = (range.startContainer as HTMLElement).children[range.startOffset]
if (rangeElement && rangeElement.tagName === 'HR') {
const rangeElement = (range.startContainer as HTMLElement).children[range.startOffset];
if (rangeElement && rangeElement.tagName === "HR") {
range.selectNodeContents(rangeElement.previousElementSibling);
range.collapse(false);
event.preventDefault();
Expand Down Expand Up @@ -977,4 +977,4 @@ export const fixHR = (range: Range) => {
(range.startContainer as HTMLElement).tagName === "HR") {
range.setStartBefore(range.startContainer);
}
}
};
4 changes: 2 additions & 2 deletions src/ts/wysiwyg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ class WYSIWYG {
setHeaders(vditor, xhr);
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
const responseJSON = JSON.parse(xhr.responseText);
if (xhr.status === 200) {
const responseJSON = JSON.parse(xhr.responseText);
if (responseJSON.code !== 0) {
vditor.tip.show(responseJSON.msg);
return;
Expand All @@ -196,7 +196,7 @@ class WYSIWYG {
imgElement.src = responseJSON.data.url;
afterRenderEvent(vditor);
} else {
vditor.tip.show(responseJSON.msg);
vditor.tip.show(xhr.responseText);
}
}
};
Expand Down

0 comments on commit 180ee01

Please sign in to comment.