This commit is contained in:
j3d1 2024-06-06 22:00:03 +02:00
parent 8f1cc0bba3
commit 54b9cefc5d

View file

@ -91,19 +91,19 @@ export default {
watch: {
value() {
if (this.selection) {
const div = this.$refs.text;
const sel = window.getSelection();
sel.removeAllRanges();
const range = document.createRange();
console.log(this.selection);
range.setStart(...this.findNode(div, this.selection.start));
range.setEnd(...this.findNode(div, this.selection.end));
console.log(range);
sel.addRange(range);
sel.type = this.selection.type;
sel.direction = this.selection.direction;
//this.selection.removeAllRanges();
//this.selection.addRange(range);
setTimeout(() => {
const div = this.$refs.text;
const range = document.createRange();
const sel = window.getSelection();
range.setStart(...this.findNode(div, this.selection.start));
range.setEnd(...this.findNode(div, this.selection.end));
sel.removeAllRanges();
sel.addRange(range);
console.log(range, sel);
}, 0);
}
}
}