├── .gitignore ├── lib ├── simditor │ ├── version.rb │ └── engine.rb └── simditor.rb ├── vendor └── assets │ ├── stylesheets │ ├── simditor.scss │ └── simditor │ │ ├── fonticon.scss │ │ └── editor.scss │ ├── images │ └── upload-loading.png │ └── javascripts │ ├── simditor.js │ └── simditor │ ├── module.js │ ├── hotkeys.js │ └── uploader.js ├── bower.json ├── package.json ├── simditor.gemspec ├── README.md ├── LICENSE └── Gruntfile.js /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | bower_components 3 | node_modules 4 | -------------------------------------------------------------------------------- /lib/simditor/version.rb: -------------------------------------------------------------------------------- 1 | module Simditor 2 | module Version 3 | EDITOR = "2.3.6" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /lib/simditor.rb: -------------------------------------------------------------------------------- 1 | require "simditor/version" 2 | require 'simditor/engine' 3 | 4 | module Simditor 5 | end 6 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/simditor.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | @import 'simditor/fonticon'; 4 | @import 'simditor/editor'; 5 | -------------------------------------------------------------------------------- /vendor/assets/images/upload-loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wentaoliu/simditor-rails/HEAD/vendor/assets/images/upload-loading.png -------------------------------------------------------------------------------- /vendor/assets/javascripts/simditor.js: -------------------------------------------------------------------------------- 1 | //= require simditor/module 2 | //= require simditor/hotkeys 3 | //= require simditor/uploader 4 | //= require simditor/simditor 5 | -------------------------------------------------------------------------------- /lib/simditor/engine.rb: -------------------------------------------------------------------------------- 1 | module Simditor 2 | class Engine < ::Rails::Engine 3 | initializer :assets do |app| 4 | app.config.assets.precompile += %w( upload-loading.png ) 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simditor-rails", 3 | "version": "2.3.6", 4 | "homepage": "https://github.com/wentaoliu/simditor-rails", 5 | "authors": [ 6 | "Wentao Liu " 7 | ], 8 | "description": "Rails assets wrapper for https://github.com/mycolorway/simditor", 9 | "dependencies": { 10 | "simditor": "2.3.6" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simditor-rails", 3 | "version": "2.3.6", 4 | "description": "Rails assets wrapper for https://github.com/mycolorway/simditor", 5 | "author": "Wentao Liu ", 6 | "repository": "https://github.com/wentaoliu/simditor-rails", 7 | "devDependencies": { 8 | "grunt": "~0.4.5", 9 | "grunt-contrib-copy": "~0.8.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /simditor.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | $:.push File.expand_path("../lib", __FILE__) 3 | require 'simditor/version' 4 | 5 | Gem::Specification.new do |s| 6 | s.name = "simditor" 7 | s.version = Simditor::Version::EDITOR 8 | s.authors = ["Wentao Liu"] 9 | s.email = ["wentaoliu@live.com"] 10 | s.license = 'MIT' 11 | s.homepage = "https://github.com/wentaoliu/simditor-rails" 12 | s.summary = "A simple editor designed by mycolorway http://mycolorway.github.io/simditor/demo.html" 13 | s.description = "Rails assets wrapper for https://github.com/mycolorway/simditor" 14 | s.files = Dir["{lib,vendor}/**/*"] + ["LICENSE", "README.md"] 15 | s.platform = Gem::Platform::RUBY 16 | s.require_paths = ['lib'] 17 | end 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # simditor gem 2 | 3 | `simditor` gem is a Rails assets wrapper of [Simditor](https://github.com/mycolorway/simditor). 4 | 5 | [![Gem Version](https://badge.fury.io/rb/simditor.svg)](https://badge.fury.io/rb/simditor) 6 | 7 | ## Usage 8 | 9 | in Gemfile 10 | ```ruby 11 | gem 'simditor' 12 | ``` 13 | 14 | in application.js 15 | ``` 16 | //= require simditor 17 | ``` 18 | 19 | in application.css 20 | ``` 21 | *= require simditor 22 | ``` 23 | 24 | ## Initialization 25 | 26 | ```coffeescript 27 | editor = new Simditor( 28 | textarea: $('#editor') 29 | toolbar: [ 30 | 'title','bold','italic','underline','strikethrough','color','|' 31 | 'ol','ul','blockquote','code','table','link','image','hr','|' 32 | 'indent','outdent' 33 | ] 34 | pasteImage: true 35 | defaultImage: '<%= image_path "upload-loading.png" %>' 36 | upload: url: '/upload') 37 | ``` 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Simditor - A simple editor designed by mycolorway 2 | Copyright (C) 2014 https://github.com/mycolorway/simditor 3 | 4 | Rubygem - simditor - Rails assets wrapper for Simditor 5 | Copyright (C) 2015 https://github.com/wentaoliu/simditor-rails 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | this software and associated documentation files (the "Software"), to deal in 9 | the Software without restriction, including without limitation the rights to 10 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 11 | of the Software, and to permit persons to whom the Software is furnished to do 12 | so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.initConfig({ 4 | 5 | copy: 6 | { 7 | main: { 8 | files: [ 9 | { 10 | expand: true, src: ['bower_components/simditor/styles/editor.scss'], 11 | dest: 'vendor/assets/stylesheets/simditor', flatten: true 12 | }, 13 | { 14 | expand: true, src: ['bower_components/simditor/styles/fonticon.scss'], 15 | dest: 'vendor/assets/stylesheets/simditor', flatten: true 16 | }, 17 | { 18 | expand: true, src: ['bower_components/simditor/lib/simditor.js'], 19 | dest: 'vendor/assets/javascripts/simditor', flatten: true 20 | }, 21 | { 22 | expand: true, src: ['bower_components/simple-hotkeys/lib/hotkeys.js'], 23 | dest: 'vendor/assets/javascripts/simditor', flatten: true 24 | }, 25 | { 26 | expand: true, src: ['bower_components/simple-module/lib/module.js'], 27 | dest: 'vendor/assets/javascripts/simditor', flatten: true 28 | }, 29 | { 30 | expand: true, src: ['bower_components/simple-uploader/lib/uploader.js'], 31 | dest: 'vendor/assets/javascripts/simditor', flatten: true 32 | }, 33 | ], 34 | }, 35 | }, 36 | }); 37 | 38 | grunt.loadNpmTasks("grunt-contrib-copy"); 39 | grunt.registerTask("default", ["copy:main"]); 40 | }; 41 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/simditor/module.js: -------------------------------------------------------------------------------- 1 | (function (root, factory) { 2 | if (typeof define === 'function' && define.amd) { 3 | // AMD. Register as an anonymous module unless amdModuleId is set 4 | define('simple-module', ["jquery"], function (a0) { 5 | return (root['Module'] = factory(a0)); 6 | }); 7 | } else if (typeof exports === 'object') { 8 | // Node. Does not work with strict CommonJS, but 9 | // only CommonJS-like environments that support module.exports, 10 | // like Node. 11 | module.exports = factory(require("jquery")); 12 | } else { 13 | root['SimpleModule'] = factory(jQuery); 14 | } 15 | }(this, function ($) { 16 | 17 | var Module, 18 | slice = [].slice; 19 | 20 | Module = (function() { 21 | Module.extend = function(obj) { 22 | var key, ref, val; 23 | if (!((obj != null) && typeof obj === 'object')) { 24 | return; 25 | } 26 | for (key in obj) { 27 | val = obj[key]; 28 | if (key !== 'included' && key !== 'extended') { 29 | this[key] = val; 30 | } 31 | } 32 | return (ref = obj.extended) != null ? ref.call(this) : void 0; 33 | }; 34 | 35 | Module.include = function(obj) { 36 | var key, ref, val; 37 | if (!((obj != null) && typeof obj === 'object')) { 38 | return; 39 | } 40 | for (key in obj) { 41 | val = obj[key]; 42 | if (key !== 'included' && key !== 'extended') { 43 | this.prototype[key] = val; 44 | } 45 | } 46 | return (ref = obj.included) != null ? ref.call(this) : void 0; 47 | }; 48 | 49 | Module.connect = function(cls) { 50 | if (typeof cls !== 'function') { 51 | return; 52 | } 53 | if (!cls.pluginName) { 54 | throw new Error('Module.connect: cannot connect plugin without pluginName'); 55 | return; 56 | } 57 | cls.prototype._connected = true; 58 | if (!this._connectedClasses) { 59 | this._connectedClasses = []; 60 | } 61 | this._connectedClasses.push(cls); 62 | if (cls.pluginName) { 63 | return this[cls.pluginName] = cls; 64 | } 65 | }; 66 | 67 | Module.prototype.opts = {}; 68 | 69 | function Module(opts) { 70 | var base, cls, i, instance, instances, len, name; 71 | this.opts = $.extend({}, this.opts, opts); 72 | (base = this.constructor)._connectedClasses || (base._connectedClasses = []); 73 | instances = (function() { 74 | var i, len, ref, results; 75 | ref = this.constructor._connectedClasses; 76 | results = []; 77 | for (i = 0, len = ref.length; i < len; i++) { 78 | cls = ref[i]; 79 | name = cls.pluginName.charAt(0).toLowerCase() + cls.pluginName.slice(1); 80 | if (cls.prototype._connected) { 81 | cls.prototype._module = this; 82 | } 83 | results.push(this[name] = new cls()); 84 | } 85 | return results; 86 | }).call(this); 87 | if (this._connected) { 88 | this.opts = $.extend({}, this.opts, this._module.opts); 89 | } else { 90 | this._init(); 91 | for (i = 0, len = instances.length; i < len; i++) { 92 | instance = instances[i]; 93 | if (typeof instance._init === "function") { 94 | instance._init(); 95 | } 96 | } 97 | } 98 | this.trigger('initialized'); 99 | } 100 | 101 | Module.prototype._init = function() {}; 102 | 103 | Module.prototype.on = function() { 104 | var args, ref; 105 | args = 1 <= arguments.length ? slice.call(arguments, 0) : []; 106 | (ref = $(this)).on.apply(ref, args); 107 | return this; 108 | }; 109 | 110 | Module.prototype.one = function() { 111 | var args, ref; 112 | args = 1 <= arguments.length ? slice.call(arguments, 0) : []; 113 | (ref = $(this)).one.apply(ref, args); 114 | return this; 115 | }; 116 | 117 | Module.prototype.off = function() { 118 | var args, ref; 119 | args = 1 <= arguments.length ? slice.call(arguments, 0) : []; 120 | (ref = $(this)).off.apply(ref, args); 121 | return this; 122 | }; 123 | 124 | Module.prototype.trigger = function() { 125 | var args, ref; 126 | args = 1 <= arguments.length ? slice.call(arguments, 0) : []; 127 | (ref = $(this)).trigger.apply(ref, args); 128 | return this; 129 | }; 130 | 131 | Module.prototype.triggerHandler = function() { 132 | var args, ref; 133 | args = 1 <= arguments.length ? slice.call(arguments, 0) : []; 134 | return (ref = $(this)).triggerHandler.apply(ref, args); 135 | }; 136 | 137 | Module.prototype._t = function() { 138 | var args, ref; 139 | args = 1 <= arguments.length ? slice.call(arguments, 0) : []; 140 | return (ref = this.constructor)._t.apply(ref, args); 141 | }; 142 | 143 | Module._t = function() { 144 | var args, key, ref, result; 145 | key = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; 146 | result = ((ref = this.i18n[this.locale]) != null ? ref[key] : void 0) || ''; 147 | if (!(args.length > 0)) { 148 | return result; 149 | } 150 | result = result.replace(/([^%]|^)%(?:(\d+)\$)?s/g, function(p0, p, position) { 151 | if (position) { 152 | return p + args[parseInt(position) - 1]; 153 | } else { 154 | return p + args.shift(); 155 | } 156 | }); 157 | return result.replace(/%%s/g, '%s'); 158 | }; 159 | 160 | Module.i18n = { 161 | 'zh-CN': {} 162 | }; 163 | 164 | Module.locale = 'zh-CN'; 165 | 166 | return Module; 167 | 168 | })(); 169 | 170 | return Module; 171 | 172 | })); 173 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/simditor/hotkeys.js: -------------------------------------------------------------------------------- 1 | (function (root, factory) { 2 | if (typeof define === 'function' && define.amd) { 3 | // AMD. Register as an anonymous module unless amdModuleId is set 4 | define('simple-hotkeys', ["jquery","simple-module"], function ($, SimpleModule) { 5 | return (root['hotkeys'] = factory($, SimpleModule)); 6 | }); 7 | } else if (typeof exports === 'object') { 8 | // Node. Does not work with strict CommonJS, but 9 | // only CommonJS-like environments that support module.exports, 10 | // like Node. 11 | module.exports = factory(require("jquery"),require("simple-module")); 12 | } else { 13 | root.simple = root.simple || {}; 14 | root.simple['hotkeys'] = factory(jQuery,SimpleModule); 15 | } 16 | }(this, function ($, SimpleModule) { 17 | 18 | var Hotkeys, hotkeys, 19 | extend = 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; }, 20 | hasProp = {}.hasOwnProperty; 21 | 22 | Hotkeys = (function(superClass) { 23 | extend(Hotkeys, superClass); 24 | 25 | function Hotkeys() { 26 | return Hotkeys.__super__.constructor.apply(this, arguments); 27 | } 28 | 29 | Hotkeys.count = 0; 30 | 31 | Hotkeys.keyNameMap = { 32 | 8: "Backspace", 33 | 9: "Tab", 34 | 13: "Enter", 35 | 16: "Shift", 36 | 17: "Control", 37 | 18: "Alt", 38 | 19: "Pause", 39 | 20: "CapsLock", 40 | 27: "Esc", 41 | 32: "Spacebar", 42 | 33: "PageUp", 43 | 34: "PageDown", 44 | 35: "End", 45 | 36: "Home", 46 | 37: "Left", 47 | 38: "Up", 48 | 39: "Right", 49 | 40: "Down", 50 | 45: "Insert", 51 | 46: "Del", 52 | 91: "Meta", 53 | 93: "Meta", 54 | 48: "0", 55 | 49: "1", 56 | 50: "2", 57 | 51: "3", 58 | 52: "4", 59 | 53: "5", 60 | 54: "6", 61 | 55: "7", 62 | 56: "8", 63 | 57: "9", 64 | 65: "A", 65 | 66: "B", 66 | 67: "C", 67 | 68: "D", 68 | 69: "E", 69 | 70: "F", 70 | 71: "G", 71 | 72: "H", 72 | 73: "I", 73 | 74: "J", 74 | 75: "K", 75 | 76: "L", 76 | 77: "M", 77 | 78: "N", 78 | 79: "O", 79 | 80: "P", 80 | 81: "Q", 81 | 82: "R", 82 | 83: "S", 83 | 84: "T", 84 | 85: "U", 85 | 86: "V", 86 | 87: "W", 87 | 88: "X", 88 | 89: "Y", 89 | 90: "Z", 90 | 96: "0", 91 | 97: "1", 92 | 98: "2", 93 | 99: "3", 94 | 100: "4", 95 | 101: "5", 96 | 102: "6", 97 | 103: "7", 98 | 104: "8", 99 | 105: "9", 100 | 106: "Multiply", 101 | 107: "Add", 102 | 109: "Subtract", 103 | 110: "Decimal", 104 | 111: "Divide", 105 | 112: "F1", 106 | 113: "F2", 107 | 114: "F3", 108 | 115: "F4", 109 | 116: "F5", 110 | 117: "F6", 111 | 118: "F7", 112 | 119: "F8", 113 | 120: "F9", 114 | 121: "F10", 115 | 122: "F11", 116 | 123: "F12", 117 | 124: "F13", 118 | 125: "F14", 119 | 126: "F15", 120 | 127: "F16", 121 | 128: "F17", 122 | 129: "F18", 123 | 130: "F19", 124 | 131: "F20", 125 | 132: "F21", 126 | 133: "F22", 127 | 134: "F23", 128 | 135: "F24", 129 | 59: ";", 130 | 61: "=", 131 | 186: ";", 132 | 187: "=", 133 | 188: ",", 134 | 190: ".", 135 | 191: "/", 136 | 192: "`", 137 | 219: "[", 138 | 220: "\\", 139 | 221: "]", 140 | 222: "'" 141 | }; 142 | 143 | Hotkeys.aliases = { 144 | "escape": "esc", 145 | "delete": "del", 146 | "return": "enter", 147 | "ctrl": "control", 148 | "space": "spacebar", 149 | "ins": "insert", 150 | "cmd": "meta", 151 | "command": "meta", 152 | "wins": "meta", 153 | "windows": "meta" 154 | }; 155 | 156 | Hotkeys.normalize = function(shortcut) { 157 | var i, j, key, keyname, keys, len; 158 | keys = shortcut.toLowerCase().replace(/\s+/gi, "").split("+"); 159 | for (i = j = 0, len = keys.length; j < len; i = ++j) { 160 | key = keys[i]; 161 | keys[i] = this.aliases[key] || key; 162 | } 163 | keyname = keys.pop(); 164 | keys.sort().push(keyname); 165 | return keys.join("_"); 166 | }; 167 | 168 | Hotkeys.prototype.opts = { 169 | el: document 170 | }; 171 | 172 | Hotkeys.prototype._init = function() { 173 | this.id = ++this.constructor.count; 174 | this._map = {}; 175 | this._delegate = typeof this.opts.el === "string" ? document : this.opts.el; 176 | return $(this._delegate).on("keydown.simple-hotkeys-" + this.id, this.opts.el, (function(_this) { 177 | return function(e) { 178 | var ref; 179 | return (ref = _this._getHander(e)) != null ? ref.call(_this, e) : void 0; 180 | }; 181 | })(this)); 182 | }; 183 | 184 | Hotkeys.prototype._getHander = function(e) { 185 | var keyname, shortcut; 186 | if (!(keyname = this.constructor.keyNameMap[e.which])) { 187 | return; 188 | } 189 | shortcut = ""; 190 | if (e.altKey) { 191 | shortcut += "alt_"; 192 | } 193 | if (e.ctrlKey) { 194 | shortcut += "control_"; 195 | } 196 | if (e.metaKey) { 197 | shortcut += "meta_"; 198 | } 199 | if (e.shiftKey) { 200 | shortcut += "shift_"; 201 | } 202 | shortcut += keyname.toLowerCase(); 203 | return this._map[shortcut]; 204 | }; 205 | 206 | Hotkeys.prototype.respondTo = function(subject) { 207 | if (typeof subject === 'string') { 208 | return this._map[this.constructor.normalize(subject)] != null; 209 | } else { 210 | return this._getHander(subject) != null; 211 | } 212 | }; 213 | 214 | Hotkeys.prototype.add = function(shortcut, handler) { 215 | this._map[this.constructor.normalize(shortcut)] = handler; 216 | return this; 217 | }; 218 | 219 | Hotkeys.prototype.remove = function(shortcut) { 220 | delete this._map[this.constructor.normalize(shortcut)]; 221 | return this; 222 | }; 223 | 224 | Hotkeys.prototype.destroy = function() { 225 | $(this._delegate).off(".simple-hotkeys-" + this.id); 226 | this._map = {}; 227 | return this; 228 | }; 229 | 230 | return Hotkeys; 231 | 232 | })(SimpleModule); 233 | 234 | hotkeys = function(opts) { 235 | return new Hotkeys(opts); 236 | }; 237 | 238 | return hotkeys; 239 | 240 | })); 241 | 242 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/simditor/uploader.js: -------------------------------------------------------------------------------- 1 | (function (root, factory) { 2 | if (typeof define === 'function' && define.amd) { 3 | // AMD. Register as an anonymous module unless amdModuleId is set 4 | define('simple-uploader', ["jquery","simple-module"], function ($, SimpleModule) { 5 | return (root['uploader'] = factory($, SimpleModule)); 6 | }); 7 | } else if (typeof exports === 'object') { 8 | // Node. Does not work with strict CommonJS, but 9 | // only CommonJS-like environments that support module.exports, 10 | // like Node. 11 | module.exports = factory(require("jquery"),require("simple-module")); 12 | } else { 13 | root.simple = root.simple || {}; 14 | root.simple['uploader'] = factory(jQuery,SimpleModule); 15 | } 16 | }(this, function ($, SimpleModule) { 17 | 18 | var Uploader, uploader, 19 | extend = 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; }, 20 | hasProp = {}.hasOwnProperty; 21 | 22 | Uploader = (function(superClass) { 23 | extend(Uploader, superClass); 24 | 25 | function Uploader() { 26 | return Uploader.__super__.constructor.apply(this, arguments); 27 | } 28 | 29 | Uploader.count = 0; 30 | 31 | Uploader.prototype.opts = { 32 | url: '', 33 | params: null, 34 | fileKey: 'upload_file', 35 | connectionCount: 3 36 | }; 37 | 38 | Uploader.prototype._init = function() { 39 | this.files = []; 40 | this.queue = []; 41 | this.id = ++Uploader.count; 42 | this.on('uploadcomplete', (function(_this) { 43 | return function(e, file) { 44 | _this.files.splice($.inArray(file, _this.files), 1); 45 | if (_this.queue.length > 0 && _this.files.length < _this.opts.connectionCount) { 46 | return _this.upload(_this.queue.shift()); 47 | } else { 48 | return _this.uploading = false; 49 | } 50 | }; 51 | })(this)); 52 | return $(window).on('beforeunload.uploader-' + this.id, (function(_this) { 53 | return function(e) { 54 | if (!_this.uploading) { 55 | return; 56 | } 57 | e.originalEvent.returnValue = _this._t('leaveConfirm'); 58 | return _this._t('leaveConfirm'); 59 | }; 60 | })(this)); 61 | }; 62 | 63 | Uploader.prototype.generateId = (function() { 64 | var id; 65 | id = 0; 66 | return function() { 67 | return id += 1; 68 | }; 69 | })(); 70 | 71 | Uploader.prototype.upload = function(file, opts) { 72 | var f, i, key, len; 73 | if (opts == null) { 74 | opts = {}; 75 | } 76 | if (file == null) { 77 | return; 78 | } 79 | if ($.isArray(file) || file instanceof FileList) { 80 | for (i = 0, len = file.length; i < len; i++) { 81 | f = file[i]; 82 | this.upload(f, opts); 83 | } 84 | } else if ($(file).is('input:file')) { 85 | key = $(file).attr('name'); 86 | if (key) { 87 | opts.fileKey = key; 88 | } 89 | this.upload($.makeArray($(file)[0].files), opts); 90 | } else if (!file.id || !file.obj) { 91 | file = this.getFile(file); 92 | } 93 | if (!(file && file.obj)) { 94 | return; 95 | } 96 | $.extend(file, opts); 97 | if (this.files.length >= this.opts.connectionCount) { 98 | this.queue.push(file); 99 | return; 100 | } 101 | if (this.triggerHandler('beforeupload', [file]) === false) { 102 | return; 103 | } 104 | this.files.push(file); 105 | this._xhrUpload(file); 106 | return this.uploading = true; 107 | }; 108 | 109 | Uploader.prototype.getFile = function(fileObj) { 110 | var name, ref, ref1; 111 | if (fileObj instanceof window.File || fileObj instanceof window.Blob) { 112 | name = (ref = fileObj.fileName) != null ? ref : fileObj.name; 113 | } else { 114 | return null; 115 | } 116 | return { 117 | id: this.generateId(), 118 | url: this.opts.url, 119 | params: this.opts.params, 120 | fileKey: this.opts.fileKey, 121 | name: name, 122 | size: (ref1 = fileObj.fileSize) != null ? ref1 : fileObj.size, 123 | ext: name ? name.split('.').pop().toLowerCase() : '', 124 | obj: fileObj 125 | }; 126 | }; 127 | 128 | Uploader.prototype._xhrUpload = function(file) { 129 | var formData, k, ref, v; 130 | formData = new FormData(); 131 | formData.append(file.fileKey, file.obj); 132 | formData.append("original_filename", file.name); 133 | if (file.params) { 134 | ref = file.params; 135 | for (k in ref) { 136 | v = ref[k]; 137 | formData.append(k, v); 138 | } 139 | } 140 | return file.xhr = $.ajax({ 141 | url: file.url, 142 | data: formData, 143 | processData: false, 144 | contentType: false, 145 | type: 'POST', 146 | headers: { 147 | 'X-File-Name': encodeURIComponent(file.name) 148 | }, 149 | xhr: function() { 150 | var req; 151 | req = $.ajaxSettings.xhr(); 152 | if (req) { 153 | req.upload.onprogress = (function(_this) { 154 | return function(e) { 155 | return _this.progress(e); 156 | }; 157 | })(this); 158 | } 159 | return req; 160 | }, 161 | progress: (function(_this) { 162 | return function(e) { 163 | if (!e.lengthComputable) { 164 | return; 165 | } 166 | return _this.trigger('uploadprogress', [file, e.loaded, e.total]); 167 | }; 168 | })(this), 169 | error: (function(_this) { 170 | return function(xhr, status, err) { 171 | return _this.trigger('uploaderror', [file, xhr, status]); 172 | }; 173 | })(this), 174 | success: (function(_this) { 175 | return function(result) { 176 | _this.trigger('uploadprogress', [file, file.size, file.size]); 177 | _this.trigger('uploadsuccess', [file, result]); 178 | return $(document).trigger('uploadsuccess', [file, result, _this]); 179 | }; 180 | })(this), 181 | complete: (function(_this) { 182 | return function(xhr, status) { 183 | return _this.trigger('uploadcomplete', [file, xhr.responseText]); 184 | }; 185 | })(this) 186 | }); 187 | }; 188 | 189 | Uploader.prototype.cancel = function(file) { 190 | var f, i, len, ref; 191 | if (!file.id) { 192 | ref = this.files; 193 | for (i = 0, len = ref.length; i < len; i++) { 194 | f = ref[i]; 195 | if (f.id === file * 1) { 196 | file = f; 197 | break; 198 | } 199 | } 200 | } 201 | this.trigger('uploadcancel', [file]); 202 | if (file.xhr) { 203 | file.xhr.abort(); 204 | } 205 | return file.xhr = null; 206 | }; 207 | 208 | Uploader.prototype.readImageFile = function(fileObj, callback) { 209 | var fileReader, img; 210 | if (!$.isFunction(callback)) { 211 | return; 212 | } 213 | img = new Image(); 214 | img.onload = function() { 215 | return callback(img); 216 | }; 217 | img.onerror = function() { 218 | return callback(); 219 | }; 220 | if (window.FileReader && FileReader.prototype.readAsDataURL && /^image/.test(fileObj.type)) { 221 | fileReader = new FileReader(); 222 | fileReader.onload = function(e) { 223 | return img.src = e.target.result; 224 | }; 225 | return fileReader.readAsDataURL(fileObj); 226 | } else { 227 | return callback(); 228 | } 229 | }; 230 | 231 | Uploader.prototype.destroy = function() { 232 | var file, i, len, ref; 233 | this.queue.length = 0; 234 | ref = this.files; 235 | for (i = 0, len = ref.length; i < len; i++) { 236 | file = ref[i]; 237 | this.cancel(file); 238 | } 239 | $(window).off('.uploader-' + this.id); 240 | return $(document).off('.uploader-' + this.id); 241 | }; 242 | 243 | Uploader.i18n = { 244 | 'zh-CN': { 245 | leaveConfirm: '正在上传文件,如果离开上传会自动取消' 246 | } 247 | }; 248 | 249 | Uploader.locale = 'zh-CN'; 250 | 251 | return Uploader; 252 | 253 | })(SimpleModule); 254 | 255 | uploader = function(opts) { 256 | return new Uploader(opts); 257 | }; 258 | 259 | return uploader; 260 | 261 | })); 262 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/simditor/fonticon.scss: -------------------------------------------------------------------------------- 1 | @font-face{font-family:'Simditor';src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABp8AA4AAAAAKmwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAaYAAAABoAAAAcdO8GE09TLzIAAAG0AAAARQAAAGAQ+ZFXY21hcAAAAkgAAABRAAABWuA2Gx9jdnQgAAAEgAAAAAoAAAAKAwQAxGZwZ20AAAKcAAABsQAAAmUPtC+nZ2x5ZgAABNgAABPeAAAgZG/p6QxoZWFkAAABRAAAADAAAAA2BvuCgGhoZWEAAAF0AAAAHgAAACQH9QTlaG10eAAAAfwAAABKAAAAlHv7AItsb2NhAAAEjAAAAEwAAABMi4qTXm1heHAAAAGUAAAAIAAAACABRwHNbmFtZQAAGLgAAAEFAAAB12vS/ulwb3N0AAAZwAAAAJ4AAAFsyCrvunByZXAAAARQAAAALgAAAC6w8isUeNpjYGRgYADiKAkPy3h+m68M8swfgCIMF0/IVyDo/84sFswJQC4HAxNIFAAZwAnyeNpjYGRgYE5gmMAQzWLBwPD/O5AEiqAAVQBa6wPkAAAAAQAAACUAoAAKAAAAAAACAAEAAgAWAAABAAEpAAAAAHjaY2BhnsA4gYGVgYGpn+k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kK80+cM/DBe6Aj4dxYXOw+ev+ee8/HvOoHm8t1mEU2hQ6s2lbBbCVrwo0QBCv4ep1im59rm3G52Iz8cg+Y42+E0mX4o+pXhStOJ7z2QxrWH6036gw2RFCfVu1xer1b5EN8hGS1i51e2tdsAsDkIPGYliDdesazes7CRI9OdoekjR6bxa8mk4OL7XB7OJ3aGoMLP4ddyVS7j5kK/36mLGfHnojgBj4/h49BOiPiadnfd9BGRDfJ9nKua6657hIdVGMMiWEOnOmvoYoT+C93/Vj8AAHjafY+/asMwEIc/JU6aQhsyltJBQ6eCg20IgdCt1GTwlNJsHUJijCCxwHaeqVufpM/Qta/Ri31ZOkTipO9Ov/sjYMwXhm7d8qBsGPGs3OOKd+U+j3wqB6L5UR5wY4zykJGxojTBtXj3bdaJDROelHvS91W5z5IP5UA038oD7vhVHjIxY1I8JQ2ObUs1lkz2C6S+bNzWl7XNMnHfRHNgJ2cjykoC7rBzjRdakVNwZM/m9LDKi+N+I3AunrYJhagsCVMiuRdi/0t20Vg0IXOxRJQxs26U1FdFbpNpZBf23FowTsJ5mETx7OKEa+ldyedcO9GpRzcF67yqnS9tLHUvVfgDz/ZF8gAAAHjabc25DgFhGIXh/53B2Pd9J9HPN/bSWolC4iI0OjfgxhFO6SQnT/k6z333errI/dvkc5yHh+98YsRJEJAkRZoMWXLkKVCkRJkKVWrUadCkRZsOXXr0GTBkxDh2vp5O3u4SPO63YxiG0mQkp3Im53Ihl3Il13Ijt3In9/Igjz9NfVPf1Df1TX1T39Q39U19U9/UN/VNfVPfDm8tR0peAAB42mNgYGBkAIKLcceVwfQJ+XIoXQEARe8GegAA) format('woff');font-weight:normal;font-style:normal}.simditor-icon{display:inline-block;font:normal normal normal 14px/1 'Simditor';font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;transform:translate(0,0)}.simditor-icon-code:before{content:'\f000'}.simditor-icon-bold:before{content:'\f001'}.simditor-icon-italic:before{content:'\f002'}.simditor-icon-underline:before{content:'\f003'}.simditor-icon-times:before{content:'\f004'}.simditor-icon-strikethrough:before{content:'\f005'}.simditor-icon-list-ol:before{content:'\f006'}.simditor-icon-list-ul:before{content:'\f007'}.simditor-icon-quote-left:before{content:'\f008'}.simditor-icon-table:before{content:'\f009'}.simditor-icon-link:before{content:'\f00a'}.simditor-icon-picture-o:before{content:'\f00b'}.simditor-icon-minus:before{content:'\f00c'}.simditor-icon-indent:before{content:'\f00d'}.simditor-icon-outdent:before{content:'\f00e'}.simditor-icon-unlink:before{content:'\f00f'}.simditor-icon-caret-down:before{content:'\f010'}.simditor-icon-caret-right:before{content:'\f011'}.simditor-icon-upload:before{content:'\f012'}.simditor-icon-undo:before{content:'\f013'}.simditor-icon-smile-o:before{content:'\f014'}.simditor-icon-tint:before{content:'\f015'}.simditor-icon-font:before{content:'\f016'}.simditor-icon-html5:before{content:'\f017'}.simditor-icon-mark:before{content:'\f018'}.simditor-icon-align-center:before{content:'\f019'}.simditor-icon-align-left:before{content:'\f01a'}.simditor-icon-align-right:before{content:'\f01b'}.simditor-icon-font-minus:before{content:'\f01c'}.simditor-icon-markdown:before{content:'\f01d'}.simditor-icon-checklist:before{content:'\f01e'} -------------------------------------------------------------------------------- /vendor/assets/stylesheets/simditor/editor.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | $simditor-button-height: 40px; 4 | $simditor-button-width: 46px; 5 | 6 | .simditor { 7 | position: relative; 8 | border: 1px solid #c9d8db; 9 | 10 | .simditor-wrapper { 11 | position: relative; 12 | background: #ffffff; 13 | 14 | & > textarea { 15 | display: none !important; 16 | width: 100%; 17 | box-sizing: border-box; 18 | font-family: monaco; 19 | font-size: 16px; 20 | line-height: 1.6; 21 | border: none; 22 | padding: 22px 15px 40px; 23 | min-height: 300px; 24 | outline: none; 25 | background: transparent; 26 | resize: none; 27 | } 28 | 29 | .simditor-placeholder { 30 | display: none; 31 | position: absolute; 32 | left: 0; 33 | z-index: 0; 34 | padding: 22px 15px; 35 | font-size: 16px; 36 | font-family: arial, sans-serif; 37 | line-height: 1.5; 38 | color: #999999; 39 | background: transparent; 40 | } 41 | 42 | &.toolbar-floating { 43 | .simditor-toolbar { 44 | position: fixed; 45 | top: 0; 46 | z-index: 10; 47 | box-shadow: 0 0 6px rgba(0,0,0,0.1); 48 | } 49 | } 50 | 51 | .simditor-image-loading { 52 | width: 100%; 53 | height: 100%; 54 | position: absolute; 55 | top: 0; 56 | left: 0; 57 | z-index: 2; 58 | 59 | .progress { 60 | width: 100%; 61 | height: 100%; 62 | background: rgba(0,0,0,0.4); 63 | position: absolute; 64 | bottom: 0; 65 | left: 0; 66 | } 67 | } 68 | } 69 | 70 | .simditor-body { 71 | padding: 22px 15px 40px; 72 | min-height: 300px; 73 | outline: none; 74 | cursor: text; 75 | position: relative; 76 | z-index: 1; 77 | background: transparent; 78 | 79 | a.selected { 80 | background: #b3d4fd; 81 | } 82 | 83 | a.simditor-mention { 84 | cursor: pointer; 85 | } 86 | 87 | .simditor-table { 88 | position: relative; 89 | 90 | &.resizing { 91 | cursor: col-resize; 92 | } 93 | 94 | .simditor-resize-handle { 95 | position: absolute; 96 | left: 0; 97 | top: 0; 98 | width: 10px; 99 | height: 100%; 100 | cursor: col-resize; 101 | } 102 | } 103 | 104 | pre { 105 | /*min-height: 28px;*/ 106 | box-sizing: border-box; 107 | -moz-box-sizing: border-box; 108 | word-wrap: break-word!important; 109 | white-space: pre-wrap!important; 110 | } 111 | 112 | img { 113 | cursor: pointer; 114 | 115 | &.selected { 116 | box-shadow: 0 0 0 4px #cccccc; 117 | } 118 | } 119 | } 120 | 121 | .simditor-paste-bin { 122 | position: fixed; 123 | bottom: 10px; 124 | right: 10px; 125 | width: 1px; 126 | height: 20px; 127 | font-size: 1px; 128 | line-height: 1px; 129 | overflow: hidden; 130 | padding: 0; 131 | margin: 0; 132 | opacity: 0; 133 | -webkit-user-select: text; 134 | } 135 | 136 | .simditor-toolbar { 137 | border-bottom: 1px solid #eeeeee; 138 | background: #ffffff; 139 | width: 100%; 140 | 141 | & > ul { 142 | margin: 0; 143 | padding: 0 0 0 6px; 144 | list-style: none; 145 | 146 | & > li { 147 | position: relative; 148 | display: inline-block; 149 | font-size: 0; 150 | 151 | & > span.separator { 152 | display: inline-block; 153 | background: #cfcfcf; 154 | width: 1px; 155 | height: 18px; 156 | margin: ($simditor-button-height - 18px) / 2 15px; 157 | vertical-align: middle; 158 | } 159 | 160 | & > .toolbar-item { 161 | display: inline-block; 162 | width: $simditor-button-width; 163 | height: $simditor-button-height; 164 | outline: none; 165 | color: #333333; 166 | font-size: 15px; 167 | line-height: $simditor-button-height; 168 | vertical-align: middle; 169 | text-align: center; 170 | text-decoration: none; 171 | 172 | span { 173 | opacity: 0.6; 174 | 175 | &.simditor-icon { 176 | display: inline; 177 | line-height: normal; 178 | } 179 | } 180 | 181 | &:hover span { 182 | opacity: 1; 183 | } 184 | 185 | &.active { 186 | background: #eeeeee; 187 | 188 | span { 189 | opacity: 1; 190 | } 191 | } 192 | 193 | &.disabled { 194 | cursor: default; 195 | 196 | span { 197 | opacity: 0.3; 198 | } 199 | } 200 | 201 | &.toolbar-item-title { 202 | span:before { 203 | content: "H"; 204 | font-size: 19px; 205 | font-weight: bold; 206 | font-family: 'Times New Roman'; 207 | } 208 | 209 | &.active-h1 span:before { 210 | content: 'H1'; 211 | font-size: 18px; 212 | } 213 | 214 | &.active-h2 span:before { 215 | content: 'H2'; 216 | font-size: 18px; 217 | } 218 | 219 | &.active-h3 span:before { 220 | content: 'H3'; 221 | font-size: 18px; 222 | } 223 | } 224 | 225 | &.toolbar-item-image { 226 | position: relative; 227 | overflow: hidden; 228 | 229 | & > input[type=file] { 230 | position: absolute; 231 | right: 0px; 232 | top: 0px; 233 | opacity: 0; 234 | font-size: 100px; 235 | cursor: pointer; 236 | } 237 | } 238 | } 239 | 240 | &.menu-on { 241 | .toolbar-item { 242 | position: relative; 243 | z-index: 20; 244 | background: #ffffff; 245 | box-shadow: 0 1px 4px rgba(0,0,0,0.3); 246 | 247 | span { 248 | opacity: 1; 249 | } 250 | } 251 | 252 | .toolbar-menu { 253 | display: block; 254 | } 255 | } 256 | } 257 | } 258 | 259 | .toolbar-menu { 260 | display: none; 261 | position: absolute; 262 | top: $simditor-button-height; 263 | left: 0; 264 | z-index: 21; 265 | background: #ffffff; 266 | text-align: left; 267 | box-shadow: 0 0 4px rgba(0,0,0,0.3); 268 | 269 | &:before { 270 | content: ''; 271 | display: block; 272 | width: $simditor-button-width; 273 | height: 4px; 274 | background: #ffffff; 275 | position: absolute; 276 | top: -3px; 277 | left: 0; 278 | } 279 | 280 | ul { 281 | min-width: 160px; 282 | list-style: none; 283 | margin: 0; 284 | padding: 10px 1px; 285 | 286 | & > li { 287 | 288 | .menu-item { 289 | display: block; 290 | font-size:16px; 291 | line-height: 2em; 292 | padding: 0 10px; 293 | text-decoration: none; 294 | color: #666666; 295 | 296 | &:hover { 297 | background: #f6f6f6; 298 | } 299 | 300 | &.menu-item-h1 { 301 | font-size: 24px; 302 | color: #333333; 303 | } 304 | 305 | &.menu-item-h2 { 306 | font-size: 22px; 307 | color: #333333; 308 | } 309 | 310 | &.menu-item-h3 { 311 | font-size: 20px; 312 | color: #333333; 313 | } 314 | 315 | &.menu-item-h4 { 316 | font-size: 18px; 317 | color: #333333; 318 | } 319 | 320 | &.menu-item-h5 { 321 | font-size: 16px; 322 | color: #333333; 323 | } 324 | } 325 | 326 | .separator { 327 | display: block; 328 | border-top: 1px solid #cccccc; 329 | height: 0; 330 | line-height: 0; 331 | font-size: 0; 332 | margin: 6px 0; 333 | } 334 | } 335 | 336 | } 337 | 338 | &.toolbar-menu-color { 339 | width: 96px; 340 | 341 | .color-list { 342 | height: 40px; 343 | margin: 10px 6px 6px 10px; 344 | padding: 0; 345 | 346 | min-width: 0; 347 | 348 | li { 349 | float: left; 350 | margin: 0 4px 4px 0; 351 | 352 | .font-color { 353 | display: block; 354 | width: 16px; 355 | height: 16px; 356 | background: #dfdfdf; 357 | border-radius: 2px; 358 | 359 | &:hover { 360 | opacity: 0.8; 361 | } 362 | 363 | &.font-color-default { 364 | background: #333333; 365 | } 366 | } 367 | 368 | $font-colors: #E33737 #e28b41 #c8a732 #209361 #418caf #aa8773 #999999; 369 | $i: 1; 370 | @each $color in $font-colors { 371 | .font-color-#{$i} { 372 | background: $color; 373 | } 374 | $i: $i + 1; 375 | } 376 | } 377 | } 378 | } 379 | 380 | &.toolbar-menu-table { 381 | .menu-create-table { 382 | background: #ffffff; 383 | padding: 1px; 384 | 385 | table { 386 | border: none; 387 | border-collapse: collapse; 388 | border-spacing: 0; 389 | table-layout: fixed; 390 | 391 | td { 392 | padding: 0; 393 | cursor: pointer; 394 | 395 | &:before { 396 | width: 16px; 397 | height: 16px; 398 | border: 1px solid #ffffff; 399 | background: #f3f3f3; 400 | display: block; 401 | content: '' 402 | } 403 | 404 | &.selected:before { 405 | background: #cfcfcf; 406 | } 407 | } 408 | } 409 | } 410 | 411 | .menu-edit-table { 412 | display: none; 413 | 414 | ul { 415 | li { 416 | white-space: nowrap; 417 | } 418 | } 419 | } 420 | } 421 | 422 | &.toolbar-menu-image { 423 | .menu-item-upload-image { 424 | position: relative; 425 | overflow: hidden; 426 | 427 | input[type=file] { 428 | position: absolute; 429 | right: 0px; 430 | top: 0px; 431 | opacity: 0; 432 | font-size: 100px; 433 | cursor: pointer; 434 | } 435 | } 436 | } 437 | 438 | &.toolbar-menu-alignment { 439 | width: 100%; 440 | ul { 441 | min-width: 100%; 442 | } 443 | .menu-item { 444 | text-align: center; 445 | } 446 | } 447 | } 448 | } 449 | 450 | .simditor-popover { 451 | display: none; 452 | padding: 5px 8px 0; 453 | background: #ffffff; 454 | box-shadow: 0 1px 4px rgba(0,0,0,0.4); 455 | border-radius: 2px; 456 | position: absolute; 457 | z-index: 2; 458 | 459 | .settings-field { 460 | margin: 0 0 5px 0; 461 | font-size: 12px; 462 | height: 25px; 463 | line-height: 25px; 464 | 465 | label { 466 | display: inline-block; 467 | margin: 0 5px 0 0; 468 | } 469 | 470 | input[type=text] { 471 | display: inline-block; 472 | width: 200px; 473 | box-sizing: border-box; 474 | font-size: 12px; 475 | 476 | &.image-size { 477 | width: 83px; 478 | } 479 | } 480 | 481 | .times { 482 | display: inline-block; 483 | width: 26px; 484 | font-size: 12px; 485 | text-align: center; 486 | } 487 | } 488 | 489 | &.link-popover .btn-unlink, 490 | &.image-popover .btn-upload, 491 | &.image-popover .btn-restore { 492 | display: inline-block; 493 | margin: 0 0 0 5px; 494 | color: #333333; 495 | font-size: 14px; 496 | outline: 0; 497 | 498 | span { 499 | opacity: 0.6; 500 | } 501 | 502 | &:hover span { 503 | opacity: 1; 504 | } 505 | } 506 | 507 | &.image-popover .btn-upload { 508 | position: relative; 509 | display: inline-block; 510 | overflow: hidden; 511 | vertical-align: middle; 512 | 513 | input[type=file] { 514 | position: absolute; 515 | right: 0px; 516 | top: 0px; 517 | opacity: 0; 518 | height: 100%; 519 | width: 28px; 520 | } 521 | } 522 | } 523 | 524 | &.simditor-mobile { 525 | .simditor-wrapper.toolbar-floating .simditor-toolbar { 526 | position: absolute; 527 | top: 0; 528 | z-index: 10; 529 | box-shadow: 0 0 6px rgba(0,0,0,0.1); 530 | } 531 | } 532 | } 533 | 534 | 535 | 536 | .simditor .simditor-body, .editor-style { 537 | font-size: 16px; 538 | font-family: arial, sans-serif; 539 | line-height: 1.6; 540 | color: #333; 541 | outline: none; 542 | word-wrap: break-word; 543 | 544 | & > :first-child { 545 | margin-top: 0!important; 546 | } 547 | 548 | a{ color: #4298BA; text-decoration: none; word-break: break-all;} 549 | a:visited{ color: #4298BA; } 550 | a:hover{ color: #0F769F; } 551 | a:active{ color:#9E792E; } 552 | a:hover, a:active{ outline: 0; } 553 | 554 | h1,h2,h3,h4,h5,h6 { 555 | font-weight: normal; 556 | margin: 40px 0 20px; 557 | color: #000000; 558 | } 559 | 560 | h1 { font-size: 24px; } 561 | h2 { font-size: 22px; } 562 | h3 { font-size: 20px; } 563 | h4 { font-size: 18px; } 564 | h5 { font-size: 16px; } 565 | h6 { font-size: 16px; } 566 | 567 | p, div { 568 | word-wrap: break-word; 569 | margin: 0 0 15px 0; 570 | color: #333; 571 | word-wrap: break-word; 572 | } 573 | 574 | b, strong { 575 | font-weight: bold; 576 | } 577 | 578 | i, em { 579 | font-style: italic; 580 | } 581 | 582 | u { 583 | text-decoration: underline; 584 | } 585 | 586 | strike, del { 587 | text-decoration: line-through; 588 | } 589 | 590 | ul, ol { 591 | list-style:disc outside none; 592 | margin: 15px 0; 593 | padding: 0 0 0 40px; 594 | line-height: 1.6; 595 | 596 | ul, ol { 597 | padding-left: 30px; 598 | } 599 | 600 | ul { 601 | list-style: circle outside none; 602 | 603 | ul { 604 | list-style: square outside none; 605 | } 606 | } 607 | } 608 | 609 | ol { 610 | list-style:decimal; 611 | } 612 | 613 | blockquote { 614 | border-left: 6px solid #ddd; 615 | padding: 5px 0 5px 10px; 616 | margin: 15px 0 15px 15px; 617 | 618 | & > :first-child { 619 | margin-top: 0; 620 | } 621 | } 622 | 623 | code { 624 | display: inline-block; 625 | padding: 0 4px; 626 | margin: 0 5px; 627 | background: #eeeeee; 628 | border-radius: 3px; 629 | font-size: 13px; 630 | font-family: 'monaco', 'Consolas', "Liberation Mono", Courier, monospace; 631 | } 632 | 633 | pre { 634 | padding: 10px 5px 10px 10px; 635 | margin: 15px 0; 636 | display: block; 637 | line-height: 18px; 638 | background: #F0F0F0; 639 | border-radius: 3px; 640 | font-size:13px; 641 | font-family: 'monaco', 'Consolas', "Liberation Mono", Courier, monospace; 642 | white-space: pre; 643 | word-wrap: normal; 644 | overflow-x: auto; 645 | 646 | code { 647 | display: block; 648 | padding: 0; 649 | margin: 0; 650 | background: none; 651 | border-radius: 0; 652 | } 653 | } 654 | 655 | hr { 656 | display: block; 657 | height: 0px; 658 | border: 0; 659 | border-top: 1px solid #ccc; 660 | margin: 15px 0; 661 | padding: 0; 662 | } 663 | 664 | table { 665 | width: 100%; 666 | table-layout: fixed; 667 | border-collapse: collapse; 668 | border-spacing: 0; 669 | margin: 15px 0; 670 | 671 | thead { 672 | background-color: #f9f9f9; 673 | } 674 | 675 | td, th { 676 | min-width: 40px; 677 | height: 30px; 678 | border: 1px solid #ccc; 679 | vertical-align: top; 680 | padding: 2px 4px; 681 | text-align: left; 682 | box-sizing: border-box; 683 | 684 | &.active { 685 | background-color: #ffffee; 686 | } 687 | } 688 | } 689 | 690 | 691 | img { 692 | margin: 0 5px; 693 | vertical-align: middle; 694 | } 695 | 696 | } 697 | --------------------------------------------------------------------------------