Compare commits

..

No commits in common. "3cd8cc54b79fcde234301708e1987800d15d0b9d" and "33d29252dc5839ef163cda2e583acf41f7b8f12c" have entirely different histories.

4 changed files with 9 additions and 13 deletions

View File

@ -23,7 +23,7 @@ export function CardLayer(props: CardLayerProps) {
const showBounds = () => props.store.state.isEditing;
function renderLayerContent(content: string) {
const iconPath = resolvePath(props.store.state.cards.sourcePath, props.cardData.iconPath ?? "./assets");
const iconPath = resolvePath(props.store.state.cards.sourcePath, props.cardData.iconPath);
return parseMarkdown(processVariables(content, props.cardData, props.store.state.cards), iconPath) as string;
}
return (

View File

@ -54,8 +54,7 @@ customElement("md-dice", { key: "" }, (props, { element }) => {
}
});
const handleRoll = (e: MouseEvent) => {
e.preventDefault();
const handleRoll = () => {
// 点击骰子图标:总是重 roll
const rollResult = rollFormula(formula).result;
setResult(rollResult.total);
@ -66,8 +65,7 @@ customElement("md-dice", { key: "" }, (props, { element }) => {
}
};
const handleTextClick = (e: MouseEvent) => {
e.preventDefault();
const handleTextClick = () => {
// 点击文本:总是重置为公式
setResult(null);
setIsRolled(false);
@ -82,14 +80,17 @@ customElement("md-dice", { key: "" }, (props, { element }) => {
return (
<span class="inline-flex items-center px-1">
<span
onClick={handleTextClick}
onClick={(e) => {
e.preventDefault();
handleRoll();
}}
class="text-blue-600 hover:text-blue-800 cursor-pointer"
title={rollDetail() || "掷骰子"}
>
🎲
</span>
<a
onClick={handleRoll}
onClick={handleTextClick}
class="cursor-pointer text-gray-700 hover:text-gray-900"
title={isRolled() ? "点击重置为公式" : formula}
>

View File

@ -40,7 +40,7 @@ const marked = new Marked()
renderer(token) {
if (!token.meta.name) {
const style = globalIconPrefix ? `style="--icon-src: url('${globalIconPrefix}/${token.text}.png')"` : '';
return `<icon ${style} class="icon-${token.text} ${token.attrs?.class || ""}"></icon>`;
return `<icon ${style} class="icon-${token.text}"></icon>`;
}
return false;
}

View File

@ -13,11 +13,6 @@ icon, pull{
background-position: center;
background-repeat: no-repeat;
}
icon.mini{
width: 1em;
height: 1em;
vertical-align: bottom;
}
pull{
margin-right: -.5em;
width: 0;