summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-12-09 17:23:46 -0800
committerMark Wells <mark@freeside.biz>2015-12-09 17:23:46 -0800
commite26b8e8e8036556000defb99879a7ae074b09c60 (patch)
treeafc0ffc90375c8e6ea12ade5d6a36a0489b08335 /httemplate
parent548b94eafa4bc90680e13f015445b6833b065c73 (diff)
fix strange behavior after inserting a substitution, #38803, fallout from #24331
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/elements/ckeditor/plugins/blockprotect/plugin.js15
-rw-r--r--httemplate/elements/htmlarea.html3
2 files changed, 16 insertions, 2 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
}) ();
diff --git a/httemplate/elements/htmlarea.html b/httemplate/elements/htmlarea.html
index d8b25121a..4f9b72163 100644
--- a/httemplate/elements/htmlarea.html
+++ b/httemplate/elements/htmlarea.html
@@ -20,7 +20,8 @@ Example:
<SCRIPT TYPE="text/javascript">
- CKEDITOR.replace('<% $opt{'field'} %>',
+ var <% $opt{'field'} %>_editor =
+ CKEDITOR.replace('<% $opt{'field'} %>',
<% encode_json($config) %>
);