simditoredit-rails 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +2 -0
- data/lib/simditor/rails/engine.rb +9 -0
- data/lib/simditor/rails/version.rb +5 -0
- data/lib/simditor/rails.rb +8 -0
- data/simditoredit-rails.gemspec +21 -0
- data/vendor/assets/images/loading-upload.gif +0 -0
- data/vendor/assets/javascripts/simditor/module.js +151 -0
- data/vendor/assets/javascripts/simditor/simditor.coffee +3649 -0
- data/vendor/assets/javascripts/simditor/uploader.js +287 -0
- data/vendor/assets/javascripts/simditor.js +3 -0
- data/vendor/assets/stylesheets/simditor.scss +3 -0
- data/vendor/assets/stylesheets/simditors/font-awesome.css.scss.erb +1567 -0
- data/vendor/assets/stylesheets/simditors/simditor.scss +675 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fa3a0da87dc1e4f9b5c819ea8a44b2e101d20eb5
|
4
|
+
data.tar.gz: f4904b3d179e9669adcbb59b95bfb1946ede332e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9b0f2aa969dfa5057ef21de8418eddd1a168f59b4256dc4bcbdd2170513b228394a1842b848beb1545319e2c2cee3b827fc463f8d9b392628fbfe33a0557eb22
|
7
|
+
data.tar.gz: 7a584fe30eec0182f593779a78135188c48b5b365ff6b50a9d9934b4d96b58a15b6c3a2495df8176d30525409fe307e6581bf0a224830e666bb7bb15cae0830b
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Tony Keng
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Simditor::Rails
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
in application.js
|
10
|
+
```js
|
11
|
+
//= require simditor
|
12
|
+
```
|
13
|
+
|
14
|
+
in application.css
|
15
|
+
```css
|
16
|
+
*= require simditor
|
17
|
+
```
|
18
|
+
|
19
|
+
init after dom load
|
20
|
+
```js
|
21
|
+
$ ->
|
22
|
+
editor = new Simditor(
|
23
|
+
textarea: $('.simditor')
|
24
|
+
upload: true
|
25
|
+
toolbar: ['bold', 'italic', 'underline', '|', 'ol', 'ul', 'blockquote', 'code', '|', 'link', 'image', '|', 'indent', 'outdent', '|', 'hr', 'table']
|
26
|
+
)
|
27
|
+
```
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
1. Fork it ( https://github.com/[my-github-username]/simditor-rails/fork )
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'simditor/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "simditoredit-rails"
|
8
|
+
spec.version = Simditor::Rails::VERSION
|
9
|
+
spec.authors = ["Tony Keng"]
|
10
|
+
spec.email = ["tony.keng@aliyun.com"]
|
11
|
+
spec.summary = "A simple editor designed by mycolorway http://mycolorway.github.io/simditor/demo.html"
|
12
|
+
spec.description = "Rails assets wrapper for https://github.com/mycolorway/simditor"
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0")
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
20
|
+
spec.add_development_dependency "rake"
|
21
|
+
end
|
Binary file
|
@@ -0,0 +1,151 @@
|
|
1
|
+
(function() {
|
2
|
+
var Module, Plugin, Widget,
|
3
|
+
__slice = [].slice,
|
4
|
+
__hasProp = {}.hasOwnProperty,
|
5
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
6
|
+
|
7
|
+
Module = (function() {
|
8
|
+
function Module() {}
|
9
|
+
|
10
|
+
Module.extend = function(obj) {
|
11
|
+
var key, val, _ref;
|
12
|
+
if (!((obj != null) && typeof obj === 'object')) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
for (key in obj) {
|
16
|
+
val = obj[key];
|
17
|
+
if (key !== 'included' && key !== 'extended') {
|
18
|
+
this[key] = val;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
return (_ref = obj.extended) != null ? _ref.call(this) : void 0;
|
22
|
+
};
|
23
|
+
|
24
|
+
Module.include = function(obj) {
|
25
|
+
var key, val, _ref;
|
26
|
+
if (!((obj != null) && typeof obj === 'object')) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
for (key in obj) {
|
30
|
+
val = obj[key];
|
31
|
+
if (key !== 'included' && key !== 'extended') {
|
32
|
+
this.prototype[key] = val;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
return (_ref = obj.included) != null ? _ref.call(this) : void 0;
|
36
|
+
};
|
37
|
+
|
38
|
+
Module.prototype.on = function() {
|
39
|
+
var args, _ref;
|
40
|
+
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
41
|
+
return (_ref = $(this)).on.apply(_ref, args);
|
42
|
+
};
|
43
|
+
|
44
|
+
Module.prototype.one = function() {
|
45
|
+
var args, _ref;
|
46
|
+
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
47
|
+
return (_ref = $(this)).one.apply(_ref, args);
|
48
|
+
};
|
49
|
+
|
50
|
+
Module.prototype.off = function() {
|
51
|
+
var args, _ref;
|
52
|
+
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
53
|
+
return (_ref = $(this)).off.apply(_ref, args);
|
54
|
+
};
|
55
|
+
|
56
|
+
Module.prototype.trigger = function() {
|
57
|
+
var args, _ref;
|
58
|
+
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
59
|
+
return (_ref = $(this)).trigger.apply(_ref, args);
|
60
|
+
};
|
61
|
+
|
62
|
+
Module.prototype.triggerHandler = function() {
|
63
|
+
var args, _ref;
|
64
|
+
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
65
|
+
return (_ref = $(this)).triggerHandler.apply(_ref, args);
|
66
|
+
};
|
67
|
+
|
68
|
+
return Module;
|
69
|
+
|
70
|
+
})();
|
71
|
+
|
72
|
+
Widget = (function(_super) {
|
73
|
+
__extends(Widget, _super);
|
74
|
+
|
75
|
+
Widget.connect = function(cls) {
|
76
|
+
if (typeof cls !== 'function') {
|
77
|
+
return;
|
78
|
+
}
|
79
|
+
if (!cls.className) {
|
80
|
+
throw new Error('Widget.connect: lack of class property "className"');
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
if (!this._connectedClasses) {
|
84
|
+
this._connectedClasses = [];
|
85
|
+
}
|
86
|
+
this._connectedClasses.push(cls);
|
87
|
+
if (cls.className) {
|
88
|
+
return this[cls.className] = cls;
|
89
|
+
}
|
90
|
+
};
|
91
|
+
|
92
|
+
Widget.prototype._init = function() {};
|
93
|
+
|
94
|
+
Widget.prototype.opts = {};
|
95
|
+
|
96
|
+
function Widget(opts) {
|
97
|
+
var cls, instance, instances, name, _base, _i, _len;
|
98
|
+
this.opts = $.extend({}, this.opts, opts);
|
99
|
+
(_base = this.constructor)._connectedClasses || (_base._connectedClasses = []);
|
100
|
+
instances = (function() {
|
101
|
+
var _i, _len, _ref, _results;
|
102
|
+
_ref = this.constructor._connectedClasses;
|
103
|
+
_results = [];
|
104
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
105
|
+
cls = _ref[_i];
|
106
|
+
name = cls.className.charAt(0).toLowerCase() + cls.className.slice(1);
|
107
|
+
_results.push(this[name] = new cls(this));
|
108
|
+
}
|
109
|
+
return _results;
|
110
|
+
}).call(this);
|
111
|
+
this._init();
|
112
|
+
for (_i = 0, _len = instances.length; _i < _len; _i++) {
|
113
|
+
instance = instances[_i];
|
114
|
+
if (typeof instance._init === "function") {
|
115
|
+
instance._init();
|
116
|
+
}
|
117
|
+
}
|
118
|
+
this.trigger('pluginconnected');
|
119
|
+
}
|
120
|
+
|
121
|
+
Widget.prototype.destroy = function() {};
|
122
|
+
|
123
|
+
return Widget;
|
124
|
+
|
125
|
+
})(Module);
|
126
|
+
|
127
|
+
Plugin = (function(_super) {
|
128
|
+
__extends(Plugin, _super);
|
129
|
+
|
130
|
+
Plugin.className = 'Plugin';
|
131
|
+
|
132
|
+
Plugin.prototype.opts = {};
|
133
|
+
|
134
|
+
function Plugin(widget) {
|
135
|
+
this.widget = widget;
|
136
|
+
this.opts = $.extend({}, this.opts, this.widget.opts);
|
137
|
+
}
|
138
|
+
|
139
|
+
Plugin.prototype._init = function() {};
|
140
|
+
|
141
|
+
return Plugin;
|
142
|
+
|
143
|
+
})(Module);
|
144
|
+
|
145
|
+
window.Module = Module;
|
146
|
+
|
147
|
+
window.Widget = Widget;
|
148
|
+
|
149
|
+
window.Plugin = Plugin;
|
150
|
+
|
151
|
+
}).call(this);
|