refinerycms-wymeditor 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/.gitignore +88 -0
  2. data/app/assets/images/wymeditor/skins/refinery/arrow_redo.png +0 -0
  3. data/app/assets/images/wymeditor/skins/refinery/arrow_undo.png +0 -0
  4. data/app/assets/images/wymeditor/skins/refinery/eye.png +0 -0
  5. data/app/assets/images/wymeditor/skins/refinery/html5/article.png +0 -0
  6. data/app/assets/images/wymeditor/skins/refinery/html5/aside.png +0 -0
  7. data/app/assets/images/wymeditor/skins/refinery/html5/blockquote.png +0 -0
  8. data/app/assets/images/wymeditor/skins/refinery/html5/command.png +0 -0
  9. data/app/assets/images/wymeditor/skins/refinery/html5/details.png +0 -0
  10. data/app/assets/images/wymeditor/skins/refinery/html5/figcaption.png +0 -0
  11. data/app/assets/images/wymeditor/skins/refinery/html5/figure.png +0 -0
  12. data/app/assets/images/wymeditor/skins/refinery/html5/footer.png +0 -0
  13. data/app/assets/images/wymeditor/skins/refinery/html5/h1.png +0 -0
  14. data/app/assets/images/wymeditor/skins/refinery/html5/h2.png +0 -0
  15. data/app/assets/images/wymeditor/skins/refinery/html5/h3.png +0 -0
  16. data/app/assets/images/wymeditor/skins/refinery/html5/h4.png +0 -0
  17. data/app/assets/images/wymeditor/skins/refinery/html5/h5.png +0 -0
  18. data/app/assets/images/wymeditor/skins/refinery/html5/h6.png +0 -0
  19. data/app/assets/images/wymeditor/skins/refinery/html5/header.png +0 -0
  20. data/app/assets/images/wymeditor/skins/refinery/html5/hgroup.png +0 -0
  21. data/app/assets/images/wymeditor/skins/refinery/html5/mark.png +0 -0
  22. data/app/assets/images/wymeditor/skins/refinery/html5/meter.png +0 -0
  23. data/app/assets/images/wymeditor/skins/refinery/html5/nav.png +0 -0
  24. data/app/assets/images/wymeditor/skins/refinery/html5/p.png +0 -0
  25. data/app/assets/images/wymeditor/skins/refinery/html5/pre.png +0 -0
  26. data/app/assets/images/wymeditor/skins/refinery/html5/progress.png +0 -0
  27. data/app/assets/images/wymeditor/skins/refinery/html5/readme.md +1 -0
  28. data/app/assets/images/wymeditor/skins/refinery/html5/rp.png +0 -0
  29. data/app/assets/images/wymeditor/skins/refinery/html5/rt.png +0 -0
  30. data/app/assets/images/wymeditor/skins/refinery/html5/ruby.png +0 -0
  31. data/app/assets/images/wymeditor/skins/refinery/html5/section.png +0 -0
  32. data/app/assets/images/wymeditor/skins/refinery/html5/summary.png +0 -0
  33. data/app/assets/images/wymeditor/skins/refinery/html5/time.png +0 -0
  34. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-blockquote.png +0 -0
  35. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h1.png +0 -0
  36. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h2.png +0 -0
  37. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h3.png +0 -0
  38. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h4.png +0 -0
  39. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h5.png +0 -0
  40. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h6.png +0 -0
  41. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-p.png +0 -0
  42. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-pre.png +0 -0
  43. data/app/assets/images/wymeditor/skins/refinery/link_add.png +0 -0
  44. data/app/assets/images/wymeditor/skins/refinery/link_break.png +0 -0
  45. data/app/assets/images/wymeditor/skins/refinery/page_code.png +0 -0
  46. data/app/assets/images/wymeditor/skins/refinery/page_paste.png +0 -0
  47. data/app/assets/images/wymeditor/skins/refinery/photo_add.png +0 -0
  48. data/app/assets/images/wymeditor/skins/refinery/right.png +0 -0
  49. data/app/assets/images/wymeditor/skins/refinery/style.png +0 -0
  50. data/app/assets/images/wymeditor/skins/refinery/table_add.png +0 -0
  51. data/app/assets/images/wymeditor/skins/refinery/text_align_center.png +0 -0
  52. data/app/assets/images/wymeditor/skins/refinery/text_align_justify.png +0 -0
  53. data/app/assets/images/wymeditor/skins/refinery/text_align_left.png +0 -0
  54. data/app/assets/images/wymeditor/skins/refinery/text_align_right.png +0 -0
  55. data/app/assets/images/wymeditor/skins/refinery/text_bold.png +0 -0
  56. data/app/assets/images/wymeditor/skins/refinery/text_heading_1.png +0 -0
  57. data/app/assets/images/wymeditor/skins/refinery/text_heading_2.png +0 -0
  58. data/app/assets/images/wymeditor/skins/refinery/text_heading_3.png +0 -0
  59. data/app/assets/images/wymeditor/skins/refinery/text_heading_4.png +0 -0
  60. data/app/assets/images/wymeditor/skins/refinery/text_heading_5.png +0 -0
  61. data/app/assets/images/wymeditor/skins/refinery/text_heading_6.png +0 -0
  62. data/app/assets/images/wymeditor/skins/refinery/text_indent.png +0 -0
  63. data/app/assets/images/wymeditor/skins/refinery/text_indent_remove.png +0 -0
  64. data/app/assets/images/wymeditor/skins/refinery/text_italic.png +0 -0
  65. data/app/assets/images/wymeditor/skins/refinery/text_list_bullets.png +0 -0
  66. data/app/assets/images/wymeditor/skins/refinery/text_list_numbers.png +0 -0
  67. data/app/assets/images/wymeditor/skins/refinery/text_paragraph.png +0 -0
  68. data/app/assets/images/wymeditor/skins/refinery/text_strikethrough.png +0 -0
  69. data/app/assets/images/wymeditor/skins/refinery/text_subscript.png +0 -0
  70. data/app/assets/images/wymeditor/skins/refinery/text_superscript.png +0 -0
  71. data/app/assets/images/wymeditor/skins/refinery/text_underline.png +0 -0
  72. data/app/assets/images/wymeditor/skins/wymeditor_icon.png +0 -0
  73. data/app/assets/javascripts/refinery/boot_wym.js.erb +289 -0
  74. data/app/assets/javascripts/refinery/wymeditor.js +37 -0
  75. data/app/assets/javascripts/wymeditor/browsers/ie.js.erb +224 -0
  76. data/app/assets/javascripts/wymeditor/browsers/mozilla.js.erb +293 -0
  77. data/app/assets/javascripts/wymeditor/browsers/opera.js.erb +123 -0
  78. data/app/assets/javascripts/wymeditor/browsers/webkit.js.erb +284 -0
  79. data/app/assets/javascripts/wymeditor/classes.js.erb +1577 -0
  80. data/app/assets/javascripts/wymeditor/functions.js.erb +218 -0
  81. data/app/assets/javascripts/wymeditor/lang/bg.js +57 -0
  82. data/app/assets/javascripts/wymeditor/lang/ca.js +45 -0
  83. data/app/assets/javascripts/wymeditor/lang/cs.js +58 -0
  84. data/app/assets/javascripts/wymeditor/lang/da.js +48 -0
  85. data/app/assets/javascripts/wymeditor/lang/de.js +45 -0
  86. data/app/assets/javascripts/wymeditor/lang/en.js +57 -0
  87. data/app/assets/javascripts/wymeditor/lang/es.js +58 -0
  88. data/app/assets/javascripts/wymeditor/lang/fa.js +46 -0
  89. data/app/assets/javascripts/wymeditor/lang/fi.js +57 -0
  90. data/app/assets/javascripts/wymeditor/lang/fr.js +57 -0
  91. data/app/assets/javascripts/wymeditor/lang/he.js +45 -0
  92. data/app/assets/javascripts/wymeditor/lang/hu.js +45 -0
  93. data/app/assets/javascripts/wymeditor/lang/it.js +48 -0
  94. data/app/assets/javascripts/wymeditor/lang/ja.js +47 -0
  95. data/app/assets/javascripts/wymeditor/lang/lv.js +47 -0
  96. data/app/assets/javascripts/wymeditor/lang/nb.js +48 -0
  97. data/app/assets/javascripts/wymeditor/lang/nl.js +47 -0
  98. data/app/assets/javascripts/wymeditor/lang/nn.js +45 -0
  99. data/app/assets/javascripts/wymeditor/lang/pl.js +45 -0
  100. data/app/assets/javascripts/wymeditor/lang/pt-BR.js +58 -0
  101. data/app/assets/javascripts/wymeditor/lang/pt.js +45 -0
  102. data/app/assets/javascripts/wymeditor/lang/rs.js +47 -0
  103. data/app/assets/javascripts/wymeditor/lang/ru.js +56 -0
  104. data/app/assets/javascripts/wymeditor/lang/sk.js +56 -0
  105. data/app/assets/javascripts/wymeditor/lang/sl.js +47 -0
  106. data/app/assets/javascripts/wymeditor/lang/sv.js +45 -0
  107. data/app/assets/javascripts/wymeditor/lang/tr.js +45 -0
  108. data/app/assets/javascripts/wymeditor/lang/vi.js +47 -0
  109. data/app/assets/javascripts/wymeditor/lang/zh_cn.js +47 -0
  110. data/app/assets/javascripts/wymeditor/prototypes.js.erb +1106 -0
  111. data/app/assets/javascripts/wymeditor/setup.js.erb +622 -0
  112. data/app/assets/javascripts/wymeditor/skins/refinery/skin.js +48 -0
  113. data/app/assets/javascripts/wymeditor/validators.js.erb +776 -0
  114. data/app/assets/stylesheets/theme.css.scss +36 -0
  115. data/app/assets/stylesheets/wymeditor/skins/refinery/skin.css.scss +530 -0
  116. data/app/assets/stylesheets/wymeditor/skins/refinery/wymiframe.css.scss +156 -0
  117. data/app/assets/stylesheets/wymeditor.css.scss +0 -0
  118. data/app/controllers/refinery/wymeditor_controller.rb +9 -0
  119. data/app/views/refinery/wymiframe.html.erb +14 -0
  120. data/config/initializers/refinery/wymeditor.rb.erb +4 -0
  121. data/lib/refinery/wymeditor/configuration.rb +10 -0
  122. data/lib/refinery/wymeditor/engine.rb +30 -0
  123. data/lib/refinery/wymeditor.rb +12 -0
  124. data/public/wymeditor/GPL-license.txt +278 -0
  125. data/public/wymeditor/MIT-license.txt +20 -0
  126. data/public/wymeditor/README +35 -0
  127. data/readme.md +96 -0
  128. data/refinerycms-wymeditor.gemspec +17 -0
  129. metadata +173 -0
