fix: 修复某些情况下切换演示模式页面样式不正确问题

This commit is contained in:
purocean
2021-08-05 15:33:09 +08:00
parent 66dc5eb23a
commit 0c8cd392dd
2 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -32,7 +32,7 @@
</div>
</div>
</div>
<div :class="{'scroll-to-top': true, 'hide': scrollTop < 30}" :style="{top: (height - 40) + 'px'}" @click="scrollToTop">TOP</div>
<div :class="{'scroll-to-top': true, 'hide': scrollTop < 30}" :style="{bottom: `max(100vh - ${height}px, 40px)`}" @click="scrollToTop">TOP</div>
<article ref="refView" class="markdown-body" @dblclick.capture="handleDbClick" @click.capture="handleClick">
<Render @render="handleRender" @rendered="handleRendered" :content="renderContent" />
</article>
@@ -1,6 +1,4 @@
import store from '@fe/support/store'
import { Plugin } from '@fe/context/plugin'
import { Escape, getKeysLabel } from '@fe/context/shortcut'
import type { Plugin } from '@fe/context/plugin'
export default {
name: 'status-bar-presentation',
@@ -9,7 +7,10 @@ export default {
if (flag) {
ctx.ui.useToast().show('info', '按下 Esc 键退出演示模式')
}
store.commit('setPresentation', flag)
ctx.store.commit('setPresentation', flag)
setTimeout(() => {
ctx.bus.emit('global.resize')
}, 0)
}
const enterPresentation = ctx.action.registerAction({
@@ -21,10 +22,10 @@ export default {
ctx.action.registerAction({
name: 'status-bar.exit-presentation',
handler: () => present(false),
keys: [Escape],
keys: [ctx.shortcut.Escape],
when: () => {
const el = window.document.activeElement
return store.state.presentation &&
return ctx.store.state.presentation &&
el?.tagName !== 'INPUT' &&
el?.tagName !== 'TEXTAREA' &&
[...document.body.children] // 判断页面是否有浮层遮住
@@ -37,7 +38,7 @@ export default {
menus['status-bar-presentation'] = {
id: 'status-bar-presentation',
position: 'right',
tips: `预览 (${getKeysLabel(enterPresentation.name)})`,
tips: `预览 (${ctx.shortcut.getKeysLabel(enterPresentation.name)})`,
icon: 'presentation',
onClick: () => present(true)
}