This commit is contained in:
wangjinlei
2023-05-18 09:42:12 +08:00
commit 6e7ee3dd44
1214 changed files with 103535 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,27 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>simditor</title>
<link rel="stylesheet" type="text/css" href="styles/simditor.css" />
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<script type="text/javascript" src="scripts/module.min.js"></script>
<script type="text/javascript" src="scripts/hotkeys.min.js"></script>
<script type="text/javascript" src="scripts/uploader.min.js"></script>
<script type="text/javascript" src="scripts/simditor.min.js"></script>
</head>
<body>
<textarea id="editor" placeholder="Balabala" autofocus></textarea>
<script>
var editor = new Simditor({
textarea: $('#editor')
//optional options
});
</script>
</body>
</html>

View File

@@ -0,0 +1,241 @@
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define('simple-hotkeys', ["jquery","simple-module"], function ($, SimpleModule) {
return (root['hotkeys'] = factory($, SimpleModule));
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory(require("jquery"),require("simplemodule"));
} else {
root.simple = root.simple || {};
root.simple['hotkeys'] = factory(jQuery,SimpleModule);
}
}(this, function ($, SimpleModule) {
var Hotkeys, hotkeys,
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; },
hasProp = {}.hasOwnProperty;
Hotkeys = (function(superClass) {
extend(Hotkeys, superClass);
function Hotkeys() {
return Hotkeys.__super__.constructor.apply(this, arguments);
}
Hotkeys.count = 0;
Hotkeys.keyNameMap = {
8: "Backspace",
9: "Tab",
13: "Enter",
16: "Shift",
17: "Control",
18: "Alt",
19: "Pause",
20: "CapsLock",
27: "Esc",
32: "Spacebar",
33: "PageUp",
34: "PageDown",
35: "End",
36: "Home",
37: "Left",
38: "Up",
39: "Right",
40: "Down",
45: "Insert",
46: "Del",
91: "Meta",
93: "Meta",
48: "0",
49: "1",
50: "2",
51: "3",
52: "4",
53: "5",
54: "6",
55: "7",
56: "8",
57: "9",
65: "A",
66: "B",
67: "C",
68: "D",
69: "E",
70: "F",
71: "G",
72: "H",
73: "I",
74: "J",
75: "K",
76: "L",
77: "M",
78: "N",
79: "O",
80: "P",
81: "Q",
82: "R",
83: "S",
84: "T",
85: "U",
86: "V",
87: "W",
88: "X",
89: "Y",
90: "Z",
96: "0",
97: "1",
98: "2",
99: "3",
100: "4",
101: "5",
102: "6",
103: "7",
104: "8",
105: "9",
106: "Multiply",
107: "Add",
109: "Subtract",
110: "Decimal",
111: "Divide",
112: "F1",
113: "F2",
114: "F3",
115: "F4",
116: "F5",
117: "F6",
118: "F7",
119: "F8",
120: "F9",
121: "F10",
122: "F11",
123: "F12",
124: "F13",
125: "F14",
126: "F15",
127: "F16",
128: "F17",
129: "F18",
130: "F19",
131: "F20",
132: "F21",
133: "F22",
134: "F23",
135: "F24",
59: ";",
61: "=",
186: ";",
187: "=",
188: ",",
190: ".",
191: "/",
192: "`",
219: "[",
220: "\\",
221: "]",
222: "'"
};
Hotkeys.aliases = {
"escape": "esc",
"delete": "del",
"return": "enter",
"ctrl": "control",
"space": "spacebar",
"ins": "insert",
"cmd": "meta",
"command": "meta",
"wins": "meta",
"windows": "meta"
};
Hotkeys.normalize = function(shortcut) {
var i, j, key, keyname, keys, len;
keys = shortcut.toLowerCase().replace(/\s+/gi, "").split("+");
for (i = j = 0, len = keys.length; j < len; i = ++j) {
key = keys[i];
keys[i] = this.aliases[key] || key;
}
keyname = keys.pop();
keys.sort().push(keyname);
return keys.join("_");
};
Hotkeys.prototype.opts = {
el: document
};
Hotkeys.prototype._init = function() {
this.id = ++this.constructor.count;
this._map = {};
this._delegate = typeof this.opts.el === "string" ? document : this.opts.el;
return $(this._delegate).on("keydown.simple-hotkeys-" + this.id, this.opts.el, (function(_this) {
return function(e) {
var ref;
return (ref = _this._getHander(e)) != null ? ref.call(_this, e) : void 0;
};
})(this));
};
Hotkeys.prototype._getHander = function(e) {
var keyname, shortcut;
if (!(keyname = this.constructor.keyNameMap[e.which])) {
return;
}
shortcut = "";
if (e.altKey) {
shortcut += "alt_";
}
if (e.ctrlKey) {
shortcut += "control_";
}
if (e.metaKey) {
shortcut += "meta_";
}
if (e.shiftKey) {
shortcut += "shift_";
}
shortcut += keyname.toLowerCase();
return this._map[shortcut];
};
Hotkeys.prototype.respondTo = function(subject) {
if (typeof subject === 'string') {
return this._map[this.constructor.normalize(subject)] != null;
} else {
return this._getHander(subject) != null;
}
};
Hotkeys.prototype.add = function(shortcut, handler) {
this._map[this.constructor.normalize(shortcut)] = handler;
return this;
};
Hotkeys.prototype.remove = function(shortcut) {
delete this._map[this.constructor.normalize(shortcut)];
return this;
};
Hotkeys.prototype.destroy = function() {
$(this._delegate).off(".simple-hotkeys-" + this.id);
this._map = {};
return this;
};
return Hotkeys;
})(SimpleModule);
hotkeys = function(opts) {
return new Hotkeys(opts);
};
return hotkeys;
}));

