diff --git a/Gemfile b/Gemfile index 66dff8d1..80ac417b 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,5 @@ source 'https://rubygems.org' gem 'github-pages' gem 'sass' +gem 'nokogiri' +gem 'redcarpet' diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 6d13c4fc..9bbdcc7f 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -92,7 +92,7 @@ module.exports = (grunt) -> amd: ['jquery', 'simple-module', 'simple-hotkeys', 'simple-uploader'] cjs: ['jquery', 'simple-module', 'simple-hotkeys', 'simple-uploader'] global: - items: ['jQuery', 'SimpleModule', 'simple.hotkeys', 'simple.uploader'] + items: ['jQuery', 'SimpleModule', 'simpleHotkeys', 'simpleUploader'] prefix: '' copy: diff --git a/bower.json b/bower.json index 2ba7a192..ca697211 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "simditor", - "version": "2.3.6", + "version": "2.3.6-next2", "homepage": "http://simditor.tower.im/", "authors": [ "farthinker " diff --git a/lib/simditor.js b/lib/simditor.js index 80bd66ba..1db22820 100644 --- a/lib/simditor.js +++ b/lib/simditor.js @@ -1,7 +1,7 @@ /*! -* Simditor v2.3.6 +* Simditor v2.3.6-next2 * http://simditor.tower.im/ -* 2015-12-21 +* 2017-08-22 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { @@ -15,7 +15,7 @@ // like Node. module.exports = factory(require("jquery"),require("simple-module"),require("simple-hotkeys"),require("simple-uploader")); } else { - root['Simditor'] = factory(jQuery,SimpleModule,simple.hotkeys,simple.uploader); + root['Simditor'] = factory(root["jQuery"],root["SimpleModule"],root["simpleHotkeys"],root["simpleUploader"]); } }(this, function ($, SimpleModule, simpleHotkeys, simpleUploader) { @@ -2670,10 +2670,12 @@ Simditor.i18n = { 'image': '插入图片', 'externalImage': '外链图片', 'uploadImage': '上传图片', - 'uploadFailed': '上传失败了', + 'uploadFailed': '图片上传失败了', 'uploadError': '上传出错了', 'imageUrl': '图片地址', 'imageSize': '图片尺寸', + 'imageResponse': '自适应', + 'imageOrigin': '原图大小', 'imageAlt': '图片描述', 'restoreImageSize': '还原图片尺寸', 'uploading': '正在上传', @@ -2727,6 +2729,8 @@ Simditor.i18n = { 'uploadError': 'Error occurs during upload', 'imageUrl': 'Url', 'imageSize': 'Size', + 'imageResponse': 'Response', + 'imageOrigin': 'Origin', 'imageAlt': 'Alt', 'restoreImageSize': 'Restore Origin Size', 'uploading': 'Uploading', @@ -4336,7 +4340,7 @@ ImageButton = (function(superClass) { type: 'file', title: _this._t('uploadImage'), multiple: true, - accept: 'image/*' + accept: 'image/gif,image/jpeg,image/jpg,image/png' }).appendTo($uploadItem); }; })(this); @@ -4438,6 +4442,8 @@ ImageButton = (function(superClass) { msg = result.msg || _this._t('uploadFailed'); alert(msg); img_path = _this.defaultImage; + } else if (_this.editor.opts.upload.buildResultPath) { + img_path = _this.editor.opts.upload.buildResultPath(result); } else { img_path = result.file_path; } @@ -4544,8 +4550,6 @@ ImageButton = (function(superClass) { height = img.height; $img.attr({ src: src, - width: width, - height: height, 'data-image-size': width + ',' + height }).removeClass('loading'); if ($img.hasClass('uploading')) { @@ -4621,13 +4625,16 @@ ImagePopover = (function(superClass) { }; ImagePopover.prototype.render = function() { - var tpl; - tpl = ""; + var random, tpl; + random = '' + Math.random(); + tpl = ""; this.el.addClass('image-popover').append(tpl); this.srcEl = this.el.find('.image-src'); this.widthEl = this.el.find('#image-width'); this.heightEl = this.el.find('#image-height'); this.altEl = this.el.find('#image-alt'); + this.widthResponse = this.el.find('#imageSize-response'); + this.widthOrigin = this.el.find('#imageSize-origin'); this.srcEl.on('keydown', (function(_this) { return function(e) { var range; @@ -4651,6 +4658,12 @@ ImagePopover = (function(superClass) { return _this.el.data('popover').refresh(); }; })(this)); + this.el.find('[name^=imageSize]').on('change', (function(_this) { + return function(e) { + _this._resizeImg($(e.currentTarget)); + return _this.el.data('popover').refresh(); + }; + })(this)); this.el.find('.image-size').on('keyup', (function(_this) { return function(e) { var inputEl; @@ -4732,7 +4745,7 @@ ImagePopover = (function(superClass) { type: 'file', title: _this._t('uploadImage'), multiple: true, - accept: 'image/*' + accept: 'image/gif,image/jpeg,image/jpg,image/png' }).appendTo($uploadBtn); }; })(this); @@ -4752,41 +4765,70 @@ ImagePopover = (function(superClass) { }; ImagePopover.prototype._resizeImg = function(inputEl, onlySetVal) { - var height, value, width; + var value; if (onlySetVal == null) { onlySetVal = false; } - value = inputEl.val() * 1; - if (!(this.target && ($.isNumeric(value) || value < 0))) { + + /* 这是旧的 + value = inputEl.val() * 1 + return unless @target and ($.isNumeric(value) or value < 0) + + if inputEl.is @widthEl + width = value + height = @height * value / @width + @heightEl.val height + else + height = value + width = @width * value / @height + @widthEl.val width + + unless onlySetVal + @target.attr + width: width + height: height + @editor.trigger 'valuechanged' + */ + value = inputEl.val(); + if (!this.target) { return; } - if (inputEl.is(this.widthEl)) { - width = value; - height = this.height * value / this.width; - this.heightEl.val(height); + if ('origin' === value) { + this.target.css({ + width: 'auto' + }); + this.target.attr({ + width: 'auto' + }); } else { - height = value; - width = this.width * value / this.height; - this.widthEl.val(width); - } - if (!onlySetVal) { + this.target.css({ + width: '100%' + }); this.target.attr({ - width: width, - height: height + width: '100%' }); - return this.editor.trigger('valuechanged'); } + this.editor.trigger('valuechanged'); }; ImagePopover.prototype._restoreImg = function() { - var ref, size; - size = ((ref = this.target.data('image-size')) != null ? ref.split(",") : void 0) || [this.width, this.height]; - this.target.attr({ - width: size[0] * 1, + + /* 这是旧的 + size = @target.data('image-size')?.split(",") || [@width, @height] + @target.attr + width: size[0] * 1 height: size[1] * 1 + @widthEl.val(size[0]) + @heightEl.val(size[1]) + + @editor.trigger 'valuechanged' + */ + this.target.attr({ + width: 'auto' + }); + this.target.css({ + width: 'auto' }); - this.widthEl.val(size[0]); - this.heightEl.val(size[1]); return this.editor.trigger('valuechanged'); }; @@ -4802,15 +4844,23 @@ ImagePopover = (function(superClass) { } return this.button.loadImage(this.target, src, (function(_this) { return function(img) { - var blob; + var blob, ref; if (!img) { return; } if (_this.active) { - _this.width = img.width; - _this.height = img.height; - _this.widthEl.val(_this.width); - _this.heightEl.val(_this.height); + + /* 这是旧的 + @width = img.width + @height = img.height + + @widthEl.val @width + @heightEl.val @height + */ + _this.widthResponse.attr('checked', true); + if ((ref = _this.widthResponse[0]) != null) { + ref.checked = true; + } } if (/^data:image/.test(src)) { blob = _this.editor.util.dataURLtoBlob(src); @@ -4847,6 +4897,29 @@ ImagePopover = (function(superClass) { } }; + ImagePopover.prototype.show = function() { + var $img, args, ref, ref1, ref2; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + ImagePopover.__super__.show.apply(this, args); + $img = this.target; + this.width = $img.attr('width') || $img.width(); + this.alt = $img.attr('alt'); + if ($img.hasClass('uploading')) { + this.srcEl.val(this._t('uploading')).prop('disabled', true); + this.widthResponse.attr('checked', true); + return (ref = this.widthResponse[0]) != null ? ref.checked = true : void 0; + } else { + this.srcEl.val($img.attr('src')).prop('disabled', false); + if (('' + this.width).endsWith('%')) { + this.widthResponse.attr('checked', true); + return (ref1 = this.widthResponse[0]) != null ? ref1.checked = true : void 0; + } else { + this.widthOrigin.attr('checked', true); + return (ref2 = this.widthOrigin[0]) != null ? ref2.checked = true : void 0; + } + } + }; + return ImagePopover; })(Popover); diff --git a/package.json b/package.json index bacfab55..9f16a8ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simditor", - "version": "2.3.6", + "version": "2.3.6-next2", "description": "A simple online editor", "keywords": "editor simditor", "repository": { @@ -19,25 +19,26 @@ "homepage": "http://simditor.tower.im", "dependencies": { "jquery": "~2.1.4", - "simple-hotkeys": "~1.0.3", - "simple-uploader": "~2.0.7", - "simple-module": "~2.0.6" + "simple-hotkeys": "github:pchange/simple-hotkeys#0ae78e4e3d326af65052bb2de009b6d61b450b51", + "simple-module": "~2.0.6", + "simple-uploader": "github:pchange/simple-uploader#e6e2bf82e376158703953c36dac81bb6cc02ab95" }, "devDependencies": { + "express": "~3.3.4", "grunt": "0.x", - "grunt-contrib-sass": "0.x", - "grunt-contrib-watch": "0.x", + "grunt-banner": "0.3.x", + "grunt-contrib-clean": "0.x", "grunt-contrib-coffee": "0.x", - "grunt-contrib-copy": "0.x", - "grunt-contrib-uglify": "0.x", "grunt-contrib-compress": "0.x", - "grunt-contrib-clean": "0.x", + "grunt-contrib-copy": "0.x", "grunt-contrib-jasmine": "0.x", - "grunt-jekyll": "0.x", - "grunt-umd": "2.3.x", - "grunt-express": "1.4.0", - "grunt-banner": "0.3.x", + "grunt-contrib-sass": "0.x", + "grunt-contrib-uglify": "0.x", + "grunt-contrib-watch": "0.x", "grunt-curl": "2.1.x", - "express": "~3.3.4" + "grunt-express": "1.4.0", + "grunt-jekyll": "0.x", + "grunt-parallel": "^0.5.1", + "grunt-umd": "2.3.x" } } diff --git a/site/assets/_coffee/page-demo.coffee b/site/assets/_coffee/page-demo.coffee index 2956280b..14c7e0d2 100644 --- a/site/assets/_coffee/page-demo.coffee +++ b/site/assets/_coffee/page-demo.coffee @@ -12,6 +12,27 @@ $ -> pasteImage: true defaultImage: 'assets/images/image.png' upload: if location.search == '?upload' then {url: '/upload'} else false + upload: { + url: if 'https:' is location.protocol then 'https://up.qbox.me/' else 'http://up.qiniu.com' + connectionCount: 3 + leaveConfirm: '还在上传图片,确定要离开吗?' + buildResultPath: () -> + console.log 'buildResultPath result', retust + return '' + params: () -> + console.log 'params' + request = new XMLHttpRequest() + request.open('GET', 'https://api.github.com', false) + request.send(null) + window.r1 = request; + + if request.status is 200 + console.log(request.responseText) + console.log 'params sync request' + return { + a: request.responseText, + } + } $preview = $('#preview') if $preview.length > 0 diff --git a/site/assets/scripts/hotkeys.js b/site/assets/scripts/hotkeys.js index de20b918..89671304 100644 --- a/site/assets/scripts/hotkeys.js +++ b/site/assets/scripts/hotkeys.js @@ -2,7 +2,7 @@ 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)); + return (root['simpleHotkeys'] = factory($, SimpleModule)); }); } else if (typeof exports === 'object') { // Node. Does not work with strict CommonJS, but @@ -11,11 +11,11 @@ module.exports = factory(require("jquery"),require("simple-module")); } else { root.simple = root.simple || {}; - root.simple['hotkeys'] = factory(jQuery,SimpleModule); + root['simpleHotkeys'] = factory(root["jQuery"],root["SimpleModule"]); } }(this, function ($, SimpleModule) { -var Hotkeys, hotkeys, +var Hotkeys, simpleHotkeys, 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; @@ -231,11 +231,11 @@ Hotkeys = (function(superClass) { })(SimpleModule); -hotkeys = function(opts) { +simpleHotkeys = function(opts) { return new Hotkeys(opts); }; -return hotkeys; +return simpleHotkeys; })); diff --git a/site/assets/scripts/page-demo.js b/site/assets/scripts/page-demo.js index 7b4d69ff..55cbffd8 100644 --- a/site/assets/scripts/page-demo.js +++ b/site/assets/scripts/page-demo.js @@ -15,7 +15,31 @@ defaultImage: 'assets/images/image.png', upload: location.search === '?upload' ? { url: '/upload' - } : false + } : false, + upload: { + url: 'https:' === location.protocol ? 'https://up.qbox.me/' : 'http://up.qiniu.com', + connectionCount: 3, + leaveConfirm: '还在上传图片,确定要离开吗?', + buildResultPath: function() { + console.log('buildResultPath result', retust); + return ''; + }, + params: function() { + var request; + console.log('params'); + request = new XMLHttpRequest(); + request.open('GET', 'https://api.github.com', false); + request.send(null); + window.r1 = request; + if (request.status === 200) { + console.log(request.responseText); + } + console.log('params sync request'); + return { + a: request.responseText + }; + } + } }); $preview = $('#preview'); if ($preview.length > 0) { diff --git a/site/assets/scripts/simditor.js b/site/assets/scripts/simditor.js index 0e066624..aace712f 100644 --- a/site/assets/scripts/simditor.js +++ b/site/assets/scripts/simditor.js @@ -10,7 +10,7 @@ // like Node. module.exports = factory(require("jquery"),require("simple-module"),require("simple-hotkeys"),require("simple-uploader")); } else { - root['Simditor'] = factory(jQuery,SimpleModule,simple.hotkeys,simple.uploader); + root['Simditor'] = factory(root["jQuery"],root["SimpleModule"],root["simpleHotkeys"],root["simpleUploader"]); } }(this, function ($, SimpleModule, simpleHotkeys, simpleUploader) { @@ -2665,10 +2665,12 @@ Simditor.i18n = { 'image': '插入图片', 'externalImage': '外链图片', 'uploadImage': '上传图片', - 'uploadFailed': '上传失败了', + 'uploadFailed': '图片上传失败了', 'uploadError': '上传出错了', 'imageUrl': '图片地址', 'imageSize': '图片尺寸', + 'imageResponse': '自适应', + 'imageOrigin': '原图大小', 'imageAlt': '图片描述', 'restoreImageSize': '还原图片尺寸', 'uploading': '正在上传', @@ -2679,8 +2681,8 @@ Simditor.i18n = { 'linkText': '链接文字', 'linkUrl': '链接地址', 'linkTarget': '打开方式', - 'openLinkInCurrentWindow': '在新窗口中打开', - 'openLinkInNewWindow': '在当前窗口中打开', + 'openLinkInCurrentWindow': '在当前窗口中打开', + 'openLinkInNewWindow': '在新窗口中打开', 'removeLink': '移除链接', 'ol': '有序列表', 'ul': '无序列表', @@ -2722,6 +2724,8 @@ Simditor.i18n = { 'uploadError': 'Error occurs during upload', 'imageUrl': 'Url', 'imageSize': 'Size', + 'imageResponse': 'Response', + 'imageOrigin': 'Origin', 'imageAlt': 'Alt', 'restoreImageSize': 'Restore Origin Size', 'uploading': 'Uploading', @@ -4331,7 +4335,7 @@ ImageButton = (function(superClass) { type: 'file', title: _this._t('uploadImage'), multiple: true, - accept: 'image/*' + accept: 'image/gif,image/jpeg,image/jpg,image/png' }).appendTo($uploadItem); }; })(this); @@ -4433,6 +4437,8 @@ ImageButton = (function(superClass) { msg = result.msg || _this._t('uploadFailed'); alert(msg); img_path = _this.defaultImage; + } else if (_this.editor.opts.upload.buildResultPath) { + img_path = _this.editor.opts.upload.buildResultPath(result); } else { img_path = result.file_path; } @@ -4539,8 +4545,6 @@ ImageButton = (function(superClass) { height = img.height; $img.attr({ src: src, - width: width, - height: height, 'data-image-size': width + ',' + height }).removeClass('loading'); if ($img.hasClass('uploading')) { @@ -4616,13 +4620,16 @@ ImagePopover = (function(superClass) { }; ImagePopover.prototype.render = function() { - var tpl; - tpl = ""; + var random, tpl; + random = '' + Math.random(); + tpl = ""; this.el.addClass('image-popover').append(tpl); this.srcEl = this.el.find('.image-src'); this.widthEl = this.el.find('#image-width'); this.heightEl = this.el.find('#image-height'); this.altEl = this.el.find('#image-alt'); + this.widthResponse = this.el.find('#imageSize-response'); + this.widthOrigin = this.el.find('#imageSize-origin'); this.srcEl.on('keydown', (function(_this) { return function(e) { var range; @@ -4646,6 +4653,12 @@ ImagePopover = (function(superClass) { return _this.el.data('popover').refresh(); }; })(this)); + this.el.find('[name^=imageSize]').on('change', (function(_this) { + return function(e) { + _this._resizeImg($(e.currentTarget)); + return _this.el.data('popover').refresh(); + }; + })(this)); this.el.find('.image-size').on('keyup', (function(_this) { return function(e) { var inputEl; @@ -4727,7 +4740,7 @@ ImagePopover = (function(superClass) { type: 'file', title: _this._t('uploadImage'), multiple: true, - accept: 'image/*' + accept: 'image/gif,image/jpeg,image/jpg,image/png' }).appendTo($uploadBtn); }; })(this); @@ -4747,41 +4760,70 @@ ImagePopover = (function(superClass) { }; ImagePopover.prototype._resizeImg = function(inputEl, onlySetVal) { - var height, value, width; + var value; if (onlySetVal == null) { onlySetVal = false; } - value = inputEl.val() * 1; - if (!(this.target && ($.isNumeric(value) || value < 0))) { + + /* 这是旧的 + value = inputEl.val() * 1 + return unless @target and ($.isNumeric(value) or value < 0) + + if inputEl.is @widthEl + width = value + height = @height * value / @width + @heightEl.val height + else + height = value + width = @width * value / @height + @widthEl.val width + + unless onlySetVal + @target.attr + width: width + height: height + @editor.trigger 'valuechanged' + */ + value = inputEl.val(); + if (!this.target) { return; } - if (inputEl.is(this.widthEl)) { - width = value; - height = this.height * value / this.width; - this.heightEl.val(height); + if ('origin' === value) { + this.target.css({ + width: 'auto' + }); + this.target.attr({ + width: 'auto' + }); } else { - height = value; - width = this.width * value / this.height; - this.widthEl.val(width); - } - if (!onlySetVal) { + this.target.css({ + width: '100%' + }); this.target.attr({ - width: width, - height: height + width: '100%' }); - return this.editor.trigger('valuechanged'); } + this.editor.trigger('valuechanged'); }; ImagePopover.prototype._restoreImg = function() { - var ref, size; - size = ((ref = this.target.data('image-size')) != null ? ref.split(",") : void 0) || [this.width, this.height]; - this.target.attr({ - width: size[0] * 1, + + /* 这是旧的 + size = @target.data('image-size')?.split(",") || [@width, @height] + @target.attr + width: size[0] * 1 height: size[1] * 1 + @widthEl.val(size[0]) + @heightEl.val(size[1]) + + @editor.trigger 'valuechanged' + */ + this.target.attr({ + width: 'auto' + }); + this.target.css({ + width: 'auto' }); - this.widthEl.val(size[0]); - this.heightEl.val(size[1]); return this.editor.trigger('valuechanged'); }; @@ -4797,15 +4839,23 @@ ImagePopover = (function(superClass) { } return this.button.loadImage(this.target, src, (function(_this) { return function(img) { - var blob; + var blob, ref; if (!img) { return; } if (_this.active) { - _this.width = img.width; - _this.height = img.height; - _this.widthEl.val(_this.width); - _this.heightEl.val(_this.height); + + /* 这是旧的 + @width = img.width + @height = img.height + + @widthEl.val @width + @heightEl.val @height + */ + _this.widthResponse.attr('checked', true); + if ((ref = _this.widthResponse[0]) != null) { + ref.checked = true; + } } if (/^data:image/.test(src)) { blob = _this.editor.util.dataURLtoBlob(src); @@ -4842,6 +4892,29 @@ ImagePopover = (function(superClass) { } }; + ImagePopover.prototype.show = function() { + var $img, args, ref, ref1, ref2; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + ImagePopover.__super__.show.apply(this, args); + $img = this.target; + this.width = $img.attr('width') || $img.width(); + this.alt = $img.attr('alt'); + if ($img.hasClass('uploading')) { + this.srcEl.val(this._t('uploading')).prop('disabled', true); + this.widthResponse.attr('checked', true); + return (ref = this.widthResponse[0]) != null ? ref.checked = true : void 0; + } else { + this.srcEl.val($img.attr('src')).prop('disabled', false); + if (('' + this.width).endsWith('%')) { + this.widthResponse.attr('checked', true); + return (ref1 = this.widthResponse[0]) != null ? ref1.checked = true : void 0; + } else { + this.widthOrigin.attr('checked', true); + return (ref2 = this.widthOrigin[0]) != null ? ref2.checked = true : void 0; + } + } + }; + return ImagePopover; })(Popover); diff --git a/site/assets/scripts/uploader.js b/site/assets/scripts/uploader.js index d96860ec..39ca3eaf 100644 --- a/site/assets/scripts/uploader.js +++ b/site/assets/scripts/uploader.js @@ -2,7 +2,7 @@ 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)); + return (root['simpleUploader'] = factory($, SimpleModule)); }); } else if (typeof exports === 'object') { // Node. Does not work with strict CommonJS, but @@ -11,11 +11,11 @@ module.exports = factory(require("jquery"),require("simple-module")); } else { root.simple = root.simple || {}; - root.simple['uploader'] = factory(jQuery,SimpleModule); + root['simpleUploader'] = factory(root["jQuery"],root["SimpleModule"]); } }(this, function ($, SimpleModule) { -var Uploader, uploader, +var Uploader, simpleUploader, 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; @@ -44,7 +44,7 @@ Uploader = (function(superClass) { _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 { + } else if (_this.files.length === 0) { return _this.uploading = false; } }; @@ -108,15 +108,21 @@ Uploader = (function(superClass) { Uploader.prototype.getFile = function(fileObj) { var name, ref, ref1; + window.console.log('getFile entry'); if (fileObj instanceof window.File || fileObj instanceof window.Blob) { name = (ref = fileObj.fileName) != null ? ref : fileObj.name; } else { return null; } + window.console.log('getFile run'); + if ($.isFunction(this.opts.params)) { + window.console.log('getFile @opts.params()'); + this.opts.params(); + } return { id: this.generateId(), url: this.opts.url, - params: this.opts.params, + params: $.isFunction(this.opts.params) ? this.opts.params() : this.opts.params, fileKey: this.opts.fileKey, name: name, size: (ref1 = fileObj.fileSize) != null ? ref1 : fileObj.size, @@ -252,10 +258,10 @@ Uploader = (function(superClass) { })(SimpleModule); -uploader = function(opts) { +simpleUploader = function(opts) { return new Uploader(opts); }; -return uploader; +return simpleUploader; })); diff --git a/site/assets/styles/simditor.css b/site/assets/styles/simditor.css index b83b0bdc..4f40ebd0 100644 --- a/site/assets/styles/simditor.css +++ b/site/assets/styles/simditor.css @@ -185,6 +185,7 @@ top: 0; left: 0; z-index: 2; + display: none !important; } .simditor .simditor-wrapper .simditor-image-loading .progress { width: 100%; @@ -233,6 +234,44 @@ .simditor .simditor-body img { cursor: pointer; } +.simditor .simditor-body img.uploading { + font-size: 0px; + padding-bottom: 4px; + background: repeating-linear-gradient(to right, #c6e8ef 0%, #3da0dc 50%, #c6e8ef 100%); + animation: 1s SimditorImgUploadingAnimate ease infinite; +} +@keyframes SimditorImgUploadingAnimate { + 10% { + background: repeating-linear-gradient(to right, #c6e8ef 10%, #3da0dc 60%, #c6e8ef 110%); + } + 20% { + background: repeating-linear-gradient(to right, #c6e8ef 20%, #3da0dc 70%, #c6e8ef 120%); + } + 30% { + background: repeating-linear-gradient(to right, #c6e8ef 30%, #3da0dc 80%, #c6e8ef 130%); + } + 40% { + background: repeating-linear-gradient(to right, #c6e8ef 40%, #3da0dc 90%, #c6e8ef 140%); + } + 50% { + background: repeating-linear-gradient(to right, #c6e8ef 50%, #3da0dc 100%, #c6e8ef 150%); + } + 60% { + background: repeating-linear-gradient(to right, #c6e8ef 60%, #3da0dc 110%, #c6e8ef 160%); + } + 70% { + background: repeating-linear-gradient(to right, #c6e8ef 70%, #3da0dc 120%, #c6e8ef 170%); + } + 80% { + background: repeating-linear-gradient(to right, #c6e8ef 80%, #3da0dc 130%, #c6e8ef 180%); + } + 90% { + background: repeating-linear-gradient(to right, #c6e8ef 90%, #3da0dc 140%, #c6e8ef 190%); + } + 100% { + background: repeating-linear-gradient(to right, #c6e8ef 100%, #3da0dc 150%, #c6e8ef 200%); + } +} .simditor .simditor-body img.selected { box-shadow: 0 0 0 4px #cccccc; } @@ -532,6 +571,9 @@ display: inline-block; margin: 0 5px 0 0; } +.simditor .simditor-popover .settings-field label.auto { + width: auto !important; +} .simditor .simditor-popover .settings-field input[type=text] { display: inline-block; width: 200px; diff --git a/site/index.html b/site/index.html index 4af7ded5..a38d72ae 100644 --- a/site/index.html +++ b/site/index.html @@ -8,7 +8,9 @@