File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export default {
14
14
textarea: null ,
15
15
content: " " ,
16
16
uploadProgress: 0 ,
17
+ uploading: false
17
18
};
18
19
},
19
20
@@ -37,7 +38,7 @@ export default {
37
38
this .textarea .style .height =
38
39
Math .min (this .textarea .scrollHeight , heightLimit) + " px" ;
39
40
40
- this .textarea .oninput = function () {
41
+ this .textarea .oninput = () => {
41
42
this .textarea .style .height = " " ;
42
43
this .textarea .style .height =
43
44
Math .min (this .textarea .scrollHeight , heightLimit) +
@@ -76,7 +77,7 @@ export default {
76
77
77
78
const placeholder = ` ![Uploading ${ image .name } …]()` ;
78
79
79
- this .content = this . content . concat (placeholder);
80
+ this .insertAtCursor (placeholder);
80
81
81
82
this .http ()
82
83
.post (" /api/uploads" , formData, {
@@ -93,6 +94,13 @@ export default {
93
94
console .log (error);
94
95
});
95
96
},
97
+
98
+ insertAtCursor (text ) {
99
+ this .textarea .focus ();
100
+
101
+ document .execCommand (" insertText" , false /* no UI*/ , text);
102
+ this .content = this .textarea .value ;
103
+ },
96
104
insertImage (placeholder , url ) {
97
105
this .content = this .content .replace (
98
106
placeholder,
You can’t perform that action at this time.
0 commit comments