bootstrap-editable-rails 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +4 -13
  3. data/bootstrap-editable-rails.gemspec +1 -1
  4. data/lib/bootstrap-editable-rails.rb +2 -1
  5. data/lib/bootstrap-editable-rails/version.rb +1 -1
  6. data/vendor/assets/images/{clear.png → bootstrap-editable/clear.png} +0 -0
  7. data/vendor/assets/images/{loading.gif → bootstrap-editable/loading.gif} +0 -0
  8. data/vendor/assets/javascripts/bootstrap-editable.js +2245 -1149
  9. data/vendor/assets/javascripts/bootstrap-editable.min.js +7 -5
  10. data/vendor/assets/javascripts/inputs-ext/address/address.js +170 -0
  11. data/vendor/assets/javascripts/inputs-ext/typeaheadjs/lib/typeahead.js +1139 -0
  12. data/vendor/assets/javascripts/inputs-ext/typeaheadjs/typeaheadjs.js +86 -0
  13. data/vendor/assets/javascripts/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.js +499 -0
  14. data/vendor/assets/javascripts/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.min.js +1 -0
  15. data/vendor/assets/javascripts/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/wysihtml5-0.3.0.js +9521 -0
  16. data/vendor/assets/javascripts/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/wysihtml5-0.3.0.min.js +261 -0
  17. data/vendor/assets/javascripts/inputs-ext/wysihtml5/wysihtml5.js +138 -0
  18. data/vendor/assets/stylesheets/{bootstrap-editable.css → bootstrap-editable.scss} +198 -15
  19. data/vendor/assets/stylesheets/inputs-ext/address/address.css +9 -0
  20. data/vendor/assets/stylesheets/inputs-ext/typeaheadjs/lib/typeahead.js-bootstrap.css +49 -0
  21. data/vendor/assets/stylesheets/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.css +102 -0
  22. data/vendor/assets/stylesheets/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/wysiwyg-color.css +67 -0
  23. metadata +54 -48
