forked from doabit/baidu_ueditor_rails
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d29b99b
Showing
235 changed files
with
21,853 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.bundle/ | ||
log/*.log | ||
pkg/ | ||
test/dummy/db/*.sqlite3 | ||
test/dummy/db/*.sqlite3-journal | ||
test/dummy/log/*.log | ||
test/dummy/tmp/ | ||
test/dummy/.sass-cache | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
source "https://rubygems.org" | ||
|
||
# Declare your gem's dependencies in baidu_ueditor_rails.gemspec. | ||
# Bundler will treat runtime dependencies like base dependencies, and | ||
# development dependencies will be added by default to the :development group. | ||
gemspec | ||
|
||
# Declare any dependencies that are still in development here instead of in | ||
# your gemspec. These might include edge Rails or gems from your path or | ||
# Git. Remember to move these dependencies to your gemspec before releasing | ||
# your gem to rubygems.org. | ||
|
||
# To use debugger | ||
# gem 'debugger' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
baidu_ueditor_rails (0.0.1) | ||
rails (~> 4.0.0.rc1) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
actionmailer (4.0.0.rc1) | ||
actionpack (= 4.0.0.rc1) | ||
mail (~> 2.5.3) | ||
actionpack (4.0.0.rc1) | ||
activesupport (= 4.0.0.rc1) | ||
builder (~> 3.1.0) | ||
erubis (~> 2.7.0) | ||
rack (~> 1.5.2) | ||
rack-test (~> 0.6.2) | ||
activemodel (4.0.0.rc1) | ||
activesupport (= 4.0.0.rc1) | ||
builder (~> 3.1.0) | ||
activerecord (4.0.0.rc1) | ||
activemodel (= 4.0.0.rc1) | ||
activerecord-deprecated_finders (~> 1.0.2) | ||
activesupport (= 4.0.0.rc1) | ||
arel (~> 4.0.0) | ||
activerecord-deprecated_finders (1.0.2) | ||
activesupport (4.0.0.rc1) | ||
i18n (~> 0.6, >= 0.6.4) | ||
minitest (~> 4.2) | ||
multi_json (~> 1.3) | ||
thread_safe (~> 0.1) | ||
tzinfo (~> 0.3.37) | ||
arel (4.0.0) | ||
atomic (1.1.9) | ||
builder (3.1.4) | ||
erubis (2.7.0) | ||
hike (1.2.2) | ||
i18n (0.6.4) | ||
mail (2.5.4) | ||
mime-types (~> 1.16) | ||
treetop (~> 1.4.8) | ||
mime-types (1.23) | ||
minitest (4.7.4) | ||
multi_json (1.7.3) | ||
polyglot (0.3.3) | ||
rack (1.5.2) | ||
rack-test (0.6.2) | ||
rack (>= 1.0) | ||
rails (4.0.0.rc1) | ||
actionmailer (= 4.0.0.rc1) | ||
actionpack (= 4.0.0.rc1) | ||
activerecord (= 4.0.0.rc1) | ||
activesupport (= 4.0.0.rc1) | ||
bundler (>= 1.3.0, < 2.0) | ||
railties (= 4.0.0.rc1) | ||
sprockets-rails (~> 2.0.0.rc4) | ||
railties (4.0.0.rc1) | ||
actionpack (= 4.0.0.rc1) | ||
activesupport (= 4.0.0.rc1) | ||
rake (>= 0.8.7) | ||
thor (>= 0.18.1, < 2.0) | ||
rake (10.0.4) | ||
sprockets (2.9.3) | ||
hike (~> 1.2) | ||
multi_json (~> 1.0) | ||
rack (~> 1.0) | ||
tilt (~> 1.1, != 1.3.0) | ||
sprockets-rails (2.0.0.rc4) | ||
actionpack (>= 3.0) | ||
activesupport (>= 3.0) | ||
sprockets (~> 2.8) | ||
sqlite3 (1.3.7) | ||
thor (0.18.1) | ||
thread_safe (0.1.0) | ||
atomic | ||
tilt (1.4.1) | ||
treetop (1.4.12) | ||
polyglot | ||
polyglot (>= 0.3.1) | ||
tzinfo (0.3.37) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
baidu_ueditor_rails! | ||
sqlite3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright 2013 Doabit | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Baidu ueditor for rails | ||
|
||
[baidu ueditor][1] for rails, precompile codes from [tinymce-rails][2] | ||
|
||
[1]: http://ueditor.baidu.com/website/ | ||
[2]: https://github.com/spohlenz/tinymce-rails | ||
|
||
### Notice: The project is unreleased. | ||
|
||
## Installation | ||
|
||
Add this line to your application's Gemfile: | ||
|
||
gem 'baidu_ueditor_rails', github: 'doabit/baidu_ueditor_rails' | ||
|
||
And then execute: | ||
|
||
$ bundle | ||
|
||
|
||
## Generating custom config js | ||
|
||
Usage: | ||
|
||
|
||
rails g baidu_ueditor_rails:install | ||
|
||
|
||
Then add codes in application.js | ||
|
||
|
||
```ruby | ||
//= require baidu_ueditor | ||
//= require ueditor_custom_config | ||
``` | ||
|
||
## Custom config | ||
|
||
In ueditor_custom_config.js, it looks like: | ||
|
||
```ruby | ||
//ueditor custom config | ||
(function () { | ||
window.CUSTOM_CONFIG = { | ||
// Insert your config code | ||
// toolbars: [ | ||
// ['Source','Undo','Redo','Cleardoc','SearchReplace','InsertImage','WordImage','Bold','ForeColor','JustifyLeft', | ||
// 'JustifyCenter','JustifyRight','JustifyJustify','RemoveFormat','FormatMatch','AutoTypeSet','PastePlain', | ||
// 'FontSize','Preview','Link','FullScreen', 'PageBreak', 'InsertTable','Attachment','InsertVideo'] | ||
// ] | ||
}; | ||
jQuery.extend(window.UEDITOR_CONFIG, window.CUSTOM_CONFIG); | ||
})(); | ||
``` | ||
|
||
you can write your custom config in | ||
|
||
```ruby | ||
window.CUSTOM_CONFIG = { | ||
//......... | ||
}; | ||
``` | ||
|
||
## Views | ||
|
||
```javascript | ||
<script type="text/javascript"> | ||
var editor = new UE.ui.Editor(); | ||
editor.render("your_textarea_id"); | ||
</script> | ||
``` | ||
|
||
## TODO | ||
|
||
1. Add upload image and file. | ||
2. Add form helpers. | ||
|
||
|
||
## Contributing | ||
|
||
1. Fork it | ||
2. Create your feature branch (`git checkout -b my-new-feature`) | ||
3. Commit your changes (`git commit -am 'Add some feature'`) | ||
4. Push to the branch (`git push origin my-new-feature`) | ||
5. Create new Pull Request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
begin | ||
require 'bundler/setup' | ||
rescue LoadError | ||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks' | ||
end | ||
|
||
require 'rdoc/task' | ||
|
||
RDoc::Task.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'BaiduUeditorRails' | ||
rdoc.options << '--line-numbers' | ||
rdoc.rdoc_files.include('README.rdoc') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end | ||
|
||
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__) | ||
load 'rails/tasks/engine.rake' | ||
|
||
|
||
|
||
Bundler::GemHelper.install_tasks | ||
|
||
require 'rake/testtask' | ||
|
||
Rake::TestTask.new(:test) do |t| | ||
t.libs << 'lib' | ||
t.libs << 'test' | ||
t.pattern = 'test/**/*_test.rb' | ||
t.verbose = false | ||
end | ||
|
||
|
||
task default: :test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// This is a manifest file that'll be compiled into application.js, which will include all the files | ||
// listed below. | ||
// | ||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | ||
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. | ||
// | ||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | ||
// compiled file. | ||
// | ||
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD | ||
// GO AFTER THE REQUIRES BELOW. | ||
// | ||
//= require ueditor/ueditor.all.min | ||
//= require ueditor/preinit | ||
//= require ueditor/ueditor.config | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(function () { | ||
window.UEDITOR_HOME_URL = '/assets/ueditor/' | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module BaiduUeditorRails | ||
module ApplicationHelper | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
$:.push File.expand_path("../lib", __FILE__) | ||
|
||
# Maintain your gem's version: | ||
require "baidu_ueditor_rails/version" | ||
|
||
# Describe your gem and declare its dependencies: | ||
Gem::Specification.new do |s| | ||
s.name = "baidu_ueditor_rails" | ||
s.version = BaiduUeditorRails::VERSION | ||
s.authors = ["doabit"] | ||
s.email = ["[email protected]"] | ||
s.homepage = "https://github.com/baidu_ueditor_rails" | ||
s.summary = "Baidu ueditor for rails." | ||
s.description = "Baidu ueditor for rails." | ||
|
||
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] | ||
s.test_files = Dir["test/**/*"] | ||
|
||
s.add_dependency "rails", ">=3.1.1" | ||
|
||
s.add_development_dependency "sqlite3" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env ruby | ||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. | ||
|
||
ENGINE_ROOT = File.expand_path('../..', __FILE__) | ||
ENGINE_PATH = File.expand_path('../../lib/baidu_ueditor_rails/engine', __FILE__) | ||
|
||
require 'rails/all' | ||
require 'rails/engine/commands' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module BaiduUeditorRails | ||
require "baidu_ueditor_rails/engine" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
require "baidu_ueditor_rails/asset_manifest" | ||
|
||
module BaiduUeditorRails | ||
class AssetInstaller | ||
ASSETS = Pathname.new(File.expand_path(File.dirname(__FILE__) + "/../../vendor/assets/javascripts/ueditor")) | ||
|
||
def initialize(target, manifest_path) | ||
@target = target | ||
@manifest_path = manifest_path || target | ||
end | ||
|
||
def install | ||
cleanup_assets | ||
copy_assets | ||
append_to_manifest | ||
|
||
manifest.write | ||
end | ||
|
||
private | ||
def manifest | ||
@manifest ||= AssetManifest.load(@manifest_path) | ||
end | ||
|
||
def cleanup_assets | ||
manifest.each(/^tinymce\//) do |asset| | ||
manifest.remove(asset) if index_asset?(asset) | ||
|
||
manifest.remove_digest(asset) do |src, dest| | ||
move_asset(src, dest) | ||
end | ||
end | ||
end | ||
|
||
def copy_assets | ||
FileUtils.cp_r(ASSETS, @target, :preserve => true) | ||
end | ||
|
||
def append_to_manifest | ||
asset_files.each do |file| | ||
manifest.append(logical_path(file), file) | ||
end | ||
end | ||
|
||
def asset_files | ||
Pathname.glob("#{ASSETS}/**/*").select(&:file?) | ||
end | ||
|
||
def logical_path(file) | ||
file.relative_path_from(ASSETS.parent).to_s | ||
end | ||
|
||
def move_asset(src, dest) | ||
src = File.join(@target, src) | ||
dest = File.join(@target, dest) | ||
|
||
FileUtils.mv(src, dest, :force => true) if src != dest && File.exists?(src) | ||
end | ||
|
||
def index_asset?(asset) | ||
asset =~ /\/index\.js$/ | ||
end | ||
end | ||
end |
Oops, something went wrong.