fl 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +44 -0
  3. data/Gemfile +5 -0
  4. data/Gemfile.lock +173 -0
  5. data/README.md +30 -0
  6. data/Rakefile +2 -0
  7. data/app/admin/options.rb +46 -0
  8. data/app/admin/pages.rb +55 -0
  9. data/app/admin/users.rb +34 -0
  10. data/app/assets/javascripts/active_admin.coffee.erb +20 -0
  11. data/app/assets/javascripts/application.coffee.erb +40 -0
  12. data/app/assets/javascripts/ckeditor/basepath.coffee.erb +21 -0
  13. data/app/assets/javascripts/ckeditor/config.coffee.erb +146 -0
  14. data/app/assets/javascripts/ckeditor/plugins/autogrow/plugin.js +232 -0
  15. data/app/assets/javascripts/ckeditor/plugins/autogrow/samples/autogrow.html +102 -0
  16. data/app/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +158 -0
  17. data/app/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/assets/sample.css +70 -0
  18. data/app/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/stylesheetparser.html +85 -0
  19. data/app/assets/javascripts/ckeditor/skins/minimalist/dialog.css +5 -0
  20. data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_ie.css +5 -0
  21. data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_ie7.css +5 -0
  22. data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_ie8.css +5 -0
  23. data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_iequirks.css +5 -0
  24. data/app/assets/javascripts/ckeditor/skins/minimalist/editor.css +5 -0
  25. data/app/assets/javascripts/ckeditor/skins/minimalist/editor_gecko.css +5 -0
  26. data/app/assets/javascripts/ckeditor/skins/minimalist/editor_ie.css +5 -0
  27. data/app/assets/javascripts/ckeditor/skins/minimalist/editor_ie7.css +5 -0
  28. data/app/assets/javascripts/ckeditor/skins/minimalist/editor_ie8.css +5 -0
  29. data/app/assets/javascripts/ckeditor/skins/minimalist/editor_iequirks.css +5 -0
  30. data/app/assets/javascripts/ckeditor/skins/minimalist/icons.png +0 -0
  31. data/app/assets/javascripts/ckeditor/skins/minimalist/icons_hidpi.png +0 -0
  32. data/app/assets/javascripts/ckeditor/skins/minimalist/images/arrow.png +0 -0
  33. data/app/assets/javascripts/ckeditor/skins/minimalist/images/close.png +0 -0
  34. data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/close.png +0 -0
  35. data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/lock-open.png +0 -0
  36. data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/lock.png +0 -0
  37. data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/refresh.png +0 -0
  38. data/app/assets/javascripts/ckeditor/skins/minimalist/images/lock-open.png +0 -0
  39. data/app/assets/javascripts/ckeditor/skins/minimalist/images/lock.png +0 -0
  40. data/app/assets/javascripts/ckeditor/skins/minimalist/images/refresh.png +0 -0
  41. data/app/assets/javascripts/ckeditor/skins/minimalist/readme.md +7 -0
  42. data/app/assets/javascripts/ckeditor/skins/minimalist/skin.js +10 -0
  43. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog.css +5 -0
  44. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie.css +5 -0
  45. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie7.css +5 -0
  46. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie8.css +5 -0
  47. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_iequirks.css +5 -0
  48. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor.css +5 -0
  49. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_gecko.css +5 -0
  50. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie.css +5 -0
  51. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie7.css +5 -0
  52. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie8.css +5 -0
  53. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_iequirks.css +5 -0
  54. data/app/assets/javascripts/ckeditor/skins/moonocolor/icons.png +0 -0
  55. data/app/assets/javascripts/ckeditor/skins/moonocolor/icons_hidpi.png +0 -0
  56. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/arrow.png +0 -0
  57. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/close.png +0 -0
  58. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/close.png +0 -0
  59. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/lock-open.png +0 -0
  60. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/lock.png +0 -0
  61. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/refresh.png +0 -0
  62. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/lock-open.png +0 -0
  63. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/lock.png +0 -0
  64. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/refresh.png +0 -0
  65. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/spinner.gif +0 -0
  66. data/app/assets/javascripts/ckeditor/skins/moonocolor/readme.md +51 -0
  67. data/app/assets/javascripts/ckeditor/skins/moonocolor/skin.js +10 -0
  68. data/app/assets/javascripts/components/confirm.coffee +51 -0
  69. data/app/assets/javascripts/components/modals.coffee +29 -0
  70. data/app/assets/stylesheets/_defaults.yml +106 -0
  71. data/app/assets/stylesheets/_functions.sass.erb +75 -0
  72. data/app/assets/stylesheets/active_admin.sass +117 -0
  73. data/app/assets/stylesheets/application.sass.erb +46 -0
  74. data/app/assets/stylesheets/styles/reset.sass +139 -0
  75. data/app/assets/stylesheets/styles/structure.sass +69 -0
  76. data/app/assets/stylesheets/styles/ui/flash.sass +128 -0
  77. data/app/assets/stylesheets/styles/ui/fonts.sass +32 -0
  78. data/app/assets/stylesheets/styles/ui/modals.sass +61 -0
  79. data/app/assets/stylesheets/styles/ui/tooltips.sass +139 -0
  80. data/app/controllers/application_controller.rb +87 -0
  81. data/app/helpers/fl/application_helper.rb +53 -0
  82. data/app/helpers/fl/asset_helper.rb +50 -0
  83. data/app/helpers/fl/liquid_helper.rb +29 -0
  84. data/app/helpers/fl/meta_helper.rb +118 -0
  85. data/app/lib/active_record/concerns/base.rb +55 -0
  86. data/app/lib/active_record/concerns/seeds.rb +78 -0
  87. data/app/liquid/filters/meta_filter.rb +6 -0
  88. data/app/liquid/tags/google_analytics_tag.rb +32 -0
  89. data/app/liquid/tags/icon_tag.rb +37 -0
  90. data/app/liquid/tags/meta_tag.rb +120 -0
  91. data/app/mailers/application_mailer.rb +28 -0
  92. data/app/models/application_record.rb +3 -0
  93. data/app/models/asset.rb +95 -0
  94. data/app/models/association.rb +21 -0
  95. data/app/models/meta.rb +27 -0
  96. data/app/models/node.rb +59 -0
  97. data/app/models/profile.rb +49 -0
  98. data/app/models/user.rb +49 -0
  99. data/app/service/flash.rb +8 -0
  100. data/app/views/layouts/_admin.haml +6 -0
  101. data/app/views/layouts/_application.haml +17 -0
  102. data/app/views/layouts/base.haml +26 -0
  103. data/app/views/mailers/layouts/mailer.haml +8 -0
  104. data/app/views/mailers/layouts/mailer.text.erb +1 -0
  105. data/app/views/mailers/new_user.erb +4 -0
  106. data/bin/console +14 -0
  107. data/bin/setup +8 -0
  108. data/config/initializers/active_admin.rb +266 -0
  109. data/config/initializers/ckeditor.rb +63 -0
  110. data/config/initializers/devise.rb +279 -0
  111. data/config/initializers/friendly_id.rb +92 -0
  112. data/config/initializers/inflections.rb +20 -0
  113. data/config/initializers/liquid.rb +87 -0
  114. data/config/initializers/sass.rb +45 -0
  115. data/config/locales/devise.en.yml +62 -0
  116. data/config/locales/en.yml +13 -0
  117. data/config/puma.rb +59 -0
  118. data/config/routes.rb +56 -0
  119. data/db/migrate/20160616060637_create_nodes.rb +26 -0
  120. data/db/migrate/20160707080248_create_users.rb +52 -0
  121. data/db/migrate/20160707094704_create_slugs.rb +33 -0
  122. data/db/migrate/20160710095916_create_associations.rb +20 -0
  123. data/db/migrate/20160713061948_create_profiles.rb +27 -0
  124. data/db/migrate/20161115101221_create_assets.rb +25 -0
  125. data/db/migrate/20170725060408_create_active_admin_comments.rb +22 -0
  126. data/db/seeds.rb +81 -0
  127. data/fl.gemspec +73 -0
  128. data/lib/fl.rb +28 -0
  129. data/lib/fl/constants.rb +52 -0
  130. data/lib/fl/engine.rb +160 -0
  131. data/lib/fl/hash.rb +34 -0
  132. data/lib/generators/fl/sass_vars_generator.rb +16 -0
  133. data/lib/generators/fl/templates/sass.yml +56 -0
  134. data/lib/tasks/ckeditor.rake +37 -0
  135. data/lib/tasks/favicon.rake +37 -0
  136. data/readme/fl.jpg +0 -0
  137. metadata +416 -0
