File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1
1
base dropfiles
2
2
author Michael Große
3
3
email dokuwiki@cosmocode.de
4
- date 2017-12-15
4
+ date 2017-12-21
5
5
name dropfiles plugin
6
6
desc Allows to upload files by drang'n'drop into the editarea of a page
7
7
url https://dokuwiki.org/plugin:dropfiles
Original file line number Diff line number Diff line change 1
1
jQuery ( function ( ) {
2
2
'use strict' ;
3
+
4
+ var $lastKnownCaretPosition = 0 ; // IE 11 fix
3
5
var $editarea = jQuery ( '#wiki__text' ) ;
4
6
var $filelisting = jQuery ( '.plugin__filelisting' ) ;
5
7
if ( ! $editarea . length && ! $filelisting . length ) {
@@ -154,6 +156,12 @@ jQuery(function () {
154
156
$elements . on ( 'dragenter' , function ( e ) {
155
157
e . preventDefault ( ) ;
156
158
e . stopPropagation ( ) ;
159
+
160
+ if ( $editarea [ 0 ] . selectionStart !== $lastKnownCaretPosition ) {
161
+ // IE 11 fix
162
+ $editarea [ 0 ] . setSelectionRange ( $lastKnownCaretPosition , $lastKnownCaretPosition ) ;
163
+ }
164
+
157
165
} ) ;
158
166
159
167
$elements . on ( 'drop' , function ( e ) {
@@ -245,6 +253,7 @@ jQuery(function () {
245
253
$editarea . text ( prefix + syntax + postfix ) ;
246
254
var newCaretPos = caretPos + syntax . length ;
247
255
$editarea [ 0 ] . setSelectionRange ( newCaretPos , newCaretPos ) ;
256
+ $lastKnownCaretPosition = newCaretPos ; // IE 11 fix
248
257
}
249
258
250
259
/**
@@ -374,4 +383,10 @@ jQuery(function () {
374
383
jQuery ( 'body' ) . append ( $widget ) ;
375
384
}
376
385
bootstrapFuntionality ( ) ;
386
+
387
+ $editarea . blur ( function ( ) {
388
+ // IE 11 fix
389
+ $lastKnownCaretPosition = $editarea [ 0 ] . selectionStart ;
390
+ } ) ;
391
+
377
392
} ) ;
You can’t perform that action at this time.
0 commit comments