Skip to content

Commit bac1b1e

Browse files
committed
fix: 删除文字的时候前一张图片不会被删除
1 parent 38b4b22 commit bac1b1e

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

src/config/menus.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,21 @@ export default {
182182
// type -> 'emoji' / 'image'
183183
type: 'emoji',
184184
// content -> 数组
185-
content: '😀 😃 😄 😁 😆 😅 😂 🤣 😊 😇 🙂 🙃 😉 😌 😍 😘 😗 😙 😚 😋 😛 😝 😜 🤓 😎 😏 😒 😞 😔 😟 😕 🙁 😣 😖 😫 😩 😢 😭 😤 😠 😡 😳 😱 😨 🤗 🤔 😶 😑 😬 🙄 😯 😴 😷 🤑 😈 🤡 💩 👻 💀 👀 👣'.split(
186-
/\s/
187-
),
185+
content:
186+
'😀 😃 😄 😁 😆 😅 😂 🤣 😊 😇 🙂 🙃 😉 😌 😍 😘 😗 😙 😚 😋 😛 😝 😜 🤓 😎 😏 😒 😞 😔 😟 😕 🙁 😣 😖 😫 😩 😢 😭 😤 😠 😡 😳 😱 😨 🤗 🤔 😶 😑 😬 🙄 😯 😴 😷 🤑 😈 🤡 💩 👻 💀 👀 👣'.split(
187+
/\s/
188+
),
188189
},
189190
{
190191
// tab 的标题
191192
title: '手势',
192193
// type -> 'emoji' / 'image'
193194
type: 'emoji',
194195
// content -> 数组
195-
content: '👐 🙌 👏 🤝 👍 👎 👊 ✊ 🤛 🤜 🤞 ✌️ 🤘 👌 👈 👉 👆 👇 ☝️ ✋ 🤚 🖐 🖖 👋 🤙 💪 🖕 ✍️ 🙏'.split(
196-
/\s/
197-
),
196+
content:
197+
'👐 🙌 👏 🤝 👍 👎 👊 ✊ 🤛 🤜 🤞 ✌️ 🤘 👌 👈 👉 👆 👇 ☝️ ✋ 🤚 🖐 🖖 👋 🤙 💪 🖕 ✍️ 🙏'.split(
198+
/\s/
199+
),
198200
},
199201
],
200202

src/lib/simplehtmlparser.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ SimpleHtmlParser.prototype = {
6161

6262
// regexps
6363

64-
startTagRe: /^<([^>\s\/]+)((\s+[^=>\s]+(\s*=\s*((\"[^"]*\")|(\'[^']*\')|[^>\s]+))?)*)\s*\/?\s*>/m,
64+
startTagRe:
65+
/^<([^>\s\/]+)((\s+[^=>\s]+(\s*=\s*((\"[^"]*\")|(\'[^']*\')|[^>\s]+))?)*)\s*\/?\s*>/m,
6566
endTagRe: /^<\/([^>\s]+)[^>]*>/m,
6667
attrRe: /([^=\s]+)(\s*=\s*((\"([^"]*)\")|(\'([^']*)\')|[^>\s]+))?/gm,
6768

src/menus/img/bind-event/keyboard-event.ts

-8
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,5 @@ export default function bindEventKeyboardEvent(editor: Editor) {
5151
lastChildNodeInPrevNode =
5252
lastChildNodeInPrevNode.childNodes[lastChildNodeInPrevNode.childNodes.length - 1]
5353
}
54-
55-
if (
56-
lastChildNodeInPrevNode instanceof HTMLElement &&
57-
lastChildNodeInPrevNode.tagName === 'IMG'
58-
) {
59-
lastChildNodeInPrevNode.remove()
60-
e.preventDefault()
61-
}
6254
})
6355
}

src/menus/lineHeight/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ class LineHeight extends DropListMenu implements MenuActive {
6969
//获取range 开头结束的dom
7070
const StartElem: DomElement = $(editor.selection.getSelectionStartElem())
7171
const EndElem: DomElement = $(editor.selection.getSelectionEndElem())
72-
const childList: NodeListOf<ChildNode> | undefined = editor.selection.getRange()
73-
?.commonAncestorContainer.childNodes
72+
const childList: NodeListOf<ChildNode> | undefined =
73+
editor.selection.getRange()?.commonAncestorContainer.childNodes
7474
arrayDom_a.push(this.getDom(StartElem.elems[0]))
7575
childList?.forEach((item, index) => {
7676
if (item === this.getDom(StartElem.elems[0])) {

src/utils/const.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
export function EMPTY_FN() {}
77

88
//用于校验是否为url格式字符串
9-
export const urlRegex = /^(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-.,@?^=%&amp;:/~+#]*[\w\-@?^=%&amp;/~+#])?/
9+
export const urlRegex =
10+
/^(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-.,@?^=%&amp;:/~+#]*[\w\-@?^=%&amp;/~+#])?/
1011

1112
// 编辑器为了方便继续输入/换行等原因 主动生成的空标签
1213
export const EMPTY_P = '<p data-we-empty-p=""><br></p>'

0 commit comments

Comments
 (0)