@@ -0,0 +1,622 @@
1
+ if(!WYMeditor) { var WYMeditor = {}; }
2
+
3
+ //Wrap the Firebug console in WYMeditor.console
4
+ (function() {
5
+ if ( !window.console || !console.firebug ) {
6
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
7
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
8
+
9
+ WYMeditor.console = {};
10
+ for (var i = 0; i < names.length; ++i)
11
+ WYMeditor.console[names[i]] = function() {};
12
+
13
+ } else { WYMeditor.console = window.console; }
14
+ })();
15
+ $.extend(WYMeditor, {
16
+
17
+ /*
18
+ Constants: Global WYMeditor constants.
19
+
20
+ VERSION - Defines WYMeditor version.
21
+ INSTANCES - An array of loaded WYMeditor.editor instances.
22
+ STRINGS - An array of loaded WYMeditor language pairs/values.
23
+ SKINS - An array of loaded WYMeditor skins.
24
+ NAME - The "name" attribute.
25
+ INDEX - A string replaced by the instance index.
26
+ WYM_INDEX - A string used to get/set the instance index.
27
+ BASE_PATH - A string replaced by WYMeditor's base path.
28
+ SKIN_PATH - A string replaced by WYMeditor's skin path.
29
+ WYM_PATH - A string replaced by WYMeditor's main JS file path.
30
+ SKINS_DEFAULT_PATH - The skins default base path.
31
+ SKINS_DEFAULT_CSS - The skins default CSS file.
32
+ LANG_DEFAULT_PATH - The language files default path.
33
+ IFRAME_BASE_PATH - A string replaced by the designmode iframe's base path.
34
+ IFRAME_DEFAULT - The iframe's default base path.
35
+ JQUERY_PATH - A string replaced by the computed jQuery path.
36
+ DIRECTION - A string replaced by the text direction (rtl or ltr).
37
+ LOGO - A string replaced by WYMeditor logo.
38
+ TOOLS - A string replaced by the toolbar's HTML.
39
+ TOOLS_ITEMS - A string replaced by the toolbar items.
40
+ TOOL_NAME - A string replaced by a toolbar item's name.
41
+ TOOL_TITLE - A string replaced by a toolbar item's title.
42
+ TOOL_CLASS - A string replaced by a toolbar item's class.
43
+ CLASSES - A string replaced by the classes panel's HTML.
44
+ CLASSES_ITEMS - A string replaced by the classes items.
45
+ CLASS_NAME - A string replaced by a class item's name.
46
+ CLASS_TITLE - A string replaced by a class item's title.
47
+ CONTAINERS - A string replaced by the containers panel's HTML.
48
+ CONTAINERS_ITEMS - A string replaced by the containers items.
49
+ CONTAINER_NAME - A string replaced by a container item's name.
50
+ CONTAINER_TITLE - A string replaced by a container item's title.
51
+ CONTAINER_CLASS - A string replaced by a container item's class.
52
+ HTML - A string replaced by the HTML view panel's HTML.
53
+ IFRAME - A string replaced by the designmode iframe.
54
+ STATUS - A string replaced by the status panel's HTML.
55
+ DIALOG_TITLE - A string replaced by a dialog's title.
56
+ DIALOG_BODY - A string replaced by a dialog's HTML body.
57
+ BODY - The BODY element.
58
+ STRING - The "string" type.
59
+ BODY,DIV,P,
60
+ H1,H2,H3,H4,H5,H6,
61
+ PRE,BLOCKQUOTE,
62
+ A,BR,IMG,
63
+ TABLE,TD,TH,
64
+ UL,OL,LI - HTML elements string representation.
65
+ CLASS,HREF,SRC,
66
+ TITLE,ALT - HTML attributes string representation.
67
+ DIALOG_LINK - A link dialog type.
68
+ DIALOG_IMAGE - An image dialog type.
69
+ DIALOG_TABLE - A table dialog type.
70
+ DIALOG_PASTE - A 'Paste' dialog type.
71
+ BOLD - Command: (un)set selection to <strong>.
72
+ ITALIC - Command: (un)set selection to <em>.
73
+ CREATE_LINK - Command: open the link dialog or (un)set link.
74
+ INSERT_IMAGE - Command: open the image dialog or insert an image.
75
+ INSERT_TABLE - Command: open the table dialog.
76
+ PASTE - Command: open the paste dialog.
77
+ INDENT - Command: nest a list item.
78
+ OUTDENT - Command: unnest a list item.
79
+ TOGGLE_HTML - Command: display/hide the HTML view.
80
+ FORMAT_BLOCK - Command: set a block element to another type.
81
+ PREVIEW - Command: open the preview dialog.
82
+ UNLINK - Command: unset a link.
83
+ INSERT_UNORDEREDLIST- Command: insert an unordered list.
84
+ INSERT_ORDEREDLIST - Command: insert an ordered list.
85
+ MAIN_CONTAINERS - An array of the main HTML containers used in WYMeditor.
86
+ BLOCKS - An array of the HTML block elements.
87
+ KEY - Standard key codes.
88
+ NODE - Node types.
89
+
90
+ */
91
+
92
+ VERSION : "0.5-rc1-refinery",
93
+ INSTANCES : [],
94
+ STRINGS : [],
95
+ SKINS : [],
96
+ NAME : "name",
97
+ INDEX : "{Wym_Index}",
98
+ WYM_INDEX : "wym_index",
99
+ BASE_PATH : "{Wym_Base_Path}",
100
+ CSS_PATH : "{Wym_Css_Path}",
101
+ WYM_PATH : "{Wym_Wym_Path}",
102
+ SKINS_DEFAULT_PATH : "/assets/wymeditor/skins/",
103
+ SKINS_DEFAULT_CSS : "skin.css",
104
+ SKINS_DEFAULT_JS : "skin.js",
105
+ LANG_DEFAULT_PATH : "lang/",
106
+ IFRAME_BASE_PATH : "{Wym_Iframe_Base_Path}",
107
+ IFRAME_DEFAULT : "iframe/default/",
108
+ JQUERY_PATH : "{Wym_Jquery_Path}",
109
+ DIRECTION : "{Wym_Direction}",
110
+ LOGO : "{Wym_Logo}",
111
+ TOOLS : "{Wym_Tools}",
112
+ TOOLS_ITEMS : "{Wym_Tools_Items}",
113
+ TOOL_NAME : "{Wym_Tool_Name}",
114
+ TOOL_TITLE : "{Wym_Tool_Title}",
115
+ TOOL_CLASS : "{Wym_Tool_Class}",
116
+ CLASSES : "{Wym_Classes}",
117
+ CLASSES_ITEMS : "{Wym_Classes_Items}",
118
+ CLASS_NAME : "{Wym_Class_Name}",
119
+ CLASS_TITLE : "{Wym_Class_Title}",
120
+ CONTAINERS : "{Wym_Containers}",
121
+ CONTAINERS_ITEMS : "{Wym_Containers_Items}",
122
+ CONTAINER_NAME : "{Wym_Container_Name}",
123
+ CONTAINER_TITLE : "{Wym_Containers_Title}",
124
+ CONTAINER_CLASS : "{Wym_Container_Class}",
125
+ HTML : "{Wym_Html}",
126
+ IFRAME : "{Wym_Iframe}",
127
+ STATUS : "{Wym_Status}",
128
+ DIALOG_TITLE : "{Wym_Dialog_Title}",
129
+ DIALOG_BODY : "{Wym_Dialog_Body}",
130
+ STRING : "string",
131
+ BODY : "body",
132
+ DIV : "div",
133
+ P : "p",
134
+ H1 : "h1",
135
+ H2 : "h2",
136
+ H3 : "h3",
137
+ H4 : "h4",
138
+ H5 : "h5",
139
+ H6 : "h6",
140
+ PRE : "pre",
141
+ BLOCKQUOTE : "blockquote",
142
+ A : "a",
143
+ BR : "br",
144
+ IMG : "img",
145
+ TABLE : "table",
146
+ TD : "td",
147
+ TH : "th",
148
+ UL : "ul",
149
+ OL : "ol",
150
+ LI : "li",
151
+ CLASS : "class",
152
+ HREF : "href",
153
+ SRC : "src",
154
+ TITLE : "title",
155
+ TARGET : "target",
156
+ ALT : "alt",
157
+ REL : 'rel',
158
+ DIALOG_LINK : "Link",
159
+ DIALOG_IMAGE : "Image",
160
+ DIALOG_TABLE : "Table",
161
+ DIALOG_PASTE : "Paste_From_Word",
162
+ DIALOG_CLASS : "Css_Class",
163
+ BOLD : "Bold",
164
+ ITALIC : "Italic",
165
+ CREATE_LINK : "CreateLink",
166
+ INSERT_IMAGE : "InsertImage",
167
+ INSERT_TABLE : "InsertTable",
168
+ INSERT_HTML : "InsertHTML",
169
+ APPLY_CLASS : "Apply_Style",
170
+ PASTE : "Paste",
171
+ INDENT : "Indent",
172
+ OUTDENT : "Outdent",
173
+ TOGGLE_HTML : "ToggleHtml",
174
+ FORMAT_BLOCK : "FormatBlock",
175
+ PREVIEW : "Preview",
176
+
177
+ UNLINK : "Unlink",
178
+ INSERT_UNORDEREDLIST : "InsertUnorderedList",
179
+ INSERT_ORDEREDLIST : "InsertOrderedList",
180
+
181
+ MAIN_CONTAINERS : new Array("p","h1","h2","h3","h4","h5","h6","pre","blockquote"),
182
+
183
+ BLOCKS : new Array("address", "blockquote", "div", "dl",
184
+ "fieldset", "form", "h1", "h2", "h3", "h4", "h5", "h6", "hr",
185
+ "noscript", "ol", "p", "pre", "table", "ul", "dd", "dt",
186
+ "li", "tbody", "td", "tfoot", "th", "thead", "tr", "meter",
187
+ "section", "article", "aside", "details", "header", "footer",
188
+ "nav", "dialog", "figure", "figcaption", "address", "hgroup",
189
+ "mark", "time", "canvas", "audio", "video", "source", "output",
190
+ "progress", "ruby", "rt", "rp", "summary", "command"<%= ", #{Refinery::Wymeditor.whitelist_tags.keys.map{|k| %Q{"#{k}"}}.join(', ')}" if Refinery::Wymeditor.whitelist_tags.any? %>),
191
+
192
+ KEY : {
193
+ BACKSPACE: 8,
194
+ ENTER: 13,
195
+ END: 35,
196
+ HOME: 36,
197
+ LEFT: 37,
198
+ UP: 38,
199
+ RIGHT: 39,
200
+ DOWN: 40,
201
+ CURSOR: new Array(37, 38, 39, 40),
202
+ DELETE: 46
203
+ },
204
+
205
+ NODE : {
206
+ ELEMENT: 1,
207
+ ATTRIBUTE: 2,
208
+ TEXT: 3
209
+ },
210
+
211
+ /*
212
+ Class: WYMeditor.editor
213
+ WYMeditor editor main class, instanciated for each editor occurrence.
214
+ */
215
+
216
+ editor : function(elem, options) {
217
+ /*
218
+ Constructor: WYMeditor.editor
219
+
220
+ Initializes main values (index, elements, paths, ...)
221
+ and call WYMeditor.editor.init which initializes the editor.
222
+
223
+ Parameters:
224
+
225
+ elem - The HTML element to be replaced by the editor.
226
+ options - The hash of options.
227
+
228
+ Returns:
229
+
230
+ Nothing.
231
+
232
+ See Also:
233
+
234
+ <WYMeditor.editor.init>
235
+ */
236
+
237
+ //store the instance in the INSTANCES array and store the index
238
+ this._index = WYMeditor.INSTANCES.push(this) - 1;
239
+ //store the element replaced by the editor
240
+ this._element = elem;
241
+ //store the options
242
+ this._options = options;
243
+ //store the element's inner value
244
+ this._html = $(elem).val();
245
+
246
+ //store the HTML option, if any
247
+ if(this._options.html) { this._html = this._options.html; }
248
+
249
+ //get or compute the base path (where the main JS file is located)
250
+ this._options.basePath = this._options.basePath || this.computeBasePath();
251
+
252
+ //get or set the skin path (where the skin files are located)
253
+ this._options.skinPath = this._options.skinPath || (this._options.basePath + WYMeditor.SKINS_DEFAULT_PATH) + this._options.skin + '/';
254
+
255
+ // set css and js skin paths
256
+ this._options.cssCompiledSkinPath = this._options.cssCompiledSkinPath || ((this._options.cssSkinPath || this._options.skinPath) + this._options.skin + "/");
257
+ this._options.jsCompiledSkinPath = this._options.jsCompiledSkinPath || ((this._options.jsSkinPath || this._options.skinPath) + this._options.skin + "/");
258
+
259
+ //get or compute the main JS file location
260
+ this._options.wymPath = this._options.wymPath || this.computeWymPath();
261
+
262
+ //get or set the language files path
263
+ this._options.langPath = this._options.langPath || this._options.basePath + WYMeditor.LANG_DEFAULT_PATH;
264
+
265
+ //get or set the designmode iframe's base path
266
+ this._options.iframeBasePath = this._options.iframeBasePath || this._options.basePath + WYMeditor.IFRAME_DEFAULT;
267
+
268
+ //get or compute the jQuery JS file location
269
+ this._options.jQueryPath = this._options.jQueryPath || this.computeJqueryPath();
270
+
271
+ //initialize the editor instance
272
+ this.init();
273
+ }
274
+
275
+ });
276
+
277
+
278
+ /********** JQUERY **********/
279
+
280
+ /**
281
+ * Replace an HTML element by WYMeditor
282
+ *
283
+ * @example $(".wymeditor").wymeditor(
284
+ * {
285
+ *
286
+ * }
287
+ * );
288
+ * @desc Example description here
289
+ *
290
+ * @name WYMeditor
291
+ * @description WYMeditor is a web-based WYSIWYM XHTML editor
292
+ * @param Hash hash A hash of parameters
293
+ * @option Integer iExample Description here
294
+ * @option String sExample Description here
295
+ *
296
+ * @type jQuery
297
+ * @cat Plugins/WYMeditor
298
+ * @author Jean-Francois Hovinne
299
+ */
300
+ $.fn.wymeditor = function(options) {
301
+
302
+ options = $.extend({
303
+
304
+ html: "",
305
+
306
+ basePath: false,
307
+
308
+ skinPath: false,
309
+ jsSkinPath: false,
310
+ cssSkinPath: false,
311
+
312
+ wymPath: false,
313
+
314
+ iframeBasePath: false,
315
+
316
+ jQueryPath: false,
317
+
318
+ styles: false,
319
+
320
+ stylesheet: false,
321
+
322
+ skin: "default",
323
+ initSkin: true,
324
+ loadSkin: true,
325
+
326
+ lang: "en",
327
+
328
+ direction: "ltr",
329
+
330
+ boxHtml: "<div class='wym_box'>"
331
+ + "<div class='wym_area_top'>" + WYMeditor.TOOLS + "</div>"
332
+ + "<div class='wym_area_left'></div>"
333
+ + "<div class='wym_area_right'>" + WYMeditor.CONTAINERS + WYMeditor.CLASSES + "</div>"
334
+ + "<div class='wym_area_main'>" + WYMeditor.HTML + WYMeditor.IFRAME + WYMeditor.STATUS + "</div>"
335
+ + "<div class='wym_area_bottom'>" + WYMeditor.LOGO + "</div>"
336
+ + "</div>",
337
+
338
+ logoHtml: "<a class='wym_wymeditor_link' href='http://www.wymeditor.org/'>WYMeditor</a>",
339
+
340
+ iframeHtml:"<div class='wym_iframe wym_section'>"
341
+ + "<iframe src='" + WYMeditor.IFRAME_BASE_PATH + "wymiframe.html' onload='"
342
+ + "this.contentWindow.parent.WYMeditor.INSTANCES[" + WYMeditor.INDEX + "].initIframe(this)'>"
343
+ + "</iframe>"
344
+ + "</div>",
345
+
346
+ editorStyles: [],
347
+
348
+ toolsHtml: "<div class='wym_tools wym_section'>"
349
+ + "<h2>{Tools}</h2>"
350
+ + "<ul>" + WYMeditor.TOOLS_ITEMS + "</ul>"
351
+ + "</div>",
352
+
353
+ toolsItemHtml:"<li class='" + WYMeditor.TOOL_CLASS + "'>"
354
+ + "<a href='#' name='" + WYMeditor.TOOL_NAME + "' title='" + WYMeditor.TOOL_TITLE + "'>"
355
+ + WYMeditor.TOOL_TITLE
356
+ + "</a>"
357
+ + "</li>",
358
+
359
+ toolsItems: [
360
+ {'name': 'Bold', 'title': 'Strong', 'css': 'wym_tools_strong'},
361
+ {'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'},
362
+ {'name': 'Superscript', 'title': 'Superscript', 'css': 'wym_tools_superscript'},
363
+ {'name': 'Subscript', 'title': 'Subscript', 'css': 'wym_tools_subscript'},
364
+ {'name': 'InsertOrderedList', 'title': 'Ordered_List', 'css': 'wym_tools_ordered_list'},
365
+ {'name': 'InsertUnorderedList', 'title': 'Unordered_List', 'css': 'wym_tools_unordered_list'},
366
+ {'name': 'Indent', 'title': 'Indent', 'css': 'wym_tools_indent'},
367
+ {'name': 'Outdent', 'title': 'Outdent', 'css': 'wym_tools_outdent'},
368
+ {'name': 'Undo', 'title': 'Undo', 'css': 'wym_tools_undo'},
369
+ {'name': 'Redo', 'title': 'Redo', 'css': 'wym_tools_redo'},
370
+ {'name': 'CreateLink', 'title': 'Link', 'css': 'wym_tools_link'},
371
+ {'name': 'Unlink', 'title': 'Unlink', 'css': 'wym_tools_unlink'},
372
+ {'name': 'InsertImage', 'title': 'Image', 'css': 'wym_tools_image'},
373
+ {'name': 'InsertTable', 'title': 'Table', 'css': 'wym_tools_table'},
374
+ {'name': 'Paste', 'title': 'Paste_From_Word', 'css': 'wym_tools_paste'},
375
+ {'name': 'ToggleHtml', 'title': 'HTML', 'css': 'wym_tools_html'},
376
+ {'name': 'Preview', 'title': 'Preview', 'css': 'wym_tools_preview'}
377
+ ],
378
+
379
+ containersHtml: "<div class='wym_containers wym_section'>"
380
+ + "<h2>{Containers}</h2>"
381
+ + "<ul>"
382
+ + WYMeditor.CONTAINERS_ITEMS
383
+ + "</ul>"
384
+ + "</div>",
385
+
386
+ containersItemHtml:"<li class='" + WYMeditor.CONTAINER_CLASS + "'>"
387
+ + "<a href='#' name='" + WYMeditor.CONTAINER_NAME + "'>"
388
+ + WYMeditor.CONTAINER_TITLE
389
+ + "</a>"
390
+ +"</li>",
391
+
392
+ containersItems: [
393
+ {'name': 'P', 'title': 'Paragraph', 'css': 'wym_containers_p'},
394
+ {'name': 'H1', 'title': 'Heading_1', 'css': 'wym_containers_h1'},
395
+ {'name': 'H2', 'title': 'Heading_2', 'css': 'wym_containers_h2'},
396
+ {'name': 'H3', 'title': 'Heading_3', 'css': 'wym_containers_h3'},
397
+ {'name': 'H4', 'title': 'Heading_4', 'css': 'wym_containers_h4'},
398
+ {'name': 'H5', 'title': 'Heading_5', 'css': 'wym_containers_h5'},
399
+ {'name': 'H6', 'title': 'Heading_6', 'css': 'wym_containers_h6'},
400
+ {'name': 'PRE', 'title': 'Preformatted', 'css': 'wym_containers_pre'},
401
+ {'name': 'BLOCKQUOTE', 'title': 'Blockquote', 'css': 'wym_containers_blockquote'},
402
+ {'name': 'TH', 'title': 'Table_Header', 'css': 'wym_containers_th'}
403
+ ],
404
+
405
+ classesHtml: "<div class='wym_classes wym_section'>"
406
+ + "<h2>{Classes}</h2><ul>"
407
+ + WYMeditor.CLASSES_ITEMS
408
+ + "</ul></div>",
409
+
410
+ classesItemHtml: "<li class='wym_classes_" + WYMeditor.CLASS_NAME + "'>"
411
+ + "<a href='#' name='" + WYMeditor.CLASS_NAME + "'>"
412
+ + WYMeditor.CLASS_TITLE
413
+ + "</a>"
414
+ +"</li>",
415
+
416
+ classesItems: [],
417
+
418
+ statusHtml: "<div class='wym_status wym_section'>"
419
+ + "<h2>{Status}</h2>"
420
+ +"</div>",
421
+
422
+ htmlHtml: "<div class='wym_html wym_section'>"
423
+ + "<h2>{Source_Code}</h2>"
424
+ + "<textarea class='wym_html_val'></textarea>"
425
+ +"</div>",
426
+
427
+ boxSelector: ".wym_box",
428
+ toolsSelector: ".wym_tools",
429
+ toolsListSelector: " ul",
430
+ containersSelector:".wym_containers",
431
+ classesSelector: ".wym_classes",
432
+ htmlSelector: ".wym_html",
433
+ iframeSelector: ".wym_iframe iframe",
434
+ iframeBodySelector:".wym_iframe",
435
+ statusSelector: ".wym_status",
436
+ toolSelector: ".wym_tools a",
437
+ containerSelector: ".wym_containers a",
438
+ classSelector: ".wym_classes a",
439
+ classUnhiddenSelector: ".wym_classes",
440
+ classHiddenSelector: ".wym_classes_hidden",
441
+ htmlValSelector: ".wym_html_val",
442
+
443
+ hrefSelector: ".wym_href",
444
+ srcSelector: ".wym_src",
445
+ titleSelector: ".wym_title",
446
+ targetSelector: ".wym_target",
447
+ altSelector: ".wym_alt",
448
+ textSelector: ".wym_text",
449
+ sizeSelector: ".wym_size",
450
+
451
+ rowsSelector: ".wym_rows",
452
+ colsSelector: ".wym_cols",
453
+ captionSelector: ".wym_caption",
454
+ summarySelector: ".wym_summary",
455
+
456
+ submitSelector: ".wym_submit",
457
+ cancelSelector: ".wym_cancel",
458
+ previewSelector: "",
459
+
460
+ dialogTypeSelector: ".wym_dialog_type",
461
+ dialogLinkSelector: ".wym_dialog_link",
462
+ dialogImageSelector: ".wym_dialog_image",
463
+ dialogTableSelector: ".wym_dialog_table",
464
+ dialogPasteSelector: ".wym_dialog_paste",
465
+ dialogPreviewSelector: ".wym_dialog_preview",
466
+
467
+ updateSelector: ".wymupdate",
468
+ updateEvent: "click",
469
+
470
+ dialogFeatures: {
471
+ width: 560
472
+ , height: 300
473
+ }
474
+
475
+ , dialogFeaturesPreview: "menubar=no,titlebar=no,toolbar=no,resizable=no,scrollbars=yes,width=560,height=300,top=0,left=0"
476
+
477
+ , dialogHtml:"<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'"
478
+ + " 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>"
479
+ + "<html dir='" + WYMeditor.DIRECTION + "'>"
480
+ + "<head>"
481
+ + "<link rel='stylesheet' type='text/css' media='screen'" + " href='" + WYMeditor.CSS_PATH + "' />"
482
+ + "<title>" + WYMeditor.DIALOG_TITLE + "</title>"
483
+ + "<script type='text/javascript' src='" + WYMeditor.JQUERY_PATH + "'></script>"
484
+ + "<script type='text/javascript' src='" + WYMeditor.WYM_PATH + "'></script>"
485
+ + "</head>"
486
+ + WYMeditor.DIALOG_BODY
487
+ + "</html>",
488
+
489
+ dialogLinkHtml: "<div class='wym_dialog wym_dialog_link'>"
490
+ + "<form>"
491
+ + "<fieldset>"
492
+ + "<input type='hidden' id='wym_dialog_type' class='wym_dialog_type' value='"
493
+ + WYMeditor.DIALOG_LINK
494
+ + "' />"
495
+ + "<legend>{Link}</legend>"
496
+ + "<div class='row'>"
497
+ + "<label>{URL}</label>"
498
+ + "<input type='text' class='wym_href' value='' size='40' />"
499
+ + "</div>"
500
+ + "<div class='row'>"
501
+ + "<label>{Title}</label>"
502
+ + "<input type='text' class='wym_title' value='' size='40' />"
503
+ + "</div>"
504
+ + "<div class='row row-indent'>"
505
+ + "<input class='wym_submit button' type='button'"
506
+ + " value='{Submit}' />"
507
+ + "<input class='wym_cancel' type='button'"
508
+ + "value='{Cancel}' />"
509
+ + "</div>"
510
+ + "</fieldset>"
511
+ + "</form>"
512
+ + "</div>",
513
+
514
+ dialogImageHtml: "<div class='wym_dialog wym_dialog_image'>"
515
+ + "<form>"
516
+ + "<fieldset>"
517
+ + "<input type='hidden' id='wym_dialog_type' class='wym_dialog_type' value='"
518
+ + WYMeditor.DIALOG_IMAGE
519
+ + "' />"
520
+ + "<legend>{Image}</legend>"
521
+ + "<div class='row'>"
522
+ + "<label>{URL}</label>"
523
+ + "<input type='text' class='wym_src' value='' size='40' />"
524
+ + "</div>"
525
+ + "<div class='row'>"
526
+ + "<label>{Alternative_Text}</label>"
527
+ + "<input type='text' class='wym_alt' value='' size='40' />"
528
+ + "</div>"
529
+ + "<div class='row'>"
530
+ + "<label>{Title}</label>"
531
+ + "<input type='text' class='wym_title' value='' size='40' />"
532
+ + "</div>"
533
+ + "<div class='row row-indent'>"
534
+ + "<input class='wym_submit button' type='button'"
535
+ + " value='{Submit}' />"
536
+ + "<input class='wym_cancel' type='button'"
537
+ + "value='{Cancel}' />"
538
+ + "</div>"
539
+ + "</fieldset>"
540
+ + "</form>"
541
+ + "</div>",
542
+
543
+ dialogTableHtml: "<div class='wym_dialog wym_dialog_table'>"
544
+ + "<form>"
545
+ + "<input type='hidden' id='wym_dialog_type' class='wym_dialog_type' value='"
546
+ + WYMeditor.DIALOG_TABLE
547
+ + "' />"
548
+ + "<div class='row'>"
549
+ + "<label>{Caption}</label>"
550
+ + "<input type='text' class='wym_caption' value='' size='40' />"
551
+ + "</div>"
552
+ + "<div class='row'>"
553
+ + "<label>{Summary}</label>"
554
+ + "<input type='text' class='wym_summary' value='' size='40' />"
555
+ + "</div>"
556
+ + "<div class='row'>"
557
+ + "<label>{Number_Of_Rows}</label>"
558
+ + "<input type='text' class='wym_rows' value='3' size='3' />"
559
+ + "</div>"
560
+ + "<div class='row'>"
561
+ + "<label>{Number_Of_Cols}</label>"
562
+ + "<input type='text' class='wym_cols' value='2' size='3' />"
563
+ + "</div>"
564
+ + "<div class='row row-indent'>"
565
+ + "<input class='wym_submit button' type='button'"
566
+ + " value='{Submit}' />"
567
+ + "<input class='wym_cancel' type='button'"
568
+ + "value='{Cancel}' />"
569
+ + "</div>"
570
+ + "</form>"
571
+ + "</div>",
572
+
573
+ dialogPasteHtml: "<div class='wym_dialog wym_dialog_paste'>"
574
+ + "<form>"
575
+ + "<input type='hidden' id='wym_dialog_type' class='wym_dialog_type' value='"
576
+ + WYMeditor.DIALOG_PASTE
577
+ + "' />"
578
+ + "<fieldset>"
579
+ + "<legend>{Paste_From_Word}</legend>"
580
+ + "<div class='row'>"
581
+ + "<textarea class='wym_text' rows='10' cols='50'></textarea>"
582
+ + "</div>"
583
+ + "<div class='row'>"
584
+ + "<input class='wym_submit button' type='button'"
585
+ + " value='{Submit}' />"
586
+ + "<input class='wym_cancel' type='button'"
587
+ + "value='{Cancel}' />"
588
+ + "</div>"
589
+ + "</fieldset>"
590
+ + "</form>"
591
+ + "</div>",
592
+
593
+ dialogPreviewHtml: "<div class='wym_dialog wym_dialog_preview'></div>",
594
+
595
+ dialogStyles: [],
596
+
597
+ stringDelimiterLeft: "{",
598
+ stringDelimiterRight:"}",
599
+
600
+ preInit: null,
601
+ preBind: null,
602
+ postInit: null,
603
+
604
+ preInitDialog: null,
605
+ postInitDialog: null
606
+
607
+ }, options);
608
+
609
+ return this.each(function() {
610
+
611
+ new WYMeditor.editor($(this),options);
612
+ });
613
+ };
614
+
615
+ /* @name extend
616
+ * @description Returns the WYMeditor instance based on its index
617
+ */
618
+ $.extend({
619
+ wymeditors: function(i) {
620
+ return (WYMeditor.INSTANCES[i]);
621
+ }
622
+ });
@@ -0,0 +1,48 @@
1
+ WYMeditor.SKINS['refinery'] = {
2
+
3
+ init: function(wym) {
4
+ //render following sections as buttons
5
+ $(wym._box).find(wym._options.toolsSelector)
6
+ .addClass('wym_buttons');
7
+
8
+ // auto add some margin to the main area sides if left area
9
+ // or right area are not empty (if they contain sections)
10
+ $(wym._box).find('div.wym_area_right ul')
11
+ .parents('div.wym_area_right').show()
12
+ .parents(wym._options.boxSelector)
13
+ .find('div.wym_area_main')
14
+ .css({'margin-right': '155px'});
15
+
16
+ $(wym._box).find('div.wym_area_left ul')
17
+ .parents('div.wym_area_left').show()
18
+ .parents(wym._options.boxSelector)
19
+ .find('div.wym_area_main')
20
+ .css({'margin-left': '155px'});
21
+
22
+ //make hover work under IE < 7
23
+ $(wym._box).find('.wym_section').hover(function(){
24
+ $(this).addClass('hover');
25
+ },function(){
26
+ $(this).removeClass('hover');
27
+ });
28
+
29
+ // show or hide CSS class options on hover
30
+ $(wym._box).find('.wym_tools_class')
31
+ .hover($.proxy(function(){
32
+ this.toggleClassSelector();
33
+ }, wym), $.proxy(function(){
34
+ this.toggleClassSelector();
35
+ }, wym));
36
+
37
+ // adjust sizing
38
+ $(wym._box).css('width', $(wym._element).width() - 2)
39
+ .find('.wym_iframe iframe').css('width', $(wym._box).width() - 2);
40
+
41
+ $('.button').corner('6px');
42
+ $(".wym_area_top li>a").corner("2px");
43
+
44
+ $(".wym_skin_refinery").animate({
45
+ opacity: 1
46
+ }, 800);
47
+ }
48
+ };