mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 18:10:12 +01:00
This commit is contained in:
parent
a4552bb554
commit
6a8ce50971
2 changed files with 30 additions and 4 deletions
|
|
@ -10,6 +10,7 @@ import {openMenuPanel} from "./openMenuPanel";
|
||||||
import {uploadFiles} from "../../upload";
|
import {uploadFiles} from "../../upload";
|
||||||
import {openLink} from "../../../editor/openLink";
|
import {openLink} from "../../../editor/openLink";
|
||||||
import {editAssetItem} from "./asset";
|
import {editAssetItem} from "./asset";
|
||||||
|
import {previewImage} from "../../preview/image";
|
||||||
|
|
||||||
const genAVRollupHTML = (value: IAVCellValue) => {
|
const genAVRollupHTML = (value: IAVCellValue) => {
|
||||||
let html = "";
|
let html = "";
|
||||||
|
|
@ -359,7 +360,7 @@ const openEdit = (protyle: IProtyle, element: HTMLElement, event: MouseEvent) =>
|
||||||
while (target && !element.isSameNode(target)) {
|
while (target && !element.isSameNode(target)) {
|
||||||
const type = target.getAttribute("data-type");
|
const type = target.getAttribute("data-type");
|
||||||
if (target.classList.contains("av__celltext--url") || target.classList.contains("av__cellassetimg")) {
|
if (target.classList.contains("av__celltext--url") || target.classList.contains("av__cellassetimg")) {
|
||||||
if (event.type === "contextmenu") {
|
if (event.type === "contextmenu" || (!target.dataset.url && target.tagName !== "IMG")) {
|
||||||
let index = 0;
|
let index = 0;
|
||||||
Array.from(target.parentElement.children).find((item, i) => {
|
Array.from(target.parentElement.children).find((item, i) => {
|
||||||
if (item.isSameNode(target)) {
|
if (item.isSameNode(target)) {
|
||||||
|
|
@ -377,9 +378,13 @@ const openEdit = (protyle: IProtyle, element: HTMLElement, event: MouseEvent) =>
|
||||||
index,
|
index,
|
||||||
rect: target.getBoundingClientRect()
|
rect: target.getBoundingClientRect()
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
if (target.tagName === "IMG") {
|
||||||
|
previewImage(target.getAttribute("src"));
|
||||||
} else {
|
} else {
|
||||||
openLink(protyle, target.dataset.url, event, event.ctrlKey || event.metaKey);
|
openLink(protyle, target.dataset.url, event, event.ctrlKey || event.metaKey);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -2234,6 +2234,27 @@ export class WYSIWYG {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aElement && aElement.classList.contains("av__celltext--url") && !aLink) {
|
||||||
|
let index = 0;
|
||||||
|
Array.from(aElement.parentElement.children).find((item, i) => {
|
||||||
|
if (item === aElement) {
|
||||||
|
index = i;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
editAssetItem({
|
||||||
|
protyle,
|
||||||
|
cellElements: [aElement.parentElement],
|
||||||
|
blockElement: hasClosestBlock(aElement) as HTMLElement,
|
||||||
|
content: aElement.getAttribute("data-url"),
|
||||||
|
type: "file",
|
||||||
|
name: aElement.getAttribute("data-name"),
|
||||||
|
index,
|
||||||
|
rect: aElement.getBoundingClientRect()
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const tagElement = hasClosestByAttribute(event.target, "data-type", "tag");
|
const tagElement = hasClosestByAttribute(event.target, "data-type", "tag");
|
||||||
if (tagElement && !event.altKey) {
|
if (tagElement && !event.altKey) {
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue