始终保留正文编辑与排版预览,删除三模式切换状态和不再使用的样式。 自动保存状态保持原位置,窄屏沿用上下对照,复制及下载不变。 验证:三个按钮不渲染且两侧始终存在先红后绿,复制/持久化保存状态机回归、完整门禁和原生备份恢复通过。
This commit is contained in:
@@ -76,6 +76,12 @@
|
|||||||
> `0.1.12`),由 `scripts/version.py` 从 git **算出来**;开发交付的独立说明写入本文件“开发快照”章节,并打 `snapshot/vX.Y.Z` 注释标签 ⇒ 每次开发交付均可追溯,
|
> `0.1.12`),由 `scripts/version.py` 从 git **算出来**;开发交付的独立说明写入本文件“开发快照”章节,并打 `snapshot/vX.Y.Z` 注释标签 ⇒ 每次开发交付均可追溯,
|
||||||
> 但"发布版本"仍然只能由人定(CI 不会自动升版本、不会打 tag)。
|
> 但"发布版本"仍然只能由人定(CI 不会自动升版本、不会打 tag)。
|
||||||
|
|
||||||
|
## 开发快照 snapshot/v0.1.63 - 2026-10-25
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 周报固定保留编辑正文与排版预览的对照界面,移除编辑/预览/对照切换按钮及无用模式状态/样式;自动保存、复制排版内容和下载保持不变。
|
||||||
|
|
||||||
## 开发快照 snapshot/v0.1.62 - 2026-10-25
|
## 开发快照 snapshot/v0.1.62 - 2026-10-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
+25
-37
@@ -17,8 +17,7 @@ interface Props {
|
|||||||
export function QAWeekly({ onBeforeLeave }: Props) {
|
export function QAWeekly({ onBeforeLeave }: Props) {
|
||||||
const [model] = useState(() => new WeeklyDraftEditorModel(currentQAWeekValue(), weeklyTransport))
|
const [model] = useState(() => new WeeklyDraftEditorModel(currentQAWeekValue(), weeklyTransport))
|
||||||
const state = useSyncExternalStore(model.subscribe, model.getSnapshot, model.getSnapshot)
|
const state = useSyncExternalStore(model.subscribe, model.getSnapshot, model.getSnapshot)
|
||||||
const [mode, setMode] = useState<'edit' | 'preview' | 'both'>('both'),
|
const [replaceConfirm, setReplaceConfirm] = useState(false),
|
||||||
[replaceConfirm, setReplaceConfirm] = useState(false),
|
|
||||||
[reloadConfirm, setReloadConfirm] = useState(false),
|
[reloadConfirm, setReloadConfirm] = useState(false),
|
||||||
[periodReset, setPeriodReset] = useState(0),
|
[periodReset, setPeriodReset] = useState(0),
|
||||||
[exporting, setExporting] = useState(false),
|
[exporting, setExporting] = useState(false),
|
||||||
@@ -177,13 +176,6 @@ export function QAWeekly({ onBeforeLeave }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div className="qa-weekly-editor-toolbar">
|
<div className="qa-weekly-editor-toolbar">
|
||||||
<div className="qa-weekly-mode" aria-label="编辑与预览">
|
|
||||||
{(['edit', 'preview', 'both'] as const).map((value) => (
|
|
||||||
<button type="button" key={value} aria-pressed={mode === value} onClick={() => setMode(value)}>
|
|
||||||
{{ edit: '编辑', preview: '预览', both: '对照' }[value]}
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
<span role="status" aria-live="polite" className="qa-weekly-editor-status" data-weekly-save-state={status}>
|
<span role="status" aria-live="polite" className="qa-weekly-editor-status" data-weekly-save-state={status}>
|
||||||
自动保存 ·{' '}
|
自动保存 ·{' '}
|
||||||
{
|
{
|
||||||
@@ -257,34 +249,30 @@ export function QAWeekly({ onBeforeLeave }: Props) {
|
|||||||
<div ref={copyBody} hidden aria-hidden="true">
|
<div ref={copyBody} hidden aria-hidden="true">
|
||||||
<QAAnswerMarkdown answer={state.text} />
|
<QAAnswerMarkdown answer={state.text} />
|
||||||
</div>
|
</div>
|
||||||
<div className="qa-weekly-editor-layout" data-mode={mode}>
|
<div className="qa-weekly-editor-layout" data-mode="both">
|
||||||
{mode !== 'preview' ? (
|
<div className="qa-weekly-writing">
|
||||||
<div className="qa-weekly-writing">
|
<label htmlFor="qa-weekly-body">
|
||||||
<label htmlFor="qa-weekly-body">
|
周报草稿正文 <small>Markdown</small>
|
||||||
周报草稿正文 <small>Markdown</small>
|
</label>
|
||||||
</label>
|
<textarea
|
||||||
<textarea
|
id="qa-weekly-body"
|
||||||
id="qa-weekly-body"
|
aria-label="周报草稿正文"
|
||||||
aria-label="周报草稿正文"
|
value={state.text}
|
||||||
value={state.text}
|
disabled={blocked}
|
||||||
disabled={blocked}
|
spellCheck={false}
|
||||||
spellCheck={false}
|
placeholder="生成并预填草稿,或直接输入。英文完整部分在上,中文在下;输入后自动保存。"
|
||||||
placeholder="生成并预填草稿,或直接输入。英文完整部分在上,中文在下;输入后自动保存。"
|
onChange={(e) => model.setText(e.target.value)}
|
||||||
onChange={(e) => model.setText(e.target.value)}
|
onKeyDown={(e) => {
|
||||||
onKeyDown={(e) => {
|
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 's') {
|
||||||
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 's') {
|
e.preventDefault()
|
||||||
e.preventDefault()
|
void model.beforeLeave()
|
||||||
void model.beforeLeave()
|
}
|
||||||
}
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
<article className="qa-weekly-preview" aria-label="周报预览">
|
||||||
) : null}
|
{preview ? <QAAnswerMarkdown answer={preview} /> : <p className="qa-ops-muted">尚无草稿正文。</p>}
|
||||||
{mode !== 'edit' ? (
|
</article>
|
||||||
<article className="qa-weekly-preview" aria-label="周报预览">
|
|
||||||
{preview ? <QAAnswerMarkdown answer={preview} /> : <p className="qa-ops-muted">尚无草稿正文。</p>}
|
|
||||||
</article>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
{source && source.source === 'governance-master' ? (
|
{source && source.source === 'governance-master' ? (
|
||||||
<details className="qa-weekly-source">
|
<details className="qa-weekly-source">
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ describe('weekly report editor surface', () => {
|
|||||||
expect(html).toContain('自动保存')
|
expect(html).toContain('自动保存')
|
||||||
expect(html).toContain('周报周次下拉选择')
|
expect(html).toContain('周报周次下拉选择')
|
||||||
expect(html).toContain('预览')
|
expect(html).toContain('预览')
|
||||||
|
expect(html).toContain('data-mode="both"')
|
||||||
|
expect(html).toContain('qa-weekly-writing')
|
||||||
|
expect(html).toContain('qa-weekly-preview')
|
||||||
|
for (const label of ['编辑', '预览', '对照'])
|
||||||
|
expect(html).not.toMatch(new RegExp('<button[^>]*>' + label + '</button>'))
|
||||||
|
expect(html).not.toContain('qa-weekly-mode')
|
||||||
expect(html).toContain('复制排版内容')
|
expect(html).toContain('复制排版内容')
|
||||||
expect(html).toContain('下载 MD')
|
expect(html).toContain('下载 MD')
|
||||||
expect(html).not.toContain('复制 Markdown 原文')
|
expect(html).not.toContain('复制 Markdown 原文')
|
||||||
|
|||||||
@@ -32,18 +32,9 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
justify-content: space-between;
|
justify-content: flex-end;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
.qa-weekly-mode {
|
|
||||||
display: flex;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
|
||||||
.qa-weekly-mode button[aria-pressed='true'] {
|
|
||||||
background: #eaf3ff;
|
|
||||||
color: #155cb5;
|
|
||||||
border-color: #a3c7f3;
|
|
||||||
}
|
|
||||||
.qa-weekly-editor-status {
|
.qa-weekly-editor-status {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
@@ -64,10 +55,6 @@
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
.qa-weekly-editor-layout[data-mode='edit'],
|
|
||||||
.qa-weekly-editor-layout[data-mode='preview'] {
|
|
||||||
grid-template-columns: minmax(0, 1fr);
|
|
||||||
}
|
|
||||||
.qa-weekly-writing {
|
.qa-weekly-writing {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -122,9 +109,6 @@
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
max-height: none;
|
max-height: none;
|
||||||
}
|
}
|
||||||
.qa-weekly-editor-layout[data-mode='preview'] .qa-weekly-preview {
|
|
||||||
border-left: 0;
|
|
||||||
}
|
|
||||||
.qa-weekly-source {
|
.qa-weekly-source {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #66778c;
|
color: #66778c;
|
||||||
|
|||||||
Reference in New Issue
Block a user