diff options
| author | Mark Wells <mark@freeside.biz> | 2015-12-09 17:23:46 -0800 |
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2015-12-09 17:23:55 -0800 |
| commit | 0414f671da0bb49fd2af12c9adc641fda3478bb1 (patch) | |
| tree | 3fd9095429a351d4b23d0abb63e07eff08ab1622 /httemplate/elements/ckeditor/plugins | |
| parent | e9f17b33c350027f713b88dc3a1c67837a8fd7d6 (diff) | |
fix strange behavior after inserting a substitution, #38803, fallout from #24331
Diffstat (limited to 'httemplate/elements/ckeditor/plugins')
| -rw-r--r-- | httemplate/elements/ckeditor/plugins/blockprotect/plugin.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/httemplate/elements/ckeditor/plugins/blockprotect/plugin.js b/httemplate/elements/ckeditor/plugins/blockprotect/plugin.js index e4ef39167..96c0f42b3 100644 --- a/httemplate/elements/ckeditor/plugins/blockprotect/plugin.js +++ b/httemplate/elements/ckeditor/plugins/blockprotect/plugin.js @@ -133,7 +133,20 @@ } // span function } // elements }); - } + + editor.on( 'afterInsertHtml', function( evt ) { + // if this leaves an open SPAN, move the cursor + // to after it + var range = editor.getSelection().getRanges()[0]; + var ec = range.endContainer; + if ( ec.hasClass('cke_blockprotect') ) { + range.setEndAfter(ec); + range.collapse(); + editor.getSelection().selectRanges([ range ]); + } + }); + + } // afterInit }); // plugins.add }) (); |
