diff --git a/app/templates/index.html b/app/templates/index.html
index d07b277..61ce187 100644
--- a/app/templates/index.html
+++ b/app/templates/index.html
@@ -310,9 +310,10 @@
-
-
-
+
+
+
+
@@ -446,7 +447,10 @@
@@ -1252,7 +1256,53 @@
task.pattern = item.pattern;
task.replace = item.replace;
}
- }
+ },
+ copyText(text, callback = () => { }) {
+ if (!text) {
+ console.error('No text to copy');
+ return;
+ }
+ if (navigator.clipboard && window.isSecureContext) {
+ navigator.clipboard.writeText(text);
+ } else {
+ const textarea = document.createElement('textarea');
+ textarea.value = text;
+ textarea.style.position = 'fixed';
+ textarea.style.top = '0';
+ textarea.style.left = '0';
+ textarea.style.opacity = '0';
+ document.body.appendChild(textarea);
+ textarea.select();
+ textarea.setSelectionRange(0, 99999);
+ document.execCommand("copy");
+ document.body.removeChild(textarea);
+ }
+ callback()
+ },
+ copyTaskToClipboard(index) {
+ const task = { ...this.formData.tasklist[index] };
+ delete task.addition;
+ this.copyText(JSON.stringify(task), function () {
+ console.log("任务参数已复制到剪贴板");
+ });
+ },
+ addTaskForClipboard() {
+ // 读取剪贴板内容
+ navigator.clipboard.readText().then(text => {
+ if (text) {
+ try {
+ const task = JSON.parse(text);
+ task.addition = config_data.task_plugins_config_default;;
+ this.formData.tasklist.push(task);
+ } catch (error) {
+ console.error("解析剪贴板内容失败:", error);
+ return;
+ }
+ }
+ }).catch(err => {
+ console.error("读取剪贴板内容失败:", err);
+ });
+ },
}
});