|
@@ -217,7 +217,13 @@
|
|
|
/** 从剪切板导入 */
|
|
|
async function handleImport() {
|
|
|
try {
|
|
|
- const text = await window.navigator.clipboard.readText();
|
|
|
+ let text = '';
|
|
|
+ // 浏览器会阻止用户在不安全的站点使用剪切板
|
|
|
+ if (window.navigator.clipboard) {
|
|
|
+ text = await window.navigator.clipboard.readText();
|
|
|
+ } else {
|
|
|
+ text = prompt('请粘贴JSON配置') || '';
|
|
|
+ }
|
|
|
const arr = JSON.parse(text);
|
|
|
if (!Array.isArray(arr)) {
|
|
|
throw '剪切板内容格式错误';
|