Skip to content

Commit eb8f004

Browse files
committed
feat: unified display text
1 parent bb80df3 commit eb8f004

File tree

3 files changed

+34
-50
lines changed

3 files changed

+34
-50
lines changed

src/config/theme.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const defaultTheme: Theme = {
8484
'border-radius': `6px`,
8585
'color': `rgba(0,0,0,0.5)`,
8686
'background': `var(--blockquote-background)`,
87+
'margin-bottom': `1em`,
8788
},
8889

8990
// 引用内容
@@ -334,6 +335,7 @@ const graceTheme = toMerged(defaultTheme, {
334335
'border-radius': `6px`,
335336
'color': `rgba(0,0,0,0.6)`,
336337
'box-shadow': `0 4px 6px rgba(0,0,0,0.05)`,
338+
'margin-bottom': `1em`,
337339
},
338340

339341
'blockquote_p': {

src/utils/renderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export function initRenderer(opts: IOpts) {
186186
}
187187
return `
188188
<blockquote ${styles(`blockquote`)}>
189-
<p ${styles(`blockquote_p`)}> ${readingTime.words} 字,需 ${readingTime.text.replace(`read`, `阅读。`)}</p>
189+
<p ${styles(`blockquote_p`)}>字数 ${readingTime?.words},阅读大约需 ${Math.ceil(readingTime?.minutes)} 分钟</p>
190190
</blockquote>
191191
`
192192
}

src/views/CodemirrorEditor.vue

Lines changed: 31 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function leftAndRightScroll() {
6161
}
6262
6363
const percentage
64-
= source.scrollTop / (source.scrollHeight - source.offsetHeight)
64+
= source.scrollTop / (source.scrollHeight - source.offsetHeight)
6565
const height = percentage * (target.scrollHeight - target.offsetHeight)
6666
6767
target.scrollTo(0, height)
@@ -274,7 +274,7 @@ function mdLocalToRemote() {
274274
let [, , matchStr] = item
275275
matchStr = matchStr.replace(/^.\//, ``) // 处理 ./img/ 为 img/ 统一相对路径风格
276276
const { file }
277-
= list.find(f => f.path === `${root}${matchStr}`) || {}
277+
= list.find(f => f.path === `${root}${matchStr}`) || {}
278278
uploadImage(file!, (url) => {
279279
resolve({ matchStr, url })
280280
})
@@ -363,29 +363,18 @@ onMounted(() => {
363363

364364
<template>
365365
<div ref="container" class="container flex flex-col">
366-
<EditorHeader
367-
@add-format="addFormat"
368-
@format-content="formatContent"
369-
@start-copy="startCopy"
370-
@end-copy="endCopy"
371-
/>
366+
<EditorHeader @add-format="addFormat" @format-content="formatContent" @start-copy="startCopy" @end-copy="endCopy" />
372367
<main class="container-main flex-1">
373368
<div class="container-main-section h-full flex border-1">
374369
<PostSlider />
375370
<div
376-
ref="codeMirrorWrapper"
377-
class="codeMirror-wrapper flex-1 border-r-1"
378-
:class="{
371+
ref="codeMirrorWrapper" class="codeMirror-wrapper flex-1 border-r-1" :class="{
379372
'order-1': !store.isEditOnLeft,
380373
}"
381374
>
382375
<ContextMenu>
383376
<ContextMenuTrigger>
384-
<textarea
385-
id="editor"
386-
type="textarea"
387-
placeholder="Your markdown text here."
388-
/>
377+
<textarea id="editor" type="textarea" placeholder="Your markdown text here." />
389378
</ContextMenuTrigger>
390379
<ContextMenuContent class="w-64">
391380
<ContextMenuItem inset @click="toggleShowUploadImgDialog()">
@@ -414,12 +403,7 @@ onMounted(() => {
414403
</ContextMenuContent>
415404
</ContextMenu>
416405
</div>
417-
<div
418-
id="preview"
419-
ref="preview"
420-
:span="isShowCssEditor ? 8 : 12"
421-
class="preview-wrapper flex-1 p-5"
422-
>
406+
<div id="preview" ref="preview" :span="isShowCssEditor ? 8 : 12" class="preview-wrapper flex-1 p-5">
423407
<div id="output-wrapper" :class="{ output_night: !backLight }">
424408
<div class="preview border shadow-xl">
425409
<section id="output" v-html="output" />
@@ -434,35 +418,33 @@ onMounted(() => {
434418
</div>
435419
<CssEditor class="flex-1" />
436420
</div>
437-
<footer class="flex flex-1 justify-end pr-5 text-[14px]">
438-
{{ readingTime?.words }} 字, {{ readingTime?.text }}
421+
<footer class="flex flex-1 justify-end pr-5 text-[12px]">
422+
字数 {{ readingTime?.words }}, 阅读大约需 {{ Math.ceil(readingTime?.minutes) }} 分钟
439423
</footer>
440-
</main>
441424

442-
<UploadImgDialog
443-
@upload-image="uploadImage"
444-
/>
445-
446-
<InsertFormDialog />
447-
448-
<RunLoading />
449-
450-
<AlertDialog v-model:open="store.isOpenConfirmDialog">
451-
<AlertDialogContent>
452-
<AlertDialogHeader>
453-
<AlertDialogTitle>提示</AlertDialogTitle>
454-
<AlertDialogDescription>
455-
此操作将丢失本地自定义样式,是否继续?
456-
</AlertDialogDescription>
457-
</AlertDialogHeader>
458-
<AlertDialogFooter>
459-
<AlertDialogCancel>取消</AlertDialogCancel>
460-
<AlertDialogAction @click="store.resetStyle()">
461-
确认
462-
</AlertDialogAction>
463-
</AlertDialogFooter>
464-
</AlertDialogContent>
465-
</AlertDialog>
425+
<UploadImgDialog @upload-image="uploadImage" />
426+
427+
<InsertFormDialog />
428+
429+
<RunLoading />
430+
431+
<AlertDialog v-model:open="store.isOpenConfirmDialog">
432+
<AlertDialogContent>
433+
<AlertDialogHeader>
434+
<AlertDialogTitle>提示</AlertDialogTitle>
435+
<AlertDialogDescription>
436+
此操作将丢失本地自定义样式,是否继续?
437+
</AlertDialogDescription>
438+
</AlertDialogHeader>
439+
<AlertDialogFooter>
440+
<AlertDialogCancel>取消</AlertDialogCancel>
441+
<AlertDialogAction @click="store.resetStyle()">
442+
确认
443+
</AlertDialogAction>
444+
</AlertDialogFooter>
445+
</AlertDialogContent>
446+
</AlertDialog>
447+
</main>
466448
</div>
467449
</template>
468450

0 commit comments

Comments
 (0)