js实现json文本可视化编辑复制粘贴节点代码

代码语言:html

所属分类:其他

代码描述:js实现json文本可视化编辑复制粘贴节点代码

代码标签: js json 文本 可视化 编辑 复制 粘贴 节点 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JSON 可视化编辑器</title>
<style>
  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #0b1220;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  /* ---------- 顶栏 ---------- */
  header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #111c30;
    border-bottom: 1px solid #1e2b45;
    flex-wrap: wrap;
  }
  h1 {
    font-size: 15px;
    margin: 0 14px 0 0;
    font-weight: 600;
    letter-spacing: .5px;
    white-space: nowrap;
  }
  h1 span { color: #38bdf8; }
  .spacer { flex: 1; }
  .btn {
    background: #1b2942;
    color: #cbd5e1;
    border: 1px solid #2a3b5c;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: .15s;
    font-family: inherit;
    white-space: nowrap;
  }
  .btn:hover { background: #24385c; color: #fff; border-color: #3b82f6; }
  .btn:active { transform: translateY(1px); }

  .clip-info {
    font-size: 12px;
    color: #64748b;
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid #1e2b45;
    background: #0d1728;
    white-space: nowrap;
    transition: .2s;
  }
  .clip-info.has { color: #4ade80; border-color: #22543d; background: #0b2018; }

  /* ---------- 主体 ---------- */
  main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px;
    min-height: 0;
  }
  .panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #0f1a2e;
    border: 1px solid #1e2b45;
    border-radius: 10px;
    overflow: hidden;
  }
  .panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: #7f93b3;
    border-bottom: 1px solid #1e2b45;
    background: #111c30;
    flex: none;
  }
  .panel-head .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #38bdf8; flex: none;
  }
  .panel-head .dot.green { background: #4ade80; }
  .status { font-size: 12px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .status.ok { color: #4ade80; }
  .status.err { color: #f87171; }

  /* ---------- 文本编辑区 ---------- */
  #jsonText {
    flex: 1;
    width: 100%;
    min-height: 0;
    resize: none;
    border: none;
    outline: none;
    backgro.........完整代码请登录后点击上方下载按钮下载查看

网友评论0