| 12 | (function() { |
| 13 | |
| 14 | var factory = function (exports) { |
| 15 | |
| 16 | var $ = jQuery; |
| 17 | var pluginName = "help-dialog"; |
| 18 | |
| 19 | exports.fn.helpDialog = function() { |
| 20 | var _this = this; |
| 21 | var lang = this.lang; |
| 22 | var editor = this.editor; |
| 23 | var settings = this.settings; |
| 24 | var path = settings.pluginPath + pluginName + "/"; |
| 25 | var classPrefix = this.classPrefix; |
| 26 | var dialogName = classPrefix + pluginName, dialog; |
| 27 | var dialogLang = lang.dialog.help; |
| 28 | |
| 29 | if (editor.find("." + dialogName).length < 1) |
| 30 | { |
| 31 | var dialogContent = "<div class=\"markdown-body\" style=\"font-family:微软雅黑, Helvetica, Tahoma, STXihei,Arial;height:390px;overflow:auto;font-size:14px;border-bottom:1px solid #ddd;padding:0 20px 20px 0;\"></div>"; |
| 32 | |
| 33 | dialog = this.createDialog({ |
| 34 | name : dialogName, |
| 35 | title : dialogLang.title, |
| 36 | width : 840, |
| 37 | height : 540, |
| 38 | mask : settings.dialogShowMask, |
| 39 | drag : settings.dialogDraggable, |
| 40 | content : dialogContent, |
| 41 | lockScreen : settings.dialogLockScreen, |
| 42 | maskStyle : { |
| 43 | opacity : settings.dialogMaskOpacity, |
| 44 | backgroundColor : settings.dialogMaskBgColor |
| 45 | }, |
| 46 | buttons : { |
| 47 | close : [lang.buttons.close, function() { |
| 48 | this.hide().lockScreen(false).hideMask(); |
| 49 | |
| 50 | return false; |
| 51 | }] |
| 52 | } |
| 53 | }); |
| 54 | } |
| 55 | |
| 56 | dialog = editor.find("." + dialogName); |
| 57 | |
| 58 | this.dialogShowMask(dialog); |
| 59 | this.dialogLockScreen(); |
| 60 | dialog.show(); |
| 61 | |
| 62 | var helpContent = dialog.find(".markdown-body"); |
| 63 | |
| 64 | if (helpContent.html() === "") |
| 65 | { |
| 66 | $.get(path + "help.md", function(text) { |
| 67 | var md = exports.$marked(text); |
| 68 | helpContent.html(md); |
| 69 | |
| 70 | helpContent.find("a").attr("target", "_blank"); |
| 71 | }); |