mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-10 07:20:54 +08:00
This commit is contained in:
parent
0f53b5aeac
commit
2011ab84e5
@ -83,20 +83,20 @@ export class Toolbar {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// https://github.com/siyuan-note/siyuan/issues/5157
|
// https://github.com/siyuan-note/siyuan/issues/5157
|
||||||
let hasImg = true;
|
let hasImg = false;
|
||||||
let noText = true;
|
let hasText = false;
|
||||||
Array.from(range.cloneContents().childNodes).find(item => {
|
Array.from(range.cloneContents().childNodes).find(item => {
|
||||||
if (item.nodeType !== 1) {
|
if (item.nodeType !== 1) {
|
||||||
if (item.textContent.length > 0) {
|
if (item.textContent.length > 0 && item.textContent !== Constants.ZWSP) {
|
||||||
noText = false;
|
hasText = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (!(item as HTMLElement).classList.contains("img")) {
|
} else if ((item as HTMLElement).classList.contains("img")) {
|
||||||
hasImg = false;
|
hasImg = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if ((hasImg && noText) ||
|
if ((hasImg && !hasText) ||
|
||||||
// 拖拽图片到最右侧
|
// 拖拽图片到最右侧
|
||||||
(range.commonAncestorContainer.nodeType !== 3 && (range.commonAncestorContainer as HTMLElement).classList.contains("img"))) {
|
(range.commonAncestorContainer.nodeType !== 3 && (range.commonAncestorContainer as HTMLElement).classList.contains("img"))) {
|
||||||
this.element.classList.add("fn__none");
|
this.element.classList.add("fn__none");
|
||||||
|
Loading…
Reference in New Issue
Block a user