View File

@@ -0,0 +1 @@
!function(a,b){"function"==typeof define&&define.amd?define("simple-hotkeys",["jquery","simple-module"],function(c,d){return a.hotkeys=b(c,d)}):"object"==typeof exports?module.exports=b(require("jquery"),require("simplemodule")):(a.simple=a.simple||{},a.simple.hotkeys=b(jQuery,SimpleModule))}(this,function(a,b){var c,d,e=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},f={}.hasOwnProperty;return c=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return e(c,b),c.count=0,c.keyNameMap={8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Spacebar",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",45:"Insert",46:"Del",91:"Meta",93:"Meta",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"Multiply",107:"Add",109:"Subtract",110:"Decimal",111:"Divide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",124:"F13",125:"F14",126:"F15",127:"F16",128:"F17",129:"F18",130:"F19",131:"F20",132:"F21",133:"F22",134:"F23",135:"F24",59:";",61:"=",186:";",187:"=",188:",",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},c.aliases={escape:"esc","delete":"del","return":"enter",ctrl:"control",space:"spacebar",ins:"insert",cmd:"meta",command:"meta",wins:"meta",windows:"meta"},c.normalize=function(a){var b,c,d,e,f,g;for(f=a.toLowerCase().replace(/\s+/gi,"").split("+"),b=c=0,g=f.length;g>c;b=++c)d=f[b],f[b]=this.aliases[d]||d;return e=f.pop(),f.sort().push(e),f.join("_")},c.prototype.opts={el:document},c.prototype._init=function(){return this.id=++this.constructor.count,this._map={},this._delegate="string"==typeof this.opts.el?document:this.opts.el,a(this._delegate).on("keydown.simple-hotkeys-"+this.id,this.opts.el,function(a){return function(b){var c;return null!=(c=a._getHander(b))?c.call(a,b):void 0}}(this))},c.prototype._getHander=function(a){var b,c;if(b=this.constructor.keyNameMap[a.which])return c="",a.altKey&&(c+="alt_"),a.ctrlKey&&(c+="control_"),a.metaKey&&(c+="meta_"),a.shiftKey&&(c+="shift_"),c+=b.toLowerCase(),this._map[c]},c.prototype.respondTo=function(a){return"string"==typeof a?null!=this._map[this.constructor.normalize(a)]:null!=this._getHander(a)},c.prototype.add=function(a,b){return this._map[this.constructor.normalize(a)]=b,this},c.prototype.remove=function(a){return delete this._map[this.constructor.normalize(a)],this},c.prototype.destroy=function(){return a(this._delegate).off(".simple-hotkeys-"+this.id),this._map={},this},c}(b),d=function(a){return new c(a)}});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,174 @@
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define('simple-module', ["jquery"], function ($) {
return (root.returnExportsGlobal = factory($));
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like enviroments that support module.exports,
// like Node.
module.exports = factory(require("jquery"));
} else {
root['SimpleModule'] = factory(jQuery);
}
}(this, function ($) {
var Module,
__slice = [].slice;
Module = (function() {
Module.extend = function(obj) {
var key, val, _ref;
if (!((obj != null) && typeof obj === 'object')) {
return;
}
for (key in obj) {
val = obj[key];
if (key !== 'included' && key !== 'extended') {
this[key] = val;
}
}
return (_ref = obj.extended) != null ? _ref.call(this) : void 0;
};
Module.include = function(obj) {
var key, val, _ref;
if (!((obj != null) && typeof obj === 'object')) {
return;
}
for (key in obj) {
val = obj[key];
if (key !== 'included' && key !== 'extended') {
this.prototype[key] = val;
}
}
return (_ref = obj.included) != null ? _ref.call(this) : void 0;
};
Module.connect = function(cls) {
if (typeof cls !== 'function') {
return;
}
if (!cls.pluginName) {
throw new Error('Module.connect: cannot connect plugin without pluginName');
return;
}
cls.prototype._connected = true;
if (!this._connectedClasses) {
this._connectedClasses = [];
}
this._connectedClasses.push(cls);
if (cls.pluginName) {
return this[cls.pluginName] = cls;
}
};
Module.prototype.opts = {};
function Module(opts) {
var cls, instance, instances, name, _base, _i, _len;
this.opts = $.extend({}, this.opts, opts);
(_base = this.constructor)._connectedClasses || (_base._connectedClasses = []);
instances = (function() {
var _i, _len, _ref, _results;
_ref = this.constructor._connectedClasses;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
cls = _ref[_i];
name = cls.pluginName.charAt(0).toLowerCase() + cls.pluginName.slice(1);
if (cls.prototype._connected) {
cls.prototype._module = this;
}
_results.push(this[name] = new cls());
}
return _results;
}).call(this);
if (this._connected) {
this.opts = $.extend({}, this.opts, this._module.opts);
} else {
this._init();
for (_i = 0, _len = instances.length; _i < _len; _i++) {
instance = instances[_i];
if (typeof instance._init === "function") {
instance._init();
}
}
}
this.trigger('initialized');
}
Module.prototype._init = function() {};
Module.prototype.on = function() {
var args, _ref;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
(_ref = $(this)).on.apply(_ref, args);
return this;
};
Module.prototype.one = function() {
var args, _ref;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
(_ref = $(this)).one.apply(_ref, args);
return this;
};
Module.prototype.off = function() {
var args, _ref;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
(_ref = $(this)).off.apply(_ref, args);
return this;
};
Module.prototype.trigger = function() {
var args, _ref;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
(_ref = $(this)).trigger.apply(_ref, args);
return this;
};
Module.prototype.triggerHandler = function() {
var args, _ref;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return (_ref = $(this)).triggerHandler.apply(_ref, args);
};
Module.prototype._t = function() {
var args, _ref;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return (_ref = this.constructor)._t.apply(_ref, args);
};
Module._t = function() {
var args, key, result, _ref;
key = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
result = ((_ref = this.i18n[this.locale]) != null ? _ref[key] : void 0) || '';
if (!(args.length > 0)) {
return result;
}
result = result.replace(/([^%]|^)%(?:(\d+)\$)?s/g, function(p0, p, position) {
if (position) {
return p + args[parseInt(position) - 1];
} else {
return p + args.shift();
}
});
return result.replace(/%%s/g, '%s');
};
Module.i18n = {
'zh-CN': {}
};
Module.locale = 'zh-CN';
return Module;
})();
return Module;
}));

