effective_ckeditor 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +23 -0
  5. data/app/assets/javascripts/ckeditor/CHANGES.md +589 -0
  6. data/app/assets/javascripts/ckeditor/LICENSE.md +1264 -0
  7. data/app/assets/javascripts/ckeditor/README.md +39 -0
  8. data/app/assets/javascripts/ckeditor/adapters/jquery.js +10 -0
  9. data/app/assets/javascripts/ckeditor/build-config.js +95 -0
  10. data/app/assets/javascripts/ckeditor/ckeditor.js +986 -0
  11. data/app/assets/javascripts/ckeditor/config.js +34 -0
  12. data/app/assets/javascripts/ckeditor/contents.css +134 -0
  13. data/app/assets/javascripts/ckeditor/lang/en.js +5 -0
  14. data/app/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +11 -0
  15. data/app/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +13 -0
  16. data/app/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +4 -0
  17. data/app/assets/javascripts/ckeditor/plugins/effective_assets/icons/effectiveassets.png +0 -0
  18. data/app/assets/javascripts/ckeditor/plugins/effective_assets/icons/hidpi/effectiveassets.png +0 -0
  19. data/app/assets/javascripts/ckeditor/plugins/effective_assets/plugin.js.coffee +17 -0
  20. data/app/assets/javascripts/ckeditor/plugins/effective_regions/icons/exit.png +0 -0
  21. data/app/assets/javascripts/ckeditor/plugins/effective_regions/icons/hidpi/exit.png +0 -0
  22. data/app/assets/javascripts/ckeditor/plugins/effective_regions/icons/hidpi/save.png +0 -0
  23. data/app/assets/javascripts/ckeditor/plugins/effective_regions/icons/save.png +0 -0
  24. data/app/assets/javascripts/ckeditor/plugins/effective_regions/icons/saving.png +0 -0
  25. data/app/assets/javascripts/ckeditor/plugins/effective_regions/plugin.js.coffee +241 -0
  26. data/app/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +24 -0
  27. data/app/assets/javascripts/ckeditor/plugins/icons.png +0 -0
  28. data/app/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
  29. data/app/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +43 -0
  30. data/app/assets/javascripts/ckeditor/plugins/image/images/noimage.png +0 -0
  31. data/app/assets/javascripts/ckeditor/plugins/image2/dialogs/image2.js +14 -0
  32. data/app/assets/javascripts/ckeditor/plugins/imagepaste/docs/install.html +66 -0
  33. data/app/assets/javascripts/ckeditor/plugins/imagepaste/docs/styles.css +59 -0
  34. data/app/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +7 -0
  35. data/app/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +26 -0
  36. data/app/assets/javascripts/ckeditor/plugins/link/images/anchor.png +0 -0
  37. data/app/assets/javascripts/ckeditor/plugins/link/images/hidpi/anchor.png +0 -0
  38. data/app/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +10 -0
  39. data/app/assets/javascripts/ckeditor/plugins/magicline/images/hidpi/icon.png +0 -0
  40. data/app/assets/javascripts/ckeditor/plugins/magicline/images/icon.png +0 -0
  41. data/app/assets/javascripts/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
  42. data/app/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +31 -0
  43. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_address.png +0 -0
  44. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
  45. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_div.png +0 -0
  46. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
  47. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
  48. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
  49. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
  50. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
  51. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
  52. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_p.png +0 -0
  53. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
  54. data/app/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +10 -0
  55. data/app/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
  56. data/app/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.png +0 -0
  57. data/app/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
  58. data/app/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.png +0 -0
  59. data/app/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
  60. data/app/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.png +0 -0
  61. data/app/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
  62. data/app/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.png +0 -0
  63. data/app/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
  64. data/app/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.png +0 -0
  65. data/app/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
  66. data/app/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.png +0 -0
  67. data/app/assets/javascripts/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
  68. data/app/assets/javascripts/ckeditor/plugins/smiley/images/embarrassed_smile.gif +0 -0
  69. data/app/assets/javascripts/ckeditor/plugins/smiley/images/embarrassed_smile.png +0 -0
  70. data/app/assets/javascripts/ckeditor/plugins/smiley/images/envelope.gif +0 -0
  71. data/app/assets/javascripts/ckeditor/plugins/smiley/images/envelope.png +0 -0
  72. data/app/assets/javascripts/ckeditor/plugins/smiley/images/heart.gif +0 -0
  73. data/app/assets/javascripts/ckeditor/plugins/smiley/images/heart.png +0 -0
  74. data/app/assets/javascripts/ckeditor/plugins/smiley/images/kiss.gif +0 -0
  75. data/app/assets/javascripts/ckeditor/plugins/smiley/images/kiss.png +0 -0
  76. data/app/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
  77. data/app/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.png +0 -0
  78. data/app/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
  79. data/app/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.png +0 -0
  80. data/app/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
  81. data/app/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.png +0 -0
  82. data/app/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
  83. data/app/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.png +0 -0
  84. data/app/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
  85. data/app/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.png +0 -0
  86. data/app/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
  87. data/app/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.png +0 -0
  88. data/app/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
  89. data/app/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.png +0 -0
  90. data/app/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
  91. data/app/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.png +0 -0
  92. data/app/assets/javascripts/ckeditor/plugins/smiley/images/tongue_smile.gif +0 -0
  93. data/app/assets/javascripts/ckeditor/plugins/smiley/images/tongue_smile.png +0 -0
  94. data/app/assets/javascripts/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
  95. data/app/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
  96. data/app/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.png +0 -0
  97. data/app/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
  98. data/app/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.png +0 -0
  99. data/app/assets/javascripts/ckeditor/plugins/sourcedialog/dialogs/sourcedialog.js +6 -0
  100. data/app/assets/javascripts/ckeditor/plugins/syntaxhighlight/dialogs/syntaxhighlight.js +16 -0
  101. data/app/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +21 -0
  102. data/app/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +17 -0
  103. data/app/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +84 -0
  104. data/app/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +10 -0
  105. data/app/assets/javascripts/ckeditor/plugins/templates/templates/default.js +6 -0
  106. data/app/assets/javascripts/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
  107. data/app/assets/javascripts/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
  108. data/app/assets/javascripts/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
  109. data/app/assets/javascripts/ckeditor/plugins/tliyoutube/dialogs/tliyoutube.js +7 -0
  110. data/app/assets/javascripts/ckeditor/plugins/widget/images/handle.png +0 -0
  111. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog.css +5 -0
  112. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie.css +5 -0
  113. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie7.css +5 -0
  114. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie8.css +5 -0
  115. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_iequirks.css +5 -0
  116. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_opera.css +5 -0
  117. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor.css +5 -0
  118. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_gecko.css +5 -0
  119. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie.css +5 -0
  120. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie7.css +5 -0
  121. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie8.css +5 -0
  122. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_iequirks.css +5 -0
  123. data/app/assets/javascripts/ckeditor/skins/moonocolor/icons.png +0 -0
  124. data/app/assets/javascripts/ckeditor/skins/moonocolor/icons_hidpi.png +0 -0
  125. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/arrow.png +0 -0
  126. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/close.png +0 -0
  127. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/close.png +0 -0
  128. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/lock-open.png +0 -0
  129. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/lock.png +0 -0
  130. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/refresh.png +0 -0
  131. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/lock-open.png +0 -0
  132. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/lock.png +0 -0
  133. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/refresh.png +0 -0
  134. data/app/assets/javascripts/ckeditor/skins/moonocolor/readme.md +51 -0
  135. data/app/assets/javascripts/ckeditor/styles.js +111 -0
  136. data/app/assets/javascripts/effective_ckeditor.js +7 -0
  137. data/app/assets/javascripts/effective_ckeditor/before_init.js.erb +21 -0
  138. data/app/assets/javascripts/effective_ckeditor/config.js.coffee +46 -0
  139. data/app/assets/javascripts/effective_ckeditor/init.js.coffee +90 -0
  140. data/app/assets/javascripts/vendor/jquery.cookie.js +117 -0
  141. data/app/assets/stylesheets/effective_ckeditor.css.scss +2 -0
  142. data/app/assets/stylesheets/effective_ckeditor/layout.css.scss +10 -0
  143. data/app/assets/stylesheets/effective_ckeditor/overrides.css.scss +40 -0
  144. data/lib/effective_ckeditor.rb +10 -0
  145. data/lib/effective_ckeditor/engine.rb +21 -0
  146. data/lib/effective_ckeditor/version.rb +3 -0
  147. data/lib/generators/effective_ckeditor/install_generator.rb +15 -0
  148. data/lib/generators/templates/README +1 -0
  149. data/lib/tasks/effective_ckeditor_tasks.rake +19 -0
  150. data/spec/dummy/README.rdoc +261 -0
  151. data/spec/dummy/Rakefile +7 -0
  152. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  153. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  154. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  155. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  156. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  157. data/spec/dummy/config.ru +4 -0
  158. data/spec/dummy/config/application.rb +65 -0
  159. data/spec/dummy/config/boot.rb +10 -0
  160. data/spec/dummy/config/database.yml +25 -0
  161. data/spec/dummy/config/environment.rb +5 -0
  162. data/spec/dummy/config/environments/development.rb +37 -0
  163. data/spec/dummy/config/environments/production.rb +67 -0
  164. data/spec/dummy/config/environments/test.rb +37 -0
  165. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  166. data/spec/dummy/config/initializers/inflections.rb +15 -0
  167. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  168. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  169. data/spec/dummy/config/initializers/session_store.rb +8 -0
  170. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  171. data/spec/dummy/config/locales/en.yml +5 -0
  172. data/spec/dummy/config/routes.rb +58 -0
  173. data/spec/dummy/db/schema.rb +34 -0
  174. data/spec/dummy/public/404.html +26 -0
  175. data/spec/dummy/public/422.html +26 -0
  176. data/spec/dummy/public/500.html +25 -0
  177. data/spec/dummy/public/favicon.ico +0 -0
  178. data/spec/dummy/script/rails +6 -0
  179. data/spec/dummy/spec_link +3 -0
  180. data/spec/effective_ckeditor_spec.rb +7 -0
  181. data/spec/spec_helper.rb +34 -0
  182. data/spec/support/factories.rb +4 -0
  183. metadata +274 -0
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.html or http://ckeditor.com/license
4
+ */
5
+
6
+ CKEDITOR.editorConfig = function( config ) {
7
+ // Define changes to default configuration here.
8
+ // For complete reference see:
9
+ // http://docs.ckeditor.com/#!/api/CKEDITOR.config
10
+
11
+ // The toolbar groups arrangement, optimized for a single toolbar row.
12
+ config.toolbarGroups = [
13
+ { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
14
+ { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
15
+ { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
16
+ { name: 'forms' },
17
+ { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
18
+ { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
19
+ { name: 'links' },
20
+ { name: 'insert' },
21
+ { name: 'styles' },
22
+ { name: 'colors' },
23
+ { name: 'tools' },
24
+ { name: 'others' },
25
+ { name: 'about' }
26
+ ];
27
+
28
+ // The default plugins included in the basic setup define some buttons that
29
+ // are not needed in a basic editor. They are removed here.
30
+ config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript';
31
+
32
+ // Dialog windows are also simplified.
33
+ config.removeDialogTabs = 'link:advanced';
34
+ };
@@ -0,0 +1,134 @@
1
+ /*
2
+ Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
3
+ For licensing, see LICENSE.md or http://ckeditor.com/license
4
+ */
5
+
6
+ body
7
+ {
8
+ /* Font */
9
+ font-family: sans-serif, Arial, Verdana, "Trebuchet MS";
10
+ font-size: 12px;
11
+
12
+ /* Text color */
13
+ color: #333;
14
+
15
+ /* Remove the background color to make it transparent */
16
+ background-color: #fff;
17
+
18
+ margin: 20px;
19
+ }
20
+
21
+ .cke_editable
22
+ {
23
+ font-size: 13px;
24
+ line-height: 1.6;
25
+ }
26
+
27
+ blockquote
28
+ {
29
+ font-style: italic;
30
+ font-family: Georgia, Times, "Times New Roman", serif;
31
+ padding: 2px 0;
32
+ border-style: solid;
33
+ border-color: #ccc;
34
+ border-width: 0;
35
+ }
36
+
37
+ .cke_contents_ltr blockquote
38
+ {
39
+ padding-left: 20px;
40
+ padding-right: 8px;
41
+ border-left-width: 5px;
42
+ }
43
+
44
+ .cke_contents_rtl blockquote
45
+ {
46
+ padding-left: 8px;
47
+ padding-right: 20px;
48
+ border-right-width: 5px;
49
+ }
50
+
51
+ a
52
+ {
53
+ color: #0782C1;
54
+ }
55
+
56
+ ol,ul,dl
57
+ {
58
+ /* IE7: reset rtl list margin. (#7334) */
59
+ *margin-right: 0px;
60
+ /* preserved spaces for list items with text direction other than the list. (#6249,#8049)*/
61
+ padding: 0 40px;
62
+ }
63
+
64
+ h1,h2,h3,h4,h5,h6
65
+ {
66
+ font-weight: normal;
67
+ line-height: 1.2;
68
+ }
69
+
70
+ hr
71
+ {
72
+ border: 0px;
73
+ border-top: 1px solid #ccc;
74
+ }
75
+
76
+ img.right
77
+ {
78
+ border: 1px solid #ccc;
79
+ float: right;
80
+ margin-left: 15px;
81
+ padding: 5px;
82
+ }
83
+
84
+ img.left
85
+ {
86
+ border: 1px solid #ccc;
87
+ float: left;
88
+ margin-right: 15px;
89
+ padding: 5px;
90
+ }
91
+
92
+ pre
93
+ {
94
+ white-space: pre-wrap; /* CSS 2.1 */
95
+ word-wrap: break-word; /* IE7 */
96
+ -moz-tab-size: 4;
97
+ -o-tab-size: 4;
98
+ -webkit-tab-size: 4;
99
+ tab-size: 4;
100
+ }
101
+
102
+ .marker
103
+ {
104
+ background-color: Yellow;
105
+ }
106
+
107
+ span[lang]
108
+ {
109
+ font-style: italic;
110
+ }
111
+
112
+ figure
113
+ {
114
+ text-align: center;
115
+ border: solid 1px #ccc;
116
+ border-radius: 2px;
117
+ background: rgba(0,0,0,0.05);
118
+ padding: 10px;
119
+ margin: 10px 20px;
120
+ display: inline-block;
121
+ }
122
+
123
+ figure > figcaption
124
+ {
125
+ text-align: center;
126
+ display: block; /* For IE8 */
127
+ }
128
+
129
+ a > img {
130
+ padding: 1px;
131
+ margin: 1px;
132
+ border: none;
133
+ outline: 1px solid #0782C1;
134
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
3
+ For licensing, see LICENSE.html or http://ckeditor.com/license
4
+ */
5
+ CKEDITOR.lang['en']={"editor":"Rich Text Editor","editorPanel":"Rich Text Editor panel","common":{"editorHelp":"Press ALT 0 for help","browseServer":"Browse Server","url":"URL","protocol":"Protocol","upload":"Upload","uploadSubmit":"Send it to the Server","image":"Image","flash":"Flash","form":"Form","checkbox":"Checkbox","radio":"Radio Button","textField":"Text Field","textarea":"Textarea","hiddenField":"Hidden Field","button":"Button","select":"Selection Field","imageButton":"Image Button","notSet":"<not set>","id":"Id","name":"Name","langDir":"Language Direction","langDirLtr":"Left to Right (LTR)","langDirRtl":"Right to Left (RTL)","langCode":"Language Code","longDescr":"Long Description URL","cssClass":"Stylesheet Classes","advisoryTitle":"Advisory Title","cssStyle":"Style","ok":"OK","cancel":"Cancel","close":"Close","preview":"Preview","resize":"Resize","generalTab":"General","advancedTab":"Advanced","validateNumberFailed":"This value is not a number.","confirmNewPage":"Any unsaved changes to this content will be lost. Are you sure you want to load new page?","confirmCancel":"You have changed some options. Are you sure you want to close the dialog window?","options":"Options","target":"Target","targetNew":"New Window (_blank)","targetTop":"Topmost Window (_top)","targetSelf":"Same Window (_self)","targetParent":"Parent Window (_parent)","langDirLTR":"Left to Right (LTR)","langDirRTL":"Right to Left (RTL)","styles":"Style","cssClasses":"Stylesheet Classes","width":"Width","height":"Height","align":"Alignment","alignLeft":"Left","alignRight":"Right","alignCenter":"Center","alignTop":"Top","alignMiddle":"Middle","alignBottom":"Bottom","alignNone":"None","invalidValue":"Invalid value.","invalidHeight":"Height must be a number.","invalidWidth":"Width must be a number.","invalidCssLength":"Value specified for the \"%1\" field must be a positive number with or without a valid CSS measurement unit (px, %, in, cm, mm, em, ex, pt, or pc).","invalidHtmlLength":"Value specified for the \"%1\" field must be a positive number with or without a valid HTML measurement unit (px or %).","invalidInlineStyle":"Value specified for the inline style must consist of one or more tuples with the format of \"name : value\", separated by semi-colons.","cssLengthTooltip":"Enter a number for a value in pixels or a number with a valid CSS unit (px, %, in, cm, mm, em, ex, pt, or pc).","unavailable":"%1<span class=\"cke_accessibility\">, unavailable</span>"},"basicstyles":{"bold":"Bold","italic":"Italic","strike":"Strike Through","subscript":"Subscript","superscript":"Superscript","underline":"Underline"},"blockquote":{"toolbar":"Block Quote"},"clipboard":{"copy":"Copy","copyError":"Your browser security settings don't permit the editor to automatically execute copying operations. Please use the keyboard for that (Ctrl/Cmd+C).","cut":"Cut","cutError":"Your browser security settings don't permit the editor to automatically execute cutting operations. Please use the keyboard for that (Ctrl/Cmd+X).","paste":"Paste","pasteArea":"Paste Area","pasteMsg":"Please paste inside the following box using the keyboard (<strong>Ctrl/Cmd+V</strong>) and hit OK","securityMsg":"Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.","title":"Paste"},"button":{"selectedLabel":"%1 (Selected)"},"colorbutton":{"auto":"Automatic","bgColorTitle":"Background Color","colors":{"000":"Black","800000":"Maroon","8B4513":"Saddle Brown","2F4F4F":"Dark Slate Gray","008080":"Teal","000080":"Navy","4B0082":"Indigo","696969":"Dark Gray","B22222":"Fire Brick","A52A2A":"Brown","DAA520":"Golden Rod","006400":"Dark Green","40E0D0":"Turquoise","0000CD":"Medium Blue","800080":"Purple","808080":"Gray","F00":"Red","FF8C00":"Dark Orange","FFD700":"Gold","008000":"Green","0FF":"Cyan","00F":"Blue","EE82EE":"Violet","A9A9A9":"Dim Gray","FFA07A":"Light Salmon","FFA500":"Orange","FFFF00":"Yellow","00FF00":"Lime","AFEEEE":"Pale Turquoise","ADD8E6":"Light Blue","DDA0DD":"Plum","D3D3D3":"Light Grey","FFF0F5":"Lavender Blush","FAEBD7":"Antique White","FFFFE0":"Light Yellow","F0FFF0":"Honeydew","F0FFFF":"Azure","F0F8FF":"Alice Blue","E6E6FA":"Lavender","FFF":"White"},"more":"More Colors...","panelTitle":"Colors","textColorTitle":"Text Color"},"colordialog":{"clear":"Clear","highlight":"Highlight","options":"Color Options","selected":"Selected Color","title":"Select color"},"contextmenu":{"options":"Context Menu Options"},"elementspath":{"eleLabel":"Elements path","eleTitle":"%1 element"},"find":{"find":"Find","findOptions":"Find Options","findWhat":"Find what:","matchCase":"Match case","matchCyclic":"Match cyclic","matchWord":"Match whole word","notFoundMsg":"The specified text was not found.","replace":"Replace","replaceAll":"Replace All","replaceSuccessMsg":"%1 occurrence(s) replaced.","replaceWith":"Replace with:","title":"Find and Replace"},"format":{"label":"Format","panelTitle":"Paragraph Format","tag_address":"Address","tag_div":"Normal (DIV)","tag_h1":"Heading 1","tag_h2":"Heading 2","tag_h3":"Heading 3","tag_h4":"Heading 4","tag_h5":"Heading 5","tag_h6":"Heading 6","tag_p":"Normal","tag_pre":"Formatted"},"horizontalrule":{"toolbar":"Insert Horizontal Line"},"image":{"alertUrl":"Please type the image URL","alt":"Alternative Text","border":"Border","btnUpload":"Send it to the Server","button2Img":"Do you want to transform the selected image button on a simple image?","hSpace":"HSpace","img2Button":"Do you want to transform the selected image on a image button?","infoTab":"Image Info","linkTab":"Link","lockRatio":"Lock Ratio","menu":"Image Properties","resetSize":"Reset Size","title":"Image Properties","titleButton":"Image Button Properties","upload":"Upload","urlMissing":"Image source URL is missing.","vSpace":"VSpace","validateBorder":"Border must be a whole number.","validateHSpace":"HSpace must be a whole number.","validateVSpace":"VSpace must be a whole number."},"widget":{"move":"Click and drag to move"},"image2":{"alt":"Alternative Text","btnUpload":"Send it to the Server","captioned":"Captioned image","captionPlaceholder":"Caption","infoTab":"Image Info","lockRatio":"Lock Ratio","menu":"Image Properties","pathName":"image","pathNameCaption":"caption","resetSize":"Reset Size","resizer":"Click and drag to resize","title":"Image Properties","uploadTab":"Upload","urlMissing":"Image source URL is missing."},"indent":{"indent":"Increase Indent","outdent":"Decrease Indent"},"justify":{"block":"Justify","center":"Center","left":"Align Left","right":"Align Right"},"fakeobjects":{"anchor":"Anchor","flash":"Flash Animation","hiddenfield":"Hidden Field","iframe":"IFrame","unknown":"Unknown Object"},"link":{"acccessKey":"Access Key","advanced":"Advanced","advisoryContentType":"Advisory Content Type","advisoryTitle":"Advisory Title","anchor":{"toolbar":"Anchor","menu":"Edit Anchor","title":"Anchor Properties","name":"Anchor Name","errorName":"Please type the anchor name","remove":"Remove Anchor"},"anchorId":"By Element Id","anchorName":"By Anchor Name","charset":"Linked Resource Charset","cssClasses":"Stylesheet Classes","emailAddress":"E-Mail Address","emailBody":"Message Body","emailSubject":"Message Subject","id":"Id","info":"Link Info","langCode":"Language Code","langDir":"Language Direction","langDirLTR":"Left to Right (LTR)","langDirRTL":"Right to Left (RTL)","menu":"Edit Link","name":"Name","noAnchors":"(No anchors available in the document)","noEmail":"Please type the e-mail address","noUrl":"Please type the link URL","other":"<other>","popupDependent":"Dependent (Netscape)","popupFeatures":"Popup Window Features","popupFullScreen":"Full Screen (IE)","popupLeft":"Left Position","popupLocationBar":"Location Bar","popupMenuBar":"Menu Bar","popupResizable":"Resizable","popupScrollBars":"Scroll Bars","popupStatusBar":"Status Bar","popupToolbar":"Toolbar","popupTop":"Top Position","rel":"Relationship","selectAnchor":"Select an Anchor","styles":"Style","tabIndex":"Tab Index","target":"Target","targetFrame":"<frame>","targetFrameName":"Target Frame Name","targetPopup":"<popup window>","targetPopupName":"Popup Window Name","title":"Link","toAnchor":"Link to anchor in the text","toEmail":"E-mail","toUrl":"URL","toolbar":"Link","type":"Link Type","unlink":"Unlink","upload":"Upload"},"list":{"bulletedlist":"Insert/Remove Bulleted List","numberedlist":"Insert/Remove Numbered List"},"liststyle":{"armenian":"Armenian numbering","bulletedTitle":"Bulleted List Properties","circle":"Circle","decimal":"Decimal (1, 2, 3, etc.)","decimalLeadingZero":"Decimal leading zero (01, 02, 03, etc.)","disc":"Disc","georgian":"Georgian numbering (an, ban, gan, etc.)","lowerAlpha":"Lower Alpha (a, b, c, d, e, etc.)","lowerGreek":"Lower Greek (alpha, beta, gamma, etc.)","lowerRoman":"Lower Roman (i, ii, iii, iv, v, etc.)","none":"None","notset":"<not set>","numberedTitle":"Numbered List Properties","square":"Square","start":"Start","type":"Type","upperAlpha":"Upper Alpha (A, B, C, D, E, etc.)","upperRoman":"Upper Roman (I, II, III, IV, V, etc.)","validateStartNumber":"List start number must be a whole number."},"magicline":{"title":"Insert paragraph here"},"newpage":{"toolbar":"New Page"},"pagebreak":{"alt":"Page Break","toolbar":"Insert Page Break for Printing"},"pastefromword":{"confirmCleanup":"The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?","error":"It was not possible to clean up the pasted data due to an internal error","title":"Paste from Word","toolbar":"Paste from Word"},"pastetext":{"button":"Paste as plain text","title":"Paste as Plain Text"},"removeformat":{"toolbar":"Remove Format"},"selectall":{"toolbar":"Select All"},"showblocks":{"toolbar":"Show Blocks"},"smiley":{"options":"Smiley Options","title":"Insert a Smiley","toolbar":"Smiley"},"sourcearea":{"toolbar":"Source"},"sourcedialog":{"toolbar":"Source","title":"Source"},"stylescombo":{"label":"Styles","panelTitle":"Formatting Styles","panelTitle1":"Block Styles","panelTitle2":"Inline Styles","panelTitle3":"Object Styles"},"syntaxhighlight":{"title":"Add or update a code snippet","contextTitle":"Edit source code","sourceTab":"Source code","langLbl":"Select language","sourceTextareaEmptyError":"Source code mustn't be empty.","advancedTab":"Advanced","hideGutter":"Hide gutter","hideGutterLbl":"Hide gutter & line numbers.","hideControls":"Hide controls","hideControlsLbl":"Hide code controls at the top of the code block.","collapse":"Collapse","collapseLbl":"Collapse the code block by default. (controls need to be turned on)","codeTitleLbl":"Use a Code Title","showColumns":"Show columns","showColumnsLbl":"Show row columns in the first line.","lineWrap":"Disable line wrapping","lineWrapLbl":"Switch off line wrapping.","lineCount":"Default line count","highlight":"Highlight lines","highlightLbl":"Enter a comma seperated lines of lines you want to highlight, eg <em style=\"font-style:italic\">3,10,15</em>."},"table":{"border":"Border size","caption":"Caption","cell":{"menu":"Cell","insertBefore":"Insert Cell Before","insertAfter":"Insert Cell After","deleteCell":"Delete Cells","merge":"Merge Cells","mergeRight":"Merge Right","mergeDown":"Merge Down","splitHorizontal":"Split Cell Horizontally","splitVertical":"Split Cell Vertically","title":"Cell Properties","cellType":"Cell Type","rowSpan":"Rows Span","colSpan":"Columns Span","wordWrap":"Word Wrap","hAlign":"Horizontal Alignment","vAlign":"Vertical Alignment","alignBaseline":"Baseline","bgColor":"Background Color","borderColor":"Border Color","data":"Data","header":"Header","yes":"Yes","no":"No","invalidWidth":"Cell width must be a number.","invalidHeight":"Cell height must be a number.","invalidRowSpan":"Rows span must be a whole number.","invalidColSpan":"Columns span must be a whole number.","chooseColor":"Choose"},"cellPad":"Cell padding","cellSpace":"Cell spacing","column":{"menu":"Column","insertBefore":"Insert Column Before","insertAfter":"Insert Column After","deleteColumn":"Delete Columns"},"columns":"Columns","deleteTable":"Delete Table","headers":"Headers","headersBoth":"Both","headersColumn":"First column","headersNone":"None","headersRow":"First Row","invalidBorder":"Border size must be a number.","invalidCellPadding":"Cell padding must be a positive number.","invalidCellSpacing":"Cell spacing must be a positive number.","invalidCols":"Number of columns must be a number greater than 0.","invalidHeight":"Table height must be a number.","invalidRows":"Number of rows must be a number greater than 0.","invalidWidth":"Table width must be a number.","menu":"Table Properties","row":{"menu":"Row","insertBefore":"Insert Row Before","insertAfter":"Insert Row After","deleteRow":"Delete Rows"},"rows":"Rows","summary":"Summary","title":"Table Properties","toolbar":"Table","widthPc":"percent","widthPx":"pixels","widthUnit":"width unit"},"templates":{"button":"Templates","emptyListMsg":"(No templates defined)","insertOption":"Replace actual contents","options":"Template Options","selectPromptMsg":"Please select the template to open in the editor","title":"Content Templates"},"toolbar":{"toolbarCollapse":"Collapse Toolbar","toolbarExpand":"Expand Toolbar","toolbarGroups":{"document":"Document","clipboard":"Clipboard/Undo","editing":"Editing","forms":"Forms","basicstyles":"Basic Styles","paragraph":"Paragraph","links":"Links","insert":"Insert","styles":"Styles","colors":"Colors","tools":"Tools"},"toolbars":"Editor toolbars"},"undo":{"redo":"Redo","undo":"Undo"}};
@@ -0,0 +1,11 @@
1
+ /*
2
+ Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
3
+ For licensing, see LICENSE.md or http://ckeditor.com/license
4
+ */
5
+ CKEDITOR.dialog.add("paste",function(c){function h(a){var b=new CKEDITOR.dom.document(a.document),f=b.getBody(),d=b.getById("cke_actscrpt");d&&d.remove();f.setAttribute("contenteditable",!0);if(CKEDITOR.env.ie&&8>CKEDITOR.env.version)b.getWindow().on("blur",function(){b.$.selection.empty()});b.on("keydown",function(a){var a=a.data,b;switch(a.getKeystroke()){case 27:this.hide();b=1;break;case 9:case CKEDITOR.SHIFT+9:this.changeFocus(1),b=1}b&&a.preventDefault()},this);c.fire("ariaWidget",new CKEDITOR.dom.element(a.frameElement));
6
+ b.getWindow().getFrame().removeCustomData("pendingFocus")&&f.focus()}var e=c.lang.clipboard;c.on("pasteDialogCommit",function(a){a.data&&c.fire("paste",{type:"auto",dataValue:a.data})},null,null,1E3);return{title:e.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?370:350,minHeight:CKEDITOR.env.quirks?250:245,onShow:function(){this.parts.dialog.$.offsetHeight;this.setupContent();this.parts.title.setHtml(this.customTitle||e.title);this.customTitle=null},onLoad:function(){(CKEDITOR.env.ie7Compat||
7
+ CKEDITOR.env.ie6Compat)&&"rtl"==c.lang.dir&&this.parts.contents.setStyle("overflow","hidden")},onOk:function(){this.commitContent()},contents:[{id:"general",label:c.lang.common.generalTab,elements:[{type:"html",id:"securityMsg",html:'<div style="white-space:normal;width:340px">'+e.securityMsg+"</div>"},{type:"html",id:"pasteMsg",html:'<div style="white-space:normal;width:340px">'+e.pasteMsg+"</div>"},{type:"html",id:"editing_area",style:"width:100%;height:100%",html:"",focus:function(){var a=this.getInputElement(),
8
+ b=a.getFrameDocument().getBody();!b||b.isReadOnly()?a.setCustomData("pendingFocus",1):b.focus()},setup:function(){var a=this.getDialog(),b='<html dir="'+c.config.contentsLangDirection+'" lang="'+(c.config.contentsLanguage||c.langCode)+'"><head><style>body{margin:3px;height:95%}</style></head><body><script id="cke_actscrpt" type="text/javascript">window.parent.CKEDITOR.tools.callFunction('+CKEDITOR.tools.addFunction(h,a)+",this);<\/script></body></html>",f=CKEDITOR.env.air?"javascript:void(0)":CKEDITOR.env.ie?
9
+ "javascript:void((function(){"+encodeURIComponent("document.open();("+CKEDITOR.tools.fixDomain+")();document.close();")+'})())"':"",d=CKEDITOR.dom.element.createFromHtml('<iframe class="cke_pasteframe" frameborder="0" allowTransparency="true" src="'+f+'" role="region" aria-label="'+e.pasteArea+'" aria-describedby="'+a.getContentElement("general","pasteMsg").domId+'" aria-multiple="true"></iframe>');d.on("load",function(a){a.removeListener();a=d.getFrameDocument();a.write(b);c.focusManager.add(a.getBody());
10
+ CKEDITOR.env.air&&h.call(this,a.getWindow().$)},a);d.setCustomData("dialog",a);a=this.getElement();a.setHtml("");a.append(d);if(CKEDITOR.env.ie){var g=CKEDITOR.dom.element.createFromHtml('<span tabindex="-1" style="position:absolute" role="presentation"></span>');g.on("focus",function(){setTimeout(function(){d.$.contentWindow.focus()})});a.append(g);this.focus=function(){g.focus();this.fire("focus")}}this.getInputElement=function(){return d};CKEDITOR.env.ie&&(a.setStyle("display","block"),a.setStyle("height",
11
+ d.$.offsetHeight+2+"px"))},commit:function(){var a=this.getDialog().getParentEditor(),b=this.getInputElement().getFrameDocument().getBody(),c=b.getBogus(),d;c&&c.remove();d=b.getHtml();setTimeout(function(){a.fire("pasteDialogCommit",d)},0)}}]}]}});
@@ -0,0 +1,13 @@
1
+ /*
2
+ Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
3
+ For licensing, see LICENSE.md or http://ckeditor.com/license
4
+ */
5
+ CKEDITOR.dialog.add("colordialog",function(t){function n(){f.getById(o).removeStyle("background-color");p.getContentElement("picker","selectedColor").setValue("");j&&j.removeAttribute("aria-selected");j=null}function u(a){var a=a.data.getTarget(),b;if("td"==a.getName()&&(b=a.getChild(0).getHtml()))j=a,j.setAttribute("aria-selected",!0),p.getContentElement("picker","selectedColor").setValue(b)}function y(a){for(var a=a.replace(/^#/,""),b=0,c=[];2>=b;b++)c[b]=parseInt(a.substr(2*b,2),16);return"#"+
6
+ (165<=0.2126*c[0]+0.7152*c[1]+0.0722*c[2]?"000":"fff")}function v(a){!a.name&&(a=new CKEDITOR.event(a));var b=!/mouse/.test(a.name),c=a.data.getTarget(),e;if("td"==c.getName()&&(e=c.getChild(0).getHtml()))q(a),b?g=c:w=c,b&&(c.setStyle("border-color",y(e)),c.setStyle("border-style","dotted")),f.getById(k).setStyle("background-color",e),f.getById(l).setHtml(e)}function q(a){if(a=!/mouse/.test(a.name)&&g){var b=a.getChild(0).getHtml();a.setStyle("border-color",b);a.setStyle("border-style","solid")}!g&&
7
+ !w&&(f.getById(k).removeStyle("background-color"),f.getById(l).setHtml("&nbsp;"))}function z(a){var b=a.data,c=b.getTarget(),e=b.getKeystroke(),d="rtl"==t.lang.dir;switch(e){case 38:if(a=c.getParent().getPrevious())a=a.getChild([c.getIndex()]),a.focus();b.preventDefault();break;case 40:if(a=c.getParent().getNext())(a=a.getChild([c.getIndex()]))&&1==a.type&&a.focus();b.preventDefault();break;case 32:case 13:u(a);b.preventDefault();break;case d?37:39:if(a=c.getNext())1==a.type&&(a.focus(),b.preventDefault(!0));
8
+ else if(a=c.getParent().getNext())if((a=a.getChild([0]))&&1==a.type)a.focus(),b.preventDefault(!0);break;case d?39:37:if(a=c.getPrevious())a.focus(),b.preventDefault(!0);else if(a=c.getParent().getPrevious())a=a.getLast(),a.focus(),b.preventDefault(!0)}}var r=CKEDITOR.dom.element,f=CKEDITOR.document,h=t.lang.colordialog,p,x={type:"html",html:"&nbsp;"},j,g,w,m=function(a){return CKEDITOR.tools.getNextId()+"_"+a},k=m("hicolor"),l=m("hicolortext"),o=m("selhicolor"),i;(function(){function a(a,d){for(var s=
9
+ a;s<a+3;s++){var e=new r(i.$.insertRow(-1));e.setAttribute("role","row");for(var f=d;f<d+3;f++)for(var g=0;6>g;g++)b(e.$,"#"+c[f]+c[g]+c[s])}}function b(a,c){var b=new r(a.insertCell(-1));b.setAttribute("class","ColorCell");b.setAttribute("tabIndex",-1);b.setAttribute("role","gridcell");b.on("keydown",z);b.on("click",u);b.on("focus",v);b.on("blur",q);b.setStyle("background-color",c);b.setStyle("border","1px solid "+c);b.setStyle("width","14px");b.setStyle("height","14px");var d=m("color_table_cell");
10
+ b.setAttribute("aria-labelledby",d);b.append(CKEDITOR.dom.element.createFromHtml('<span id="'+d+'" class="cke_voice_label">'+c+"</span>",CKEDITOR.document))}i=CKEDITOR.dom.element.createFromHtml('<table tabIndex="-1" aria-label="'+h.options+'" role="grid" style="border-collapse:separate;" cellspacing="0"><caption class="cke_voice_label">'+h.options+'</caption><tbody role="presentation"></tbody></table>');i.on("mouseover",v);i.on("mouseout",q);var c="00 33 66 99 cc ff".split(" ");a(0,0);a(3,0);a(0,
11
+ 3);a(3,3);var e=new r(i.$.insertRow(-1));e.setAttribute("role","row");for(var d=0;6>d;d++)b(e.$,"#"+c[d]+c[d]+c[d]);for(d=0;12>d;d++)b(e.$,"#000000")})();return{title:h.title,minWidth:360,minHeight:220,onLoad:function(){p=this},onHide:function(){n();var a=g.getChild(0).getHtml();g.setStyle("border-color",a);g.setStyle("border-style","solid");f.getById(k).removeStyle("background-color");f.getById(l).setHtml("&nbsp;");g=null},contents:[{id:"picker",label:h.title,accessKey:"I",elements:[{type:"hbox",
12
+ padding:0,widths:["70%","10%","30%"],children:[{type:"html",html:"<div></div>",onLoad:function(){CKEDITOR.document.getById(this.domId).append(i)},focus:function(){(g||this.getElement().getElementsByTag("td").getItem(0)).focus()}},x,{type:"vbox",padding:0,widths:["70%","5%","25%"],children:[{type:"html",html:"<span>"+h.highlight+'</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+k+'" style="border: 1px solid; height: 74px; width: 74px;"></div>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+l+'">&nbsp;</div><span>'+h.selected+
13
+ '</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+o+'" style="border: 1px solid; height: 20px; width: 74px;"></div>'},{type:"text",label:h.selected,labelStyle:"display:none",id:"selectedColor",style:"width: 76px;margin-top:4px",onChange:function(){try{f.getById(o).setStyle("background-color",this.getValue())}catch(a){n()}}},x,{type:"button",id:"clear",label:h.clear,onClick:n}]}]}]}]}});
@@ -0,0 +1,4 @@
1
+ /*
2
+ Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
3
+ For licensing, see LICENSE.md or http://ckeditor.com/license
4
+ */
@@ -0,0 +1,17 @@
1
+ # This plugin just opens the Snippet dialog
2
+
3
+ CKEDITOR.plugins.add 'effective_assets',
4
+ icons: 'effectiveassets',
5
+ hidpi: true,
6
+ init: (editor) ->
7
+ editor.ui.addButton 'EffectiveAssets', {label: 'Insert File', command: 'openEffectiveAssetsSnippetDialog'}
8
+ editor.addCommand('openEffectiveAssetsSnippetDialog', OpenEffectiveAssetsSnippetDialog)
9
+
10
+ OpenEffectiveAssetsSnippetDialog = {
11
+ exec: (editor) ->
12
+ if (command = editor.getCommand('effective_asset'))
13
+ command.exec(editor)
14
+ else
15
+ alert('This function is currently disabled. Please install EffectiveAssets gem.')
16
+ }
17
+
@@ -0,0 +1,241 @@
1
+ SaveAll = {
2
+ instanceData: (instance) ->
3
+ instance.resetDirty()
4
+
5
+ snippets = {} # This is the Data we're going to post to the server
6
+ snippet_ids = [] # This keeps track html classes we need to later replace
7
+
8
+ for id, widget of instance.widgets.instances
9
+ if widget.effectiveSnippetConfigured != undefined # This is an effectiveSnippet type widget
10
+ snippet_id = "snippet_#{id}"
11
+ snippets[snippet_id] = widget.data
12
+ snippets[snippet_id]['class_name'] = widget.name
13
+ widget.element.addClass(snippet_id)
14
+ snippet_ids.push(snippet_id)
15
+
16
+ # Replace the entire widget <div>...</div> with [snippet_0]
17
+ content = $('<div>' + instance.getData() + '</div>')
18
+ content.find(".#{snippet_id}").replaceWith("[#{snippet_id}]") for snippet_id in snippet_ids
19
+
20
+ # Slightly different values for the different region types
21
+ if instance.config.effectiveRegionType == 'snippets'
22
+ content = content.text()
23
+ content = content.replace(/\s+/gi, '') if content.indexOf('[snippet_') > -1
24
+ else if instance.config.toolbar == 'simple'
25
+ content = content.text()
26
+ else
27
+ content = content.html()
28
+
29
+ {content: content, snippets: snippets}
30
+
31
+ exec: (editor) ->
32
+ # Show a checkmark on the Save button
33
+ try
34
+ button = $("##{this.uiItems[0]._.id}").find('.cke_button__save_icon')
35
+
36
+ button.css('background-image', 'url(/assets/ckeditor/plugins/effective_regions/icons/saving.png)')
37
+ setTimeout(
38
+ -> button.css('background-image', 'url(/assets/ckeditor/plugins/effective_regions/icons/save.png)')
39
+ 2000)
40
+
41
+ data = {}
42
+ data[name] = @instanceData(instance) for name, instance of CKEDITOR.instances
43
+
44
+ url = window.location.protocol + '//' + window.location.host + '/edit' + window.location.pathname
45
+
46
+ $.ajax
47
+ url: url
48
+ type: 'PUT'
49
+ dataType: 'json'
50
+ data: { effective_regions: data }
51
+ async: false
52
+ complete: (data) ->
53
+ if data.responseText == 'refresh'
54
+ location.reload(true)
55
+ }
56
+
57
+ Exit = {
58
+ exec: (editor) ->
59
+ url = $.cookie('effective_regions_editting')
60
+
61
+ if url != undefined && url.length > 0
62
+ window.location = url
63
+ else
64
+ window.history.back()
65
+ }
66
+
67
+ Regions = {
68
+ initFullRegion: (editor) ->
69
+ # Remove any style attributes
70
+ editor.on 'paste', (evt) ->
71
+ data = $('<div>' + evt.data.dataValue + '</div>')
72
+ data.find('[style]').removeAttr('style')
73
+ evt.data.dataValue = data.html()
74
+
75
+ initSimpleRegion: (editor) ->
76
+ # Disable all tags
77
+ filter = new CKEDITOR.filter('no_tags_allowed')
78
+ editor.setActiveFilter(filter)
79
+
80
+ # Disable wrapping content with <p></p>. This could break plugins.
81
+ editor.config.autoParagraph = false
82
+
83
+ # Disable enter button
84
+ editor.on 'key', (event) -> event.cancel() if (event.data.keyCode == 13 || event.data.keyCode == 2228237)
85
+
86
+ # Paste as plain text, but this doesn't work all the way
87
+ editor.config.forcePasteAsPlainText = true
88
+ editor.on 'paste', (evt) -> evt.data.dataValue = evt.data.dataValue.replace(/<[^<|>]+?>/gi,'')
89
+
90
+ initSnippetRegion: (editor) ->
91
+ # Disable wrapping content with <p></p>. This could break plugins.
92
+ editor.config.autoParagraph = false
93
+
94
+ # Disable enter button
95
+ editor.on 'key', (event) -> event.cancel() unless (event.data.keyCode == 8) # 8 is backspace
96
+
97
+ # Paste as plain text, but this doesn't work all the way
98
+ editor.config.forcePasteAsPlainText = true
99
+ editor.on 'paste', (evt) -> evt.data.dataValue = evt.data.dataValue.replace(/<[^<|>]+?>/gi,'')
100
+ }
101
+
102
+ Snippets = {
103
+ snippets: undefined
104
+
105
+ all: ->
106
+ if @snippets == undefined
107
+ $.ajax
108
+ url: '/effective/snippets'
109
+ type: 'GET'
110
+ dataType: 'json'
111
+ async: false
112
+ complete: (data) -> Snippets.snippets = data.responseJSON
113
+ @snippets
114
+
115
+ build: (editor, name, values) ->
116
+ snippet = {}
117
+
118
+ snippet['effectiveSnippetConfigured'] = false
119
+ snippet['dialog_url'] = values.dialog_url
120
+ snippet['dialog'] = name if values.dialog_url
121
+ snippet['inline'] = values.inline
122
+ snippet['editables'] = values.editables if values.editables
123
+ snippet['draggable'] = editor.config.effectiveRegionType != 'wrapped_snippets'
124
+ snippet['template'] = "<#{values.tag} data-effective-snippet='#{name}'></#{values.tag}>"
125
+ snippet['upcast'] = (element) -> element.attributes['data-effective-snippet'] == name
126
+ snippet['loadTemplate'] = (widget) ->
127
+ $.ajax
128
+ url: "/effective/snippet/#{widget.name}"
129
+ type: 'GET'
130
+ data: {effective_regions: {name: widget.name, data: widget.data}}
131
+ async: false
132
+ complete: (data) -> widget.element.setHtml(data.responseText)
133
+
134
+ snippet['init'] = ->
135
+ this.data[k] = v for k, v of $(this.element.$).data('snippet-data')
136
+
137
+ this.on 'dialog', (evt) -> @effectiveSnippetConfigured = true
138
+ this.on 'data', (evt) -> @loadTemplate(evt.sender) if @effectiveSnippetConfigured
139
+ this.on 'ready', (evt) ->
140
+
141
+ return true if @effectiveSnippetConfigured != true || evt.sender.editor.config.effectiveRegionType != 'wrapped_snippets'
142
+ editor = evt.sender.editor
143
+
144
+ # This makes sure an inserted snippet within a 'wrapped_snippets' region is inserted under <ol><li>
145
+ try
146
+ root = editor.getSelection().getCommonAncestor()
147
+ root = root.getParent() while (root.hasClass('effective-region') == false && root.getName() != 'body')
148
+
149
+ children = root.getChildren()
150
+
151
+ node0 = children.getItem(0)
152
+ node1 = children.getItem(1)
153
+ node2 = children.getItem(2)
154
+
155
+ # Find the first OL/UL, find its LI, clone it, then insert the widget into that LI
156
+ if (node0.getName() == 'ol' || node0.getName() == 'ul') && (node1 == null || node1.hasClass('cke_widget_wrapper'))
157
+ if (liNode = node0.getChild(0)).getName() == 'li'
158
+ newNode = liNode.clone()
159
+ newNode.append(this.wrapper)
160
+ node0.append(newNode)
161
+ node2.remove() if (node2 != null && node2.getName() == 'br')
162
+ else if node0.hasClass('cke_widget_wrapper') && node2 != null && (node2.getName() == 'ol' || node2.getName() == 'ul')
163
+ if (liNode = node2.getChild(0)).getName() == 'li'
164
+ newNode = liNode.clone()
165
+ newNode.append(this.wrapper)
166
+ node2.append(newNode, true) # prepend it
167
+ node1.remove() if (node1 != null && node1.getName() == 'br')
168
+
169
+ snippet
170
+ }
171
+
172
+ Templates = {
173
+ templates: undefined
174
+
175
+ all: ->
176
+ if @templates == undefined
177
+ $.ajax
178
+ url: '/effective/templates'
179
+ type: 'GET'
180
+ dataType: 'json'
181
+ async: false
182
+ complete: (data) -> Templates.templates = data.responseJSON
183
+ @templates
184
+
185
+ build: (definition) -> definition
186
+ }
187
+
188
+ BuildInsertSnippetDropdown = (editor, all_snippets) ->
189
+ editor.ui.addRichCombo 'InsertSnippet',
190
+ label: 'Insert Snippet',
191
+ title: 'Insert Snippet',
192
+ panel:
193
+ css: [ CKEDITOR.skin.getPath( 'editor' ) ],
194
+ multiSelect: false,
195
+ init: ->
196
+ for name, values of all_snippets
197
+ if name != 'effective_asset'
198
+ this.add(name, "#{values.label}", "#{values.description}")
199
+ onClick: (value) -> editor.getCommand(value).exec(editor)
200
+ onOpen: (evt) ->
201
+ this.showAll()
202
+ allowedSnippets = this._.panel._.editor.config.allowedSnippets
203
+
204
+ if allowedSnippets.length > 0
205
+ for name, _ of this._.items
206
+ this.hideItem(name) if allowedSnippets.indexOf(name) == -1 # Hide it, if it's not in allowedSnippets array
207
+
208
+ CKEDITOR.plugins.add 'effective_regions',
209
+ requires: 'widget',
210
+ icons: 'save,exit',
211
+ hidpi: true,
212
+ init: (editor) ->
213
+ # Saving
214
+ editor.ui.addButton 'Save', {label: 'Save', command: 'effectiveRegionsSaveAll'}
215
+ editor.addCommand('effectiveRegionsSaveAll', SaveAll)
216
+
217
+ # Exit Button
218
+ editor.ui.addButton 'Exit', {label: 'Exit', command: 'effectiveRegionsExit'}
219
+ editor.addCommand('effectiveRegionsExit', Exit)
220
+
221
+ # Regions
222
+ Regions.initFullRegion(editor) if editor.config.effectiveRegionType == 'full'
223
+ Regions.initSimpleRegion(editor) if editor.config.effectiveRegionType == 'simple'
224
+ Regions.initSnippetRegion(editor) if editor.config.effectiveRegionType == 'snippets'
225
+ Regions.initSnippetRegion(editor) if editor.config.effectiveRegionType == 'wrapped_snippets'
226
+
227
+ # Snippets
228
+ BuildInsertSnippetDropdown(editor, Snippets.all()) # Insert Snippets Dropdown
229
+
230
+ # Initialize all the Snippets as CKeditor widgets
231
+ for name, values of Snippets.all()
232
+ snippet = Snippets.build(editor, name, values)
233
+
234
+ editor.widgets.add(name, snippet)
235
+ CKEDITOR.dialog.add(name, snippet.dialog_url) if snippet.dialog_url
236
+
237
+ # Templates
238
+ # these are loaded once per page, not for each editor (as the snippets are above)
239
+ CKEDITOR.addTemplates 'effective_regions',
240
+ imagesPath: CKEDITOR.getUrl( '/assets/effective/templates/' ),
241
+ templates: Templates.build(template) for template in Templates.all()