feat: 优化代码编辑器样式和增强预览功能

This commit is contained in:
2026-04-10 20:45:24 +08:00
parent 96b9eb57e2
commit 5baab4da11
3 changed files with 157 additions and 17 deletions

View File

@@ -24,14 +24,57 @@ if ($pr_flag) {
}
.copy {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 68px;
font-size: 12px;
color: #4d4d4d;
background-color: white;
padding: 2px 8px;
margin: 8px;
border-radius: 4px;
font-weight: 600;
color: #2f4f7f;
background: rgba(255, 255, 255, 0.96);
padding: 6px 12px;
margin: 0;
border: 1px solid #c8d3e6;
border-radius: 999px;
cursor: pointer;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.05);
box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}
.copy:hover {
background: #ffffff;
}
.sample-header {
display: flex !important;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.sample-box {
border: 1px solid #cfd7e6 !important;
background: linear-gradient(180deg, #f9fbff 0%, #f3f7ff 100%) !important;
box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}
.sample-box pre {
margin: 0;
padding: 16px 18px;
overflow: auto;
background: transparent;
}
.sample-box code {
display: block;
font-family: "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
font-size: 15px;
line-height: 1.7;
}
.hustoj-md-io-label {
margin: 12px 0 8px;
font-weight: 600;
color: #3d4d66;
}
</style>
@@ -213,12 +256,12 @@ if ($pr_flag) {
<?php if (strlen($sinput) > 0 && $sinput != "\n" || isset($_GET['spa'])) { ?>
<div class="row">
<div class="column">
<h4 class="ui top attached block header"><?php echo $MSG_Sample_Input ?>
<h4 class="ui top attached block header sample-header"><?php echo $MSG_Sample_Input ?>
<span class="copy" id="copyin"
data-clipboard-text="<?php echo htmlentities($sinput, ENT_QUOTES, 'UTF-8'); ?>"><?php echo $MSG_COPY; ?></span>
</h4>
<!-- <span class=copy id=\"copyin\" data-clipboard-text=\"".($sinput)."\"><?php echo $MSG_COPY; ?></span> -->
<div class="ui bottom attached segment font-content">
<div class="ui bottom attached segment font-content sample-box">
<!-- <pre><?php echo ($sinput); ?></pre> -->
<pre
style="margin-top: 0; margin-bottom: 0; "><code id='sinput' class="lang-plain"><?php echo ($sinput); ?></code></pre>
@@ -229,12 +272,12 @@ if ($pr_flag) {
<?php if (strlen($soutput) > 0 && $soutput != "\n" || isset($_GET['spa'])) { ?>
<div class="row">
<div class="column">
<h4 class="ui top attached block header"><?php echo $MSG_Sample_Output ?>
<h4 class="ui top attached block header sample-header"><?php echo $MSG_Sample_Output ?>
<span class="copy" id="copyout"
data-clipboard-text="<?php echo htmlentities($soutput, ENT_QUOTES, 'UTF-8'); ?>"><?php echo $MSG_COPY; ?></span>
</h4>
<!-- <span class=copy id=\"copyout\" data-clipboard-text=\"".($soutput)."\"><?php echo $MSG_COPY; ?></span> -->
<div class="ui bottom attached segment font-content">
<div class="ui bottom attached segment font-content sample-box">
<!-- <div class="ui existing segment"> -->
<pre
style="margin-top: 0; margin-bottom: 0; "><code id='soutput' class="lang-plain"><?php echo ($soutput); ?></code></pre>