@@ -0,0 +1,86 @@
1
+ /**
2
+ Typeahead.js input, based on [Twitter Typeahead](http://twitter.github.io/typeahead.js).
3
+ It is mainly replacement of typeahead in Bootstrap 3.
4
+
5
+
6
+ @class typeaheadjs
7
+ @extends text
8
+ @since 1.5.0
9
+ @final
10
+ @example
11
+ <a href="#" id="country" data-type="typeaheadjs" data-pk="1" data-url="/post" data-title="Input country"></a>
12
+ <script>
13
+ $(function(){
14
+ $('#country').editable({
15
+ value: 'ru',
16
+ typeahead: {
17
+ name: 'country',
18
+ local: [
19
+ {value: 'ru', tokens: ['Russia']},
20
+ {value: 'gb', tokens: ['Great Britain']},
21
+ {value: 'us', tokens: ['United States']}
22
+ ],
23
+ template: function(item) {
24
+ return item.tokens[0] + ' (' + item.value + ')';
25
+ }
26
+ }
27
+ });
28
+ });
29
+ </script>
30
+ **/
31
+ (function ($) {
32
+ "use strict";
33
+
34
+ var Constructor = function (options) {
35
+ this.init('typeaheadjs', options, Constructor.defaults);
36
+ };
37
+
38
+ $.fn.editableutils.inherit(Constructor, $.fn.editabletypes.text);
39
+
40
+ $.extend(Constructor.prototype, {
41
+ render: function() {
42
+ this.renderClear();
43
+ this.setClass();
44
+ this.setAttr('placeholder');
45
+ this.$input.typeahead(this.options.typeahead);
46
+
47
+ // copy `input-sm | input-lg` classes to placeholder input
48
+ if($.fn.editableform.engine === 'bs3') {
49
+ if(this.$input.hasClass('input-sm')) {
50
+ this.$input.siblings('input.tt-hint').addClass('input-sm');
51
+ }
52
+ if(this.$input.hasClass('input-lg')) {
53
+ this.$input.siblings('input.tt-hint').addClass('input-lg');
54
+ }
55
+ }
56
+ }
57
+ });
58
+
59
+ Constructor.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
60
+ /**
61
+ @property tpl
62
+ @default <input type="text">
63
+ **/
64
+ tpl:'<input type="text">',
65
+ /**
66
+ Configuration of typeahead itself.
67
+ [Full list of options](https://github.com/twitter/typeahead.js#dataset).
68
+
69
+ @property typeahead
70
+ @type object
71
+ @default null
72
+ **/
73
+ typeahead: null,
74
+ /**
75
+ Whether to show `clear` button
76
+
77
+ @property clear
78
+ @type boolean
79
+ @default true
80
+ **/
81
+ clear: true
82
+ });
83
+
84
+ $.fn.editabletypes.typeaheadjs = Constructor;
85
+
86
+ }(window.jQuery));
@@ -0,0 +1,499 @@
1
+ !function($, wysi) {
2
+ "use strict";
3
+
4
+ var tpl = {
5
+ "font-styles": function(locale, options) {
6
+ var size = (options && options.size) ? ' btn-'+options.size : '';
7
+ return "<li class='dropdown'>" +
8
+ "<a class='btn dropdown-toggle" + size + "' data-toggle='dropdown' href='#'>" +
9
+ "<i class='icon-font'></i>&nbsp;<span class='current-font'>" + locale.font_styles.normal + "</span>&nbsp;<b class='caret'></b>" +
10
+ "</a>" +
11
+ "<ul class='dropdown-menu'>" +
12
+ "<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='div' tabindex='-1'>" + locale.font_styles.normal + "</a></li>" +
13
+ "<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='h1' tabindex='-1'>" + locale.font_styles.h1 + "</a></li>" +
14
+ "<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='h2' tabindex='-1'>" + locale.font_styles.h2 + "</a></li>" +
15
+ "<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='h3' tabindex='-1'>" + locale.font_styles.h3 + "</a></li>" +
16
+ "</ul>" +
17
+ "</li>";
18
+ },
19
+
20
+ "emphasis": function(locale, options) {
21
+ var size = (options && options.size) ? ' btn-'+options.size : '';
22
+ return "<li>" +
23
+ "<div class='btn-group'>" +
24
+ "<a class='btn" + size + "' data-wysihtml5-command='bold' title='CTRL+B' tabindex='-1'>" + locale.emphasis.bold + "</a>" +
25
+ "<a class='btn" + size + "' data-wysihtml5-command='italic' title='CTRL+I' tabindex='-1'>" + locale.emphasis.italic + "</a>" +
26
+ "<a class='btn" + size + "' data-wysihtml5-command='underline' title='CTRL+U' tabindex='-1'>" + locale.emphasis.underline + "</a>" +
27
+ "</div>" +
28
+ "</li>";
29
+ },
30
+
31
+ "lists": function(locale, options) {
32
+ var size = (options && options.size) ? ' btn-'+options.size : '';
33
+ return "<li>" +
34
+ "<div class='btn-group'>" +
35
+ "<a class='btn" + size + "' data-wysihtml5-command='insertUnorderedList' title='" + locale.lists.unordered + "' tabindex='-1'><i class='icon-list'></i></a>" +
36
+ "<a class='btn" + size + "' data-wysihtml5-command='insertOrderedList' title='" + locale.lists.ordered + "' tabindex='-1'><i class='icon-th-list'></i></a>" +
37
+ "<a class='btn" + size + "' data-wysihtml5-command='Outdent' title='" + locale.lists.outdent + "' tabindex='-1'><i class='icon-indent-right'></i></a>" +
38
+ "<a class='btn" + size + "' data-wysihtml5-command='Indent' title='" + locale.lists.indent + "' tabindex='-1'><i class='icon-indent-left'></i></a>" +
39
+ "</div>" +
40
+ "</li>";
41
+ },
42
+
43
+ "link": function(locale, options) {
44
+ var size = (options && options.size) ? ' btn-'+options.size : '';
45
+ return "<li>" +
46
+ "<div class='bootstrap-wysihtml5-insert-link-modal modal hide fade'>" +
47
+ "<div class='modal-header'>" +
48
+ "<a class='close' data-dismiss='modal'>&times;</a>" +
49
+ "<h3>" + locale.link.insert + "</h3>" +
50
+ "</div>" +
51
+ "<div class='modal-body'>" +
52
+ "<input value='http://' class='bootstrap-wysihtml5-insert-link-url input-xlarge'>" +
53
+ "</div>" +
54
+ "<div class='modal-footer'>" +
55
+ "<a href='#' class='btn' data-dismiss='modal'>" + locale.link.cancel + "</a>" +
56
+ "<a href='#' class='btn btn-primary' data-dismiss='modal'>" + locale.link.insert + "</a>" +
57
+ "</div>" +
58
+ "</div>" +
59
+ "<a class='btn" + size + "' data-wysihtml5-command='createLink' title='" + locale.link.insert + "' tabindex='-1'><i class='icon-share'></i></a>" +
60
+ "</li>";
61
+ },
62
+
63
+ "image": function(locale, options) {
64
+ var size = (options && options.size) ? ' btn-'+options.size : '';
65
+ return "<li>" +
66
+ "<div class='bootstrap-wysihtml5-insert-image-modal modal hide fade'>" +
67
+ "<div class='modal-header'>" +
68
+ "<a class='close' data-dismiss='modal'>&times;</a>" +
69
+ "<h3>" + locale.image.insert + "</h3>" +
70
+ "</div>" +
71
+ "<div class='modal-body'>" +
72
+ "<input value='http://' class='bootstrap-wysihtml5-insert-image-url input-xlarge'>" +
73
+ "</div>" +
74
+ "<div class='modal-footer'>" +
75
+ "<a href='#' class='btn' data-dismiss='modal'>" + locale.image.cancel + "</a>" +
76
+ "<a href='#' class='btn btn-primary' data-dismiss='modal'>" + locale.image.insert + "</a>" +
77
+ "</div>" +
78
+ "</div>" +
79
+ "<a class='btn" + size + "' data-wysihtml5-command='insertImage' title='" + locale.image.insert + "' tabindex='-1'><i class='icon-picture'></i></a>" +
80
+ "</li>";
81
+ },
82
+
83
+ "html": function(locale, options) {
84
+ var size = (options && options.size) ? ' btn-'+options.size : '';
85
+ return "<li>" +
86
+ "<div class='btn-group'>" +
87
+ "<a class='btn" + size + "' data-wysihtml5-action='change_view' title='" + locale.html.edit + "' tabindex='-1'><i class='icon-pencil'></i></a>" +
88
+ "</div>" +
89
+ "</li>";
90
+ },
91
+
92
+ "color": function(locale, options) {
93
+ var size = (options && options.size) ? ' btn-'+options.size : '';
94
+ return "<li class='dropdown'>" +
95
+ "<a class='btn dropdown-toggle" + size + "' data-toggle='dropdown' href='#' tabindex='-1'>" +
96
+ "<span class='current-color'>" + locale.colours.black + "</span>&nbsp;<b class='caret'></b>" +
97
+ "</a>" +
98
+ "<ul class='dropdown-menu'>" +
99
+ "<li><div class='wysihtml5-colors' data-wysihtml5-command-value='black'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='black'>" + locale.colours.black + "</a></li>" +
100
+ "<li><div class='wysihtml5-colors' data-wysihtml5-command-value='silver'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='silver'>" + locale.colours.silver + "</a></li>" +
101
+ "<li><div class='wysihtml5-colors' data-wysihtml5-command-value='gray'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='gray'>" + locale.colours.gray + "</a></li>" +
102
+ "<li><div class='wysihtml5-colors' data-wysihtml5-command-value='maroon'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='maroon'>" + locale.colours.maroon + "</a></li>" +
103
+ "<li><div class='wysihtml5-colors' data-wysihtml5-command-value='red'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='red'>" + locale.colours.red + "</a></li>" +
104
+ "<li><div class='wysihtml5-colors' data-wysihtml5-command-value='purple'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='purple'>" + locale.colours.purple + "</a></li>" +
105
+ "<li><div class='wysihtml5-colors' data-wysihtml5-command-value='green'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='green'>" + locale.colours.green + "</a></li>" +
106
+ "<li><div class='wysihtml5-colors' data-wysihtml5-command-value='olive'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='olive'>" + locale.colours.olive + "</a></li>" +
107
+ "<li><div class='wysihtml5-colors' data-wysihtml5-command-value='navy'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='navy'>" + locale.colours.navy + "</a></li>" +
108
+ "<li><div class='wysihtml5-colors' data-wysihtml5-command-value='blue'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='blue'>" + locale.colours.blue + "</a></li>" +
109
+ "<li><div class='wysihtml5-colors' data-wysihtml5-command-value='orange'></div><a class='wysihtml5-colors-title' data-wysihtml5-command='foreColor' data-wysihtml5-command-value='orange'>" + locale.colours.orange + "</a></li>" +
110
+ "</ul>" +
111
+ "</li>";
112
+ }
113
+ };
114
+
115
+ var templates = function(key, locale, options) {
116
+ return tpl[key](locale, options);
117
+ };
118
+
119
+
120
+ var Wysihtml5 = function(el, options) {
121
+ this.el = el;
122
+ var toolbarOpts = options || defaultOptions;
123
+ for(var t in toolbarOpts.customTemplates) {
124
+ tpl[t] = toolbarOpts.customTemplates[t];
125
+ }
126
+ this.toolbar = this.createToolbar(el, toolbarOpts);
127
+ this.editor = this.createEditor(options);
128
+
129
+ window.editor = this.editor;
130
+
131
+ $('iframe.wysihtml5-sandbox').each(function(i, el){
132
+ $(el.contentWindow).off('focus.wysihtml5').on({
133
+ 'focus.wysihtml5' : function(){
134
+ $('li.dropdown').removeClass('open');
135
+ }
136
+ });
137
+ });
138
+ };
139
+
140
+ Wysihtml5.prototype = {
141
+
142
+ constructor: Wysihtml5,
143
+
144
+ createEditor: function(options) {
145
+ options = options || {};
146
+
147
+ // Add the toolbar to a clone of the options object so multiple instances
148
+ // of the WYISYWG don't break because "toolbar" is already defined
149
+ options = $.extend(true, {}, options);
150
+ options.toolbar = this.toolbar[0];
151
+
152
+ var editor = new wysi.Editor(this.el[0], options);
153
+
154
+ if(options && options.events) {
155
+ for(var eventName in options.events) {
156
+ editor.on(eventName, options.events[eventName]);
157
+ }
158
+ }
159
+ return editor;
160
+ },
161
+
162
+ createToolbar: function(el, options) {
163
+ var self = this;
164
+ var toolbar = $("<ul/>", {
165
+ 'class' : "wysihtml5-toolbar",
166
+ 'style': "display:none"
167
+ });
168
+ var culture = options.locale || defaultOptions.locale || "en";
169
+ for(var key in defaultOptions) {
170
+ var value = false;
171
+
172
+ if(options[key] !== undefined) {
173
+ if(options[key] === true) {
174
+ value = true;
175
+ }
176
+ } else {
177
+ value = defaultOptions[key];
178
+ }
179
+
180
+ if(value === true) {
181
+ toolbar.append(templates(key, locale[culture], options));
182
+
183
+ if(key === "html") {
184
+ this.initHtml(toolbar);
185
+ }
186
+
187
+ if(key === "link") {
188
+ this.initInsertLink(toolbar);
189
+ }
190
+
191
+ if(key === "image") {
192
+ this.initInsertImage(toolbar);
193
+ }
194
+ }
195
+ }
196
+
197
+ if(options.toolbar) {
198
+ for(key in options.toolbar) {
199
+ toolbar.append(options.toolbar[key]);
200
+ }
201
+ }
202
+
203
+ toolbar.find("a[data-wysihtml5-command='formatBlock']").click(function(e) {
204
+ var target = e.target || e.srcElement;
205
+ var el = $(target);
206
+ self.toolbar.find('.current-font').text(el.html());
207
+ });
208
+
209
+ toolbar.find("a[data-wysihtml5-command='foreColor']").click(function(e) {
210
+ var target = e.target || e.srcElement;
211
+ var el = $(target);
212
+ self.toolbar.find('.current-color').text(el.html());
213
+ });
214
+
215
+ this.el.before(toolbar);
216
+
217
+ return toolbar;
218
+ },
219
+
220
+ initHtml: function(toolbar) {
221
+ var changeViewSelector = "a[data-wysihtml5-action='change_view']";
222
+ toolbar.find(changeViewSelector).click(function(e) {
223
+ toolbar.find('a.btn').not(changeViewSelector).toggleClass('disabled');
224
+ });
225
+ },
226
+
227
+ initInsertImage: function(toolbar) {
228
+ var self = this;
229
+ var insertImageModal = toolbar.find('.bootstrap-wysihtml5-insert-image-modal');
230
+ var urlInput = insertImageModal.find('.bootstrap-wysihtml5-insert-image-url');
231
+ var insertButton = insertImageModal.find('a.btn-primary');
232
+ var initialValue = urlInput.val();
233
+ var caretBookmark;
234
+
235
+ var insertImage = function() {
236
+ var url = urlInput.val();
237
+ urlInput.val(initialValue);
238
+ self.editor.currentView.element.focus();
239
+ if (caretBookmark) {
240
+ self.editor.composer.selection.setBookmark(caretBookmark);
241
+ caretBookmark = null;
242
+ }
243
+ self.editor.composer.commands.exec("insertImage", url);
244
+ };
245
+
246
+ urlInput.keypress(function(e) {
247
+ if(e.which == 13) {
248
+ insertImage();
249
+ insertImageModal.modal('hide');
250
+ }
251
+ });
252
+
253
+ insertButton.click(insertImage);
254
+
255
+ insertImageModal.on('shown', function() {
256
+ urlInput.focus();
257
+ });
258
+
259
+ insertImageModal.on('hide', function() {
260
+ self.editor.currentView.element.focus();
261
+ });
262
+
263
+ toolbar.find('a[data-wysihtml5-command=insertImage]').click(function() {
264
+ var activeButton = $(this).hasClass("wysihtml5-command-active");
265
+
266
+ if (!activeButton) {
267
+ self.editor.currentView.element.focus(false);
268
+ caretBookmark = self.editor.composer.selection.getBookmark();
269
+ insertImageModal.appendTo('body').modal('show');
270
+ insertImageModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
271
+ e.stopPropagation();
272
+ });
273
+ return false;
274
+ }
275
+ else {
276
+ return true;
277
+ }
278
+ });
279
+ },
280
+
281
+ initInsertLink: function(toolbar) {
282
+ var self = this;
283
+ var insertLinkModal = toolbar.find('.bootstrap-wysihtml5-insert-link-modal');
284
+ var urlInput = insertLinkModal.find('.bootstrap-wysihtml5-insert-link-url');
285
+ var insertButton = insertLinkModal.find('a.btn-primary');
286
+ var initialValue = urlInput.val();
287
+ var caretBookmark;
288
+
289
+ var insertLink = function() {
290
+ var url = urlInput.val();
291
+ urlInput.val(initialValue);
292
+ self.editor.currentView.element.focus();
293
+ if (caretBookmark) {
294
+ self.editor.composer.selection.setBookmark(caretBookmark);
295
+ caretBookmark = null;
296
+ }
297
+ self.editor.composer.commands.exec("createLink", {
298
+ href: url,
299
+ target: "_blank",
300
+ rel: "nofollow"
301
+ });
302
+ };
303
+ var pressedEnter = false;
304
+
305
+ urlInput.keypress(function(e) {
306
+ if(e.which == 13) {
307
+ insertLink();
308
+ insertLinkModal.modal('hide');
309
+ }
310
+ });
311
+
312
+ insertButton.click(insertLink);
313
+
314
+ insertLinkModal.on('shown', function() {
315
+ urlInput.focus();
316
+ });
317
+
318
+ insertLinkModal.on('hide', function() {
319
+ self.editor.currentView.element.focus();
320
+ });
321
+
322
+ toolbar.find('a[data-wysihtml5-command=createLink]').click(function() {
323
+ var activeButton = $(this).hasClass("wysihtml5-command-active");
324
+
325
+ if (!activeButton) {
326
+ self.editor.currentView.element.focus(false);
327
+ caretBookmark = self.editor.composer.selection.getBookmark();
328
+ insertLinkModal.appendTo('body').modal('show');
329
+ insertLinkModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
330
+ e.stopPropagation();
331
+ });
332
+ return false;
333
+ }
334
+ else {
335
+ return true;
336
+ }
337
+ });
338
+ }
339
+ };
340
+
341
+ // these define our public api
342
+ var methods = {
343
+ resetDefaults: function() {
344
+ $.fn.wysihtml5.defaultOptions = $.extend(true, {}, $.fn.wysihtml5.defaultOptionsCache);
345
+ },
346
+ bypassDefaults: function(options) {
347
+ return this.each(function () {
348
+ var $this = $(this);
349
+ $this.data('wysihtml5', new Wysihtml5($this, options));
350
+ });
351
+ },
352
+ shallowExtend: function (options) {
353
+ var settings = $.extend({}, $.fn.wysihtml5.defaultOptions, options || {});
354
+ var that = this;
355
+ return methods.bypassDefaults.apply(that, [settings]);
356
+ },
357
+ deepExtend: function(options) {
358
+ var settings = $.extend(true, {}, $.fn.wysihtml5.defaultOptions, options || {});
359
+ var that = this;
360
+ return methods.bypassDefaults.apply(that, [settings]);
361
+ },
362
+ init: function(options) {
363
+ var that = this;
364
+ return methods.shallowExtend.apply(that, [options]);
365
+ }
366
+ };
367
+
368
+ $.fn.wysihtml5 = function ( method ) {
369
+ if ( methods[method] ) {
370
+ return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
371
+ } else if ( typeof method === 'object' || ! method ) {
372
+ return methods.init.apply( this, arguments );
373
+ } else {
374
+ $.error( 'Method ' + method + ' does not exist on jQuery.wysihtml5' );
375
+ }
376
+ };
377
+
378
+ $.fn.wysihtml5.Constructor = Wysihtml5;
379
+
380
+ var defaultOptions = $.fn.wysihtml5.defaultOptions = {
381
+ "font-styles": true,
382
+ "color": false,
383
+ "emphasis": true,
384
+ "lists": true,
385
+ "html": false,
386
+ "link": true,
387
+ "image": true,
388
+ events: {},
389
+ parserRules: {
390
+ classes: {
391
+ // (path_to_project/lib/css/wysiwyg-color.css)
392
+ "wysiwyg-color-silver" : 1,
393
+ "wysiwyg-color-gray" : 1,
394
+ "wysiwyg-color-white" : 1,
395
+ "wysiwyg-color-maroon" : 1,
396
+ "wysiwyg-color-red" : 1,
397
+ "wysiwyg-color-purple" : 1,
398
+ "wysiwyg-color-fuchsia" : 1,
399
+ "wysiwyg-color-green" : 1,
400
+ "wysiwyg-color-lime" : 1,
401
+ "wysiwyg-color-olive" : 1,
402
+ "wysiwyg-color-yellow" : 1,
403
+ "wysiwyg-color-navy" : 1,
404
+ "wysiwyg-color-blue" : 1,
405
+ "wysiwyg-color-teal" : 1,
406
+ "wysiwyg-color-aqua" : 1,
407
+ "wysiwyg-color-orange" : 1
408
+ },
409
+ tags: {
410
+ "b": {},
411
+ "i": {},
412
+ "br": {},
413
+ "ol": {},
414
+ "ul": {},
415
+ "li": {},
416
+ "h1": {},
417
+ "h2": {},
418
+ "h3": {},
419
+ "blockquote": {},
420
+ "u": 1,
421
+ "img": {
422
+ "check_attributes": {
423
+ "width": "numbers",
424
+ "alt": "alt",
425
+ "src": "url",
426
+ "height": "numbers"
427
+ }
428
+ },
429
+ "a": {
430
+ set_attributes: {
431
+ target: "_blank",
432
+ rel: "nofollow"
433
+ },
434
+ check_attributes: {
435
+ href: "url" // important to avoid XSS
436
+ }
437
+ },
438
+ "span": 1,
439
+ "div": 1,
440
+ // to allow save and edit files with code tag hacks
441
+ "code": 1,
442
+ "pre": 1
443
+ }
444
+ },
445
+ stylesheets: ["./lib/css/wysiwyg-color.css"], // (path_to_project/lib/css/wysiwyg-color.css)
446
+ locale: "en"
447
+ };
448
+
449
+ if (typeof $.fn.wysihtml5.defaultOptionsCache === 'undefined') {
450
+ $.fn.wysihtml5.defaultOptionsCache = $.extend(true, {}, $.fn.wysihtml5.defaultOptions);
451
+ }
452
+
453
+ var locale = $.fn.wysihtml5.locale = {
454
+ en: {
455
+ font_styles: {
456
+ normal: "Normal text",
457
+ h1: "Heading 1",
458
+ h2: "Heading 2",
459
+ h3: "Heading 3"
460
+ },
461
+ emphasis: {
462
+ bold: "Bold",
463
+ italic: "Italic",
464
+ underline: "Underline"
465
+ },
466
+ lists: {
467
+ unordered: "Unordered list",
468
+ ordered: "Ordered list",
469
+ outdent: "Outdent",
470
+ indent: "Indent"
471
+ },
472
+ link: {
473
+ insert: "Insert link",
474
+ cancel: "Cancel"
475
+ },
476
+ image: {
477
+ insert: "Insert image",
478
+ cancel: "Cancel"
479
+ },
480
+ html: {
481
+ edit: "Edit HTML"
482
+ },
483
+ colours: {
484
+ black: "Black",
485
+ silver: "Silver",
486
+ gray: "Grey",
487
+ maroon: "Maroon",
488
+ red: "Red",
489
+ purple: "Purple",
490
+ green: "Green",
491
+ olive: "Olive",
492
+ navy: "Navy",
493
+ blue: "Blue",
494
+ orange: "Orange"
495
+ }
496
+ }
497
+ };
498
+
499
+ }(window.jQuery, window.wysihtml5);