This commit is contained in:
j3d1 2024-06-06 22:00:03 +02:00
parent 84c9d922ce
commit 9ffaa5513a

View file

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