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: {
|
||||
value() {
|
||||
if (this.selection) {
|
||||
const div = this.$refs.text;
|
||||
const sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
const range = document.createRange();
|
||||
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.setEnd(...this.findNode(div, this.selection.end));
|
||||
console.log(range);
|
||||
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
sel.type = this.selection.type;
|
||||
sel.direction = this.selection.direction;
|
||||
//this.selection.removeAllRanges();
|
||||
//this.selection.addRange(range);
|
||||
console.log(range, sel);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue