Skip to content

Instantly share code, notes, and snippets.

@BrianGilbert
Created June 30, 2014 01:37
Show Gist options
  • Save BrianGilbert/c41dd35692c3fd7e12b6 to your computer and use it in GitHub Desktop.
Save BrianGilbert/c41dd35692c3fd7e12b6 to your computer and use it in GitHub Desktop.
Patch Showprotected plugin to use textarea and have bigger dialog window
diff --git a/showprotected/dialogs/protected.js b/showprotected/dialogs/protected.js
index 9c7ede3..8a06f04 100644
--- a/showprotected/dialogs/protected.js
+++ b/showprotected/dialogs/protected.js
@@ -3,13 +3,13 @@ CKEDITOR.dialog.add( 'showProtectedDialog', function( editor ) {
return {
title: 'Edit Protected Source',
- minWidth: 300,
- minHeight: 60,
+ minWidth: 500,
+ minHeight: 400,
onOk: function() {
var newSourceValue = this.getContentElement( 'info', 'txtProtectedSource' ).getValue();
-
+
var encodedSourceValue = CKEDITOR.plugins.showprotected.encodeProtectedSource( newSourceValue );
-
+
this._.selectedElement.setAttribute('data-cke-realelement', encodedSourceValue);
this._.selectedElement.setAttribute('title', newSourceValue);
this._.selectedElement.setAttribute('alt', newSourceValue);
@@ -21,7 +21,7 @@ CKEDITOR.dialog.add( 'showProtectedDialog', function( editor ) {
onShow: function() {
this._.selectedElement = editor.getSelection().getSelectedElement();
-
+
var decodedSourceValue = CKEDITOR.plugins.showprotected.decodeProtectedSource( this._.selectedElement.getAttribute('data-cke-realelement') );
this.setValueOf( 'info', 'txtProtectedSource', decodedSourceValue );
@@ -33,10 +33,12 @@ CKEDITOR.dialog.add( 'showProtectedDialog', function( editor ) {
accessKey: 'I',
elements: [
{
- type: 'text',
+ type: 'textarea',
id: 'txtProtectedSource',
label: 'Value',
required: true,
+ rows: 26,
+ style : 'width:100%',
validate: function() {
if ( !this.getValue() ) {
alert( 'The value cannot be empty' );
@@ -49,4 +51,4 @@ CKEDITOR.dialog.add( 'showProtectedDialog', function( editor ) {
}
]
};
-} );
\ No newline at end of file
+} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment