Vanessa 2025-08-24 10:14:58 +08:00
parent 7206fc107d
commit 7300a4849c
2 changed files with 23 additions and 2 deletions

View file

@ -28,6 +28,14 @@
&[data-type="select"] { &[data-type="select"] {
padding-left: 6px; padding-left: 6px;
} }
span.b3-menu__avemoji {
line-height: 26px;
img {
margin-top: 6px;
}
}
} }
&__avheader { &__avheader {

View file

@ -4,7 +4,7 @@ import {escapeAriaLabel, escapeAttr, escapeHtml} from "../../../util/escape";
import * as dayjs from "dayjs"; import * as dayjs from "dayjs";
import {popTextCell, updateCellsValue} from "./cell"; import {popTextCell, updateCellsValue} from "./cell";
import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "../../util/hasClosest"; import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "../../util/hasClosest";
import {unicode2Emoji} from "../../../emoji"; import {openEmojiPanel, unicode2Emoji} from "../../../emoji";
import {transaction} from "../../wysiwyg/transaction"; import {transaction} from "../../wysiwyg/transaction";
import {openMenuPanel} from "./openMenuPanel"; import {openMenuPanel} from "./openMenuPanel";
import {uploadFiles} from "../../upload"; import {uploadFiles} from "../../upload";
@ -465,7 +465,20 @@ const openEdit = (protyle: IProtyle, element: HTMLElement, event: MouseEvent) =>
} }
while (target && element !== target) { while (target && element !== 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("b3-menu__avemoji")) {
const rect = target.getBoundingClientRect();
openEmojiPanel(target.nextElementSibling.getAttribute("data-id"), "doc", {
x: rect.left,
y: rect.bottom,
h: rect.height,
w: rect.width,
}, (unicode) => {
target.innerHTML = unicode2Emoji(unicode || window.siyuan.storage[Constants.LOCAL_IMAGES].file);
}, target.querySelector("img"));
event.preventDefault();
event.stopPropagation();
return true;
} else if (target.classList.contains("av__celltext--url") || target.classList.contains("av__cellassetimg")) {
if (event.type === "contextmenu" || (!target.dataset.url && target.tagName !== "IMG")) { 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) => {