更改预设复制逻辑
This commit is contained in:
@@ -233,17 +233,13 @@ function deletePreset(preset: ExtendedPreset) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function duplicatePreset(preset: ExtendedPreset) {
|
async function copyPresetContent(preset: ExtendedPreset) {
|
||||||
const newPreset = {
|
try {
|
||||||
name: `${preset.name} - 副本`,
|
await navigator.clipboard.writeText(preset.content);
|
||||||
type: preset.type,
|
showNotification(`预设「${preset.name}」内容已复制到剪贴板`, 'success');
|
||||||
content: preset.content,
|
} catch (error) {
|
||||||
description: preset.description,
|
showNotification('复制失败,请手动复制', 'error');
|
||||||
tags: preset.tags,
|
}
|
||||||
folderId: preset.folderId
|
|
||||||
};
|
|
||||||
store.createExtendedPreset(newPreset);
|
|
||||||
showNotification(`预设「${newPreset.name}」已创建`, 'success');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyPreset(preset: ExtendedPreset) {
|
function applyPreset(preset: ExtendedPreset) {
|
||||||
@@ -506,7 +502,7 @@ onMounted(() => {
|
|||||||
<polyline points="20,6 9,17 4,12" stroke="currentColor" stroke-width="2"/>
|
<polyline points="20,6 9,17 4,12" stroke="currentColor" stroke-width="2"/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
<button @click="duplicatePreset(preset)" class="pm-action-btn" title="复制预设">
|
<button @click="copyPresetContent(preset)" class="pm-action-btn" title="复制内容到剪贴板">
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" stroke="currentColor" stroke-width="2"/>
|
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" stroke="currentColor" stroke-width="2"/>
|
||||||
<path d="m5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" stroke="currentColor" stroke-width="2"/>
|
<path d="m5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" stroke="currentColor" stroke-width="2"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user