|
@@ -3,6 +3,7 @@ import { onClickOutsideUp, setCss, isMobileDevice } from '../ui_utils';
|
|
|
import copy from 'copy-to-clipboard';
|
|
|
|
|
|
export class TextEditor {
|
|
|
+ #editList = []
|
|
|
constructor({
|
|
|
eventBus,
|
|
|
contentContainer,
|
|
@@ -31,7 +32,7 @@ export class TextEditor {
|
|
|
this.newAdd = newAdd
|
|
|
this.pageViewer = pageViewer
|
|
|
this.hidden = hidden
|
|
|
-
|
|
|
+
|
|
|
this.type = 'text'
|
|
|
this.deleteSvgStr = `<rect width="30" height="30" rx="2" fill="#DDE9FF"/>
|
|
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19 6.5V9.5H24V10.5H21.5V23.5H8.5V10.5H6V9.5H11V6.5H19ZM9.5 10.5V22.5H20.5V10.5H9.5ZM18 7.5V9.5H12V7.5H18ZM13.5 13V20H12.5V13H13.5ZM17.5 20V13H16.5V20H17.5Z" fill="#333333"/>`
|
|
@@ -998,17 +999,26 @@ export class TextEditor {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ this.#editList.push(data)
|
|
|
+ if (this.#editList.length > 1) return
|
|
|
+ this.handleInsertText()
|
|
|
+ }
|
|
|
|
|
|
+ async handleInsertText() {
|
|
|
const newChar = await this.messageHandler.sendWithPromise('InsertText', {
|
|
|
editAreaPtr: this.editAreaPtr,
|
|
|
char: this.activeCharPlace,
|
|
|
- text: data
|
|
|
+ text: this.#editList[0]
|
|
|
})
|
|
|
this.activeCharPlace = newChar
|
|
|
|
|
|
this.addUndoHistory()
|
|
|
this.updateCanvas()
|
|
|
this.updateCursorLine()
|
|
|
+ this.#editList.length && this.#editList.shift()
|
|
|
+ if (this.#editList.length > 0) {
|
|
|
+ await this.handleInsertText()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 兼容FireFox 监听中文输入
|