fix: Text-editing undo bug

This commit is contained in:
ShawnPhang 2025-02-12 18:53:50 +08:00
parent af9e7292b0
commit 65453b5a3a

View File

@ -3,7 +3,7 @@
* @Date: 2022-03-09 16:29:54 * @Date: 2022-03-09 16:29:54
* @Description: ctrl建相关的操作 * @Description: ctrl建相关的操作
* @LastEditors: ShawnPhang <https://m.palxp.cn> * @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastEditTime: 2024-04-18 17:35:57 * @LastEditTime: 2025-02-12 18:52:35
*/ */
// import store from '@/store' // import store from '@/store'
import handlePaste from './handlePaste' import handlePaste from './handlePaste'
@ -84,15 +84,12 @@ function paste() {
* *
*/ */
function undo(shiftKey: any) { function undo(shiftKey: any) {
const widgetStore = useWidgetStore()
const historyStore = useHistoryStore() const historyStore = useHistoryStore()
shiftKey ? historyStore.handleHistory("redo") : historyStore.handleHistory('undo')
// if (shiftKey) { const { type, editable }: any = widgetStore.dActiveElement
// if (!(historyStore.dHistoryParams.index === historyStore.dHistoryParams.length - 1)) { if (type === 'w-text') {
// historyStore.handleHistory("redo") // 不在编辑状态则执行撤销操作
// } !editable && (shiftKey ? historyStore.handleHistory('redo') : historyStore.handleHistory('undo'))
// } else if (historyStore.dHistoryParams.index !== -1) { } else shiftKey ? historyStore.handleHistory('redo') : historyStore.handleHistory('undo')
// // this.handleHistory('undo')
// historyStore.handleHistory('undo')
// }
} }