Skip to content

Commit e3c412b

Browse files
authored
fix update code onPaste (#12)
1 parent d8d786b commit e3c412b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/components/Editor.vue

+3-5
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ export default {
131131
const newCursorPos = currentCursorPos.end + text.length;
132132
this.selection = { start: newCursorPos, end: newCursorPos };
133133
134-
this.codeData = this.getPlain();
135-
this.recordChange(this.codeData, this.selection);
134+
const plain = this.getPlain();
135+
this.recordChange(plain, this.selection);
136+
this.updateContent(plain);
136137
this.setLineNumbersHeight();
137138
};
138139
const $pre = this.$refs.pre;
@@ -221,9 +222,6 @@ export default {
221222
this.undoTimestamp = timestamp;
222223
},
223224
updateContent(plain) {
224-
this.$nextTick(() => {
225-
this.codeData = plain;
226-
});
227225
this.$emit("change", plain);
228226
},
229227
restoreStackState(offset) {

0 commit comments

Comments
 (0)