fix json tool show
This commit is contained in:
@@ -137,6 +137,7 @@
|
|||||||
.editor-content {
|
.editor-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
@@ -154,15 +155,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.output-area {
|
.output-area {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
background: white;
|
background: white;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
font-family: "Consolas", "Monaco", "Courier New", monospace;
|
font-family: "Consolas", "Monaco", "Courier New", monospace;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
white-space: pre-wrap;
|
white-space: pre;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
height: 100%;
|
|
||||||
color: #333;
|
color: #333;
|
||||||
|
word-wrap: break-word;
|
||||||
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-message {
|
.error-message {
|
||||||
@@ -411,13 +418,10 @@
|
|||||||
// 语法高亮
|
// 语法高亮
|
||||||
output.innerHTML = highlightJSON(formatted);
|
output.innerHTML = highlightJSON(formatted);
|
||||||
|
|
||||||
// 显示成功消息
|
// 在状态栏显示成功消息
|
||||||
successMessage.textContent = "✅ JSON 格式化成功!";
|
document.getElementById("status").textContent = "✅ JSON 格式化成功!";
|
||||||
successMessage.style.display = "block";
|
|
||||||
|
|
||||||
// 3秒后隐藏成功消息
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
successMessage.style.display = "none";
|
document.getElementById("status").textContent = "就绪";
|
||||||
}, 3000);
|
}, 3000);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 显示错误
|
// 显示错误
|
||||||
@@ -446,12 +450,11 @@
|
|||||||
const minified = JSON.stringify(jsonObj);
|
const minified = JSON.stringify(jsonObj);
|
||||||
output.textContent = minified;
|
output.textContent = minified;
|
||||||
|
|
||||||
successMessage.textContent = "✅ JSON 压缩成功!";
|
// 在状态栏显示成功消息
|
||||||
successMessage.style.display = "block";
|
document.getElementById("status").textContent = "✅ JSON 压缩成功!";
|
||||||
errorMessage.style.display = "none";
|
errorMessage.style.display = "none";
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
successMessage.style.display = "none";
|
document.getElementById("status").textContent = "就绪";
|
||||||
}, 3000);
|
}, 3000);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
errorMessage.innerHTML = `❌ JSON 格式错误: ${error.message}`;
|
errorMessage.innerHTML = `❌ JSON 格式错误: ${error.message}`;
|
||||||
@@ -533,11 +536,10 @@
|
|||||||
navigator.clipboard
|
navigator.clipboard
|
||||||
.writeText(textToCopy)
|
.writeText(textToCopy)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
successMessage.textContent = "📋 已复制到剪贴板!";
|
// 在状态栏显示成功消息
|
||||||
successMessage.style.display = "block";
|
document.getElementById("status").textContent = "📋 已复制到剪贴板!";
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
successMessage.style.display = "none";
|
document.getElementById("status").textContent = "就绪";
|
||||||
}, 2000);
|
}, 2000);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@@ -549,11 +551,10 @@
|
|||||||
document.execCommand("copy");
|
document.execCommand("copy");
|
||||||
document.body.removeChild(textArea);
|
document.body.removeChild(textArea);
|
||||||
|
|
||||||
successMessage.textContent = "📋 已复制到剪贴板!";
|
// 在状态栏显示成功消息
|
||||||
successMessage.style.display = "block";
|
document.getElementById("status").textContent = "📋 已复制到剪贴板!";
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
successMessage.style.display = "none";
|
document.getElementById("status").textContent = "就绪";
|
||||||
}, 2000);
|
}, 2000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user