Skip to content

Commit

Permalink
🚨
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Feb 3, 2025
1 parent 8018d54 commit 6d82682
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/src/protyle/wysiwyg/keydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -821,15 +821,15 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (event.key === "Delete" || matchHotKey("⌃D", event)) {
// 图片后为空格,在空格后删除 https://github.com/siyuan-note/siyuan/issues/13949
if (range.startOffset === 0 && range.startContainer.textContent.length === 1) {
const rangePreviousElement = hasPreviousSibling(range.startContainer) as HTMLElement
const rangeNextElement = hasNextSibling(range.startContainer) as HTMLElement
const rangePreviousElement = hasPreviousSibling(range.startContainer) as HTMLElement;
const rangeNextElement = hasNextSibling(range.startContainer) as HTMLElement;
if (rangePreviousElement && rangePreviousElement.nodeType === 1 && rangePreviousElement.classList.contains("img") &&
rangeNextElement && rangeNextElement.nodeType === 1 && rangeNextElement.classList.contains("img")) {
const wbrElement = document.createElement("wbr")
range.insertNode(wbrElement)
const wbrElement = document.createElement("wbr");
range.insertNode(wbrElement);
const oldHTML = nodeElement.outerHTML;
wbrElement.nextSibling.textContent = Constants.ZWSP;
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML)
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML);
focusByWbr(nodeElement, range);
event.preventDefault();
return;
Expand Down Expand Up @@ -920,15 +920,15 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}
// 图片后为空格,在空格后删除 https://github.com/siyuan-note/siyuan/issues/13949
if (range.startOffset === 1 && range.startContainer.textContent.length === 1) {
const rangePreviousElement = hasPreviousSibling(range.startContainer) as HTMLElement
const rangeNextElement = hasNextSibling(range.startContainer) as HTMLElement
const rangePreviousElement = hasPreviousSibling(range.startContainer) as HTMLElement;
const rangeNextElement = hasNextSibling(range.startContainer) as HTMLElement;
if (rangePreviousElement && rangePreviousElement.nodeType === 1 && rangePreviousElement.classList.contains("img") &&
rangeNextElement && rangeNextElement.nodeType === 1 && rangeNextElement.classList.contains("img")) {
const wbrElement = document.createElement("wbr")
range.insertNode(wbrElement)
const wbrElement = document.createElement("wbr");
range.insertNode(wbrElement);
const oldHTML = nodeElement.outerHTML;
wbrElement.previousSibling.textContent = Constants.ZWSP;
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML)
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML);
focusByWbr(nodeElement, range);
event.preventDefault();
return;
Expand Down

0 comments on commit 6d82682

Please sign in to comment.