fix: window close alert

This commit is contained in:
ShawnPhang 2024-04-22 21:42:33 +08:00
parent 63b8660e7b
commit 73c0f922b6
3 changed files with 12 additions and 10 deletions

View File

@ -3,7 +3,7 @@
* @Date: 2024-04-05 07:31:45 * @Date: 2024-04-05 07:31:45
* @Description: * @Description:
* @LastEditors: ShawnPhang <https://m.palxp.cn> * @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastEditTime: 2024-04-12 01:00:40 * @LastEditTime: 2024-04-22 20:47:43
*/ */
// const prefix = import.meta.env // const prefix = import.meta.env
const prefix = process.env const prefix = process.env
@ -25,7 +25,7 @@ export default {
ICONFONT_URL: '//at.alicdn.com/t/font_2717063_ypy8vprc3b.css?display=swap', ICONFONT_URL: '//at.alicdn.com/t/font_2717063_ypy8vprc3b.css?display=swap',
ICONFONT_EXTRA: '//at.alicdn.com/t/c/font_3228074_xojoer6zhp.css', ICONFONT_EXTRA: '//at.alicdn.com/t/c/font_3228074_xojoer6zhp.css',
QINIUYUN_PLUGIN: 'https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/qiniu-js/2.5.5/qiniu.min.js', QINIUYUN_PLUGIN: 'https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/qiniu-js/2.5.5/qiniu.min.js',
supportSubFont: true, // 是否开启服务端字体压缩 supportSubFont: false, // 是否开启服务端字体压缩
} }
export const LocalStorageKey = { export const LocalStorageKey = {

View File

@ -3,7 +3,7 @@
* @Date: 2022-03-09 14:20:09 * @Date: 2022-03-09 14:20:09
* @Description: * @Description:
* @LastEditors: ShawnPhang <https://m.palxp.cn> * @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastEditTime: 2024-04-16 19:19:36 * @LastEditTime: 2024-04-19 15:55:22
*/ */
import { useControlStore, useWidgetStore } from '@/store' import { useControlStore, useWidgetStore } from '@/store'
import { TdWidgetData } from '@/store/design/widget' import { TdWidgetData } from '@/store/design/widget'
@ -50,7 +50,7 @@ export default function keyCodeOptions(e: any, params: any) {
break break
} }
if (e.key === ' ' && widgetStore.dActiveElement?.uuid == '-1') { if (e.key === ' ') {
dealWithSpace(e) dealWithSpace(e)
} }
} }
@ -93,10 +93,12 @@ function dealWithSpace(event: any) {
// 防止编辑文字时空格按不出来 // 防止编辑文字时空格按不出来
if (!widgetStore.dActiveElement.editable) { if (!widgetStore.dActiveElement.editable) {
event.preventDefault() event.preventDefault()
appContainer.classList.add('move-case'); if (widgetStore.dActiveElement?.uuid == '-1') {
appContainer.classList.add('move-case')
if (!controlStore.dSpaceDown) { if (!controlStore.dSpaceDown) {
widgetStore.lockWidgets() widgetStore.lockWidgets()
} }
controlStore.setSpaceDown(true) controlStore.setSpaceDown(true)
} }
} }
}

View File

@ -4,7 +4,7 @@
* @Description: * @Description:
* @LastEditors: ShawnPhang <https://m.palxp.cn> * @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastUpdateContent: Support typescript * @LastUpdateContent: Support typescript
* @LastEditTime: 2024-04-18 18:14:36 * @LastEditTime: 2024-04-20 11:14:13
--> -->
<template> <template>
<div id="page-design-index" ref="pageDesignIndex" class="page-design-bg-color"> <div id="page-design-index" ref="pageDesignIndex" class="page-design-bg-color">
@ -135,7 +135,7 @@ const controlStore = useControlStore()
const createDesignRef: Ref<typeof createDesign | null> = ref(null) const createDesignRef: Ref<typeof createDesign | null> = ref(null)
const beforeUnload = function (e: Event): any { const beforeUnload = function (e: Event): any {
if (dHistoryParams.value.length > 0) { if (dHistoryStack.value.changes.length > 0) {
const confirmationMessage: string = '系统不会自动保存您未修改的内容'; const confirmationMessage: string = '系统不会自动保存您未修改的内容';
(e || window.event).returnValue = (confirmationMessage as any) // Gecko and Trident (e || window.event).returnValue = (confirmationMessage as any) // Gecko and Trident
return confirmationMessage // Gecko and WebKit return confirmationMessage // Gecko and WebKit