From 585680694183739950147f85280ff6ee609f8565 Mon Sep 17 00:00:00 2001 From: ShawnPhang Date: Thu, 28 Mar 2024 18:30:05 +0800 Subject: [PATCH] fix: some bugs --- src/components/modules/settings/textInputArea.vue | 3 ++- src/components/modules/widgets/wText/wText.vue | 5 ++--- src/mixins/methods/dealWithCtrl.ts | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/modules/settings/textInputArea.vue b/src/components/modules/settings/textInputArea.vue index 6bbffad..e82584f 100644 --- a/src/components/modules/settings/textInputArea.vue +++ b/src/components/modules/settings/textInputArea.vue @@ -67,7 +67,8 @@ function blurInput() { } } function getValue(value: string) { - return value.replace(/\n|\r\n/g, '
').replace(/ /g, ' ') + return value + // return value.replace(/\n|\r\n/g, '
').replace(/ /g, ' ') } diff --git a/src/components/modules/widgets/wText/wText.vue b/src/components/modules/widgets/wText/wText.vue index 5b58a0f..49e8119 100644 --- a/src/components/modules/widgets/wText/wText.vue +++ b/src/components/modules/widgets/wText/wText.vue @@ -164,8 +164,7 @@ function updateRecord() { } function updateText(e?: Event) { - const value = e && e.target ? (e.target as HTMLElement).innerHTML : props.params.text.replace(/\n/g, '
') - // const value = (e ? e.target.innerText : props.params.text).replace(//g, '\r\n').replace(/ /g, ' ') + const value = e && e.target ? (e.target as HTMLElement).innerHTML : props.params.text//.replace(/\n/g, '
') if (value !== props.params.text) { store.dispatch('updateWidgetData', { uuid: props.params.uuid, @@ -242,7 +241,7 @@ defineExpose({ .edit-text { outline: none; word-break: break-word; - // white-space: pre; + white-space: pre-wrap; margin: 0; } .effect-text { diff --git a/src/mixins/methods/dealWithCtrl.ts b/src/mixins/methods/dealWithCtrl.ts index e71e727..c6f5793 100644 --- a/src/mixins/methods/dealWithCtrl.ts +++ b/src/mixins/methods/dealWithCtrl.ts @@ -77,12 +77,14 @@ function paste() { * 撤销 */ function undo(shiftKey: any) { + console.log(store.getters.dHistoryParams); + if (shiftKey) { if (!(store.getters.dHistoryParams.index === store.getters.dHistoryParams.length - 1)) { // this.handleHistory('redo') store.dispatch('handleHistory', 'redo') } - } else if (!(store.getters.dHistoryParams.index === -1 || (store.getters.dHistoryParams === 0 && store.getters.dHistoryParams.length === 10))) { + } else if (store.getters.dHistoryParams.index !== -1) { // this.handleHistory('undo') store.dispatch('handleHistory', 'undo') }