x-editable-rails 1.2.2 → 1.3.0

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.
@@ -0,0 +1,127 @@
1
+ /**
2
+ Bootstrap wysihtml5 editor. Based on [bootstrap-wysihtml5](https://github.com/jhollingworth/bootstrap-wysihtml5).
3
+ You should include **manually** distributives of `wysihtml5` and `bootstrap-wysihtml5`:
4
+
5
+ <link href="js/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.css" rel="stylesheet" type="text/css"></link>
6
+ <script src="js/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/wysihtml5-0.3.0.min.js"></script>
7
+ <script src="js/inputs-ext/wysihtml5/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.min.js"></script>
8
+
9
+ And also include `wysihtml5.js` from `inputs-ext` directory of x-editable:
10
+
11
+ <script src="js/inputs-ext/wysihtml5/wysihtml5.js"></script>
12
+
13
+ **Note:** It's better to use fresh bootstrap-wysihtml5 from it's [master branch](https://github.com/jhollingworth/bootstrap-wysihtml5/tree/master/src) as there is update for correct image insertion.
14
+
15
+ @class wysihtml5
16
+ @extends abstractinput
17
+ @final
18
+ @since 1.4.0
19
+ @example
20
+ <div id="comments" data-type="wysihtml5" data-pk="1"><h2>awesome</h2> comment!</div>
21
+ <script>
22
+ $(function(){
23
+ $('#comments').editable({
24
+ url: '/post',
25
+ title: 'Enter comments'
26
+ });
27
+ });
28
+ </script>
29
+ **/
30
+ (function ($) {
31
+ "use strict";
32
+
33
+ var Wysihtml5 = function (options) {
34
+ this.init('wysihtml5', options, Wysihtml5.defaults);
35
+
36
+ //extend wysihtml5 manually as $.extend not recursive
37
+ this.options.wysihtml5 = $.extend({}, Wysihtml5.defaults.wysihtml5, options.wysihtml5);
38
+ };
39
+
40
+ $.fn.editableutils.inherit(Wysihtml5, $.fn.editabletypes.abstractinput);
41
+
42
+ $.extend(Wysihtml5.prototype, {
43
+ render: function () {
44
+ var deferred = $.Deferred(),
45
+ msieOld;
46
+
47
+ //generate unique id as it required for wysihtml5
48
+ this.$input.attr('id', 'textarea_'+(new Date()).getTime());
49
+
50
+ this.setClass();
51
+ this.setAttr('placeholder');
52
+
53
+ //resolve deffered when widget loaded
54
+ $.extend(this.options.wysihtml5, {
55
+ events: {
56
+ load: function() {
57
+ deferred.resolve();
58
+ }
59
+ }
60
+ });
61
+
62
+ this.$input.wysihtml5(this.options.wysihtml5);
63
+
64
+ /*
65
+ In IE8 wysihtml5 iframe stays on the same line with buttons toolbar (inside popover).
66
+ The only solution I found is to add <br>. If you fine better way, please send PR.
67
+ */
68
+ msieOld = /msie\s*(8|7|6)/.test(navigator.userAgent.toLowerCase());
69
+ if(msieOld) {
70
+ this.$input.before('<br><br>');
71
+ }
72
+
73
+ return deferred.promise();
74
+ },
75
+
76
+ value2html: function(value, element) {
77
+ $(element).html(value);
78
+ },
79
+
80
+ html2value: function(html) {
81
+ return html;
82
+ },
83
+
84
+ value2input: function(value) {
85
+ this.$input.data("wysihtml5").editor.setValue(value, true);
86
+ },
87
+
88
+ activate: function() {
89
+ this.$input.data("wysihtml5").editor.focus();
90
+ }
91
+ });
92
+
93
+ Wysihtml5.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
94
+ /**
95
+ @property tpl
96
+ @default <textarea></textarea>
97
+ **/
98
+ tpl:'<textarea></textarea>',
99
+ /**
100
+ @property inputclass
101
+ @default editable-wysihtml5
102
+ **/
103
+ inputclass: 'editable-wysihtml5',
104
+ /**
105
+ Placeholder attribute of input. Shown when input is empty.
106
+
107
+ @property placeholder
108
+ @type string
109
+ @default null
110
+ **/
111
+ placeholder: null,
112
+ /**
113
+ Wysihtml5 default options.
114
+ See https://github.com/jhollingworth/bootstrap-wysihtml5#options
115
+
116
+ @property wysihtml5
117
+ @type object
118
+ @default {stylesheets: false}
119
+ **/
120
+ wysihtml5: {
121
+ stylesheets: false //see https://github.com/jhollingworth/bootstrap-wysihtml5/issues/183
122
+ }
123
+ });
124
+
125
+ $.fn.editabletypes.wysihtml5 = Wysihtml5;
126
+
127
+ }(window.jQuery));
@@ -0,0 +1,9 @@
1
+ .editable-address {
2
+ display: block;
3
+ margin-bottom: 5px;
4
+ }
5
+
6
+ .editable-address span {
7
+ width: 70px;
8
+ display: inline-block;
9
+ }
@@ -0,0 +1,102 @@
1
+ ul.wysihtml5-toolbar {
2
+ margin: 0;
3
+ padding: 0;
4
+ display: block;
5
+ }
6
+
7
+ ul.wysihtml5-toolbar::after {
8
+ clear: both;
9
+ display: table;
10
+ content: "";
11
+ }
12
+
13
+ ul.wysihtml5-toolbar > li {
14
+ float: left;
15
+ display: list-item;
16
+ list-style: none;
17
+ margin: 0 5px 10px 0;
18
+ }
19
+
20
+ ul.wysihtml5-toolbar a[data-wysihtml5-command=bold] {
21
+ font-weight: bold;
22
+ }
23
+
24
+ ul.wysihtml5-toolbar a[data-wysihtml5-command=italic] {
25
+ font-style: italic;
26
+ }
27
+
28
+ ul.wysihtml5-toolbar a[data-wysihtml5-command=underline] {
29
+ text-decoration: underline;
30
+ }
31
+
32
+ ul.wysihtml5-toolbar a.btn.wysihtml5-command-active {
33
+ background-image: none;
34
+ -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
35
+ -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
36
+ box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
37
+ background-color: #E6E6E6;
38
+ background-color: #D9D9D9;
39
+ outline: 0;
40
+ }
41
+
42
+ ul.wysihtml5-commands-disabled .dropdown-menu {
43
+ display: none !important;
44
+ }
45
+
46
+ ul.wysihtml5-toolbar div.wysihtml5-colors {
47
+ display:block;
48
+ width: 50px;
49
+ height: 20px;
50
+ margin-top: 2px;
51
+ margin-left: 5px;
52
+ position: absolute;
53
+ pointer-events: none;
54
+ }
55
+
56
+ ul.wysihtml5-toolbar a.wysihtml5-colors-title {
57
+ padding-left: 70px;
58
+ }
59
+
60
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="black"] {
61
+ background: black !important;
62
+ }
63
+
64
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="silver"] {
65
+ background: silver !important;
66
+ }
67
+
68
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="gray"] {
69
+ background: gray !important;
70
+ }
71
+
72
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="maroon"] {
73
+ background: maroon !important;
74
+ }
75
+
76
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="red"] {
77
+ background: red !important;
78
+ }
79
+
80
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="purple"] {
81
+ background: purple !important;
82
+ }
83
+
84
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="green"] {
85
+ background: green !important;
86
+ }
87
+
88
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="olive"] {
89
+ background: olive !important;
90
+ }
91
+
92
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="navy"] {
93
+ background: navy !important;
94
+ }
95
+
96
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="blue"] {
97
+ background: blue !important;
98
+ }
99
+
100
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="orange"] {
101
+ background: orange !important;
102
+ }
@@ -0,0 +1,67 @@
1
+ .wysiwyg-color-black {
2
+ color: black;
3
+ }
4
+
5
+ .wysiwyg-color-silver {
6
+ color: silver;
7
+ }
8
+
9
+ .wysiwyg-color-gray {
10
+ color: gray;
11
+ }
12
+
13
+ .wysiwyg-color-white {
14
+ color: white;
15
+ }
16
+
17
+ .wysiwyg-color-maroon {
18
+ color: maroon;
19
+ }
20
+
21
+ .wysiwyg-color-red {
22
+ color: red;
23
+ }
24
+
25
+ .wysiwyg-color-purple {
26
+ color: purple;
27
+ }
28
+
29
+ .wysiwyg-color-fuchsia {
30
+ color: fuchsia;
31
+ }
32
+
33
+ .wysiwyg-color-green {
34
+ color: green;
35
+ }
36
+
37
+ .wysiwyg-color-lime {
38
+ color: lime;
39
+ }
40
+
41
+ .wysiwyg-color-olive {
42
+ color: olive;
43
+ }
44
+
45
+ .wysiwyg-color-yellow {
46
+ color: yellow;
47
+ }
48
+
49
+ .wysiwyg-color-navy {
50
+ color: navy;
51
+ }
52
+
53
+ .wysiwyg-color-blue {
54
+ color: blue;
55
+ }
56
+
57
+ .wysiwyg-color-teal {
58
+ color: teal;
59
+ }
60
+
61
+ .wysiwyg-color-aqua {
62
+ color: aqua;
63
+ }
64
+
65
+ .wysiwyg-color-orange {
66
+ color: orange;
67
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: x-editable-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jiri Kolarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-19 00:00:00.000000000 Z
11
+ date: 2013-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -65,10 +65,17 @@ files:
65
65
  - vendor/assets/images/editable/clear.png
66
66
  - vendor/assets/images/editable/loading.gif
67
67
  - vendor/assets/javascripts/editable/bootstrap-editable.js
68
+ - vendor/assets/javascripts/editable/inputs-ext/address.js
69
+ - vendor/assets/javascripts/editable/inputs-ext/bootstrap-wysihtml5/bootstrap-wysihtml5.js
70
+ - vendor/assets/javascripts/editable/inputs-ext/bootstrap-wysihtml5/wysihtml5.js
71
+ - vendor/assets/javascripts/editable/inputs-ext/wysihtml5.js
68
72
  - vendor/assets/javascripts/editable/jquery-editable-poshytip.js
69
73
  - vendor/assets/javascripts/editable/jqueryui-editable.js
70
74
  - vendor/assets/javascripts/editable/rails.js.coffee
71
75
  - vendor/assets/stylesheets/editable/bootstrap-editable.scss
76
+ - vendor/assets/stylesheets/editable/inputs-ext/address.css
77
+ - vendor/assets/stylesheets/editable/inputs-ext/bootstrap-wysihtml5.css
78
+ - vendor/assets/stylesheets/editable/inputs-ext/wysiwyg-color.css
72
79
  - vendor/assets/stylesheets/editable/jquery-editable.scss
73
80
  - vendor/assets/stylesheets/editable/jqueryui-editable.scss
74
81
  - LICENSE.txt