File tree Expand file tree Collapse file tree 3 files changed +21
-7
lines changed
vendor/assets/javascripts Expand file tree Collapse file tree 3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 1
1
module Wysihtml5x
2
2
module Rails
3
- VERSION = "0.4.11 "
3
+ VERSION = "0.4.12 "
4
4
end
5
5
end
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ if(!Array.isArray) {
25
25
return Object . prototype . toString . call ( arg ) === '[object Array]' ;
26
26
} ;
27
27
} ; /**
28
- * @license wysihtml5x v0.4.11
28
+ * @license wysihtml5x v0.4.12
29
29
* https://github.com/Edicy/wysihtml5
30
30
*
31
31
* Author: Christopher Blum (https://github.com/tiff)
@@ -36,7 +36,7 @@ if(!Array.isArray) {
36
36
*
37
37
*/
38
38
var wysihtml5 = {
39
- version : "0.4.11 " ,
39
+ version : "0.4.12 " ,
40
40
41
41
// namespaces
42
42
commands : { } ,
@@ -7046,6 +7046,13 @@ wysihtml5.dom.replaceWithChildNodes = function(node) {
7046
7046
unset = function ( ) {
7047
7047
if ( view . hasPlaceholderSet ( ) ) {
7048
7048
view . clear ( ) ;
7049
+ view . element . focus ( ) ;
7050
+ setTimeout ( function ( ) {
7051
+ var sel = view . selection . getSelection ( ) ;
7052
+ if ( ! sel . focusNode || ! sel . anchorNode ) {
7053
+ view . selection . selectNode ( view . element . firstChild || view . element ) ;
7054
+ }
7055
+ } , 0 ) ;
7049
7056
}
7050
7057
view . placeholderSet = false ;
7051
7058
dom . removeClass ( view . element , CLASS_NAME ) ;
@@ -11845,7 +11852,7 @@ wysihtml5.views.View = Base.extend(
11845
11852
11846
11853
isEmpty : function ( ) {
11847
11854
var innerHTML = this . element . innerHTML . toLowerCase ( ) ;
11848
- return ( / ^ \s * $ / i) . test ( innerHTML ) ||
11855
+ return ( / ^ ( \s | < b r > | < \/ b r > | < p > | < \/ p > ) * $ / i) . test ( innerHTML ) ||
11849
11856
innerHTML === "" ||
11850
11857
innerHTML === "<br>" ||
11851
11858
innerHTML === "<p></p>" ||
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ if(!Array.isArray) {
25
25
return Object . prototype . toString . call ( arg ) === '[object Array]' ;
26
26
} ;
27
27
} ; /**
28
- * @license wysihtml5x v0.4.11
28
+ * @license wysihtml5x v0.4.12
29
29
* https://github.com/Edicy/wysihtml5
30
30
*
31
31
* Author: Christopher Blum (https://github.com/tiff)
@@ -36,7 +36,7 @@ if(!Array.isArray) {
36
36
*
37
37
*/
38
38
var wysihtml5 = {
39
- version : "0.4.11 " ,
39
+ version : "0.4.12 " ,
40
40
41
41
// namespaces
42
42
commands : { } ,
@@ -7046,6 +7046,13 @@ wysihtml5.dom.replaceWithChildNodes = function(node) {
7046
7046
unset = function ( ) {
7047
7047
if ( view . hasPlaceholderSet ( ) ) {
7048
7048
view . clear ( ) ;
7049
+ view . element . focus ( ) ;
7050
+ setTimeout ( function ( ) {
7051
+ var sel = view . selection . getSelection ( ) ;
7052
+ if ( ! sel . focusNode || ! sel . anchorNode ) {
7053
+ view . selection . selectNode ( view . element . firstChild || view . element ) ;
7054
+ }
7055
+ } , 0 ) ;
7049
7056
}
7050
7057
view . placeholderSet = false ;
7051
7058
dom . removeClass ( view . element , CLASS_NAME ) ;
@@ -11845,7 +11852,7 @@ wysihtml5.views.View = Base.extend(
11845
11852
11846
11853
isEmpty : function ( ) {
11847
11854
var innerHTML = this . element . innerHTML . toLowerCase ( ) ;
11848
- return ( / ^ \s * $ / i) . test ( innerHTML ) ||
11855
+ return ( / ^ ( \s | < b r > | < \/ b r > | < p > | < \/ p > ) * $ / i) . test ( innerHTML ) ||
11849
11856
innerHTML === "" ||
11850
11857
innerHTML === "<br>" ||
11851
11858
innerHTML === "<p></p>" ||
You can’t perform that action at this time.
0 commit comments