activeadmin-ckeditor 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/app/.DS_Store +0 -0
- data/app/assets/.DS_Store +0 -0
- data/app/assets/javascripts/.DS_Store +0 -0
- data/app/assets/javascripts/ckeditor/config.js +118 -0
- data/app/assets/stylesheets/.DS_Store +0 -0
- data/app/assets/stylesheets/activeadmin-ckeditor.css.sass +3 -0
- data/app/assets/stylesheets/ckeditor/.DS_Store +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/.DS_Store +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/autogrow/plugin.js +187 -0
- data/app/assets/stylesheets/ckeditor/plugins/autogrow/samples/autogrow.html +99 -0
- data/app/assets/stylesheets/ckeditor/plugins/floating-tools/README.md +20 -0
- data/app/assets/stylesheets/ckeditor/plugins/floating-tools/plugin.js +582 -0
- data/app/assets/stylesheets/ckeditor/plugins/imagepaste/docs/install.html +64 -0
- data/app/assets/stylesheets/ckeditor/plugins/imagepaste/docs/styles.css +59 -0
- data/app/assets/stylesheets/ckeditor/plugins/imagepaste/plugin.js +82 -0
- data/app/assets/stylesheets/ckeditor/plugins/stylesheetparser/plugin.js +152 -0
- data/app/assets/stylesheets/ckeditor/plugins/stylesheetparser/samples/assets/sample.css +70 -0
- data/app/assets/stylesheets/ckeditor/plugins/stylesheetparser/samples/stylesheetparser.html +82 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/LICENSE.md +28 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/README.md +55 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/images/transformCapitalize.png +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/images/transformSwitcher.png +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/images/transformToLower.png +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/images/transformToUpper.png +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/lang/en.js +17 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/lang/tr.js +41 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/plugin.js +151 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/images/icon.png +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/de.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/en.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/fr.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/hu.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/it.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/ja.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/pt.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/ru.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/tr.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/plugin.js +321 -0
- data/app/assets/stylesheets/ckeditor/skins/.DS_Store +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dev/icons16.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dev/icons16.svg +2106 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dev/icons32.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dev/icons32.svg +2442 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dev/locations.json +139 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog.css.scss +7 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog_ie.css.scss +7 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog_ie7.css.scss +7 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog_ie8.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog_iequirks.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog_opera.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor_gecko.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor_ie.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor_ie7.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor_ie8.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor_iequirks.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/arrow.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/close.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/hidpi/close.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/lock-open.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/lock.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/refresh.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/readme.md +51 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/skin.js +10 -0
- data/lib/.DS_Store +0 -0
- data/lib/activeadmin-ckeditor.rb +3 -3
- data/lib/activeadmin-ckeditor/engine.rb +9 -0
- data/lib/activeadmin-ckeditor/version.rb +1 -1
- data/lib/generators/.DS_Store +0 -0
- data/lib/generators/activeadmin/.DS_Store +0 -0
- data/lib/generators/activeadmin/ckeditor/install_generator.rb +19 -0
- metadata +74 -1
data/.DS_Store
ADDED
Binary file
|
data/app/.DS_Store
ADDED
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,118 @@
|
|
1
|
+
CKEDITOR.editorConfig = function( config )
|
2
|
+
{
|
3
|
+
// Define changes to default configuration here. For example:
|
4
|
+
config.language = 'ru';
|
5
|
+
// config.uiColor = '#AADC6E';
|
6
|
+
|
7
|
+
config.extraPlugins = 'stylesheetparser,youtube,texttransform,autogrow,floating-tools';
|
8
|
+
|
9
|
+
config.toolbar = [
|
10
|
+
{ name: 'document', items: [ 'Source' ] },
|
11
|
+
{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
|
12
|
+
{ name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'TransformTextSwitcher', 'TransformTextToLowercase', 'TransformTextToUppercase', 'TransformTextCapitalize' ] },
|
13
|
+
'/',
|
14
|
+
{ name: 'basicstyles', items: [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
|
15
|
+
{ name: 'paragraph', items: [ 'NumberedList','BulletedList','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ] },
|
16
|
+
{ name: 'links', items: [ 'Link','Unlink','Anchor' ] },
|
17
|
+
'/',
|
18
|
+
{ name: 'insert', items: [ 'Image', 'Youtube', 'Flash', 'Table', 'SpecialChar' ] },
|
19
|
+
{ name: 'styles', items: [ 'Styles', 'Format' ] },
|
20
|
+
{ name: 'others', items: [ 'Maximize', 'ShowBlocks' ] }
|
21
|
+
];
|
22
|
+
|
23
|
+
// config.floatingtools = 'Basic';
|
24
|
+
// config.floatingtools_Basic = [
|
25
|
+
// ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link']
|
26
|
+
// ];
|
27
|
+
|
28
|
+
config.stylesSet = [];
|
29
|
+
config.contentsCss = '/assets/ckeditor/styles.css';
|
30
|
+
|
31
|
+
config.autoGrow_onStartup = true;
|
32
|
+
|
33
|
+
config.youtube_width = '698';
|
34
|
+
config.youtube_height = '524';
|
35
|
+
config.youtube_related = false;
|
36
|
+
config.allowedContent = true;
|
37
|
+
|
38
|
+
/* Filebrowser routes */
|
39
|
+
// The location of an external file browser, that should be launched when "Browse Server" button is pressed.
|
40
|
+
config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
|
41
|
+
|
42
|
+
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Flash dialog.
|
43
|
+
config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";
|
44
|
+
|
45
|
+
// The location of a script that handles file uploads in the Flash dialog.
|
46
|
+
config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files";
|
47
|
+
|
48
|
+
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Link tab of Image dialog.
|
49
|
+
config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";
|
50
|
+
|
51
|
+
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Image dialog.
|
52
|
+
config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
|
53
|
+
|
54
|
+
// The location of a script that handles file uploads in the Image dialog.
|
55
|
+
config.filebrowserImageUploadUrl = "/ckeditor/pictures";
|
56
|
+
|
57
|
+
// The location of a script that handles file uploads.
|
58
|
+
config.filebrowserUploadUrl = "/ckeditor/attachment_files";
|
59
|
+
|
60
|
+
// Rails CSRF token
|
61
|
+
config.filebrowserParams = function(){
|
62
|
+
var csrf_token, csrf_param, meta,
|
63
|
+
metas = document.getElementsByTagName('meta'),
|
64
|
+
params = new Object();
|
65
|
+
|
66
|
+
for ( var i = 0 ; i < metas.length ; i++ ){
|
67
|
+
meta = metas[i];
|
68
|
+
|
69
|
+
switch(meta.name) {
|
70
|
+
case "csrf-token":
|
71
|
+
csrf_token = meta.content;
|
72
|
+
break;
|
73
|
+
case "csrf-param":
|
74
|
+
csrf_param = meta.content;
|
75
|
+
break;
|
76
|
+
default:
|
77
|
+
continue;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
if (csrf_param !== undefined && csrf_token !== undefined) {
|
82
|
+
params[csrf_param] = csrf_token;
|
83
|
+
}
|
84
|
+
|
85
|
+
return params;
|
86
|
+
};
|
87
|
+
|
88
|
+
config.addQueryString = function( url, params ){
|
89
|
+
var queryString = [];
|
90
|
+
|
91
|
+
if ( !params ) {
|
92
|
+
return url;
|
93
|
+
} else {
|
94
|
+
for ( var i in params )
|
95
|
+
queryString.push( i + "=" + encodeURIComponent( params[ i ] ) );
|
96
|
+
}
|
97
|
+
|
98
|
+
return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" );
|
99
|
+
};
|
100
|
+
|
101
|
+
// Integrate Rails CSRF token into file upload dialogs (link, image, attachment and flash)
|
102
|
+
CKEDITOR.on( 'dialogDefinition', function( ev ){
|
103
|
+
// Take the dialog name and its definition from the event data.
|
104
|
+
var dialogName = ev.data.name;
|
105
|
+
var dialogDefinition = ev.data.definition;
|
106
|
+
var content, upload;
|
107
|
+
|
108
|
+
if (CKEDITOR.tools.indexOf(['link', 'image', 'attachment', 'flash'], dialogName) > -1) {
|
109
|
+
content = (dialogDefinition.getContents('Upload') || dialogDefinition.getContents('upload'));
|
110
|
+
upload = (content == null ? null : content.get('upload'));
|
111
|
+
|
112
|
+
if (upload && upload.filebrowser && upload.filebrowser['params'] === undefined) {
|
113
|
+
upload.filebrowser['params'] = config.filebrowserParams();
|
114
|
+
upload.action = config.addQueryString(upload.action, upload.filebrowser['params']);
|
115
|
+
}
|
116
|
+
}
|
117
|
+
});
|
118
|
+
};
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,187 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
4
|
+
*/
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @fileOverview AutoGrow plugin.
|
8
|
+
*/
|
9
|
+
|
10
|
+
(function() {
|
11
|
+
|
12
|
+
// Actual content height, figured out by appending check the last element's document position.
|
13
|
+
function contentHeight( scrollable ) {
|
14
|
+
var overflowY = scrollable.getStyle( 'overflow-y' );
|
15
|
+
|
16
|
+
var doc = scrollable.getDocument();
|
17
|
+
// Create a temporary marker element.
|
18
|
+
var marker = CKEDITOR.dom.element.createFromHtml( '<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;">' + ( CKEDITOR.env.webkit ? ' ' : '' ) + '</span>', doc );
|
19
|
+
doc[ CKEDITOR.env.ie ? 'getBody' : 'getDocumentElement' ]().append( marker );
|
20
|
+
|
21
|
+
var height = marker.getDocumentPosition( doc ).y + marker.$.offsetHeight;
|
22
|
+
marker.remove();
|
23
|
+
scrollable.setStyle( 'overflow-y', overflowY );
|
24
|
+
return height;
|
25
|
+
}
|
26
|
+
|
27
|
+
function getScrollable( editor ) {
|
28
|
+
var doc = editor.document,
|
29
|
+
body = doc.getBody(),
|
30
|
+
htmlElement = doc.getDocumentElement();
|
31
|
+
|
32
|
+
// Quirks mode overflows body, standards overflows document element
|
33
|
+
return doc.$.compatMode == 'BackCompat' ? body : htmlElement;
|
34
|
+
}
|
35
|
+
|
36
|
+
// @param editor
|
37
|
+
// @param {Number} lastHeight The last height set by autogrow.
|
38
|
+
// @returns {Number} New height if has been changed, or the passed `lastHeight`.
|
39
|
+
var resizeEditor = function( editor, lastHeight ) {
|
40
|
+
if ( !editor.window )
|
41
|
+
return null;
|
42
|
+
|
43
|
+
var maximize = editor.getCommand( 'maximize' );
|
44
|
+
// Disable autogrow when the editor is maximized .(#6339)
|
45
|
+
if( maximize && maximize.state == CKEDITOR.TRISTATE_ON )
|
46
|
+
return null;
|
47
|
+
|
48
|
+
var scrollable = getScrollable( editor ),
|
49
|
+
currentHeight = editor.window.getViewPaneSize().height,
|
50
|
+
newHeight = contentHeight( scrollable );
|
51
|
+
|
52
|
+
// Additional space specified by user.
|
53
|
+
newHeight += ( editor.config.autoGrow_bottomSpace || 0 );
|
54
|
+
|
55
|
+
var min = editor.config.autoGrow_minHeight != undefined ? editor.config.autoGrow_minHeight : 200,
|
56
|
+
max = editor.config.autoGrow_maxHeight || Infinity;
|
57
|
+
|
58
|
+
newHeight = Math.max( newHeight, min );
|
59
|
+
newHeight = Math.min( newHeight, max );
|
60
|
+
|
61
|
+
// #10196 Do not resize editor if new height is equal
|
62
|
+
// to the one set by previous resizeEditor() call.
|
63
|
+
if ( newHeight != currentHeight && lastHeight != newHeight ) {
|
64
|
+
newHeight = editor.fire( 'autoGrow', { currentHeight: currentHeight, newHeight: newHeight } ).newHeight;
|
65
|
+
editor.resize( editor.container.getStyle( 'width' ), newHeight, true );
|
66
|
+
lastHeight = newHeight;
|
67
|
+
}
|
68
|
+
|
69
|
+
if ( scrollable.$.scrollHeight > scrollable.$.clientHeight && newHeight < max )
|
70
|
+
scrollable.setStyle( 'overflow-y', 'hidden' );
|
71
|
+
else
|
72
|
+
scrollable.removeStyle( 'overflow-y' );
|
73
|
+
|
74
|
+
return lastHeight;
|
75
|
+
};
|
76
|
+
|
77
|
+
CKEDITOR.plugins.add( 'autogrow', {
|
78
|
+
init: function( editor ) {
|
79
|
+
|
80
|
+
// This feature is available only for themed ui instance.
|
81
|
+
if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_INLINE )
|
82
|
+
return;
|
83
|
+
|
84
|
+
editor.on( 'instanceReady', function() {
|
85
|
+
|
86
|
+
var editable = editor.editable(),
|
87
|
+
lastHeight;
|
88
|
+
|
89
|
+
// Simply set auto height with div wysiwyg.
|
90
|
+
if ( editable.isInline() )
|
91
|
+
editor.ui.space( 'contents' ).setStyle( 'height', 'auto' );
|
92
|
+
// For framed wysiwyg we need to resize the editor.
|
93
|
+
else
|
94
|
+
{
|
95
|
+
editor.addCommand( 'autogrow', {
|
96
|
+
exec: function( editor ) {
|
97
|
+
lastHeight = resizeEditor( editor, lastHeight );
|
98
|
+
},
|
99
|
+
modes:{ wysiwyg:1 },
|
100
|
+
readOnly: 1,
|
101
|
+
canUndo: false,
|
102
|
+
editorFocus: false
|
103
|
+
} );
|
104
|
+
|
105
|
+
var eventsList = { contentDom:1,key:1,selectionChange:1,insertElement:1,mode:1 };
|
106
|
+
for ( var eventName in eventsList ) {
|
107
|
+
editor.on( eventName, function( evt ) {
|
108
|
+
// Some time is required for insertHtml, and it gives other events better performance as well.
|
109
|
+
if ( evt.editor.mode == 'wysiwyg' ) {
|
110
|
+
setTimeout( function() {
|
111
|
+
lastHeight = resizeEditor( evt.editor, lastHeight );
|
112
|
+
// Second pass to make correction upon
|
113
|
+
// the first resize, e.g. scrollbar.
|
114
|
+
lastHeight = resizeEditor( evt.editor, lastHeight );
|
115
|
+
}, 100 );
|
116
|
+
}
|
117
|
+
});
|
118
|
+
}
|
119
|
+
|
120
|
+
// Coordinate with the "maximize" plugin. (#9311)
|
121
|
+
editor.on( 'afterCommandExec', function( evt ) {
|
122
|
+
if ( evt.data.name == 'maximize' && evt.editor.mode == 'wysiwyg' ) {
|
123
|
+
if ( evt.data.command.state == CKEDITOR.TRISTATE_ON ) {
|
124
|
+
var scrollable = getScrollable( editor );
|
125
|
+
scrollable.removeStyle( 'overflow' );
|
126
|
+
}
|
127
|
+
else
|
128
|
+
lastHeight = resizeEditor( editor, lastHeight );
|
129
|
+
}
|
130
|
+
});
|
131
|
+
|
132
|
+
editor.config.autoGrow_onStartup && editor.execCommand( 'autogrow' );
|
133
|
+
}
|
134
|
+
});
|
135
|
+
}
|
136
|
+
});
|
137
|
+
})();
|
138
|
+
|
139
|
+
/**
|
140
|
+
* The minimum height that the editor can reach using the AutoGrow feature.
|
141
|
+
*
|
142
|
+
* config.autoGrow_minHeight = 300;
|
143
|
+
*
|
144
|
+
* @since 3.4
|
145
|
+
* @cfg {Number} [autoGrow_minHeight=200]
|
146
|
+
* @member CKEDITOR.config
|
147
|
+
*/
|
148
|
+
|
149
|
+
/**
|
150
|
+
* The maximum height that the editor can reach using the AutoGrow feature. Zero means unlimited.
|
151
|
+
*
|
152
|
+
* config.autoGrow_maxHeight = 400;
|
153
|
+
*
|
154
|
+
* @since 3.4
|
155
|
+
* @cfg {Number} [autoGrow_maxHeight=0]
|
156
|
+
* @member CKEDITOR.config
|
157
|
+
*/
|
158
|
+
|
159
|
+
/**
|
160
|
+
* Whether to have the auto grow happen on editor creation.
|
161
|
+
*
|
162
|
+
* config.autoGrow_onStartup = true;
|
163
|
+
*
|
164
|
+
* @since 3.6.2
|
165
|
+
* @cfg {Boolean} [autoGrow_onStartup=false]
|
166
|
+
* @member CKEDITOR.config
|
167
|
+
*/
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Extra height in pixel to leave between the bottom boundary of content with document size when auto resizing.
|
171
|
+
*
|
172
|
+
* @since 3.6.2
|
173
|
+
* @cfg {Number} [autoGrow_bottomSpace=0]
|
174
|
+
* @member CKEDITOR.config
|
175
|
+
*/
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Fired when the AutoGrow plugin is about to change the size of the editor.
|
179
|
+
*
|
180
|
+
* @event autogrow
|
181
|
+
* @member CKEDITOR.editor
|
182
|
+
* @param {CKEDITOR.editor} editor This editor instance.
|
183
|
+
* @param data
|
184
|
+
* @param {Number} data.currentHeight The current height of the editor (before resizing).
|
185
|
+
* @param {Number} data.newHeight The new height of the editor (after resizing). It can be changed
|
186
|
+
* to determine a different height value to be used instead.
|
187
|
+
*/
|
@@ -0,0 +1,99 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<!--
|
3
|
+
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
4
|
+
For licensing, see LICENSE.md or http://ckeditor.com/license
|
5
|
+
-->
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>AutoGrow Plugin — CKEditor Sample</title>
|
9
|
+
<meta charset="utf-8">
|
10
|
+
<script src="../../../ckeditor.js"></script>
|
11
|
+
<link rel="stylesheet" href="../../../samples/sample.css">
|
12
|
+
<meta name="ckeditor-sample-name" content="AutoGrow plugin">
|
13
|
+
<meta name="ckeditor-sample-group" content="Plugins">
|
14
|
+
<meta name="ckeditor-sample-description" content="Using the AutoGrow plugin in order to make the editor grow to fit the size of its content.">
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
<h1 class="samples">
|
18
|
+
<a href="../../../samples/index.html">CKEditor Samples</a> » Using AutoGrow Plugin
|
19
|
+
</h1>
|
20
|
+
<div class="description">
|
21
|
+
<p>
|
22
|
+
This sample shows how to configure CKEditor instances to use the
|
23
|
+
<strong>AutoGrow</strong> (<code>autogrow</code>) plugin that lets the editor window expand
|
24
|
+
and shrink depending on the amount and size of content entered in the editing area.
|
25
|
+
</p>
|
26
|
+
<p>
|
27
|
+
In its default implementation the <strong>AutoGrow feature</strong> can expand the
|
28
|
+
CKEditor window infinitely in order to avoid introducing scrollbars to the editing area.
|
29
|
+
</p>
|
30
|
+
<p>
|
31
|
+
It is also possible to set a maximum height for the editor window. Once CKEditor
|
32
|
+
editing area reaches the value in pixels specified in the
|
33
|
+
<code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-autoGrow_maxHeight">autoGrow_maxHeight</a></code>
|
34
|
+
configuration setting, scrollbars will be added and the editor window will no longer expand.
|
35
|
+
</p>
|
36
|
+
<p>
|
37
|
+
To add a CKEditor instance using the <code>autogrow</code> plugin and its
|
38
|
+
<code>autoGrow_maxHeight</code> attribute, insert the following JavaScript call to your code:
|
39
|
+
</p>
|
40
|
+
<pre class="samples">
|
41
|
+
CKEDITOR.replace( '<em>textarea_id</em>', {
|
42
|
+
<strong>extraPlugins: 'autogrow',</strong>
|
43
|
+
autoGrow_maxHeight: 800,
|
44
|
+
|
45
|
+
// Remove the Resize plugin as it does not make sense to use it in conjunction with the AutoGrow plugin.
|
46
|
+
removePlugins: 'resize'
|
47
|
+
});</pre>
|
48
|
+
<p>
|
49
|
+
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
50
|
+
the <code><textarea></code> element to be replaced with CKEditor. The maximum height should
|
51
|
+
be given in pixels.
|
52
|
+
</p>
|
53
|
+
</div>
|
54
|
+
<form action="../../../samples/sample_posteddata.php" method="post">
|
55
|
+
<p>
|
56
|
+
<label for="editor1">
|
57
|
+
CKEditor using the <code>autogrow</code> plugin with its default configuration:
|
58
|
+
</label>
|
59
|
+
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
60
|
+
<script>
|
61
|
+
|
62
|
+
CKEDITOR.replace( 'editor1', {
|
63
|
+
extraPlugins: 'autogrow',
|
64
|
+
removePlugins: 'resize'
|
65
|
+
});
|
66
|
+
|
67
|
+
</script>
|
68
|
+
</p>
|
69
|
+
<p>
|
70
|
+
<label for="editor2">
|
71
|
+
CKEditor using the <code>autogrow</code> plugin with maximum height set to 400 pixels:
|
72
|
+
</label>
|
73
|
+
<textarea cols="80" id="editor2" name="editor2" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
74
|
+
<script>
|
75
|
+
|
76
|
+
CKEDITOR.replace( 'editor2', {
|
77
|
+
extraPlugins: 'autogrow',
|
78
|
+
autoGrow_maxHeight: 400,
|
79
|
+
removePlugins: 'resize'
|
80
|
+
});
|
81
|
+
|
82
|
+
</script>
|
83
|
+
</p>
|
84
|
+
<p>
|
85
|
+
<input type="submit" value="Submit">
|
86
|
+
</p>
|
87
|
+
</form>
|
88
|
+
<div id="footer">
|
89
|
+
<hr>
|
90
|
+
<p>
|
91
|
+
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
92
|
+
</p>
|
93
|
+
<p id="copy">
|
94
|
+
Copyright © 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
95
|
+
Knabben. All rights reserved.
|
96
|
+
</p>
|
97
|
+
</div>
|
98
|
+
</body>
|
99
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
![Screenshot](http://stracker-phil.github.com/Floating-Tools/images/example-2.png)
|
2
|
+
|
3
|
+
-----
|
4
|
+
|
5
|
+
Floating-Tools
|
6
|
+
==============
|
7
|
+
|
8
|
+
Plugin for CKEditor to show an floating toolbar for quick access to formatting functions!
|
9
|
+
|
10
|
+
|
11
|
+
Documentation
|
12
|
+
=============
|
13
|
+
|
14
|
+
Also have a look at the project-page at
|
15
|
+
http://stracker-phil.github.com/Floating-Tools/
|
16
|
+
|
17
|
+
-----
|
18
|
+
|
19
|
+
Philipp Stracker
|
20
|
+
http://www.stracker.net
|