Skip to content

Commit

Permalink
FIX: 从其它地方拷贝过来的多层列表,在多次回车后可能出现内容被清除的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
biallo committed Mar 1, 2018
1 parent 3b6d68f commit b90a014
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
11 changes: 5 additions & 6 deletions lib/simditor.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/*!
* Simditor v2.3.12
* http://simditor.tower.im/
* 2018-02-28
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
Expand Down Expand Up @@ -1178,7 +1173,11 @@ Keystroke = (function(superClass) {
if ($node.prev('li').length) {
$node.remove();
} else {
listEl.remove();
if ($node.prev('ul').length || $node.prev('ol').length) {
$node.remove();
} else {
listEl.remove();
}
}
_this.editor.selection.setRangeAtStartOf(newBlockEl);
return true;
Expand Down
6 changes: 5 additions & 1 deletion site/assets/scripts/simditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,11 @@ Keystroke = (function(superClass) {
if ($node.prev('li').length) {
$node.remove();
} else {
listEl.remove();
if ($node.prev('ul').length || $node.prev('ol').length) {
$node.remove();
} else {
listEl.remove();
}
}
_this.editor.selection.setRangeAtStartOf(newBlockEl);
return true;
Expand Down
6 changes: 5 additions & 1 deletion src/keystroke.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ class Keystroke extends SimpleModule
if $node.prev('li').length
$node.remove()
else
listEl.remove()
# 兼容从其它地方拷贝过来的嵌套列表格式
if $node.prev('ul').length || $node.prev('ol').length
$node.remove()
else
listEl.remove()

@editor.selection.setRangeAtStartOf newBlockEl
true
Expand Down
2 changes: 1 addition & 1 deletion styles/simditor.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* Simditor v2.3.12
* http://simditor.tower.im/
* 2018-02-28
* 2018-03-01
*/
@font-face {
font-family: 'Simditor';
Expand Down

0 comments on commit b90a014

Please sign in to comment.