wysihtml-rails 0.5.5 → 0.6.0.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -6
  3. data/lib/wysihtml/rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/wysihtml.js +5944 -8553
  5. data/vendor/assets/javascripts/wysihtml/all_commands.js +23 -0
  6. data/vendor/assets/javascripts/wysihtml/extra_commands/alignCenterStyle.js +17 -0
  7. data/vendor/assets/javascripts/wysihtml/extra_commands/alignJustifyStyle.js +17 -0
  8. data/vendor/assets/javascripts/wysihtml/extra_commands/alignLeftStyle.js +17 -0
  9. data/vendor/assets/javascripts/wysihtml/extra_commands/alignRightStyle.js +17 -0
  10. data/vendor/assets/javascripts/wysihtml/extra_commands/bgColorStyle.js +48 -0
  11. data/vendor/assets/javascripts/wysihtml/extra_commands/bold.js +16 -0
  12. data/vendor/assets/javascripts/wysihtml/extra_commands/command_formatCode.js +52 -0
  13. data/vendor/assets/javascripts/wysihtml/extra_commands/command_insertImage.js +108 -0
  14. data/vendor/assets/javascripts/wysihtml/extra_commands/fontSize.js +13 -0
  15. data/vendor/assets/javascripts/wysihtml/extra_commands/fontSizeStyle.js +35 -0
  16. data/vendor/assets/javascripts/wysihtml/extra_commands/foreColor.js +13 -0
  17. data/vendor/assets/javascripts/wysihtml/extra_commands/foreColorStyle.js +52 -0
  18. data/vendor/assets/javascripts/wysihtml/extra_commands/insertBlockQuote.js +16 -0
  19. data/vendor/assets/javascripts/wysihtml/extra_commands/insertOrderedList.js +11 -0
  20. data/vendor/assets/javascripts/wysihtml/extra_commands/insertUnorderedList.js +11 -0
  21. data/vendor/assets/javascripts/wysihtml/extra_commands/italic.js +17 -0
  22. data/vendor/assets/javascripts/wysihtml/extra_commands/justifyCenter.js +18 -0
  23. data/vendor/assets/javascripts/wysihtml/extra_commands/justifyFull.js +17 -0
  24. data/vendor/assets/javascripts/wysihtml/extra_commands/justifyLeft.js +17 -0
  25. data/vendor/assets/javascripts/wysihtml/extra_commands/justifyRight.js +17 -0
  26. data/vendor/assets/javascripts/wysihtml/extra_commands/subscript.js +17 -0
  27. data/vendor/assets/javascripts/wysihtml/extra_commands/superscript.js +17 -0
  28. data/vendor/assets/javascripts/wysihtml/extra_commands/underline.js +17 -0
  29. data/vendor/assets/javascripts/{parser_rules → wysihtml/parser_rules}/advanced.js +4 -4
  30. data/vendor/assets/javascripts/{parser_rules → wysihtml/parser_rules}/advanced_and_extended.js +25 -25
  31. data/vendor/assets/javascripts/{parser_rules → wysihtml/parser_rules}/advanced_unwrap.js +5 -5
  32. data/vendor/assets/javascripts/{parser_rules → wysihtml/parser_rules}/simple.js +2 -2
  33. data/vendor/assets/javascripts/wysihtml/table_editing.js +1163 -0
  34. data/vendor/assets/javascripts/wysihtml/toolbar.js +850 -0
  35. metadata +35 -9
  36. data/vendor/assets/javascripts/wysihtml-toolbar.js +0 -19308
