diff options
Diffstat (limited to 'plugins/sourcedialog/dialogs/sourcedialog.js')
| -rwxr-xr-x[-rw-r--r--] | plugins/sourcedialog/dialogs/sourcedialog.js | 84 |
1 files changed, 6 insertions, 78 deletions
diff --git a/plugins/sourcedialog/dialogs/sourcedialog.js b/plugins/sourcedialog/dialogs/sourcedialog.js index 81aa7c8..5ee4ac3 100644..100755 --- a/plugins/sourcedialog/dialogs/sourcedialog.js +++ b/plugins/sourcedialog/dialogs/sourcedialog.js @@ -1,78 +1,6 @@ -/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-CKEDITOR.dialog.add( 'sourcedialog', function( editor ) {
- var size = CKEDITOR.document.getWindow().getViewPaneSize();
-
- // Make it maximum 800px wide, but still fully visible in the viewport.
- var width = Math.min( size.width - 70, 800);
-
- // Make it use 2/3 of the viewport height.
- var height = size.height / 1.5;
-
- // Store old editor data to avoid unnecessary setData.
- var oldData;
-
- return {
- title: editor.lang.sourcedialog.title,
- minWidth: 100,
- minHeight: 100,
-
- onShow: function() {
- this.setValueOf( 'main', 'data', oldData = editor.getData() );
- },
-
- onOk: (function() {
- function setData( newData ) {
- var that = this;
-
- editor.setData( newData, function() {
- that.hide();
-
- // Ensure correct selection.
- var range = editor.createRange();
- range.moveToElementEditStart( editor.editable() );
- range.select();
- } );
- }
-
- return function( event ) {
- // Remove CR from input data for reliable comparison with editor data.
- var newData = this.getValueOf( 'main', 'data' ).replace( /\r/g, '' );
-
- // Avoid unnecessary setData. Also preserve selection
- // when user changed his mind and goes back to wysiwyg editing.
- if ( newData === oldData )
- return true;
-
- // Set data asynchronously to avoid errors in IE.
- CKEDITOR.env.ie ?
- CKEDITOR.tools.setTimeout( setData, 0, this, newData )
- :
- setData.call( this, newData );
-
- // Don't let the dialog close before setData is over.
- return false;
- };
- })(),
-
- contents: [{
- id: 'main',
- label: editor.lang.sourcedialog.title,
- elements: [{
- type: 'textarea',
- type: 'textarea',
- id: 'data',
- dir: 'ltr',
- inputStyle: 'cursor:auto;' +
- 'width:' + width + 'px;' +
- 'height:' + height + 'px;' +
- 'tab-size:4;' +
- 'text-align:left;',
- 'class': 'cke_source'
- }]
- }]
- };
-});
+/* + Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +CKEDITOR.dialog.add("sourcedialog",function(a){var b=CKEDITOR.document.getWindow().getViewPaneSize(),d=Math.min(b.width-70,800),b=b.height/1.5,c;return{title:a.lang.sourcedialog.title,minWidth:100,minHeight:100,onShow:function(){this.setValueOf("main","data",c=a.getData())},onOk:function(){function b(e){var c=this;a.setData(e,function(){c.hide();var b=a.createRange();b.moveToElementEditStart(a.editable());b.select()})}return function(){var a=this.getValueOf("main","data").replace(/\r/g,"");if(a=== +c)return!0;CKEDITOR.env.ie?CKEDITOR.tools.setTimeout(b,0,this,a):b.call(this,a);return!1}}(),contents:[{id:"main",label:a.lang.sourcedialog.title,elements:[{type:"textarea",type:"textarea",id:"data",dir:"ltr",inputStyle:"cursor:auto;width:"+d+"px;height:"+b+"px;tab-size:4;text-align:left;","class":"cke_source"}]}]}});
\ No newline at end of file |