@@ -0,0 +1,21 @@
1
+ ############################################
2
+ ############################################
3
+
4
+ # BASEPATH
5
+ # This caused massive issues with the config.assets.prefix setting
6
+ # https://github.com/galetahub/ckeditor#include-customized-ckeditor_basepath-setting
7
+
8
+ ############################################
9
+ ############################################
10
+
11
+ <%
12
+ base_path = ''
13
+ base_path << "/#{Rails.root.basename.to_s}/" if ENV['PROJECT'] =~ /editor/i
14
+ base_path << Rails.application.config.assets.prefix
15
+ base_path << '/ckeditor/'
16
+ %>
17
+
18
+ CKEDITOR_BASEPATH = '<%= base_path %>'
19
+
20
+ ############################################
21
+ ############################################
@@ -0,0 +1,146 @@
1
+ #################################################
2
+ #################################################
3
+ ## _____ _ __ _____ _ _ _ ##
4
+ ## / __ \| | / /| ___| | (_) | ##
5
+ ## | / \/| |/ / | |__ __| |_| |_ ___ _ __ ##
6
+ ## | | | \ | __|/ _` | | __/ _ \| '__| ##
7
+ ## | \__/\| |\ \| |__| (_| | | || (_) | | ##
8
+ ## \____/\_| \_/\____/\__,_|_|\__\___/|_| ##
9
+ ## ##
10
+ #################################################
11
+ #################################################
12
+
13
+ # Any extra skins, put them into vendor/assets/javascripts/ckeditor/skins/...
14
+ # https://github.com/galetahub/ckeditor/issues/88#issuecomment-4327683
15
+
16
+ #################################################
17
+ #################################################
18
+
19
+ ### BASE PATH ###
20
+
21
+ # Sometimes, the base path can become corrupted.
22
+ # There is a tutorial here: https://github.com/galetahub/ckeditor#include-customized-ckeditor_basepath-setting
23
+ # Basically, if you change assets.prefix, it will likely not change in CKEditor
24
+ # The best way to fix it is by running "rake tmp:clear"
25
+
26
+ #= link_tree ./skins
27
+ #= link_tree ./plugins
28
+
29
+ #################################################
30
+ #################################################
31
+
32
+ #CKEditor -> https://github.com/galetahub/ckeditor/issues/470
33
+ ################################
34
+
35
+ CKEDITOR.editorConfig = (config) ->
36
+
37
+ #################################
38
+
39
+ config.filebrowserBrowseUrl = "/ckeditor/attachment_files"
40
+ config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files"
41
+ config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files"
42
+ config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures"
43
+ config.filebrowserImageBrowseUrl = "/ckeditor/pictures"
44
+ config.filebrowserImageUploadUrl = "/ckeditor/pictures"
45
+ config.filebrowserUploadUrl = "/ckeditor/attachment_files"
46
+
47
+ #################################
48
+
49
+ #CSRF
50
+ config.filebrowserParams = ->
51
+ csrf_token = undefined
52
+ csrf_param = undefined
53
+ meta = undefined
54
+ metas = document.getElementsByTagName("meta")
55
+ params = new Object()
56
+ i = 0
57
+
58
+ while i < metas.length
59
+ meta = metas[i]
60
+ switch meta.name
61
+ when "csrf-token"
62
+ csrf_token = meta.content
63
+ when "csrf-param"
64
+ csrf_param = meta.content
65
+ else
66
+ i++
67
+ continue
68
+ i++
69
+ params[csrf_param] = csrf_token if csrf_param isnt `undefined` and csrf_token isnt `undefined`
70
+ params
71
+
72
+ #Querystring
73
+ config.addQueryString = (url, params) ->
74
+ queryString = []
75
+ unless params
76
+ return url
77
+ else
78
+ for i of params
79
+ queryString.push i + "=" + encodeURIComponent(params[i])
80
+ url + ((if (url.indexOf("?") isnt -1) then "&" else "?")) + queryString.join("&")
81
+
82
+
83
+ # Integrate Rails CSRF token into file upload dialogs (link, image, attachment and flash) -> https://github.com/galetahub/ckeditor/blob/master/app/assets/javascripts/ckeditor/config.js
84
+ CKEDITOR.on "dialogDefinition", (ev) ->
85
+
86
+ # Take the dialog name and its definition from the event data.
87
+ dialogName = ev.data.name
88
+ dialogDefinition = ev.data.definition
89
+ content = undefined
90
+ upload = undefined
91
+ if CKEDITOR.tools.indexOf([
92
+ "link"
93
+ "image"
94
+ "image2"
95
+ "attachment"
96
+ "flash"
97
+ ], dialogName) > -1
98
+ content = (dialogDefinition.getContents("Upload") or dialogDefinition.getContents("upload"))
99
+ upload = ((if not content? then null else content.get("upload")))
100
+ if upload and upload.filebrowser and upload.filebrowser["params"] is `undefined`
101
+ upload.filebrowser["params"] = config.filebrowserParams()
102
+ upload.action = config.addQueryString(upload.action, upload.filebrowser["params"])
103
+ return
104
+
105
+ ##################################
106
+
107
+ # Title Attrs
108
+ config.title = false
109
+
110
+ # Content
111
+ #config.contentsCss = '<%= asset_path("ckeditor.css") %>'
112
+
113
+ # HTML5 Tags
114
+ config.extraAllowedContent = 'section article header nav aside[lang,foo]'
115
+
116
+ # Skin
117
+ config.skin = 'moonocolor'
118
+
119
+ # Plugins
120
+ config.extraPlugins = "stylesheetparser,autogrow"
121
+ config.removePlugins = "forms"
122
+
123
+ # Autogrow
124
+ # http://docs.ckeditor.com/#!/guide/dev_autogrow-section-stylistic-fine-tuning
125
+ config.autoGrow_minHeight = 250
126
+ config.autoGrow_maxHeight = 600
127
+ config.autoGrow_onStartup = true
128
+ config.autoGrow_bottomSpace = 30
129
+
130
+ # Toobar
131
+ config.toolbar_Pure = [
132
+ { name: 'document', items: [ 'Source' ] },
133
+ { name: 'styles', items: [ 'Format' ] }
134
+ { name: 'basicstyles', items: [ 'Bold','Italic','Underline','Strike','-','JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'RemoveFormat']},
135
+ { name: 'paragraph', items: [ 'NumberedList','BulletedList','-','Blockquote'] },
136
+ { name: 'table', items: [ 'Table' ]},
137
+ { name: 'hr', items: [ 'HorizontalRule' ]}
138
+ { name: 'colors', items: [ 'TextColor', 'BGColor' ] },
139
+ { name: 'urls', items: [ 'Link','Unlink']},
140
+ { name: 'insert', items: [ 'Image', 'WPMore', 'Scayt' ]},
141
+ { name: 'tools', items: [ 'Maximize', 'ShowBlocks' ] },
142
+ ]
143
+ config.toolbar = "Pure"
144
+ return
145
+
146
+ #################################################
@@ -0,0 +1,232 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or http://ckeditor.com/license
4
+ */
5
+
6
+ /**
7
+ * @fileOverview The Auto Grow plugin.
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ ( function() {
13
+ CKEDITOR.plugins.add( 'autogrow', {
14
+ init: function( editor ) {
15
+ // This feature is available only for themed ui instance.
16
+ if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_INLINE )
17
+ return;
18
+
19
+ editor.on( 'instanceReady', function() {
20
+ // Simply set auto height with div wysiwyg.
21
+ if ( editor.editable().isInline() )
22
+ editor.ui.space( 'contents' ).setStyle( 'height', 'auto' );
23
+ // For classic (`iframe`-based) wysiwyg we need to resize the editor.
24
+ else
25
+ initIframeAutogrow( editor );
26
+ } );
27
+ }
28
+ } );
29
+
30
+ function initIframeAutogrow( editor ) {
31
+ var lastHeight,
32
+ doc,
33
+ markerContainer,
34
+ scrollable,
35
+ marker,
36
+ configBottomSpace = editor.config.autoGrow_bottomSpace || 0,
37
+ configMinHeight = editor.config.autoGrow_minHeight !== undefined ? editor.config.autoGrow_minHeight : 200,
38
+ configMaxHeight = editor.config.autoGrow_maxHeight || Infinity,
39
+ maxHeightIsUnlimited = !editor.config.autoGrow_maxHeight;
40
+
41
+ editor.addCommand( 'autogrow', {
42
+ exec: resizeEditor,
43
+ modes: { wysiwyg: 1 },
44
+ readOnly: 1,
45
+ canUndo: false,
46
+ editorFocus: false
47
+ } );
48
+
49
+ var eventsList = { contentDom: 1, key: 1, selectionChange: 1, insertElement: 1, mode: 1 };
50
+ for ( var eventName in eventsList ) {
51
+ editor.on( eventName, function( evt ) {
52
+ // Some time is required for insertHtml, and it gives other events better performance as well.
53
+ if ( evt.editor.mode == 'wysiwyg' ) {
54
+ setTimeout( function() {
55
+ if ( isNotResizable() ) {
56
+ lastHeight = null;
57
+ return;
58
+ }
59
+
60
+ resizeEditor();
61
+
62
+ // Second pass to make correction upon the first resize, e.g. scrollbar.
63
+ // If height is unlimited vertical scrollbar was removed in the first
64
+ // resizeEditor() call, so we don't need the second pass.
65
+ if ( !maxHeightIsUnlimited )
66
+ resizeEditor();
67
+ }, 100 );
68
+ }
69
+ } );
70
+ }
71
+
72
+ // Coordinate with the "maximize" plugin. (#9311)
73
+ editor.on( 'afterCommandExec', function( evt ) {
74
+ if ( evt.data.name == 'maximize' && evt.editor.mode == 'wysiwyg' ) {
75
+ if ( evt.data.command.state == CKEDITOR.TRISTATE_ON )
76
+ scrollable.removeStyle( 'overflow-y' );
77
+ else
78
+ resizeEditor();
79
+ }
80
+ } );
81
+
82
+ editor.on( 'contentDom', refreshCache );
83
+
84
+ refreshCache();
85
+
86
+ if ( editor.config.autoGrow_onStartup && editor.editable().isVisible() ) {
87
+ editor.execCommand( 'autogrow' );
88
+ }
89
+
90
+ function refreshCache() {
91
+ doc = editor.document;
92
+ markerContainer = doc[ CKEDITOR.env.ie ? 'getBody' : 'getDocumentElement' ]();
93
+
94
+ // Quirks mode overflows body, standards overflows document element.
95
+ scrollable = CKEDITOR.env.quirks ? doc.getBody() : doc.getDocumentElement();
96
+
97
+ // Reset scrollable body height and min-height css values.
98
+ // While set by outside code it may break resizing. (#14620)
99
+ var body = CKEDITOR.env.quirks ? scrollable : scrollable.findOne( 'body' );
100
+ if ( body ) {
101
+ body.setStyle( 'height', 'auto' );
102
+ body.setStyle( 'min-height', CKEDITOR.env.safari ? '0%' : 'auto' ); // Safari does not support 'min-height: auto'.
103
+ }
104
+
105
+ marker = CKEDITOR.dom.element.createFromHtml(
106
+ '<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;">' +
107
+ ( CKEDITOR.env.webkit ? '&nbsp;' : '' ) +
108
+ '</span>',
109
+ doc );
110
+ }
111
+
112
+ function isNotResizable() {
113
+ var maximizeCommand = editor.getCommand( 'maximize' );
114
+
115
+ return (
116
+ !editor.window ||
117
+ // Disable autogrow when the editor is maximized. (#6339)
118
+ maximizeCommand && maximizeCommand.state == CKEDITOR.TRISTATE_ON
119
+ );
120
+ }
121
+
122
+ // Actual content height, figured out by appending check the last element's document position.
123
+ function contentHeight() {
124
+ // Append a temporary marker element.
125
+ markerContainer.append( marker );
126
+ var height = marker.getDocumentPosition( doc ).y + marker.$.offsetHeight;
127
+ marker.remove();
128
+
129
+ return height;
130
+ }
131
+
132
+ function resizeEditor() {
133
+ // Hide scroll because we won't need it at all.
134
+ // Thanks to that we'll need only one resizeEditor() call per change.
135
+ if ( maxHeightIsUnlimited )
136
+ scrollable.setStyle( 'overflow-y', 'hidden' );
137
+
138
+ var currentHeight = editor.window.getViewPaneSize().height,
139
+ newHeight = contentHeight();
140
+
141
+ // Additional space specified by user.
142
+ newHeight += configBottomSpace;
143
+ newHeight = Math.max( newHeight, configMinHeight );
144
+ newHeight = Math.min( newHeight, configMaxHeight );
145
+
146
+ // #10196 Do not resize editor if new height is equal
147
+ // to the one set by previous resizeEditor() call.
148
+ if ( newHeight != currentHeight && lastHeight != newHeight ) {
149
+ newHeight = editor.fire( 'autoGrow', { currentHeight: currentHeight, newHeight: newHeight } ).newHeight;
150
+ editor.resize( editor.container.getStyle( 'width' ), newHeight, true );
151
+ lastHeight = newHeight;
152
+ }
153
+
154
+ if ( !maxHeightIsUnlimited ) {
155
+ if ( newHeight < configMaxHeight && scrollable.$.scrollHeight > scrollable.$.clientHeight )
156
+ scrollable.setStyle( 'overflow-y', 'hidden' );
157
+ else
158
+ scrollable.removeStyle( 'overflow-y' );
159
+ }
160
+ }
161
+ }
162
+ } )();
163
+
164
+ /**
165
+ * The minimum height that the editor can assume when adjusting to content by using the Auto Grow
166
+ * feature. This option accepts a value in pixels, without the unit (for example: `300`).
167
+ *
168
+ * Read more in the [documentation](#!/guide/dev_autogrow)
169
+ * and see the [SDK sample](http://sdk.ckeditor.com/samples/autogrow.html).
170
+ *
171
+ * config.autoGrow_minHeight = 300;
172
+ *
173
+ * @since 3.4
174
+ * @cfg {Number} [autoGrow_minHeight=200]
175
+ * @member CKEDITOR.config
176
+ */
177
+
178
+ /**
179
+ * The maximum height that the editor can assume when adjusting to content by using the Auto Grow
180
+ * feature. This option accepts a value in pixels, without the unit (for example: `600`).
181
+ * Zero (`0`) means that the maximum height is not limited and the editor will expand infinitely.
182
+ *
183
+ * Read more in the [documentation](#!/guide/dev_autogrow)
184
+ * and see the [SDK sample](http://sdk.ckeditor.com/samples/autogrow.html).
185
+ *
186
+ * config.autoGrow_maxHeight = 400;
187
+ *
188
+ * @since 3.4
189
+ * @cfg {Number} [autoGrow_maxHeight=0]
190
+ * @member CKEDITOR.config
191
+ */
192
+
193
+ /**
194
+ * Whether automatic editor height adjustment brought by the Auto Grow feature should happen on
195
+ * editor creation.
196
+ *
197
+ * Read more in the [documentation](#!/guide/dev_autogrow)
198
+ * and see the [SDK sample](http://sdk.ckeditor.com/samples/autogrow.html).
199
+ *
200
+ * config.autoGrow_onStartup = true;
201
+ *
202
+ * @since 3.6.2
203
+ * @cfg {Boolean} [autoGrow_onStartup=false]
204
+ * @member CKEDITOR.config
205
+ */
206
+
207
+ /**
208
+ * Extra vertical space to be added between the content and the editor bottom bar when adjusting
209
+ * editor height to content by using the Auto Grow feature. This option accepts a value in pixels,
210
+ * without the unit (for example: `50`).
211
+ *
212
+ * Read more in the [documentation](#!/guide/dev_autogrow)
213
+ * and see the [SDK sample](http://sdk.ckeditor.com/samples/autogrow.html).
214
+ *
215
+ * config.autoGrow_bottomSpace = 50;
216
+ *
217
+ * @since 3.6.2
218
+ * @cfg {Number} [autoGrow_bottomSpace=0]
219
+ * @member CKEDITOR.config
220
+ */
221
+
222
+ /**
223
+ * Fired when the Auto Grow plugin is about to change the size of the editor.
224
+ *
225
+ * @event autogrow
226
+ * @member CKEDITOR.editor
227
+ * @param {CKEDITOR.editor} editor This editor instance.
228
+ * @param data
229
+ * @param {Number} data.currentHeight The current editor height (before resizing).
230
+ * @param {Number} data.newHeight The new editor height (after resizing). It can be changed
231
+ * to achieve a different height value to be used instead.
232
+ */
@@ -0,0 +1,102 @@
1
+ <!DOCTYPE html>
2
+ <!--
3
+ Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
4
+ For licensing, see LICENSE.md or http://ckeditor.com/license
5
+ -->
6
+ <html>
7
+ <head>
8
+ <meta charset="utf-8">
9
+ <title>AutoGrow Plugin &mdash; CKEditor Sample</title>
10
+ <script src="../../../ckeditor.js"></script>
11
+ <link rel="stylesheet" href="../../../samples/old/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/old/index.html">CKEditor Samples</a> &raquo; Using AutoGrow Plugin
19
+ </h1>
20
+ <div class="warning deprecated">
21
+ This sample is not maintained anymore. Check out its <a href="http://sdk.ckeditor.com/samples/autogrow.html">brand new version in CKEditor SDK</a>.
22
+ </div>
23
+ <div class="description">
24
+ <p>
25
+ This sample shows how to configure CKEditor instances to use the
26
+ <strong>AutoGrow</strong> (<code>autogrow</code>) plugin that lets the editor window expand
27
+ and shrink depending on the amount and size of content entered in the editing area.
28
+ </p>
29
+ <p>
30
+ In its default implementation the <strong>AutoGrow feature</strong> can expand the
31
+ CKEditor window infinitely in order to avoid introducing scrollbars to the editing area.
32
+ </p>
33
+ <p>
34
+ It is also possible to set a maximum height for the editor window. Once CKEditor
35
+ editing area reaches the value in pixels specified in the
36
+ <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-autoGrow_maxHeight">autoGrow_maxHeight</a></code>
37
+ configuration setting, scrollbars will be added and the editor window will no longer expand.
38
+ </p>
39
+ <p>
40
+ To add a CKEditor instance using the <code>autogrow</code> plugin and its
41
+ <code>autoGrow_maxHeight</code> attribute, insert the following JavaScript call to your code:
42
+ </p>
43
+ <pre class="samples">
44
+ CKEDITOR.replace( '<em>textarea_id</em>', {
45
+ <strong>extraPlugins: 'autogrow',</strong>
46
+ autoGrow_maxHeight: 800,
47
+
48
+ // Remove the Resize plugin as it does not make sense to use it in conjunction with the AutoGrow plugin.
49
+ removePlugins: 'resize'
50
+ });</pre>
51
+ <p>
52
+ Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
53
+ the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor. The maximum height should
54
+ be given in pixels.
55
+ </p>
56
+ </div>
57
+ <form action="../../../samples/sample_posteddata.php" method="post">
58
+ <p>
59
+ <label for="editor1">
60
+ CKEditor using the <code>autogrow</code> plugin with its default configuration:
61
+ </label>
62
+ <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
63
+ <script>
64
+
65
+ CKEDITOR.replace( 'editor1', {
66
+ extraPlugins: 'autogrow',
67
+ removePlugins: 'resize'
68
+ });
69
+
70
+ </script>
71
+ </p>
72
+ <p>
73
+ <label for="editor2">
74
+ CKEditor using the <code>autogrow</code> plugin with maximum height set to 400 pixels:
75
+ </label>
76
+ <textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
77
+ <script>
78
+
79
+ CKEDITOR.replace( 'editor2', {
80
+ extraPlugins: 'autogrow',
81
+ autoGrow_maxHeight: 400,
82
+ removePlugins: 'resize'
83
+ });
84
+
85
+ </script>
86
+ </p>
87
+ <p>
88
+ <input type="submit" value="Submit">
89
+ </p>
90
+ </form>
91
+ <div id="footer">
92
+ <hr>
93
+ <p>
94
+ CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
95
+ </p>
96
+ <p id="copy">
97
+ Copyright &copy; 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
98
+ Knabben. All rights reserved.
99
+ </p>
100
+ </div>
101
+ </body>
102
+ </html>