@@ -0,0 +1,16 @@
1
+ wysihtml.commands.insertBlockQuote = (function() {
2
+ var nodeOptions = {
3
+ nodeName: "BLOCKQUOTE",
4
+ toggle: true
5
+ };
6
+
7
+ return {
8
+ exec: function(composer, command) {
9
+ return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
10
+ },
11
+
12
+ state: function(composer, command) {
13
+ return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
14
+ }
15
+ };
16
+ })();
@@ -0,0 +1,11 @@
1
+ wysihtml.commands.insertOrderedList = (function() {
2
+ return {
3
+ exec: function(composer, command) {
4
+ wysihtml.commands.insertList.exec(composer, command, "OL");
5
+ },
6
+
7
+ state: function(composer, command) {
8
+ return wysihtml.commands.insertList.state(composer, command, "OL");
9
+ }
10
+ };
11
+ })();
@@ -0,0 +1,11 @@
1
+ wysihtml.commands.insertUnorderedList = (function() {
2
+ return {
3
+ exec: function(composer, command) {
4
+ wysihtml.commands.insertList.exec(composer, command, "UL");
5
+ },
6
+
7
+ state: function(composer, command) {
8
+ return wysihtml.commands.insertList.state(composer, command, "UL");
9
+ }
10
+ };
11
+ })();
@@ -0,0 +1,17 @@
1
+ wysihtml.commands.italic = (function() {
2
+ var nodeOptions = {
3
+ nodeName: "I",
4
+ toggle: true
5
+ };
6
+
7
+ return {
8
+ exec: function(composer, command) {
9
+ wysihtml.commands.formatInline.exec(composer, command, nodeOptions);
10
+ },
11
+
12
+ state: function(composer, command) {
13
+ return wysihtml.commands.formatInline.state(composer, command, nodeOptions);
14
+ }
15
+ };
16
+
17
+ })();
@@ -0,0 +1,18 @@
1
+ wysihtml.commands.justifyCenter = (function() {
2
+ var nodeOptions = {
3
+ className: "wysiwyg-text-align-center",
4
+ classRegExp: /wysiwyg-text-align-[0-9a-z]+/g,
5
+ toggle: true
6
+ };
7
+
8
+ return {
9
+ exec: function(composer, command) {
10
+ return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
11
+ },
12
+
13
+ state: function(composer, command) {
14
+ return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
15
+ }
16
+ };
17
+
18
+ })();
@@ -0,0 +1,17 @@
1
+ wysihtml.commands.justifyFull = (function() {
2
+ var nodeOptions = {
3
+ className: "wysiwyg-text-align-justify",
4
+ classRegExp: /wysiwyg-text-align-[0-9a-z]+/g,
5
+ toggle: true
6
+ };
7
+
8
+ return {
9
+ exec: function(composer, command) {
10
+ return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
11
+ },
12
+
13
+ state: function(composer, command) {
14
+ return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
15
+ }
16
+ };
17
+ })();
@@ -0,0 +1,17 @@
1
+ wysihtml.commands.justifyLeft = (function() {
2
+ var nodeOptions = {
3
+ className: "wysiwyg-text-align-left",
4
+ classRegExp: /wysiwyg-text-align-[0-9a-z]+/g,
5
+ toggle: true
6
+ };
7
+
8
+ return {
9
+ exec: function(composer, command) {
10
+ return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
11
+ },
12
+
13
+ state: function(composer, command) {
14
+ return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
15
+ }
16
+ };
17
+ })();
@@ -0,0 +1,17 @@
1
+ wysihtml.commands.justifyRight = (function() {
2
+ var nodeOptions = {
3
+ className: "wysiwyg-text-align-right",
4
+ classRegExp: /wysiwyg-text-align-[0-9a-z]+/g,
5
+ toggle: true
6
+ };
7
+
8
+ return {
9
+ exec: function(composer, command) {
10
+ return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
11
+ },
12
+
13
+ state: function(composer, command) {
14
+ return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
15
+ }
16
+ };
17
+ })();
@@ -0,0 +1,17 @@
1
+ wysihtml.commands.subscript = (function() {
2
+ var nodeOptions = {
3
+ nodeName: "SUB",
4
+ toggle: true
5
+ };
6
+
7
+ return {
8
+ exec: function(composer, command) {
9
+ wysihtml.commands.formatInline.exec(composer, command, nodeOptions);
10
+ },
11
+
12
+ state: function(composer, command) {
13
+ return wysihtml.commands.formatInline.state(composer, command, nodeOptions);
14
+ }
15
+ };
16
+
17
+ })();
@@ -0,0 +1,17 @@
1
+ wysihtml.commands.superscript = (function() {
2
+ var nodeOptions = {
3
+ nodeName: "SUP",
4
+ toggle: true
5
+ };
6
+
7
+ return {
8
+ exec: function(composer, command) {
9
+ wysihtml.commands.formatInline.exec(composer, command, nodeOptions);
10
+ },
11
+
12
+ state: function(composer, command) {
13
+ return wysihtml.commands.formatInline.state(composer, command, nodeOptions);
14
+ }
15
+ };
16
+
17
+ })();
@@ -0,0 +1,17 @@
1
+ wysihtml.commands.underline = (function() {
2
+ var nodeOptions = {
3
+ nodeName: "U",
4
+ toggle: true
5
+ };
6
+
7
+ return {
8
+ exec: function(composer, command) {
9
+ wysihtml.commands.formatInline.exec(composer, command, nodeOptions);
10
+ },
11
+
12
+ state: function(composer, command) {
13
+ return wysihtml.commands.formatInline.state(composer, command, nodeOptions);
14
+ }
15
+ };
16
+
17
+ })();
@@ -32,10 +32,10 @@
32
32
  * ... becomes ...
