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; const showBounds = () => props.store.state.isEditing;
function renderLayerContent(content: string) { 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 parseMarkdown(processVariables(content, props.cardData, props.store.state.cards), iconPath) as string;
} }
return ( return (

View File

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

View File

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

View File

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