]> git.pld-linux.org Git - packages/ckeditor-addon-autogrow.git/blame - allow-disable.patch
add allow disable patch
[packages/ckeditor-addon-autogrow.git] / allow-disable.patch
CommitLineData
46881b36
ER
1--- autogrow/plugin.js 2013-11-14 13:14:39.000000000 +0200
2+++ autogrow/plugin.js 2014-01-22 11:37:50.747323000 +0200
3@@ -40,6 +40,10 @@
4 if ( !editor.window )
5 return null;
6
7+ if (editor.config.autoGrow_disabled && typeof editor.config.autoGrow_disabled != 'undefined') {
8+ return null;
9+ }
10+
11 var maximize = editor.getCommand( 'maximize' );
12 // Disable autogrow when the editor is maximized .(#6339)
13 if( maximize && maximize.state == CKEDITOR.TRISTATE_ON )
14@@ -84,7 +88,8 @@
15 editor.on( 'instanceReady', function() {
16
17 var editable = editor.editable(),
18- lastHeight;
19+ lastHeight,
20+ lastResizedHeight;
21
22 // Simply set auto height with div wysiwyg.
23 if ( editable.isInline() )
24@@ -92,6 +97,22 @@
25 // For framed wysiwyg we need to resize the editor.
26 else
27 {
28+ editor.addCommand( 'autogrowDisable', {
29+ exec: function( editor ) {
30+ editor.resize( '100%', lastResizedHeight, true );
31+ }
32+ } );
33+ editor.addCommand( 'autogrowEnable', {
34+ exec: function( editor, a ) {
35+ var scrollable = getScrollable( editor ),
36+ currentHeight = editor.window.getViewPaneSize().height;
37+ if (!currentHeight) {
38+ currentHeight = parseInt(editor.config.height);
39+ }
40+ lastResizedHeight = currentHeight;
41+ lastHeight = resizeEditor( editor );
42+ }
43+ } );
44 editor.addCommand( 'autogrow', {
45 exec: function( editor ) {
46 lastHeight = resizeEditor( editor, lastHeight );
This page took 0.078134 seconds and 5 git commands to generate.