/*! * File (upload) dialog plugin for Editor.md * * @file file-dialog.js * @author minho * @version 0.1.0 * @updateTime 2017-01-06 * {@link https://github.com/lifei6671/SmartWiki} * @license MIT */ (function() { var factory = function (exports) { var pluginName = "file-dialog"; exports.fn.fileDialog = function() { var _this = this; var cm = this.cm; var lang = this.lang; var editor = this.editor; var settings = this.settings; var cursor = cm.getCursor(); var selection = cm.getSelection(); var fileLang = lang.dialog.file; var classPrefix = this.classPrefix; var iframeName = classPrefix + "file-iframe"; var dialogName = classPrefix + pluginName, dialog; cm.focus(); var loading = function(show) { var _loading = dialog.find("." + classPrefix + "dialog-mask"); _loading[(show) ? "show" : "hide"](); }; if (editor.find("." + dialogName).length < 1) { var guid = (new Date).getTime(); var action = settings.fileUploadURL + (settings.fileUploadURL.indexOf("?") >= 0 ? "&" : "?") + "guid=" + guid; if (settings.crossDomainUpload) { action += "&callback=" + settings.uploadCallbackURL + "&dialog_id=editormd-file-dialog-" + guid; } var dialogContent = ( (settings.fileUpload) ? "