View File

@@ -0,0 +1 @@
!function(a,b){"function"==typeof define&&define.amd?define("simple-module",["jquery"],function(c){return a.returnExportsGlobal=b(c)}):"object"==typeof exports?module.exports=b(require("jquery")):a.SimpleModule=b(jQuery)}(this,function(a){var b,c=[].slice;return b=function(){function b(b){var c,d,e,f,g,h,i;if(this.opts=a.extend({},this.opts,b),(g=this.constructor)._connectedClasses||(g._connectedClasses=[]),e=function(){var a,b,d,e;for(d=this.constructor._connectedClasses,e=[],a=0,b=d.length;b>a;a++)c=d[a],f=c.pluginName.charAt(0).toLowerCase()+c.pluginName.slice(1),c.prototype._connected&&(c.prototype._module=this),e.push(this[f]=new c);return e}.call(this),this._connected)this.opts=a.extend({},this.opts,this._module.opts);else for(this._init(),h=0,i=e.length;i>h;h++)d=e[h],"function"==typeof d._init&&d._init();this.trigger("initialized")}return b.extend=function(a){var b,c,d;if(null!=a&&"object"==typeof a){for(b in a)c=a[b],"included"!==b&&"extended"!==b&&(this[b]=c);return null!=(d=a.extended)?d.call(this):void 0}},b.include=function(a){var b,c,d;if(null!=a&&"object"==typeof a){for(b in a)c=a[b],"included"!==b&&"extended"!==b&&(this.prototype[b]=c);return null!=(d=a.included)?d.call(this):void 0}},b.connect=function(a){if("function"==typeof a){if(!a.pluginName)throw new Error("Module.connect: cannot connect plugin without pluginName");return a.prototype._connected=!0,this._connectedClasses||(this._connectedClasses=[]),this._connectedClasses.push(a),a.pluginName?this[a.pluginName]=a:void 0}},b.prototype.opts={},b.prototype._init=function(){},b.prototype.on=function(){var b,d;return b=1<=arguments.length?c.call(arguments,0):[],(d=a(this)).on.apply(d,b),this},b.prototype.one=function(){var b,d;return b=1<=arguments.length?c.call(arguments,0):[],(d=a(this)).one.apply(d,b),this},b.prototype.off=function(){var b,d;return b=1<=arguments.length?c.call(arguments,0):[],(d=a(this)).off.apply(d,b),this},b.prototype.trigger=function(){var b,d;return b=1<=arguments.length?c.call(arguments,0):[],(d=a(this)).trigger.apply(d,b),this},b.prototype.triggerHandler=function(){var b,d;return b=1<=arguments.length?c.call(arguments,0):[],(d=a(this)).triggerHandler.apply(d,b)},b.prototype._t=function(){var a,b;return a=1<=arguments.length?c.call(arguments,0):[],(b=this.constructor)._t.apply(b,a)},b._t=function(){var a,b,d,e;return b=arguments[0],a=2<=arguments.length?c.call(arguments,1):[],d=(null!=(e=this.i18n[this.locale])?e[b]:void 0)||"",a.length>0?(d=d.replace(/([^%]|^)%(?:(\d+)\$)?s/g,function(b,c,d){return d?c+a[parseInt(d)-1]:c+a.shift()}),d.replace(/%%s/g,"%s")):d},b.i18n={"zh-CN":{}},b.locale="zh-CN",b}()});

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,261 @@
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define('simple-uploader', ["jquery","simple-module"], function ($, SimpleModule) {
return (root['uploader'] = factory($, SimpleModule));
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory(require("jquery"),require("simplemodule"));
} else {
root.simple = root.simple || {};
root.simple['uploader'] = factory(jQuery,SimpleModule);
}
}(this, function ($, SimpleModule) {
var Uploader, uploader,
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; },
hasProp = {}.hasOwnProperty;
Uploader = (function(superClass) {
extend(Uploader, superClass);
function Uploader() {
return Uploader.__super__.constructor.apply(this, arguments);
}
Uploader.count = 0;
Uploader.prototype.opts = {
url: '',
params: null,
fileKey: 'upload_file',
connectionCount: 3
};
Uploader.prototype._init = function() {
this.files = [];
this.queue = [];
this.id = ++Uploader.count;
this.on('uploadcomplete', (function(_this) {
return function(e, file) {
_this.files.splice($.inArray(file, _this.files), 1);
if (_this.queue.length > 0 && _this.files.length < _this.opts.connectionCount) {
return _this.upload(_this.queue.shift());
} else {
return _this.uploading = false;
}
};
})(this));
return $(window).on('beforeunload.uploader-' + this.id, (function(_this) {
return function(e) {
if (!_this.uploading) {
return;
}
e.originalEvent.returnValue = _this._t('leaveConfirm');
return _this._t('leaveConfirm');
};
})(this));
};
Uploader.prototype.generateId = (function() {
var id;
id = 0;
return function() {
return id += 1;
};
})();
Uploader.prototype.upload = function(file, opts) {
var f, i, key, len;
if (opts == null) {
opts = {};
}
if (file == null) {
return;
}
if ($.isArray(file) || file instanceof FileList) {
for (i = 0, len = file.length; i < len; i++) {
f = file[i];
this.upload(f, opts);
}
} else if ($(file).is('input:file')) {
key = $(file).attr('name');
if (key) {
opts.fileKey = key;
}
this.upload($.makeArray($(file)[0].files), opts);
} else if (!file.id || !file.obj) {
file = this.getFile(file);
}
if (!(file && file.obj)) {
return;
}
$.extend(file, opts);
if (this.files.length >= this.opts.connectionCount) {
this.queue.push(file);
return;
}
if (this.triggerHandler('beforeupload', [file]) === false) {
return;
}
this.files.push(file);
this._xhrUpload(file);
return this.uploading = true;
};
Uploader.prototype.getFile = function(fileObj) {
var name, ref, ref1;
if (fileObj instanceof window.File || fileObj instanceof window.Blob) {
name = (ref = fileObj.fileName) != null ? ref : fileObj.name;
} else {
return null;
}
return {
id: this.generateId(),
url: this.opts.url,
params: this.opts.params,
fileKey: this.opts.fileKey,
name: name,
size: (ref1 = fileObj.fileSize) != null ? ref1 : fileObj.size,
ext: name ? name.split('.').pop().toLowerCase() : '',
obj: fileObj
};
};
Uploader.prototype._xhrUpload = function(file) {
var formData, k, ref, v;
formData = new FormData();
formData.append(file.fileKey, file.obj);
formData.append("original_filename", file.name);
if (file.params) {
ref = file.params;
for (k in ref) {
v = ref[k];
formData.append(k, v);
}
}
return file.xhr = $.ajax({
url: file.url,
data: formData,
processData: false,
contentType: false,
type: 'POST',
headers: {
'X-File-Name': encodeURIComponent(file.name)
},
xhr: function() {
var req;
req = $.ajaxSettings.xhr();
if (req) {
req.upload.onprogress = (function(_this) {
return function(e) {
return _this.progress(e);
};
})(this);
}
return req;
},
progress: (function(_this) {
return function(e) {
if (!e.lengthComputable) {
return;
}
return _this.trigger('uploadprogress', [file, e.loaded, e.total]);
};
})(this),
error: (function(_this) {
return function(xhr, status, err) {
return _this.trigger('uploaderror', [file, xhr, status]);
};
})(this),
success: (function(_this) {
return function(result) {
_this.trigger('uploadprogress', [file, file.size, file.size]);
_this.trigger('uploadsuccess', [file, result]);
return $(document).trigger('uploadsuccess', [file, result, _this]);
};
})(this),
complete: (function(_this) {
return function(xhr, status) {
return _this.trigger('uploadcomplete', [file, xhr.responseText]);
};
})(this)
});
};
Uploader.prototype.cancel = function(file) {
var f, i, len, ref;
if (!file.id) {
ref = this.files;
for (i = 0, len = ref.length; i < len; i++) {
f = ref[i];
if (f.id === file * 1) {
file = f;
break;
}
}
}
this.trigger('uploadcancel', [file]);
if (file.xhr) {
file.xhr.abort();
}
return file.xhr = null;
};
Uploader.prototype.readImageFile = function(fileObj, callback) {
var fileReader, img;
if (!$.isFunction(callback)) {
return;
}
img = new Image();
img.onload = function() {
return callback(img);
};
img.onerror = function() {
return callback();
};
if (window.FileReader && FileReader.prototype.readAsDataURL && /^image/.test(fileObj.type)) {
fileReader = new FileReader();
fileReader.onload = function(e) {
return img.src = e.target.result;
};
return fileReader.readAsDataURL(fileObj);
} else {
return callback();
}
};
Uploader.prototype.destroy = function() {
var file, i, len, ref;
this.queue.length = 0;
ref = this.files;
for (i = 0, len = ref.length; i < len; i++) {
file = ref[i];
this.cancel(file);
}
$(window).off('.uploader-' + this.id);
return $(document).off('.uploader-' + this.id);
};
Uploader.i18n = {
'zh-CN': {
leaveConfirm: '正在上传文件,如果离开上传会自动取消'
}
};
Uploader.locale = 'zh-CN';
return Uploader;
})(SimpleModule);
uploader = function(opts) {
return new Uploader(opts);
};
return uploader;
}));

