<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>语音转文字编辑窗口</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
background: rgba(0, 0, 0, 0.5);
height: 100vh;
overflow: hidden;
}
.container {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(10px);
}
.content-area {
flex: 1;
overflow-y: auto;
padding: 20px;
padding-bottom: 100px;
}
.section {
margin-bottom: 20px;
animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.section-title {
font-size: 14px;
color: #fff;
margin-bottom: 10px;
font-weight: 500;
opacity: 0.8;
}
.text-bubble {
background: #95EC69;
color: #000;
padding: 12px 16px;
border-radius: 10px;
font-size: 16px;
line-height: 1.5;
max-width: 100%;
word-wrap: break-word;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
position: relative;
margin-left: 40px;
}
.text-bubble::before {
content: '';
position: absolute;
left: -8px;
top: 10px;
width: 0;
height: 0;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-right: 8px solid #95EC69;
}
.text-bubble[contenteditable="true"] {
outline: none;
cursor: text;
transition: all 0.3s ease;
}
.text-bubble[contenteditable="true"]:focus {
box-shadow: 0 0 0 2px #07C160;
}
.text-option {
background: rgba(255, 255, 255, 0.95);
color: #333;
padding: 12px 16px;
border-radius: 8px;
font-size: 15px;
line-height: 1.5;
margin-bottom: 8px;
cursor: pointer;
transition: all 0.3s ease;
border: 1px solid transparent;
}
.text-option:hover {
background: #fff;
transform: translateX(5px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.text-option:active {
transform: translateX(3px);
background: #f0f0f0;
}
.bottom-actions {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: rgba(255, 255, 255, 0.98);
backdrop-filter: blur(20px);
padding: 20px;
display: flex;
gap: 12px;
box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
}
.btn {
flex: 1;
padding: 14px 0;
border: none;
border-radius: 25px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
}
.btn-cancel {
background: #f2f2f2;
color: #666;
}
.btn-cancel:hover {
background: #e5e5e5;
}
.btn-send {
background: #07C160;
color: white;
}
.btn-send:hover {
background: #06ad56;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
}
.btn:active {
transform: scale(0.98);
}
.highlight {
animation: pulse 0.3s ease;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.02); }
100% { transform: scale(1); }
}
</style>
</head>
<body>
<div class="container">
<div class="content-area">
<div class="section">
<div class="section-title">最终文本</div>
<div class="text-bubble" contenteditable="true" id="finalText"></div>
</div>
<div class="section">
<div class="section-title">原始文本</div>
<div class="text-option" onclick="selectText('original')">
今天天气真好,我们一起去公园散步吧,顺便买点水果回来。
</div>
</div>
<div class="section">
<div class="section-title">AI 处理文本</div>
<div class="text-option" onclick="selectText('ai1')">
今天天气晴朗,适合外出活动,建议去公园散步并购买新鲜水果。
</div>
<div class="text-option" onclick="selectText('ai2')">
天气不错,一起去公园走走,顺便采购些水果回家。
</div>
<div class="text-option" onclick="selectText('ai3')">
阳光明媚的日子,最适合去公园散步了,记得买些水果哦。
</div>
<div class="text-option" onclick="selectText('ai4')">
今天是个好天气,不如去公园散步,顺路买点水果。
</div>
</div>
</div>
<div class="bottom-actions">
<button class="btn btn-cancel" onclick="cancel()">取消</button>
<button class="btn btn-send" onclick="send()">发送</button>
</div>
</div>
<script>
// 文本数据
const texts = {
original: "今天天气真好,我们一起去公园散步吧,顺便买点水果回来。",
ai1: "今天天气晴朗,适合外出活动,建议去公园散步并购买新鲜水果。",
ai2: "天气不错,一起去公园走走,顺便采购些水果回家。",
ai3: "阳光明媚的日子,最适合去公园散步了,记得买些水果哦。",
ai4: "今天是个好天气,不如去公园散步,顺路买点水果。"
};
// 初始化最终文本
const finalTextEl = document.getElementById('finalText');
finalTextEl.textContent = texts.original;
// 选择文本
function selectText(type) {
finalTextEl.textContent = texts[type];
finalTextEl.classList.add('highlight');
setTimeout(() => {
finalTextEl.classList.remove('highlight');
}, 300);
// 将光标移到文本末尾
const range = document.createRange();
range.selectNodeContents(finalTextEl);
range.collapse(false);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
}
// 取消操作
function cancel() {
if (confirm('确定要取消编辑吗?')) {
window.close();
}
}
// 发送操作
function send() {
const text = finalTextEl.textContent.trim();
if (text) {
alert('已发送:' + text);
// 这里可以添加实际的发送逻辑
window.close();
} else {
alert('请输入要发送的内容');
}
}
// 防止页面滚动
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, { passive: false });
</script>
</body>
</html>