Skip to content

Commit

Permalink
🐛 #285
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Apr 9, 2020
1 parent 6a72510 commit 74aeb96
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

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

* [285](https://github.com/Vanessa219/vditor/issues/285) shift+tab is not working at lists `修复缺陷`
* [292](https://github.com/Vanessa219/vditor/pull/292) 🐛 全屏模式文末空白 `修复缺陷`
* [293](https://github.com/Vanessa219/vditor/issues/293) iOS Safari 快捷键显示为 Windows 版本 `修复缺陷`
* [290](https://github.com/Vanessa219/vditor/pull/290) 🎨 add minHeight `改进功能`
Expand Down
6 changes: 6 additions & 0 deletions src/assets/scss/_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,9 @@
border-bottom-color: var(--panel-background-color);
}
}

@media screen and (max-width: $max-width) {
.vditor-arrow:before {
left: 12px;
}
}
26 changes: 19 additions & 7 deletions src/ts/util/fixBrowserBehavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ export const listIndent = (vditor: IVditor, liElement: HTMLElement, range: Range
`<${parentTagName} data-block="0"><li data-marker="${marker}">${liElement.innerHTML}</li></${parentTagName}>`);
liElement.remove();

topListElement.outerHTML = vditor.lute.SpinVditorDOM(topListElement.outerHTML);
if (vditor.currentMode === "wysiwyg") {
topListElement.outerHTML = vditor.lute.SpinVditorDOM(topListElement.outerHTML);
} else {
topListElement.outerHTML = vditor.lute.SpinVditorIRDOM(topListElement.outerHTML);
}

setRangeByWbr(vditor[vditor.currentMode].element, range);
const tempTopListElement = getTopList(range.startContainer);
Expand Down Expand Up @@ -222,18 +226,26 @@ export const listOutdent = (vditor: IVditor, liElement: HTMLElement, range: Rang
liParentElement.querySelectorAll("li").forEach((item) => {
if (isMatch) {
afterHTML += item.outerHTML;
item.remove();
if (!item.nextElementSibling && !item.previousElementSibling) {
item.parentElement.remove();
} else {
item.remove();
}
}
if (item.isEqualNode(liElement)) {
isMatch = true;
}
});
liParentAfterElement.innerHTML = afterHTML;

liParentLiElement.insertAdjacentElement("afterend", liElement);
liElement.insertAdjacentElement("beforeend", liParentAfterElement);

topListElement.outerHTML = vditor.lute.SpinVditorDOM(topListElement.outerHTML);
if (afterHTML) {
liParentAfterElement.innerHTML = afterHTML;
liElement.insertAdjacentElement("beforeend", liParentAfterElement);
}
if (vditor.currentMode === "wysiwyg") {
topListElement.outerHTML = vditor.lute.SpinVditorDOM(topListElement.outerHTML);
} else {
topListElement.outerHTML = vditor.lute.SpinVditorIRDOM(topListElement.outerHTML);
}

setRangeByWbr(vditor[vditor.currentMode].element, range);
const tempTopListElement = getTopList(range.startContainer);
Expand Down

0 comments on commit 74aeb96

Please sign in to comment.