33
33
  * <div class="wysiwyg-text-align-center">hello</div>
34
34
  */
35
- var wysihtml5ParserRules = {
35
+ var wysihtmlParserRules = {
36
36
  /**
37
37
  * CSS Class white-list
38
- * Following CSS classes won't be removed when parsed by the wysihtml5 HTML parser
38
+ * Following CSS classes won't be removed when parsed by the wysihtml HTML parser
39
39
  */
40
40
  "classes": {
41
41
  "wysiwyg-clear-both": 1,
@@ -79,7 +79,7 @@ var wysihtml5ParserRules = {
79
79
  * The following options are available:
80
80
  *
81
81
  * - add_class: converts and deletes the given HTML4 attribute (align, clear, ...) via the given method to a css class
82
- * The following methods are implemented in wysihtml5.dom.parse:
82
+ * The following methods are implemented in wysihtml.dom.parse:
83
83
  * - align_text: converts align attribute values (right/left/center/justify) to their corresponding css class "wysiwyg-text-align-*")
84
84
  * <p align="center">foo</p> ... becomes ... <p class="wysiwyg-text-align-center">foo</p>
85
85
  * - clear_br: converts clear attribute values left/right/all/both to their corresponding css class "wysiwyg-clear-*"
@@ -87,7 +87,7 @@ var wysihtml5ParserRules = {
87
87
  * - align_img: converts align attribute values (right/left) on <img> to their corresponding css class "wysiwyg-float-*"
88
88
  *
89
89
  * - add_style: converts and deletes the given HTML4 attribute (align) via the given method to a css style
90
- * The following methods are implemented in wysihtml5.dom.parse:
90
+ * The following methods are implemented in wysihtml.dom.parse:
91
91
  * - align_text: converts align attribute values (right/left/center) to their corresponding css style)
92
92
  * <p align="center">foo</p> ... becomes ... <p style="text-align:center">foo</p>
93
93
  *
@@ -4,7 +4,7 @@
4
4
  * These rules define which tags and CSS classes are supported and which tags should be specially treated.
5
5
  */
6
6
 
7
- var wysihtml5ParserRulesDefaults = {
7
+ var wysihtmlParserRulesDefaults = {
8
8
  "blockLevelEl": {
9
9
  "keep_styles": {
10
10
  "textAlign": /^((left)|(right)|(center)|(justify))$/i,
@@ -37,10 +37,10 @@ var wysihtml5ParserRulesDefaults = {
37
37
  }
38
38
  };
39
39
 
40
- var wysihtml5ParserRules = {
40
+ var wysihtmlParserRules = {
41
41
  /**
42
42
  * CSS Class white-list
43
- * Following CSS classes won't be removed when parsed by the wysihtml5 HTML parser
43
+ * Following CSS classes won't be removed when parsed by the wysihtml HTML parser
44
44
  * If all classes should pass "any" as classes value. Ex: "classes": "any"
45
45
  */
46
46
  "classes": "any",
@@ -127,7 +127,7 @@ var wysihtml5ParserRules = {
127
127
  * The following options are available:
128
128
  *
129
129
  * - add_class: converts and deletes the given HTML4 attribute (align, clear, ...) via the given method to a css class
130
- * The following methods are implemented in wysihtml5.dom.parse:
130
+ * The following methods are implemented in wysihtml.dom.parse:
131
131
  * - align_text: converts align attribute values (right/left/center/justify) to their corresponding css class "wysiwyg-text-align-*")
132
132
  * <p align="center">foo</p> ... becomes ... <p> class="wysiwyg-text-align-center">foo</p>
133
133
  * - clear_br: converts clear attribute values left/right/all/both to their corresponding css class "wysiwyg-clear-*"
@@ -183,7 +183,7 @@ var wysihtml5ParserRules = {
183
183
  "details": {
184
184
  "unwrap": 1
185
185
  },
186
- "h4": wysihtml5ParserRulesDefaults.blockLevelEl,
186
+ "h4": wysihtmlParserRulesDefaults.blockLevelEl,
187
187
  "em": {},
188
188
  "title": {
189
189
  "remove": 1
@@ -266,7 +266,7 @@ var wysihtml5ParserRules = {
266
266
  "rb": {
267
267
  "unwrap": 1
268
268
  },
269
- "footer": wysihtml5ParserRulesDefaults.makeDiv,
269
+ "footer": wysihtmlParserRulesDefaults.makeDiv,
270
270
  "noframes": {
271
271
  "remove": 1
272
272
  },
@@ -287,11 +287,11 @@ var wysihtml5ParserRules = {
287
287
  "nav": {
288
288
  "unwrap": 1
289
289
  },
290
- "h1": wysihtml5ParserRulesDefaults.blockLevelEl,
290
+ "h1": wysihtmlParserRulesDefaults.blockLevelEl,
291
291
  "head": {
292
292
  "unwrap": 1
293
293
  },
294
- "tbody": wysihtml5ParserRulesDefaults.blockLevelEl,
294
+ "tbody": wysihtmlParserRulesDefaults.blockLevelEl,
295
295
  "dd": {
296
296
  "unwrap": 1
297
297
  },
@@ -384,7 +384,7 @@ var wysihtml5ParserRules = {
384
384
  "keygen": {
385
385
  "remove": 1
386
386
  },
387
- "h5": wysihtml5ParserRulesDefaults.blockLevelEl,
387
+ "h5": wysihtmlParserRulesDefaults.blockLevelEl,
388
388
  "meta": {
389
389
  "remove": 1
390
390
  },
@@ -397,8 +397,8 @@ var wysihtml5ParserRules = {
397
397
  "mark": {
398
398
  "unwrap": 1
399
399
  },
400
- "caption": wysihtml5ParserRulesDefaults.blockLevelEl,
401
- "tfoot": wysihtml5ParserRulesDefaults.blockLevelEl,
400
+ "caption": wysihtmlParserRulesDefaults.blockLevelEl,
401
+ "tfoot": wysihtmlParserRulesDefaults.blockLevelEl,
402
402
  "base": {
403
403
  "remove": 1
404
404
  },
@@ -450,11 +450,11 @@ var wysihtml5ParserRules = {
450
450
  "source": {
451
451
  "remove": 1
452
452
  },
453
- "aside": wysihtml5ParserRulesDefaults.makeDiv,
453
+ "aside": wysihtmlParserRulesDefaults.makeDiv,
454
454
  "frame": {
455
455
  "remove": 1
456
456
  },
457
- "section": wysihtml5ParserRulesDefaults.makeDiv,
457
+ "section": wysihtmlParserRulesDefaults.makeDiv,
458
458
  "body": {
459
459
  "unwrap": 1
460
460
  },
@@ -500,7 +500,7 @@ var wysihtml5ParserRules = {
500
500
  "meter": {
501
501
  "unwrap": 1
502
502
  },
503
- "h3": wysihtml5ParserRulesDefaults.blockLevelEl,
503
+ "h3": wysihtmlParserRulesDefaults.blockLevelEl,
504
504
  "textarea": {
505
505
  "unwrap": 1
506
506
  },
@@ -539,7 +539,7 @@ var wysihtml5ParserRules = {
539
539
  "xml": {
540
540
  "remove": 1
541
541
  },
542
- "h6": wysihtml5ParserRulesDefaults.blockLevelEl,
542
+ "h6": wysihtmlParserRulesDefaults.blockLevelEl,
543
543
  "param": {
544
544
  "remove": 1
545
545
  },
@@ -583,7 +583,7 @@ var wysihtml5ParserRules = {
583
583
  "remove": 1
584
584
  },
585
585
  "pre": {},
586
- "center": wysihtml5ParserRulesDefaults.makeDiv,
586
+ "center": wysihtmlParserRulesDefaults.makeDiv,
587
587
  "audio": {
588
588
  "remove": 1
589
589
  },
@@ -596,7 +596,7 @@ var wysihtml5ParserRules = {
596
596
  "col": {
597
597
  "remove": 1
598
598
  },
599
- "article": wysihtml5ParserRulesDefaults.makeDiv,
599
+ "article": wysihtmlParserRulesDefaults.makeDiv,
600
600
  "cite": {},
601
601
  "link": {
602
602
  "remove": 1
@@ -620,11 +620,11 @@ var wysihtml5ParserRules = {
620
620
  "ruby": {
621
621
  "unwrap": 1
622
622
  },
623
- "h2": wysihtml5ParserRulesDefaults.blockLevelEl,
623
+ "h2": wysihtmlParserRulesDefaults.blockLevelEl,
624
624
  "ins": {
625
625
  "unwrap": 1
626
626
  },
627
- "p": wysihtml5ParserRulesDefaults.blockLevelEl,
627
+ "p": wysihtmlParserRulesDefaults.blockLevelEl,
628
628
  "sub": {},
629
629
  "comment": {
630
630
  "remove": 1
@@ -635,14 +635,14 @@ var wysihtml5ParserRules = {
635
635
  "optgroup": {
636
636
  "unwrap": 1
637
637
  },
638
- "header": wysihtml5ParserRulesDefaults.makeDiv
638
+ "header": wysihtmlParserRulesDefaults.makeDiv
639
639
  }
640
640
  };
641
641
 
642
642
 
643
643
  (function() {
644
644
  // Paste cleanup rules universal for all rules (also applied to content copied from editor)
645
- var commonRules = wysihtml5.lang.object(wysihtml5ParserRules).clone(true);
645
+ var commonRules = wysihtml.lang.object(wysihtmlParserRules).clone(true);
646
646
  commonRules.comments = false;
647
647
  commonRules.selectors = { "a u": "unwrap"};
648
648
  commonRules.tags.style = { "remove": 1 };
@@ -650,7 +650,7 @@ var wysihtml5ParserRules = {
650
650
  commonRules.tags.head = { "remove": 1 };
651
651
 
652
652
  // Paste cleanup for unindentified source
653
- var universalRules = wysihtml5.lang.object(commonRules).clone(true);
653
+ var universalRules = wysihtml.lang.object(commonRules).clone(true);
654
654
  universalRules.tags.div.one_of_type.alignment_object = 1;
655
655
  universalRules.tags.div.remove_action = "unwrap";
656
656
  universalRules.tags.div.check_attributes.style = false;
@@ -662,15 +662,15 @@ var wysihtml5ParserRules = {
662
662
 
663
663
  // Paste cleanup for MS Office
664
664
  // TODO: should be extended to stricter ruleset, as current set will probably not cover all Office bizarreness
665
- var msOfficeRules = wysihtml5.lang.object(universalRules).clone(true);
665
+ var msOfficeRules = wysihtml.lang.object(universalRules).clone(true);
666
666
  msOfficeRules.classes = {};
667
667
 
668
- window.wysihtml5ParserPasteRulesets = [
668
+ window.wysihtmlParserPasteRulesets = [
669
669
  {
670
670
  condition: /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument|class="OutlineElement|id="?docs\-internal\-guid\-/i,
671
671
  set: msOfficeRules
672
672
  },{
673
- condition: /<meta name="copied-from" content="wysihtml5">/i,
673
+ condition: /<meta name="copied-from" content="wysihtml">/i,
674
674
  set: commonRules
675
675
  },{
676
676
  set: universalRules
@@ -32,10 +32,10 @@
32
32
  * ... becomes ...
33
33
  * <div class="wysiwyg-text-align-center">hello</div>
34
34
  */
35
- var wysihtml5ParserRules = {
35
+ var wysihtmlParserRules = {
36
36
  /**
37
37
  * CSS Class white-list
38
- * Following CSS classes won't be removed when parsed by the wysihtml5 HTML parser
38
+ * Following CSS classes won't be removed when parsed by the wysihtml HTML parser
39
39
  * If all classes should pass "any" as classes value. Ex: "classes": "any"
40
40
  */
41
41
  "classes": {
@@ -157,7 +157,7 @@ var wysihtml5ParserRules = {
157
157
  * The following options are available:
158
158
  *
159
159
  * - add_class: converts and deletes the given HTML4 attribute (align, clear, ...) via the given method to a css class
160
- * The following methods are implemented in wysihtml5.dom.parse:
160
+ * The following methods are implemented in wysihtml.dom.parse:
161
161
  * - align_text: converts align attribute values (right/left/center/justify) to their corresponding css class "wysiwyg-text-align-*")
162
162
  * <p align="center">foo</p> ... becomes ... <p class="wysiwyg-text-align-center">foo</p>
163
163
  * - clear_br: converts clear attribute values left/right/all/both to their corresponding css class "wysiwyg-clear-*"
@@ -165,7 +165,7 @@ var wysihtml5ParserRules = {
165
165
  * - align_img: converts align attribute values (right/left) on <img> to their corresponding css class "wysiwyg-float-*"
166
166
  *
167
167
  * - add_style: converts and deletes the given HTML4 attribute (align) via the given method to a css style
168
- * The following methods are implemented in wysihtml5.dom.parse:
168
+ * The following methods are implemented in wysihtml.dom.parse:
169
169
  * - align_text: converts align attribute values (right/left/center) to their corresponding css style)
170
170
  * <p align="center">foo</p> ... becomes ... <p style="text-align:center">foo</p>
171
171
  *
@@ -660,4 +660,4 @@ var wysihtml5ParserRules = {
660
660
  "rename_tag": "div"
661
661
  }
662
662
  }
663
- };
663
+ };
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * For a proper documentation of the format check advanced.js
8
8
  */
9
- var wysihtml5ParserRules = {
9
+ var wysihtmlParserRules = {
10
10
  tags: {
11
11
  strong: {},
12
12
  b: {},
@@ -29,4 +29,4 @@ var wysihtml5ParserRules = {
29
29
  }
30
30
  }
31
31
  }
32
- };
32
+ };