Skip to content
Permalink
Browse files

geshi dialog now supports direct insertion of plain text, strips out …

…html (#486)
  • Loading branch information...
turnermm committed Jul 1, 2019
1 parent e5fd1e8 commit aac94dfaf7c631350101f7748fe7c543b09025e4

Some generated files are not rendered by default. Learn more.

@@ -135,7 +135,7 @@ CKEDITOR.dialog.add( 'geshiDialog', function( editor ) {
type: 'radio',
id: 'which',
label: editor.lang.geshi.which,
items: [ [ editor.lang.geshi.codeblock, 'block' ], [ editor.lang.geshi.snippet, 'snippet' ] ],
items: [ [ editor.lang.geshi.codeblock, 'block' ], [ editor.lang.geshi.snippet, 'snippet' ], [ editor.lang.geshi.plain_text, 'text' ]],
'default': 'block',
style: 'color: green',
onClick: function() {
@@ -177,7 +177,10 @@ CKEDITOR.dialog.add( 'geshiDialog', function( editor ) {

var p_lang = dialog.getValueOf( 'tab-basic', 'ckg_geshi_lang' );
if(p_lang.match(/Not Set/i)) {
p_lang = "";
if(which == 'text') {
p_lang = 'text';
}
else p_lang = "";
}

if(!p_lang) {
@@ -187,7 +190,11 @@ CKEDITOR.dialog.add( 'geshiDialog', function( editor ) {
}

if(p_lang) {
if(which == 'block') {
if(p_lang == 'text') {
text = text.replace(/^(.*?)\n$/gm,"<p>$1</p>");
retval = text;
}
else if(which == 'block') {
retval = '<pre class="code ' + p_lang+ '">' + text + '</pre>';
}
else retval = downloadable_header(p_lang,dialog.getValueOf( 'tab-basic', 'file' ) ) + text + downloadable_footer();
@@ -1,9 +1,10 @@
CKEDITOR.plugins.setLang("geshi","en",{
title: 'Geshi snippet or block',
lang: 'Select language',
which: 'Codeblock or Snippet?',
which: 'Codeblock or Snippet? Plain Text removes HTML',
codeblock: 'Codeblock',
snippet: 'Downloadable Snippet',
plain_text:'Plain Text',
lang_empty: 'Language field cannot be empty.',
code: 'Text for Snippet or Codeblock',
code_empty: 'Snippet or Codeblock required.',

0 comments on commit aac94df

Please sign in to comment.
You can’t perform that action at this time.