View File

@@ -0,0 +1 @@
!function(a,b){"function"==typeof define&&define.amd?define("simple-uploader",["jquery","simple-module"],function(c,d){return a.uploader=b(c,d)}):"object"==typeof exports?module.exports=b(require("jquery"),require("simplemodule")):(a.simple=a.simple||{},a.simple.uploader=b(jQuery,SimpleModule))}(this,function(a,b){var c,d,e=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},f={}.hasOwnProperty;return c=function(b){function c(){return c.__super__.constructor.apply(this,arguments)}return e(c,b),c.count=0,c.prototype.opts={url:"",params:null,fileKey:"upload_file",connectionCount:3},c.prototype._init=function(){return this.files=[],this.queue=[],this.id=++c.count,this.on("uploadcomplete",function(b){return function(c,d){return b.files.splice(a.inArray(d,b.files),1),b.queue.length>0&&b.files.length<b.opts.connectionCount?b.upload(b.queue.shift()):b.uploading=!1}}(this)),a(window).on("beforeunload.uploader-"+this.id,function(a){return function(b){return a.uploading?(b.originalEvent.returnValue=a._t("leaveConfirm"),a._t("leaveConfirm")):void 0}}(this))},c.prototype.generateId=function(){var a;return a=0,function(){return a+=1}}(),c.prototype.upload=function(b,c){var d,e,f,g;if(null==c&&(c={}),null!=b){if(a.isArray(b)||b instanceof FileList)for(e=0,g=b.length;g>e;e++)d=b[e],this.upload(d,c);else a(b).is("input:file")?(f=a(b).attr("name"),f&&(c.fileKey=f),this.upload(a.makeArray(a(b)[0].files),c)):b.id&&b.obj||(b=this.getFile(b));if(b&&b.obj){if(a.extend(b,c),this.files.length>=this.opts.connectionCount)return void this.queue.push(b);if(this.triggerHandler("beforeupload",[b])!==!1)return this.files.push(b),this._xhrUpload(b),this.uploading=!0}}},c.prototype.getFile=function(a){var b,c,d;return a instanceof window.File||a instanceof window.Blob?(b=null!=(c=a.fileName)?c:a.name,{id:this.generateId(),url:this.opts.url,params:this.opts.params,fileKey:this.opts.fileKey,name:b,size:null!=(d=a.fileSize)?d:a.size,ext:b?b.split(".").pop().toLowerCase():"",obj:a}):null},c.prototype._xhrUpload=function(b){var c,d,e,f;if(c=new FormData,c.append(b.fileKey,b.obj),c.append("original_filename",b.name),b.params){e=b.params;for(d in e)f=e[d],c.append(d,f)}return b.xhr=a.ajax({url:b.url,data:c,processData:!1,contentType:!1,type:"POST",headers:{"X-File-Name":encodeURIComponent(b.name)},xhr:function(){var b;return b=a.ajaxSettings.xhr(),b&&(b.upload.onprogress=function(a){return function(b){return a.progress(b)}}(this)),b},progress:function(a){return function(c){return c.lengthComputable?a.trigger("uploadprogress",[b,c.loaded,c.total]):void 0}}(this),error:function(a){return function(c,d,e){return a.trigger("uploaderror",[b,c,d])}}(this),success:function(c){return function(d){return c.trigger("uploadprogress",[b,b.size,b.size]),c.trigger("uploadsuccess",[b,d]),a(document).trigger("uploadsuccess",[b,d,c])}}(this),complete:function(a){return function(c,d){return a.trigger("uploadcomplete",[b,c.responseText])}}(this)})},c.prototype.cancel=function(a){var b,c,d,e;if(!a.id)for(e=this.files,c=0,d=e.length;d>c;c++)if(b=e[c],b.id===1*a){a=b;break}return this.trigger("uploadcancel",[a]),a.xhr&&a.xhr.abort(),a.xhr=null},c.prototype.readImageFile=function(b,c){var d,e;if(a.isFunction(c))return e=new Image,e.onload=function(){return c(e)},e.onerror=function(){return c()},window.FileReader&&FileReader.prototype.readAsDataURL&&/^image/.test(b.type)?(d=new FileReader,d.onload=function(a){return e.src=a.target.result},d.readAsDataURL(b)):c()},c.prototype.destroy=function(){var b,c,d,e;for(this.queue.length=0,e=this.files,c=0,d=e.length;d>c;c++)b=e[c],this.cancel(b);return a(window).off(".uploader-"+this.id),a(document).off(".uploader-"+this.id)},c.i18n={"zh-CN":{leaveConfirm:"正在上传文件,如果离开上传会自动取消"}},c.locale="zh-CN",c}(b),d=function(a){return new c(a)}});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,696 @@
@charset "UTF-8";
$simditor-button-height: 40px;
$simditor-button-width: 46px;
.simditor {
position: relative;
border: 1px solid #c9d8db;
.simditor-wrapper {
position: relative;
background: #ffffff;
& > textarea {
display: none !important;
width: 100%;
box-sizing: border-box;
font-family: monaco;
font-size: 16px;
line-height: 1.6;
border: none;
padding: 22px 15px 40px;
min-height: 300px;
outline: none;
background: transparent;
resize: none;
}
.simditor-placeholder {
display: none;
position: absolute;
left: 0;
z-index: 0;
padding: 22px 15px;
font-size: 16px;
font-family: arial, sans-serif;
line-height: 1.5;
color: #999999;
background: transparent;
}
&.toolbar-floating {
.simditor-toolbar {
position: fixed;
top: 0;
z-index: 10;
box-shadow: 0 0 6px rgba(0,0,0,0.1);
}
}
.simditor-image-loading {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 2;
.progress {
width: 100%;
height: 100%;
background: rgba(0,0,0,0.4);
position: absolute;
bottom: 0;
left: 0;
}
}
}
.simditor-body {
padding: 22px 15px 40px;
min-height: 300px;
outline: none;
cursor: text;
position: relative;
z-index: 1;
background: transparent;
a.selected {
background: #b3d4fd;
}
a.simditor-mention {
cursor: pointer;
}
.simditor-table {
position: relative;
&.resizing {
cursor: col-resize;
}
.simditor-resize-handle {
position: absolute;
left: 0;
top: 0;
width: 10px;
height: 100%;
cursor: col-resize;
}
}
pre {
/*min-height: 28px;*/
box-sizing: border-box;
-moz-box-sizing: border-box;
word-wrap: break-word!important;
white-space: pre-wrap!important;
}
img {
cursor: pointer;
&.selected {
box-shadow: 0 0 0 4px #cccccc;
}
}
}
.simditor-paste-bin {
position: fixed;
bottom: 10px;
right: 10px;
width: 1px;
height: 20px;
font-size: 1px;
line-height: 1px;
overflow: hidden;
padding: 0;
margin: 0;
opacity: 0;
-webkit-user-select: text;
}
.simditor-toolbar {
border-bottom: 1px solid #eeeeee;
background: #ffffff;
width: 100%;
& > ul {
margin: 0;
padding: 0 0 0 6px;
list-style: none;
& > li {
position: relative;
display: inline-block;
font-size: 0;
& > span.separator {
display: inline-block;
background: #cfcfcf;
width: 1px;
height: 18px;
margin: ($simditor-button-height - 18px) / 2 15px;
vertical-align: middle;
}
& > .toolbar-item {
display: inline-block;
width: $simditor-button-width;
height: $simditor-button-height;
outline: none;
color: #333333;
font-size: 15px;
line-height: $simditor-button-height;
vertical-align: middle;
text-align: center;
text-decoration: none;
span {
opacity: 0.6;
&.simditor-icon {
display: inline;
line-height: normal;
}
}
&:hover span {
opacity: 1;
}
&.active {
background: #eeeeee;
span {
opacity: 1;
}
}
&.disabled {
cursor: default;
span {
opacity: 0.3;
}
}
&.toolbar-item-title {
span:before {
content: "H";
font-size: 19px;
font-weight: bold;
font-family: 'Times New Roman';
}
&.active-h1 span:before {
content: 'H1';
font-size: 18px;
}
&.active-h2 span:before {
content: 'H2';
font-size: 18px;
}
&.active-h3 span:before {
content: 'H3';
font-size: 18px;
}
}
&.toolbar-item-image {
position: relative;
overflow: hidden;
& > input[type=file] {
position: absolute;
right: 0px;
top: 0px;
opacity: 0;
font-size: 100px;
cursor: pointer;
}
}
}
&.menu-on {
.toolbar-item {
position: relative;
z-index: 20;
background: #ffffff;
box-shadow: 0 1px 4px rgba(0,0,0,0.3);
span {
opacity: 1;
}
}
.toolbar-menu {
display: block;
}
}
}
}
.toolbar-menu {
display: none;
position: absolute;
top: $simditor-button-height;
left: 0;
z-index: 21;
background: #ffffff;
text-align: left;
box-shadow: 0 0 4px rgba(0,0,0,0.3);
&:before {
content: '';
display: block;
width: $simditor-button-width;
height: 4px;
background: #ffffff;
position: absolute;
top: -3px;
left: 0;
}
ul {
min-width: 160px;
list-style: none;
margin: 0;
padding: 10px 1px;
& > li {
.menu-item {
display: block;
font-size:16px;
line-height: 2em;
padding: 0 10px;
text-decoration: none;
color: #666666;
&:hover {
background: #f6f6f6;
}
&.menu-item-h1 {
font-size: 24px;
color: #333333;
}
&.menu-item-h2 {
font-size: 22px;
color: #333333;
}
&.menu-item-h3 {
font-size: 20px;
color: #333333;
}
&.menu-item-h4 {
font-size: 18px;
color: #333333;
}
&.menu-item-h5 {
font-size: 16px;
color: #333333;
}
}
.separator {
display: block;
border-top: 1px solid #cccccc;
height: 0;
line-height: 0;
font-size: 0;
margin: 6px 0;
}
}
}
&.toolbar-menu-color {
width: 96px;
.color-list {
height: 40px;
margin: 10px 6px 6px 10px;
padding: 0;
min-width: 0;
li {
float: left;
margin: 0 4px 4px 0;
.font-color {
display: block;
width: 16px;
height: 16px;
background: #dfdfdf;
border-radius: 2px;
&:hover {
opacity: 0.8;
}
&.font-color-default {
background: #333333;
}
}
$font-colors: #E33737 #e28b41 #c8a732 #209361 #418caf #aa8773 #999999;
$i: 1;
@each $color in $font-colors {
.font-color-#{$i} {
background: $color;
}
$i: $i + 1;
}
}
}
}
&.toolbar-menu-table {
.menu-create-table {
background: #ffffff;
padding: 1px;
table {
border: none;
border-collapse: collapse;
border-spacing: 0;
table-layout: fixed;
td {
padding: 0;
cursor: pointer;
&:before {
width: 16px;
height: 16px;
border: 1px solid #ffffff;
background: #f3f3f3;
display: block;
content: ''
}
&.selected:before {
background: #cfcfcf;
}
}
}
}
.menu-edit-table {
display: none;
ul {
li {
white-space: nowrap;
}
}
}
}
&.toolbar-menu-image {
.menu-item-upload-image {
position: relative;
overflow: hidden;
input[type=file] {
position: absolute;
right: 0px;
top: 0px;
opacity: 0;
font-size: 100px;
cursor: pointer;
}
}
}
&.toolbar-menu-alignment {
width: 100%;
ul {
min-width: 100%;
}
.menu-item {
text-align: center;
}
}
}
}
.simditor-popover {
display: none;
padding: 5px 8px 0;
background: #ffffff;
box-shadow: 0 1px 4px rgba(0,0,0,0.4);
border-radius: 2px;
position: absolute;
z-index: 2;
.settings-field {
margin: 0 0 5px 0;
font-size: 12px;
height: 25px;
line-height: 25px;
label {
display: inline-block;
margin: 0 5px 0 0;
}
input[type=text] {
display: inline-block;
width: 200px;
box-sizing: border-box;
font-size: 12px;
&.image-size {
width: 83px;
}
}
.times {
display: inline-block;
width: 26px;
font-size: 12px;
text-align: center;
}
}
&.link-popover .btn-unlink,
&.image-popover .btn-upload,
&.image-popover .btn-restore {
display: inline-block;
margin: 0 0 0 5px;
color: #333333;
font-size: 14px;
outline: 0;
span {
opacity: 0.6;
}
&:hover span {
opacity: 1;
}
}
&.image-popover .btn-upload {
position: relative;
display: inline-block;
overflow: hidden;
vertical-align: middle;
input[type=file] {
position: absolute;
right: 0px;
top: 0px;
opacity: 0;
height: 100%;
width: 28px;
}
}
}
&.simditor-mobile {
.simditor-wrapper.toolbar-floating .simditor-toolbar {
position: absolute;
top: 0;
z-index: 10;
box-shadow: 0 0 6px rgba(0,0,0,0.1);
}
}
}
.simditor .simditor-body, .editor-style {
font-size: 16px;
font-family: arial, sans-serif;
line-height: 1.6;
color: #333;
outline: none;
word-wrap: break-word;
& > :first-child {
margin-top: 0!important;
}
a{ color: #4298BA; text-decoration: none; word-break: break-all;}
a:visited{ color: #4298BA; }
a:hover{ color: #0F769F; }
a:active{ color:#9E792E; }
a:hover, a:active{ outline: 0; }
h1,h2,h3,h4,h5,h6 {
font-weight: normal;
margin: 40px 0 20px;
color: #000000;
}
h1 { font-size: 24px; }
h2 { font-size: 22px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 16px; }
p, div {
word-wrap: break-word;
margin: 0 0 15px 0;
color: #333;
word-wrap: break-word;
}
b, strong {
font-weight: bold;
}
i, em {
font-style: italic;
}
u {
text-decoration: underline;
}
strike, del {
text-decoration: line-through;
}
ul, ol {
list-style:disc outside none;
margin: 15px 0;
padding: 0 0 0 40px;
line-height: 1.6;
ul, ol {
padding-left: 30px;
}
ul {
list-style: circle outside none;
ul {
list-style: square outside none;
}
}
}
ol {
list-style:decimal;
}
blockquote {
border-left: 6px solid #ddd;
padding: 5px 0 5px 10px;
margin: 15px 0 15px 15px;
& > :first-child {
margin-top: 0;
}
}
code {
display: inline-block;
padding: 0 4px;
margin: 0 5px;
background: #eeeeee;
border-radius: 3px;
font-size: 13px;
font-family: 'monaco', 'Consolas', "Liberation Mono", Courier, monospace;
}
pre {
padding: 10px 5px 10px 10px;
margin: 15px 0;
display: block;
line-height: 18px;
background: #F0F0F0;
border-radius: 3px;
font-size:13px;
font-family: 'monaco', 'Consolas', "Liberation Mono", Courier, monospace;
white-space: pre;
word-wrap: normal;
overflow-x: auto;
code {
display: block;
padding: 0;
margin: 0;
background: none;
border-radius: 0;
}
}
hr {
display: block;
height: 0px;
border: 0;
border-top: 1px solid #ccc;
margin: 15px 0;
padding: 0;
}
table {
width: 100%;
table-layout: fixed;
border-collapse: collapse;
border-spacing: 0;
margin: 15px 0;
thead {
background-color: #f9f9f9;
}
td, th {
min-width: 40px;
height: 30px;
border: 1px solid #ccc;
vertical-align: top;
padding: 2px 4px;
text-align: left;
box-sizing: border-box;
&.active {
background-color: #ffffee;
}
}
}
img {
margin: 0 5px;
vertical-align: middle;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
@charset "UTF-8";
@import 'fonticon';
@import 'editor';