stash
This commit is contained in:
parent
9ffaa5513a
commit
3d793b4d6c
1 changed files with 12 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div contenteditable @input="onchange" ref="text" v-html="rawhtml(value)">
|
<div contenteditable @input="onchange" ref="text">
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -93,8 +93,9 @@ export default {
|
||||||
if (this.selection) {
|
if (this.selection) {
|
||||||
console.log(this.selection);
|
console.log(this.selection);
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
const div = this.$refs.text;
|
const div = this.$refs.text;
|
||||||
|
div.innerHTML = this.rawhtml(this.value);
|
||||||
|
|
||||||
const range = document.createRange();
|
const range = document.createRange();
|
||||||
const sel = window.getSelection();
|
const sel = window.getSelection();
|
||||||
range.setStart(...this.findNode(div, this.selection.start));
|
range.setStart(...this.findNode(div, this.selection.start));
|
||||||
|
@ -103,7 +104,7 @@ export default {
|
||||||
sel.removeAllRanges();
|
sel.removeAllRanges();
|
||||||
sel.addRange(range);
|
sel.addRange(range);
|
||||||
console.log(range, sel);
|
console.log(range, sel);
|
||||||
}, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue