stash
This commit is contained in:
parent
84c9d922ce
commit
9ffaa5513a
1 changed files with 12 additions and 12 deletions
|
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue