mirror of
https://github.com/discourse/discourse.git
synced 2025-06-18 05:17:23 +08:00
FIX: Default selectionStart/end differences in PhantomJS
This commit is contained in:
@ -89,8 +89,13 @@ export default Ember.Component.extend({
|
|||||||
if (!this.get('ready')) { return; }
|
if (!this.get('ready')) { return; }
|
||||||
|
|
||||||
const textarea = this.$('textarea.d-editor-input')[0];
|
const textarea = this.$('textarea.d-editor-input')[0];
|
||||||
const start = textarea.selectionStart;
|
let start = textarea.selectionStart;
|
||||||
const end = textarea.selectionEnd;
|
let end = textarea.selectionEnd;
|
||||||
|
|
||||||
|
if (start === end) {
|
||||||
|
start = end = textarea.value.length;
|
||||||
|
}
|
||||||
|
|
||||||
const value = textarea.value.substring(start, end);
|
const value = textarea.value.substring(start, end);
|
||||||
const pre = textarea.value.slice(0, start);
|
const pre = textarea.value.slice(0, start);
|
||||||
const post = textarea.value.slice(end);
|
const post = textarea.value.slice(end);
|
||||||
|
Reference in New Issue
Block a user