first commit
This commit is contained in:
commit
9f374011ae
1240 files changed
+181139
No files matched your search
+237
@@ -0,0 +1,237 @@
|
||||
/*!
|
||||
* Code block dialog plugin for Editor.md
|
||||
*
|
||||
* @file code-block-dialog.js
|
||||
* @author pandao
|
||||
* @version 1.2.0
|
||||
* @updateTime 2015-03-07
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
var cmEditor;
|
||||
var pluginName = "code-block-dialog";
|
||||
|
||||
// for CodeBlock dialog select
|
||||
var codeLanguages = exports.codeLanguages = {
|
||||
asp : ["ASP", "vbscript"],
|
||||
actionscript : ["ActionScript(3.0)/Flash/Flex", "clike"],
|
||||
bash : ["Bash/Bat", "shell"],
|
||||
css : ["CSS", "css"],
|
||||
c : ["C", "clike"],
|
||||
cpp : ["C++", "clike"],
|
||||
csharp : ["C#", "clike"],
|
||||
coffeescript : ["CoffeeScript", "coffeescript"],
|
||||
d : ["D", "d"],
|
||||
dart : ["Dart", "dart"],
|
||||
delphi : ["Delphi/Pascal", "pascal"],
|
||||
erlang : ["Erlang", "erlang"],
|
||||
go : ["Golang", "go"],
|
||||
groovy : ["Groovy", "groovy"],
|
||||
html : ["HTML", "text/html"],
|
||||
java : ["Java", "clike"],
|
||||
json : ["JSON", "text/json"],
|
||||
javascript : ["Javascript", "javascript"],
|
||||
lua : ["Lua", "lua"],
|
||||
less : ["LESS", "css"],
|
||||
markdown : ["Markdown", "gfm"],
|
||||
"objective-c" : ["Objective-C", "clike"],
|
||||
php : ["PHP", "php"],
|
||||
perl : ["Perl", "perl"],
|
||||
python : ["Python", "python"],
|
||||
r : ["R", "r"],
|
||||
rst : ["reStructedText", "rst"],
|
||||
ruby : ["Ruby", "ruby"],
|
||||
sql : ["SQL", "sql"],
|
||||
sass : ["SASS/SCSS", "sass"],
|
||||
shell : ["Shell", "shell"],
|
||||
scala : ["Scala", "clike"],
|
||||
swift : ["Swift", "clike"],
|
||||
vb : ["VB/VBScript", "vb"],
|
||||
xml : ["XML", "text/xml"],
|
||||
yaml : ["YAML", "yaml"]
|
||||
};
|
||||
|
||||
exports.fn.codeBlockDialog = 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 classPrefix = this.classPrefix;
|
||||
var dialogName = classPrefix + pluginName, dialog;
|
||||
var dialogLang = lang.dialog.codeBlock;
|
||||
|
||||
cm.focus();
|
||||
|
||||
if (editor.find("." + dialogName).length > 0)
|
||||
{
|
||||
dialog = editor.find("." + dialogName);
|
||||
dialog.find("option:first").attr("selected", "selected");
|
||||
dialog.find("textarea").val(selection);
|
||||
|
||||
this.dialogShowMask(dialog);
|
||||
this.dialogLockScreen();
|
||||
dialog.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
var dialogHTML = "<div class=\"" + classPrefix + "code-toolbar\">" +
|
||||
dialogLang.selectLabel + "<select><option selected=\"selected\" value=\"\">" + dialogLang.selectDefaultText + "</option></select>" +
|
||||
"</div>" +
|
||||
"<textarea placeholder=\"" + dialogLang.placeholder + "\" style=\"display:none;\">" + selection + "</textarea>";
|
||||
|
||||
dialog = this.createDialog({
|
||||
name : dialogName,
|
||||
title : dialogLang.title,
|
||||
width : 780,
|
||||
height : 565,
|
||||
mask : settings.dialogShowMask,
|
||||
drag : settings.dialogDraggable,
|
||||
content : dialogHTML,
|
||||
lockScreen : settings.dialogLockScreen,
|
||||
maskStyle : {
|
||||
opacity : settings.dialogMaskOpacity,
|
||||
backgroundColor : settings.dialogMaskBgColor
|
||||
},
|
||||
buttons : {
|
||||
enter : [lang.buttons.enter, function() {
|
||||
var codeTexts = this.find("textarea").val();
|
||||
var langName = this.find("select").val();
|
||||
|
||||
if (langName === "")
|
||||
{
|
||||
alert(lang.dialog.codeBlock.unselectedLanguageAlert);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (codeTexts === "")
|
||||
{
|
||||
alert(lang.dialog.codeBlock.codeEmptyAlert);
|
||||
return false;
|
||||
}
|
||||
|
||||
langName = (langName === "other") ? "" : langName;
|
||||
|
||||
cm.replaceSelection(["```" + langName, codeTexts, "```"].join("\n"));
|
||||
|
||||
if (langName === "") {
|
||||
cm.setCursor(cursor.line, cursor.ch + 3);
|
||||
}
|
||||
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}],
|
||||
cancel : [lang.buttons.cancel, function() {
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var langSelect = dialog.find("select");
|
||||
|
||||
if (langSelect.find("option").length === 1)
|
||||
{
|
||||
for (var key in codeLanguages)
|
||||
{
|
||||
var codeLang = codeLanguages[key];
|
||||
langSelect.append("<option value=\"" + key + "\" mode=\"" + codeLang[1] + "\">" + codeLang[0] + "</option>");
|
||||
}
|
||||
|
||||
langSelect.append("<option value=\"other\">" + dialogLang.otherLanguage + "</option>");
|
||||
}
|
||||
|
||||
var mode = langSelect.find("option:selected").attr("mode");
|
||||
|
||||
var cmConfig = {
|
||||
mode : (mode) ? mode : "text/html",
|
||||
theme : settings.theme,
|
||||
tabSize : 4,
|
||||
autofocus : true,
|
||||
autoCloseTags : true,
|
||||
indentUnit : 4,
|
||||
lineNumbers : true,
|
||||
lineWrapping : true,
|
||||
extraKeys : {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
|
||||
foldGutter : true,
|
||||
gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
|
||||
matchBrackets : true,
|
||||
indentWithTabs : true,
|
||||
styleActiveLine : true,
|
||||
styleSelectedText : true,
|
||||
autoCloseBrackets : true,
|
||||
showTrailingSpace : true,
|
||||
highlightSelectionMatches : true
|
||||
};
|
||||
|
||||
var textarea = dialog.find("textarea");
|
||||
var cmObj = dialog.find(".CodeMirror");
|
||||
|
||||
if (dialog.find(".CodeMirror").length < 1)
|
||||
{
|
||||
cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig);
|
||||
cmObj = dialog.find(".CodeMirror");
|
||||
|
||||
cmObj.css({
|
||||
"float" : "none",
|
||||
margin : "8px 0",
|
||||
border : "1px solid #ddd",
|
||||
fontSize : settings.fontSize,
|
||||
width : "100%",
|
||||
height : "390px"
|
||||
});
|
||||
|
||||
cmEditor.on("change", function(cm) {
|
||||
textarea.val(cm.getValue());
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
cmEditor.setValue(cm.getSelection());
|
||||
}
|
||||
|
||||
langSelect.change(function(){
|
||||
var _mode = $(this).find("option:selected").attr("mode");
|
||||
cmEditor.setOption("mode", _mode);
|
||||
});
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,327 @@
|
||||
/*!
|
||||
* Emoji dialog plugin for Editor.md
|
||||
*
|
||||
* @file emoji-dialog.js
|
||||
* @author pandao
|
||||
* @version 1.2.0
|
||||
* @updateTime 2015-03-08
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
|
||||
var $ = jQuery;
|
||||
var pluginName = "emoji-dialog";
|
||||
var emojiTabIndex = 0;
|
||||
var emojiData = [];
|
||||
var selecteds = [];
|
||||
|
||||
var logoPrefix = "editormd-logo";
|
||||
var logos = [
|
||||
logoPrefix,
|
||||
logoPrefix + "-1x",
|
||||
logoPrefix + "-2x",
|
||||
logoPrefix + "-3x",
|
||||
logoPrefix + "-4x",
|
||||
logoPrefix + "-5x",
|
||||
logoPrefix + "-6x",
|
||||
logoPrefix + "-7x",
|
||||
logoPrefix + "-8x"
|
||||
];
|
||||
|
||||
var langs = {
|
||||
"zh-cn" : {
|
||||
toolbar : {
|
||||
emoji : "Emoji 表情"
|
||||
},
|
||||
dialog : {
|
||||
emoji : {
|
||||
title : "Emoji 表情"
|
||||
}
|
||||
}
|
||||
},
|
||||
"zh-tw" : {
|
||||
toolbar : {
|
||||
emoji : "Emoji 表情"
|
||||
},
|
||||
dialog : {
|
||||
emoji : {
|
||||
title : "Emoji 表情"
|
||||
}
|
||||
}
|
||||
},
|
||||
"en" : {
|
||||
toolbar : {
|
||||
emoji : "Emoji"
|
||||
},
|
||||
dialog : {
|
||||
emoji : {
|
||||
title : "Emoji"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.fn.emojiDialog = function() {
|
||||
var _this = this;
|
||||
var cm = this.cm;
|
||||
var settings = _this.settings;
|
||||
|
||||
if (!settings.emoji)
|
||||
{
|
||||
alert("settings.emoji == false");
|
||||
return ;
|
||||
}
|
||||
|
||||
var path = settings.pluginPath + pluginName + "/";
|
||||
var editor = this.editor;
|
||||
var cursor = cm.getCursor();
|
||||
var selection = cm.getSelection();
|
||||
var classPrefix = this.classPrefix;
|
||||
|
||||
$.extend(true, this.lang, langs[this.lang.name]);
|
||||
this.setToolbar();
|
||||
|
||||
var lang = this.lang;
|
||||
var dialogName = classPrefix + pluginName, dialog;
|
||||
var dialogLang = lang.dialog.emoji;
|
||||
|
||||
var dialogContent = [
|
||||
"<div class=\"" + classPrefix + "emoji-dialog-box\" style=\"width: 760px;height: 334px;margin-bottom: 8px;overflow: hidden;\">",
|
||||
"<div class=\"" + classPrefix + "tab\"></div>",
|
||||
"</div>",
|
||||
].join("\n");
|
||||
|
||||
cm.focus();
|
||||
|
||||
if (editor.find("." + dialogName).length > 0)
|
||||
{
|
||||
dialog = editor.find("." + dialogName);
|
||||
|
||||
selecteds = [];
|
||||
dialog.find("a").removeClass("selected");
|
||||
|
||||
this.dialogShowMask(dialog);
|
||||
this.dialogLockScreen();
|
||||
dialog.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog = this.createDialog({
|
||||
name : dialogName,
|
||||
title : dialogLang.title,
|
||||
width : 800,
|
||||
height : 475,
|
||||
mask : settings.dialogShowMask,
|
||||
drag : settings.dialogDraggable,
|
||||
content : dialogContent,
|
||||
lockScreen : settings.dialogLockScreen,
|
||||
maskStyle : {
|
||||
opacity : settings.dialogMaskOpacity,
|
||||
backgroundColor : settings.dialogMaskBgColor
|
||||
},
|
||||
buttons : {
|
||||
enter : [lang.buttons.enter, function() {
|
||||
cm.replaceSelection(selecteds.join(" "));
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}],
|
||||
cancel : [lang.buttons.cancel, function() {
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var category = ["Github emoji", "Twemoji", "Font awesome", "Editor.md logo"];
|
||||
var tab = dialog.find("." + classPrefix + "tab");
|
||||
|
||||
if (tab.html() === "")
|
||||
{
|
||||
var head = "<ul class=\"" + classPrefix + "tab-head\">";
|
||||
|
||||
for (var i = 0; i<4; i++) {
|
||||
var active = (i === 0) ? " class=\"active\"" : "";
|
||||
head += "<li" + active + "><a href=\"javascript:;\">" + category[i] + "</a></li>";
|
||||
}
|
||||
|
||||
head += "</ul>";
|
||||
|
||||
tab.append(head);
|
||||
|
||||
var container = "<div class=\"" + classPrefix + "tab-container\">";
|
||||
|
||||
for (var x = 0; x < 4; x++)
|
||||
{
|
||||
var display = (x === 0) ? "" : "display:none;";
|
||||
container += "<div class=\"" + classPrefix + "tab-box\" style=\"height: 260px;overflow: hidden;overflow-y: auto;" + display + "\"></div>";
|
||||
}
|
||||
|
||||
container += "</div>";
|
||||
|
||||
tab.append(container);
|
||||
}
|
||||
|
||||
var tabBoxs = tab.find("." + classPrefix + "tab-box");
|
||||
var emojiCategories = ["github-emoji", "twemoji", "font-awesome", logoPrefix];
|
||||
|
||||
var drawTable = function() {
|
||||
var cname = emojiCategories[emojiTabIndex];
|
||||
var $data = emojiData[cname];
|
||||
var $tab = tabBoxs.eq(emojiTabIndex);
|
||||
|
||||
if ($tab.html() !== "") {
|
||||
//console.log("break =>", cname);
|
||||
return ;
|
||||
}
|
||||
|
||||
var pagination = function(data, type) {
|
||||
var rowNumber = (type === "editormd-logo") ? "5" : 20;
|
||||
var pageTotal = Math.ceil(data.length / rowNumber);
|
||||
var table = "<div class=\"" + classPrefix + "grid-table\">";
|
||||
|
||||
for (var i = 0; i < pageTotal; i++)
|
||||
{
|
||||
var row = "<div class=\"" + classPrefix + "grid-table-row\">";
|
||||
|
||||
for (var x = 0; x < rowNumber; x++)
|
||||
{
|
||||
var emoji = $.trim(data[(i * rowNumber) + x]);
|
||||
|
||||
if (typeof emoji !== "undefined" && emoji !== "")
|
||||
{
|
||||
var img = "", icon = "";
|
||||
|
||||
if (type === "github-emoji")
|
||||
{
|
||||
var src = (emoji === "+1") ? "plus1" : emoji;
|
||||
src = (src === "black_large_square") ? "black_square" : src;
|
||||
src = (src === "moon") ? "waxing_gibbous_moon" : src;
|
||||
|
||||
src = exports.emoji.path + src + exports.emoji.ext;
|
||||
img = "<img src=\"" + src + "\" width=\"24\" class=\"emoji\" title=\":" + emoji + ":\" alt=\":" + emoji + ":\" />";
|
||||
row += "<a href=\"javascript:;\" value=\":" + emoji + ":\" title=\":" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + img + "</a>";
|
||||
}
|
||||
else if (type === "twemoji")
|
||||
{
|
||||
var twemojiSrc = exports.twemoji.path + emoji + exports.twemoji.ext;
|
||||
img = "<img src=\"" + twemojiSrc + "\" width=\"24\" title=\"twemoji-" + emoji + "\" alt=\"twemoji-" + emoji + "\" class=\"emoji twemoji\" />";
|
||||
row += "<a href=\"javascript:;\" value=\":tw-" + emoji + ":\" title=\":tw-" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + img + "</a>";
|
||||
}
|
||||
else if (type === "font-awesome")
|
||||
{
|
||||
icon = "<i class=\"fa fa-" + emoji + " fa-emoji\" title=\"" + emoji + "\"></i>";
|
||||
row += "<a href=\"javascript:;\" value=\":fa-" + emoji + ":\" title=\":fa-" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + icon + "</a>";
|
||||
}
|
||||
else if (type === "editormd-logo")
|
||||
{
|
||||
icon = "<i class=\"" + emoji + "\" title=\"Editor.md logo (" + emoji + ")\"></i>";
|
||||
row += "<a href=\"javascript:;\" value=\":" + emoji + ":\" title=\":" + emoji + ":\" style=\"width:20%;\" class=\"" + classPrefix + "emoji-btn\">" + icon + "</a>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
row += "<a href=\"javascript:;\" value=\"\"></a>";
|
||||
}
|
||||
}
|
||||
|
||||
row += "</div>";
|
||||
|
||||
table += row;
|
||||
}
|
||||
|
||||
table += "</div>";
|
||||
|
||||
return table;
|
||||
};
|
||||
|
||||
if (emojiTabIndex === 0)
|
||||
{
|
||||
for (var i = 0, len = $data.length; i < len; i++)
|
||||
{
|
||||
var h4Style = (i === 0) ? " style=\"margin: 0 0 10px;\"" : " style=\"margin: 10px 0;\"";
|
||||
$tab.append("<h4" + h4Style + ">" + $data[i].category + "</h4>");
|
||||
$tab.append(pagination($data[i].list, cname));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$tab.append(pagination($data, cname));
|
||||
}
|
||||
|
||||
$tab.find("." + classPrefix + "emoji-btn").bind(exports.mouseOrTouch("click", "touchend"), function() {
|
||||
$(this).toggleClass("selected");
|
||||
|
||||
if ($(this).hasClass("selected"))
|
||||
{
|
||||
selecteds.push($(this).attr("value"));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (emojiData.length < 1)
|
||||
{
|
||||
if (typeof dialog.loading === "function") {
|
||||
dialog.loading(true);
|
||||
}
|
||||
|
||||
$.getJSON(path + "emoji.json?temp=" + Math.random(), function(json) {
|
||||
|
||||
if (typeof dialog.loading === "function") {
|
||||
dialog.loading(false);
|
||||
}
|
||||
|
||||
emojiData = json;
|
||||
emojiData[logoPrefix] = logos;
|
||||
drawTable();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
drawTable();
|
||||
}
|
||||
|
||||
tab.find("li").bind(exports.mouseOrTouch("click", "touchend"), function() {
|
||||
var $this = $(this);
|
||||
emojiTabIndex = $this.index();
|
||||
|
||||
$this.addClass("active").siblings().removeClass("active");
|
||||
tabBoxs.eq(emojiTabIndex).show().siblings().hide();
|
||||
drawTable();
|
||||
});
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"github-emoji" : [
|
||||
{
|
||||
"category" :"People",
|
||||
"list" : ["bowtie","smile","laughing","blush","smiley","relaxed","smirk","heart_eyes","kissing_heart","kissing_closed_eyes","flushed","relieved","satisfied","grin","wink","stuck_out_tongue_winking_eye","stuck_out_tongue_closed_eyes","grinning","kissing","kissing_smiling_eyes","stuck_out_tongue","sleeping","worried","frowning","anguished","open_mouth","grimacing","confused","hushed","expressionless","unamused","sweat_smile","sweat","disappointed_relieved","weary","pensive","disappointed","confounded","fearful","cold_sweat","persevere","cry","sob","joy","astonished","scream","neckbeard","tired_face","angry","rage","triumph","sleepy","yum","mask","sunglasses","dizzy_face","imp","smiling_imp","neutral_face","no_mouth","innocent","alien","yellow_heart","blue_heart","purple_heart","heart","green_heart","broken_heart","heartbeat","heartpulse","two_hearts","revolving_hearts","cupid","sparkling_heart","sparkles","star","star2","dizzy","boom","collision","anger","exclamation","question","grey_exclamation","grey_question","zzz","dash","sweat_drops","notes","musical_note","fire","hankey","poop","shit","+1","thumbsup","-1","thumbsdown","ok_hand","punch","facepunch","fist","v","wave","hand","raised_hand","open_hands","point_up","point_down","point_left","point_right","raised_hands","pray","point_up_2","clap","muscle","metal","fu","walking","runner","running","couple","family","two_men_holding_hands","two_women_holding_hands","dancer","dancers","ok_woman","no_good","information_desk_person","raising_hand","bride_with_veil","person_with_pouting_face","person_frowning","bow","couplekiss","couple_with_heart","massage","haircut","nail_care","boy","girl","woman","man","baby","older_woman","older_man","person_with_blond_hair","man_with_gua_pi_mao","man_with_turban","construction_worker","cop","angel","princess","smiley_cat","smile_cat","heart_eyes_cat","kissing_cat","smirk_cat","scream_cat","crying_cat_face","joy_cat","pouting_cat","japanese_ogre","japanese_goblin","see_no_evil","hear_no_evil","speak_no_evil","guardsman","skull","feet","lips","kiss","droplet","ear","eyes","nose","tongue","love_letter","bust_in_silhouette","busts_in_silhouette","speech_balloon","thought_balloon","feelsgood","finnadie","goberserk","godmode","hurtrealbad","rage1","rage2","rage3","rage4","suspect","trollface"]
|
||||
},
|
||||
{
|
||||
"category" :"Nature",
|
||||
"list" : ["sunny","umbrella","cloud","snowflake","snowman","zap","cyclone","foggy","ocean","cat","dog","mouse","hamster","rabbit","wolf","frog","tiger","koala","bear","pig","pig_nose","cow","boar","monkey_face","monkey","horse","racehorse","camel","sheep","elephant","panda_face","snake","bird","baby_chick","hatched_chick","hatching_chick","chicken","penguin","turtle","bug","honeybee","ant","beetle","snail","octopus","tropical_fish","fish","whale","whale2","dolphin","cow2","ram","rat","water_buffalo","tiger2","rabbit2","dragon","goat","rooster","dog2","pig2","mouse2","ox","dragon_face","blowfish","crocodile","dromedary_camel","leopard","cat2","poodle","paw_prints","bouquet","cherry_blossom","tulip","four_leaf_clover","rose","sunflower","hibiscus","maple_leaf","leaves","fallen_leaf","herb","mushroom","cactus","palm_tree","evergreen_tree","deciduous_tree","chestnut","seedling","blossom","ear_of_rice","shell","globe_with_meridians","sun_with_face","full_moon_with_face","new_moon_with_face","new_moon","waxing_crescent_moon","first_quarter_moon","waxing_gibbous_moon","full_moon","waning_gibbous_moon","last_quarter_moon","waning_crescent_moon","last_quarter_moon_with_face","first_quarter_moon_with_face","moon","earth_africa","earth_americas","earth_asia","volcano","milky_way","partly_sunny","octocat","squirrel"]
|
||||
},
|
||||
{
|
||||
"category" :"Objects",
|
||||
"list" : ["bamboo","gift_heart","dolls","school_satchel","mortar_board","flags","fireworks","sparkler","wind_chime","rice_scene","jack_o_lantern","ghost","santa","christmas_tree","gift","bell","no_bell","tanabata_tree","tada","confetti_ball","balloon","crystal_ball","cd","dvd","floppy_disk","camera","video_camera","movie_camera","computer","tv","iphone","phone","telephone","telephone_receiver","pager","fax","minidisc","vhs","sound","speaker","mute","loudspeaker","mega","hourglass","hourglass_flowing_sand","alarm_clock","watch","radio","satellite","loop","mag","mag_right","unlock","lock","lock_with_ink_pen","closed_lock_with_key","key","bulb","flashlight","high_brightness","low_brightness","electric_plug","battery","calling","email","mailbox","postbox","bath","bathtub","shower","toilet","wrench","nut_and_bolt","hammer","seat","moneybag","yen","dollar","pound","euro","credit_card","money_with_wings","e-mail","inbox_tray","outbox_tray","envelope","incoming_envelope","postal_horn","mailbox_closed","mailbox_with_mail","mailbox_with_no_mail","package","door","smoking","bomb","gun","hocho","pill","syringe","page_facing_up","page_with_curl","bookmark_tabs","bar_chart","chart_with_upwards_trend","chart_with_downwards_trend","scroll","clipboard","calendar","date","card_index","file_folder","open_file_folder","scissors","pushpin","paperclip","black_nib","pencil2","straight_ruler","triangular_ruler","closed_book","green_book","blue_book","orange_book","notebook","notebook_with_decorative_cover","ledger","books","bookmark","name_badge","microscope","telescope","newspaper","football","basketball","soccer","baseball","tennis","8ball","rugby_football","bowling","golf","mountain_bicyclist","bicyclist","horse_racing","snowboarder","swimmer","surfer","ski","spades","hearts","clubs","diamonds","gem","ring","trophy","musical_score","musical_keyboard","violin","space_invader","video_game","black_joker","flower_playing_cards","game_die","dart","mahjong","clapper","memo","pencil","book","art","microphone","headphones","trumpet","saxophone","guitar","shoe","sandal","high_heel","lipstick","boot","shirt","tshirt","necktie","womans_clothes","dress","running_shirt_with_sash","jeans","kimono","bikini","ribbon","tophat","crown","womans_hat","mans_shoe","closed_umbrella","briefcase","handbag","pouch","purse","eyeglasses","fishing_pole_and_fish","coffee","tea","sake","baby_bottle","beer","beers","cocktail","tropical_drink","wine_glass","fork_and_knife","pizza","hamburger","fries","poultry_leg","meat_on_bone","spaghetti","curry","fried_shrimp","bento","sushi","fish_cake","rice_ball","rice_cracker","rice","ramen","stew","oden","dango","egg","bread","doughnut","custard","icecream","ice_cream","shaved_ice","birthday","cake","cookie","chocolate_bar","candy","lollipop","honey_pot","apple","green_apple","tangerine","lemon","cherries","grapes","watermelon","strawberry","peach","melon","banana","pear","pineapple","sweet_potato","eggplant","tomato","corn"]
|
||||
},
|
||||
{
|
||||
"category" :"Places",
|
||||
"list" : ["house","house_with_garden","school","office","post_office","hospital","bank","convenience_store","love_hotel","hotel","wedding","church","department_store","european_post_office","city_sunrise","city_sunset","japanese_castle","european_castle","tent","factory","tokyo_tower","japan","mount_fuji","sunrise_over_mountains","sunrise","stars","statue_of_liberty","bridge_at_night","carousel_horse","rainbow","ferris_wheel","fountain","roller_coaster","ship","speedboat","boat","sailboat","rowboat","anchor","rocket","airplane","helicopter","steam_locomotive","tram","mountain_railway","bike","aerial_tramway","suspension_railway","mountain_cableway","tractor","blue_car","oncoming_automobile","car","red_car","taxi","oncoming_taxi","articulated_lorry","bus","oncoming_bus","rotating_light","police_car","oncoming_police_car","fire_engine","ambulance","minibus","truck","train","station","train2","bullettrain_front","bullettrain_side","light_rail","monorail","railway_car","trolleybus","ticket","fuelpump","vertical_traffic_light","traffic_light","warning","construction","beginner","atm","slot_machine","busstop","barber","hotsprings","checkered_flag","crossed_flags","izakaya_lantern","moyai","circus_tent","performing_arts","round_pushpin","triangular_flag_on_post","jp","kr","cn","us","fr","es","it","ru","gb","uk","de"]
|
||||
},
|
||||
{
|
||||
"category" :"Symbols",
|
||||
"list" : ["one","two","three","four","five","six","seven","eight","nine","keycap_ten","1234","zero","hash","symbols","arrow_backward","arrow_down","arrow_forward","arrow_left","capital_abcd","abcd","abc","arrow_lower_left","arrow_lower_right","arrow_right","arrow_up","arrow_upper_left","arrow_upper_right","arrow_double_down","arrow_double_up","arrow_down_small","arrow_heading_down","arrow_heading_up","leftwards_arrow_with_hook","arrow_right_hook","left_right_arrow","arrow_up_down","arrow_up_small","arrows_clockwise","arrows_counterclockwise","rewind","fast_forward","information_source","ok","twisted_rightwards_arrows","repeat","repeat_one","new","top","up","cool","free","ng","cinema","koko","signal_strength","u5272","u5408","u55b6","u6307","u6708","u6709","u6e80","u7121","u7533","u7a7a","u7981","sa","restroom","mens","womens","baby_symbol","no_smoking","parking","wheelchair","metro","baggage_claim","accept","wc","potable_water","put_litter_in_its_place","secret","congratulations","m","passport_control","left_luggage","customs","ideograph_advantage","cl","sos","id","no_entry_sign","underage","no_mobile_phones","do_not_litter","non-potable_water","no_bicycles","no_pedestrians","children_crossing","no_entry","eight_spoked_asterisk","sparkle","eight_pointed_black_star","heart_decoration","vs","vibration_mode","mobile_phone_off","chart","currency_exchange","aries","taurus","gemini","cancer","leo","virgo","libra","scorpius","sagittarius","capricorn","aquarius","pisces","ophiuchus","six_pointed_star","negative_squared_cross_mark","a","b","ab","o2","diamond_shape_with_a_dot_inside","recycle","end","back","on","soon","clock1","clock130","clock10","clock1030","clock11","clock1130","clock12","clock1230","clock2","clock230","clock3","clock330","clock4","clock430","clock5","clock530","clock6","clock630","clock7","clock730","clock8","clock830","clock9","clock930","heavy_dollar_sign","copyright","registered","tm","x","heavy_exclamation_mark","bangbang","interrobang","o","heavy_multiplication_x","heavy_plus_sign","heavy_minus_sign","heavy_division_sign","white_flower","100","heavy_check_mark","ballot_box_with_check","radio_button","link","curly_loop","wavy_dash","part_alternation_mark","trident","black_small_square","white_small_square","black_medium_small_square","white_medium_small_square","black_medium_square","white_medium_square","black_large_square","white_large_square","white_check_mark","black_square_button","white_square_button","black_circle","white_circle","red_circle","large_blue_circle","large_blue_diamond","large_orange_diamond","small_blue_diamond","small_orange_diamond","small_red_triangle","small_red_triangle_down","shipit"]
|
||||
}
|
||||
],
|
||||
|
||||
"twemoji" : ["1f004","1f0cf","1f170","1f171","1f17e","1f17f","1f18e","1f191","1f192","1f193","1f194","1f195","1f196","1f197","1f198","1f199","1f19a","1f1e6","1f1e7","1f1e8-1f1f3","1f1e8","1f1e9-1f1ea","1f1e9","1f1ea-1f1f8","1f1ea","1f1eb-1f1f7","1f1eb","1f1ec-1f1e7","1f1ec","1f1ed","1f1ee-1f1f9","1f1ee","1f1ef-1f1f5","1f1ef","1f1f0-1f1f7","1f1f0","1f1f1","1f1f2","1f1f3","1f1f4","1f1f5","1f1f6","1f1f7-1f1fa","1f1f7","1f1f8","1f1f9","1f1fa-1f1f8","1f1fa","1f1fb","1f1fc","1f1fd","1f1fe","1f1ff","1f201","1f202","1f21a","1f22f","1f232","1f233","1f234","1f235","1f236","1f237","1f238","1f239","1f23a","1f250","1f251","1f300","1f301","1f302","1f303","1f304","1f305","1f306","1f307","1f308","1f309","1f30a","1f30b","1f30c","1f30d","1f30e","1f30f","1f310","1f311","1f312","1f313","1f314","1f315","1f316","1f317","1f318","1f319","1f31a","1f31b","1f31c","1f31d","1f31e","1f31f","1f320","1f330","1f331","1f332","1f333","1f334","1f335","1f337","1f338","1f339","1f33a","1f33b","1f33c","1f33d","1f33e","1f33f","1f340","1f341","1f342","1f343","1f344","1f345","1f346","1f347","1f348","1f349","1f34a","1f34b","1f34c","1f34d","1f34e","1f34f","1f350","1f351","1f352","1f353","1f354","1f355","1f356","1f357","1f358","1f359","1f35a","1f35b","1f35c","1f35d","1f35e","1f35f","1f360","1f361","1f362","1f363","1f364","1f365","1f366","1f367","1f368","1f369","1f36a","1f36b","1f36c","1f36d","1f36e","1f36f","1f370","1f371","1f372","1f373","1f374","1f375","1f376","1f377","1f378","1f379","1f37a","1f37b","1f37c","1f380","1f381","1f382","1f383","1f384","1f385","1f386","1f387","1f388","1f389","1f38a","1f38b","1f38c","1f38d","1f38e","1f38f","1f390","1f391","1f392","1f393","1f3a0","1f3a1","1f3a2","1f3a3","1f3a4","1f3a5","1f3a6","1f3a7","1f3a8","1f3a9","1f3aa","1f3ab","1f3ac","1f3ad","1f3ae","1f3af","1f3b0","1f3b1","1f3b2","1f3b3","1f3b4","1f3b5","1f3b6","1f3b7","1f3b8","1f3b9","1f3ba","1f3bb","1f3bc","1f3bd","1f3be","1f3bf","1f3c0","1f3c1","1f3c2","1f3c3","1f3c4","1f3c6","1f3c7","1f3c8","1f3c9","1f3ca","1f3e0","1f3e1","1f3e2","1f3e3","1f3e4","1f3e5","1f3e6","1f3e7","1f3e8","1f3e9","1f3ea","1f3eb","1f3ec","1f3ed","1f3ee","1f3ef","1f3f0","1f400","1f401","1f402","1f403","1f404","1f405","1f406","1f407","1f408","1f409","1f40a","1f40b","1f40c","1f40d","1f40e","1f40f","1f410","1f411","1f412","1f413","1f414","1f415","1f416","1f417","1f418","1f419","1f41a","1f41b","1f41c","1f41d","1f41e","1f41f","1f420","1f421","1f422","1f423","1f424","1f425","1f426","1f427","1f428","1f429","1f42a","1f42b","1f42c","1f42d","1f42e","1f42f","1f430","1f431","1f432","1f433","1f434","1f435","1f436","1f437","1f438","1f439","1f43a","1f43b","1f43c","1f43d","1f43e","1f440","1f442","1f443","1f444","1f445","1f446","1f447","1f448","1f449","1f44a","1f44b","1f44c","1f44d","1f44e","1f44f","1f450","1f451","1f452","1f453","1f454","1f455","1f456","1f457","1f458","1f459","1f45a","1f45b","1f45c","1f45d","1f45e","1f45f","1f460","1f461","1f462","1f463","1f464","1f465","1f466","1f467","1f468","1f469","1f46a","1f46b","1f46c","1f46d","1f46e","1f46f","1f470","1f471","1f472","1f473","1f474","1f475","1f476","1f477","1f478","1f479","1f47a","1f47b","1f47c","1f47d","1f47e","1f47f","1f480","1f481","1f482","1f483","1f484","1f485","1f486","1f487","1f488","1f489","1f48a","1f48b","1f48c","1f48d","1f48e","1f48f","1f490","1f491","1f492","1f493","1f494","1f495","1f496","1f497","1f498","1f499","1f49a","1f49b","1f49c","1f49d","1f49e","1f49f","1f4a0","1f4a1","1f4a2","1f4a3","1f4a4","1f4a5","1f4a6","1f4a7","1f4a8","1f4a9","1f4aa","1f4ab","1f4ac","1f4ad","1f4ae","1f4af","1f4b0","1f4b1","1f4b2","1f4b3","1f4b4","1f4b5","1f4b6","1f4b7","1f4b8","1f4b9","1f4ba","1f4bb","1f4bc","1f4bd","1f4be","1f4bf","1f4c0","1f4c1","1f4c2","1f4c3","1f4c4","1f4c5","1f4c6","1f4c7","1f4c8","1f4c9","1f4ca","1f4cb","1f4cc","1f4cd","1f4ce","1f4cf","1f4d0","1f4d1","1f4d2","1f4d3","1f4d4","1f4d5","1f4d6","1f4d7","1f4d8","1f4d9","1f4da","1f4db","1f4dc","1f4dd","1f4de","1f4df","1f4e0","1f4e1","1f4e2","1f4e3","1f4e4","1f4e5","1f4e6","1f4e7","1f4e8","1f4e9","1f4ea","1f4eb","1f4ec","1f4ed","1f4ee","1f4ef","1f4f0","1f4f1","1f4f2","1f4f3","1f4f4","1f4f5","1f4f6","1f4f7","1f4f9","1f4fa","1f4fb","1f4fc","1f500","1f501","1f502","1f503","1f504","1f505","1f506","1f507","1f508","1f509","1f50a","1f50b","1f50c","1f50d","1f50e","1f50f","1f510","1f511","1f512","1f513","1f514","1f515","1f516","1f517","1f518","1f519","1f51a","1f51b","1f51c","1f51d","1f51e","1f51f","1f520","1f521","1f522","1f523","1f524","1f525","1f526","1f527","1f528","1f529","1f52a","1f52b","1f52c","1f52d","1f52e","1f52f","1f530","1f531","1f532","1f533","1f534","1f535","1f536","1f537","1f538","1f539","1f53a","1f53b","1f53c","1f53d","1f550","1f551","1f552","1f553","1f554","1f555","1f556","1f557","1f558","1f559","1f55a","1f55b","1f55c","1f55d","1f55e","1f55f","1f560","1f561","1f562","1f563","1f564","1f565","1f566","1f567","1f5fb","1f5fc","1f5fd","1f5fe","1f5ff","1f600","1f601","1f602","1f603","1f604","1f605","1f606","1f607","1f608","1f609","1f60a","1f60b","1f60c","1f60d","1f60e","1f60f","1f610","1f611","1f61Line truncated
|
||||
|
||||
"font-awesome" : ["glass","music","search","envelope-o","heart","star","star-o","user","film","th-large","th","th-list","check","times","search-plus","search-minus","power-off","signal","cog","trash-o","home","file-o","clock-o","road","download","arrow-circle-o-down","arrow-circle-o-up","inbox","play-circle-o","repeat","refresh","list-alt","lock","flag","headphones","volume-off","volume-down","volume-up","qrcode","barcode","tag","tags","book","bookmark","print","camera","font","bold","italic","text-height","text-width","align-left","align-center","align-right","align-justify","list","outdent","indent","video-camera","picture-o","pencil","map-marker","adjust","tint","pencil-square-o","share-square-o","check-square-o","arrows","step-backward","fast-backward","backward","play","pause","stop","forward","fast-forward","step-forward","eject","chevron-left","chevron-right","plus-circle","minus-circle","times-circle","check-circle","question-circle","info-circle","crosshairs","times-circle-o","check-circle-o","ban","arrow-left","arrow-right","arrow-up","arrow-down","share","expand","compress","plus","minus","asterisk","exclamation-circle","gift","leaf","fire","eye","eye-slash","exclamation-triangle","plane","calendar","random","comment","magnet","chevron-up","chevron-down","retweet","shopping-cart","folder","folder-open","arrows-v","arrows-h","bar-chart","twitter-square","facebook-square","camera-retro","key","cogs","comments","thumbs-o-up","thumbs-o-down","star-half","heart-o","sign-out","linkedin-square","thumb-tack","external-link","sign-in","trophy","github-square","upload","lemon-o","phone","square-o","bookmark-o","phone-square","twitter","facebook","github","unlock","credit-card","rss","hdd-o","bullhorn","bell","certificate","hand-o-right","hand-o-left","hand-o-up","hand-o-down","arrow-circle-left","arrow-circle-right","arrow-circle-up","arrow-circle-down","globe","wrench","tasks","filter","briefcase","arrows-alt","users","link","cloud","flask","scissors","files-o","paperclip","floppy-o","square","bars","list-ul","list-ol","strikethrough","underline","table","magic","truck","pinterest","pinterest-square","google-plus-square","google-plus","money","caret-down","caret-up","caret-left","caret-right","columns","sort","sort-desc","sort-asc","envelope","linkedin","undo","gavel","tachometer","comment-o","comments-o","bolt","sitemap","umbrella","clipboard","lightbulb-o","exchange","cloud-download","cloud-upload","user-md","stethoscope","suitcase","bell-o","coffee","cutlery","file-text-o","building-o","hospital-o","ambulance","medkit","fighter-jet","beer","h-square","plus-square","angle-double-left","angle-double-right","angle-double-up","angle-double-down","angle-left","angle-right","angle-up","angle-down","desktop","laptop","tablet","mobile","circle-o","quote-left","quote-right","spinner","circle","reply","github-alt","folder-o","folder-open-o","smile-o","frown-o","meh-o","gamepad","keyboard-o","flag-o","flag-checkered","terminal","code","reply-all","star-half-o","location-arrow","crop","code-fork","chain-broken","question","info","exclamation","superscript","subscript","eraser","puzzle-piece","microphone","microphone-slash","shield","calendar-o","fire-extinguisher","rocket","maxcdn","chevron-circle-left","chevron-circle-right","chevron-circle-up","chevron-circle-down","html5","css3","anchor","unlock-alt","bullseye","ellipsis-h","ellipsis-v","rss-square","play-circle","ticket","minus-square","minus-square-o","level-up","level-down","check-square","pencil-square","share-square","compass","caret-square-o-down","caret-square-o-up","caret-square-o-right","eur","gbp","usd","inr","jpy","rub","krw","btc","file","file-text","sort-alpha-asc","sort-alpha-desc","sort-amount-asc","sort-amount-desc","sort-numeric-asc","sort-numeric-desc","thumbs-up","thumbs-down","youtube-square","youtube","xing","xing-square","youtube-play","dropbox","stack-overflow","instagram","flickr","adn","bitbucket","bitbucket-square","tumblr","tumblr-square","long-arrow-down","long-arrow-up","long-arrow-left","long-arrow-right","apple","windows","android","linux","dribbble","skype","foursquare","trello","female","male","gratipay","sun-o","moon-o","archive","bug","vk","weibo","renren","pagelines","stack-exchange","arrow-circle-o-right","arrow-circle-o-left","caret-square-o-left","dot-circle-o","wheelchair","vimeo-square","try","plus-square-o","space-shuttle","slack","envelope-square","wordpress","openid","university","graduation-cap","yahoo","google","reddit","reddit-square","stumbleupon-circle","stumbleupon","delicious","digg","pied-piper","pied-piper-alt","drupal","joomla","language","fax","building","child","paw","spoon","cube","cubes","behance","behance-square","steam","steam-square","recycle","car","taxi","tree","spotify","deviantart","soundcloud","database","file-pdf-o","file-word-o","file-excel-o","file-powerpoint-o","file-image-o","file-archive-o","file-audio-o","file-video-o","file-code-o","vine","codepen","jsfiddle","life-ring","circle-o-notchLine truncated
|
||||
}
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
/*!
|
||||
* Goto line dialog plugin for Editor.md
|
||||
*
|
||||
* @file goto-line-dialog.js
|
||||
* @author pandao
|
||||
* @version 1.2.1
|
||||
* @updateTime 2015-06-09
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
|
||||
var $ = jQuery;
|
||||
var pluginName = "goto-line-dialog";
|
||||
|
||||
var langs = {
|
||||
"zh-cn" : {
|
||||
toolbar : {
|
||||
"goto-line" : "跳转到行"
|
||||
},
|
||||
dialog : {
|
||||
"goto-line" : {
|
||||
title : "跳转到行",
|
||||
label : "请输入行号",
|
||||
error : "错误:"
|
||||
}
|
||||
}
|
||||
},
|
||||
"zh-tw" : {
|
||||
toolbar : {
|
||||
"goto-line" : "跳轉到行"
|
||||
},
|
||||
dialog : {
|
||||
"goto-line" : {
|
||||
title : "跳轉到行",
|
||||
label : "請輸入行號",
|
||||
error : "錯誤:"
|
||||
}
|
||||
}
|
||||
},
|
||||
"en" : {
|
||||
toolbar : {
|
||||
"goto-line" : "Goto line"
|
||||
},
|
||||
dialog : {
|
||||
"goto-line" : {
|
||||
title : "Goto line",
|
||||
label : "Enter a line number, range ",
|
||||
error : "Error: "
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.fn.gotoLineDialog = function() {
|
||||
var _this = this;
|
||||
var cm = this.cm;
|
||||
var editor = this.editor;
|
||||
var settings = this.settings;
|
||||
var path = settings.pluginPath + pluginName +"/";
|
||||
var classPrefix = this.classPrefix;
|
||||
var dialogName = classPrefix + pluginName, dialog;
|
||||
|
||||
$.extend(true, this.lang, langs[this.lang.name]);
|
||||
this.setToolbar();
|
||||
|
||||
var lang = this.lang;
|
||||
var dialogLang = lang.dialog["goto-line"];
|
||||
var lineCount = cm.lineCount();
|
||||
|
||||
dialogLang.error += dialogLang.label + " 1-" + lineCount;
|
||||
|
||||
if (editor.find("." + dialogName).length < 1)
|
||||
{
|
||||
var dialogContent = [
|
||||
"<div class=\"editormd-form\" style=\"padding: 10px 0;\">",
|
||||
"<p style=\"margin: 0;\">" + dialogLang.label + " 1-" + lineCount +" <input type=\"number\" class=\"number-input\" style=\"width: 60px;\" value=\"1\" max=\"" + lineCount + "\" min=\"1\" data-line-number /></p>",
|
||||
"</div>"
|
||||
].join("\n");
|
||||
|
||||
dialog = this.createDialog({
|
||||
name : dialogName,
|
||||
title : dialogLang.title,
|
||||
width : 400,
|
||||
height : 180,
|
||||
mask : settings.dialogShowMask,
|
||||
drag : settings.dialogDraggable,
|
||||
content : dialogContent,
|
||||
lockScreen : settings.dialogLockScreen,
|
||||
maskStyle : {
|
||||
opacity : settings.dialogMaskOpacity,
|
||||
backgroundColor : settings.dialogMaskBgColor
|
||||
},
|
||||
buttons : {
|
||||
enter : [lang.buttons.enter, function() {
|
||||
var line = parseInt(this.find("[data-line-number]").val());
|
||||
|
||||
if (line < 1 || line > lineCount) {
|
||||
alert(dialogLang.error);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
_this.gotoLine(line);
|
||||
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}],
|
||||
|
||||
cancel : [lang.buttons.cancel, function() {
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dialog = editor.find("." + dialogName);
|
||||
|
||||
this.dialogShowMask(dialog);
|
||||
this.dialogLockScreen();
|
||||
dialog.show();
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,102 @@
|
||||
/*!
|
||||
* Help dialog plugin for Editor.md
|
||||
*
|
||||
* @file help-dialog.js
|
||||
* @author pandao
|
||||
* @version 1.2.0
|
||||
* @updateTime 2015-03-08
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
|
||||
var $ = jQuery;
|
||||
var pluginName = "help-dialog";
|
||||
|
||||
exports.fn.helpDialog = function() {
|
||||
var _this = this;
|
||||
var lang = this.lang;
|
||||
var editor = this.editor;
|
||||
var settings = this.settings;
|
||||
var path = settings.pluginPath + pluginName + "/";
|
||||
var classPrefix = this.classPrefix;
|
||||
var dialogName = classPrefix + pluginName, dialog;
|
||||
var dialogLang = lang.dialog.help;
|
||||
|
||||
if (editor.find("." + dialogName).length < 1)
|
||||
{
|
||||
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>";
|
||||
|
||||
dialog = this.createDialog({
|
||||
name : dialogName,
|
||||
title : dialogLang.title,
|
||||
width : 840,
|
||||
height : 540,
|
||||
mask : settings.dialogShowMask,
|
||||
drag : settings.dialogDraggable,
|
||||
content : dialogContent,
|
||||
lockScreen : settings.dialogLockScreen,
|
||||
maskStyle : {
|
||||
opacity : settings.dialogMaskOpacity,
|
||||
backgroundColor : settings.dialogMaskBgColor
|
||||
},
|
||||
buttons : {
|
||||
close : [lang.buttons.close, function() {
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dialog = editor.find("." + dialogName);
|
||||
|
||||
this.dialogShowMask(dialog);
|
||||
this.dialogLockScreen();
|
||||
dialog.show();
|
||||
|
||||
var helpContent = dialog.find(".markdown-body");
|
||||
|
||||
if (helpContent.html() === "")
|
||||
{
|
||||
$.get(path + "help.md", function(text) {
|
||||
var md = exports.$marked(text);
|
||||
helpContent.html(md);
|
||||
|
||||
helpContent.find("a").attr("target", "_blank");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,77 @@
|
||||
##### Markdown语法教程 (Markdown syntax tutorial)
|
||||
|
||||
- [Markdown Syntax](http://daringfireball.net/projects/markdown/syntax/ "Markdown Syntax")
|
||||
- [Mastering Markdown](https://guides.github.com/features/mastering-markdown/ "Mastering Markdown")
|
||||
- [Markdown Basics](https://help.github.com/articles/markdown-basics/ "Markdown Basics")
|
||||
- [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown/ "GitHub Flavored Markdown")
|
||||
- [Markdown 语法说明(简体中文)](http://www.markdown.cn/ "Markdown 语法说明(简体中文)")
|
||||
- [Markdown 語法說明(繁體中文)](http://markdown.tw/ "Markdown 語法說明(繁體中文)")
|
||||
|
||||
##### 键盘快捷键 (Keyboard shortcuts)
|
||||
|
||||
> If Editor.md code editor is on focus, you can use keyboard shortcuts.
|
||||
|
||||
| Keyboard shortcuts (键盘快捷键) | 说明 | Description |
|
||||
| :---------------------------------------------- |:--------------------------------- | :------------------------------------------------- |
|
||||
| F9 | 切换实时预览 | Switch watch/unwatch |
|
||||
| F10 | 全屏HTML预览(按 Shift + ESC 退出) | Full preview HTML (Press Shift + ESC exit) |
|
||||
| F11 | 切换全屏状态 | Switch fullscreen (Press ESC exit) |
|
||||
| Ctrl + 1~6 / Command + 1~6 | 插入标题1~6 | Insert heading 1~6 |
|
||||
| Ctrl + A / Command + A | 全选 | Select all |
|
||||
| Ctrl + B / Command + B | 插入粗体 | Insert bold |
|
||||
| Ctrl + D / Command + D | 插入日期时间 | Insert datetime |
|
||||
| Ctrl + E / Command + E | 插入Emoji符号 | Insert :emoji: |
|
||||
| Ctrl + F / Command + F | 查找/搜索 | Start searching |
|
||||
| Ctrl + G / Command + G | 切换到下一个搜索结果项 | Find next search results |
|
||||
| Ctrl + H / Command + H | 插入水平线 | Insert horizontal rule |
|
||||
| Ctrl + I / Command + I | 插入斜体 | Insert italic |
|
||||
| Ctrl + K / Command + K | 插入行内代码 | Insert inline code |
|
||||
| Ctrl + L / Command + L | 插入链接 | Insert link |
|
||||
| Ctrl + U / Command + U | 插入无序列表 | Insert unordered list |
|
||||
| Ctrl + Q | 代码折叠切换 | Switch code fold |
|
||||
| Ctrl + Z / Command + Z | 撤销 | Undo |
|
||||
| Ctrl + Y / Command + Y | 重做 | Redo |
|
||||
| Ctrl + Shift + A | 插入@链接 | Insert @link |
|
||||
| Ctrl + Shift + C | 插入行内代码 | Insert inline code |
|
||||
| Ctrl + Shift + E | 打开插入Emoji表情对话框 | Open emoji dialog |
|
||||
| Ctrl + Shift + F / Command + Option + F | 替换 | Replace |
|
||||
| Ctrl + Shift + G / Shift + Command + G | 切换到上一个搜索结果项 | Find previous search results |
|
||||
| Ctrl + Shift + H | 打开HTML实体字符对话框 | Open HTML Entities dialog |
|
||||
| Ctrl + Shift + I | 插入图片 | Insert image ![]() |
|
||||
| Ctrl + Shift + K | 插入TeX(KaTeX)公式符号 | Insert TeX(KaTeX) symbol $$TeX$$ |
|
||||
| Ctrl + Shift + L | 打开插入链接对话框 | Open link dialog |
|
||||
| Ctrl + Shift + O | 插入有序列表 | Insert ordered list |
|
||||
| Ctrl + Shift + P | 打开插入PRE对话框 | Open Preformatted text dialog |
|
||||
| Ctrl + Shift + Q | 插入引用 | Insert blockquotes |
|
||||
| Ctrl + Shift + R / Shift + Command + Option + F | 全部替换 | Replace all |
|
||||
| Ctrl + Shift + S | 插入删除线 | Insert strikethrough |
|
||||
| Ctrl + Shift + T | 打开插入表格对话框 | Open table dialog |
|
||||
| Ctrl + Shift + U | 将所选文字转成大写 | Selection text convert to uppercase |
|
||||
| Shift + Alt + C | 插入```代码 | Insert code blocks (```) |
|
||||
| Shift + Alt + H | 打开使用帮助对话框 | Open help dialog |
|
||||
| Shift + Alt + L | 将所选文本转成小写 | Selection text convert to lowercase |
|
||||
| Shift + Alt + P | 插入分页符 | Insert page break |
|
||||
| Alt + L | 将所选文本转成小写 | Selection text convert to lowercase |
|
||||
| Shift + Alt + U | 将所选的每个单词的首字母转成大写 | Selection words first letter convert to Uppercase |
|
||||
| Ctrl + Shift + Alt + C | 打开插入代码块对话框层 | Open code blocks dialog |
|
||||
| Ctrl + Shift + Alt + I | 打开插入图片对话框层 | Open image dialog |
|
||||
| Ctrl + Shift + Alt + U | 将所选文本的第一个首字母转成大写 | Selection text first letter convert to uppercase |
|
||||
| Ctrl + Alt + G | 跳转到指定的行 | Goto line |
|
||||
|
||||
##### Emoji表情参考 (Emoji reference)
|
||||
|
||||
- [Github emoji](http://www.emoji-cheat-sheet.com/ "Github emoji")
|
||||
- [Twitter Emoji \(Twemoji\)](http://twitter.github.io/twemoji/preview.html "Twitter Emoji \(Twemoji\)")
|
||||
- [FontAwesome icons emoji](http://fortawesome.github.io/Font-Awesome/icons/ "FontAwesome icons emoji")
|
||||
|
||||
##### 流程图参考 (Flowchart reference)
|
||||
|
||||
[http://adrai.github.io/flowchart.js/](http://adrai.github.io/flowchart.js/)
|
||||
|
||||
##### 时序图参考 (SequenceDiagram reference)
|
||||
|
||||
[http://bramp.github.io/js-sequence-diagrams/](http://bramp.github.io/js-sequence-diagrams/)
|
||||
|
||||
##### TeX/LaTeX reference
|
||||
|
||||
[http://meta.wikimedia.org/wiki/Help:Formula](http://meta.wikimedia.org/wiki/Help:Formula)
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
/*!
|
||||
* HTML entities dialog plugin for Editor.md
|
||||
*
|
||||
* @file html-entities-dialog.js
|
||||
* @author pandao
|
||||
* @version 1.2.0
|
||||
* @updateTime 2015-03-08
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
|
||||
var $ = jQuery;
|
||||
var pluginName = "html-entities-dialog";
|
||||
var selecteds = [];
|
||||
var entitiesData = [];
|
||||
|
||||
exports.fn.htmlEntitiesDialog = function() {
|
||||
var _this = this;
|
||||
var cm = this.cm;
|
||||
var lang = _this.lang;
|
||||
var settings = _this.settings;
|
||||
var path = settings.pluginPath + pluginName + "/";
|
||||
var editor = this.editor;
|
||||
var cursor = cm.getCursor();
|
||||
var selection = cm.getSelection();
|
||||
var classPrefix = _this.classPrefix;
|
||||
|
||||
var dialogName = classPrefix + "dialog-" + pluginName, dialog;
|
||||
var dialogLang = lang.dialog.htmlEntities;
|
||||
|
||||
var dialogContent = [
|
||||
'<div class="' + classPrefix + 'html-entities-box" style=\"width: 760px;height: 334px;margin-bottom: 8px;overflow: hidden;overflow-y: auto;\">',
|
||||
'<div class="' + classPrefix + 'grid-table">',
|
||||
'</div>',
|
||||
'</div>',
|
||||
].join("\r\n");
|
||||
|
||||
cm.focus();
|
||||
|
||||
if (editor.find("." + dialogName).length > 0)
|
||||
{
|
||||
dialog = editor.find("." + dialogName);
|
||||
|
||||
selecteds = [];
|
||||
dialog.find("a").removeClass("selected");
|
||||
|
||||
this.dialogShowMask(dialog);
|
||||
this.dialogLockScreen();
|
||||
dialog.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog = this.createDialog({
|
||||
name : dialogName,
|
||||
title : dialogLang.title,
|
||||
width : 800,
|
||||
height : 475,
|
||||
mask : settings.dialogShowMask,
|
||||
drag : settings.dialogDraggable,
|
||||
content : dialogContent,
|
||||
lockScreen : settings.dialogLockScreen,
|
||||
maskStyle : {
|
||||
opacity : settings.dialogMaskOpacity,
|
||||
backgroundColor : settings.dialogMaskBgColor
|
||||
},
|
||||
buttons : {
|
||||
enter : [lang.buttons.enter, function() {
|
||||
cm.replaceSelection(selecteds.join(" "));
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}],
|
||||
cancel : [lang.buttons.cancel, function() {
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var table = dialog.find("." + classPrefix + "grid-table");
|
||||
|
||||
var drawTable = function() {
|
||||
|
||||
if (entitiesData.length < 1) return ;
|
||||
|
||||
var rowNumber = 20;
|
||||
var pageTotal = Math.ceil(entitiesData.length / rowNumber);
|
||||
|
||||
table.html("");
|
||||
|
||||
for (var i = 0; i < pageTotal; i++)
|
||||
{
|
||||
var row = "<div class=\"" + classPrefix + "grid-table-row\">";
|
||||
|
||||
for (var x = 0; x < rowNumber; x++)
|
||||
{
|
||||
var entity = entitiesData[(i * rowNumber) + x];
|
||||
|
||||
if (typeof entity !== "undefined")
|
||||
{
|
||||
var name = entity.name.replace("&", "&");
|
||||
|
||||
row += "<a href=\"javascript:;\" value=\"" + entity.name + "\" title=\"" + name + "\" class=\"" + classPrefix + "html-entity-btn\">" + name + "</a>";
|
||||
}
|
||||
}
|
||||
|
||||
row += "</div>";
|
||||
|
||||
table.append(row);
|
||||
}
|
||||
|
||||
dialog.find("." + classPrefix + "html-entity-btn").bind(exports.mouseOrTouch("click", "touchend"), function() {
|
||||
$(this).toggleClass("selected");
|
||||
|
||||
if ($(this).hasClass("selected"))
|
||||
{
|
||||
selecteds.push($(this).attr("value"));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (entitiesData.length < 1)
|
||||
{
|
||||
if (typeof (dialog.loading) == "function") dialog.loading(true);
|
||||
|
||||
$.getJSON(path + pluginName.replace("-dialog", "") + ".json", function(json) {
|
||||
|
||||
if (typeof (dialog.loading) == "function") dialog.loading(false);
|
||||
|
||||
entitiesData = json;
|
||||
drawTable();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
drawTable();
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
+936
@@ -0,0 +1,936 @@
|
||||
[
|
||||
{
|
||||
"name" : "&#64;",
|
||||
"description":"at symbol"
|
||||
},
|
||||
{
|
||||
"name":"&copy;",
|
||||
"description":"copyright symbol"
|
||||
},
|
||||
{
|
||||
"name":"&reg;",
|
||||
"description":"registered symbol"
|
||||
},
|
||||
{
|
||||
"name":"&trade;",
|
||||
"description":"trademark symbol"
|
||||
},
|
||||
{
|
||||
"name":"&hearts;",
|
||||
"description":"heart"
|
||||
},
|
||||
{
|
||||
"name":"&nbsp;",
|
||||
"description":"Inserts a non-breaking blank space"
|
||||
},
|
||||
{
|
||||
"name":"&amp;",
|
||||
"description":"Ampersand"
|
||||
},
|
||||
{
|
||||
"name":"&#36;",
|
||||
"description":"dollar symbol"
|
||||
},
|
||||
{
|
||||
"name":"&cent;",
|
||||
"description":"Cent symbol"
|
||||
},
|
||||
{
|
||||
"name":"&pound;",
|
||||
"description":"Pound"
|
||||
},
|
||||
{
|
||||
"name":"&yen;",
|
||||
"description":"Yen"
|
||||
},
|
||||
{
|
||||
"name":"&euro;",
|
||||
"description":"Euro symbol"
|
||||
},
|
||||
{
|
||||
"name":"&quot;",
|
||||
"description":"quotation mark"
|
||||
},
|
||||
{
|
||||
"name":"&ldquo;",
|
||||
"description":"Opening Double Quotes "
|
||||
},
|
||||
{
|
||||
"name":"&rdquo;",
|
||||
"description":"Closing Double Quotes "
|
||||
},
|
||||
{
|
||||
"name":"&lsquo;",
|
||||
"description":"Opening Single Quote Mark "
|
||||
},
|
||||
{
|
||||
"name":"&rsquo;",
|
||||
"description":"Closing Single Quote Mark "
|
||||
},
|
||||
{
|
||||
"name":"&laquo;",
|
||||
"description":"angle quotation mark (left)"
|
||||
},
|
||||
{
|
||||
"name":"&raquo;",
|
||||
"description":"angle quotation mark (right)"
|
||||
},
|
||||
{
|
||||
"name":"&lsaquo;",
|
||||
"description":"single left angle quotation"
|
||||
},
|
||||
{
|
||||
"name":"&rsaquo;",
|
||||
"description":"single right angle quotation"
|
||||
},
|
||||
{
|
||||
"name":"&sect;",
|
||||
"description":"Section Symbol"
|
||||
},
|
||||
{
|
||||
"name":"&micro;",
|
||||
"description":"micro sign"
|
||||
},
|
||||
{
|
||||
"name":"&para;",
|
||||
"description":"Paragraph symbol"
|
||||
},
|
||||
{
|
||||
"name":"&bull;",
|
||||
"description":"Big List Dot"
|
||||
},
|
||||
{
|
||||
"name":"&middot;",
|
||||
"description":"Medium List Dot"
|
||||
},
|
||||
{
|
||||
"name":"&hellip;",
|
||||
"description":"horizontal ellipsis"
|
||||
},
|
||||
{
|
||||
"name":"&#124;",
|
||||
"description":"vertical bar"
|
||||
},
|
||||
{
|
||||
"name":"&brvbar;",
|
||||
"description":"broken vertical bar"
|
||||
},
|
||||
{
|
||||
"name":"&ndash;",
|
||||
"description":"en-dash"
|
||||
},
|
||||
{
|
||||
"name":"&mdash;",
|
||||
"description":"em-dash"
|
||||
},
|
||||
{
|
||||
"name":"&curren;",
|
||||
"description":"Generic currency symbol"
|
||||
},
|
||||
{
|
||||
"name":"&#33;",
|
||||
"description":"exclamation point"
|
||||
},
|
||||
{
|
||||
"name":"&#35;",
|
||||
"description":"number sign"
|
||||
},
|
||||
{
|
||||
"name":"&#39;",
|
||||
"description":"single quote"
|
||||
},
|
||||
{
|
||||
"name":"&#40;",
|
||||
"description":""
|
||||
},
|
||||
{
|
||||
"name":"&#41;",
|
||||
"description":""
|
||||
},
|
||||
{
|
||||
"name":"&#42;",
|
||||
"description":"asterisk"
|
||||
},
|
||||
{
|
||||
"name":"&#43;",
|
||||
"description":"plus sign"
|
||||
},
|
||||
{
|
||||
"name":"&#44;",
|
||||
"description":"comma"
|
||||
},
|
||||
{
|
||||
"name":"&#45;",
|
||||
"description":"minus sign - hyphen"
|
||||
},
|
||||
{
|
||||
"name":"&#46;",
|
||||
"description":"period"
|
||||
},
|
||||
{
|
||||
"name":"&#47;",
|
||||
"description":"slash"
|
||||
},
|
||||
{
|
||||
"name":"&#48;",
|
||||
"description":"0"
|
||||
},
|
||||
{
|
||||
"name":"&#49;",
|
||||
"description":"1"
|
||||
},
|
||||
{
|
||||
"name":"&#50;",
|
||||
"description":"2"
|
||||
},
|
||||
{
|
||||
"name":"&#51;",
|
||||
"description":"3"
|
||||
},
|
||||
{
|
||||
"name":"&#52;",
|
||||
"description":"4"
|
||||
},
|
||||
{
|
||||
"name":"&#53;",
|
||||
"description":"5"
|
||||
},
|
||||
{
|
||||
"name":"&#54;",
|
||||
"description":"6"
|
||||
},
|
||||
{
|
||||
"name":"&#55;",
|
||||
"description":"7"
|
||||
},
|
||||
{
|
||||
"name":"&#56;",
|
||||
"description":"8"
|
||||
},
|
||||
{
|
||||
"name":"&#57;",
|
||||
"description":"9"
|
||||
},
|
||||
{
|
||||
"name":"&#58;",
|
||||
"description":"colon"
|
||||
},
|
||||
{
|
||||
"name":"&#59;",
|
||||
"description":"semicolon"
|
||||
},
|
||||
{
|
||||
"name":"&#61;",
|
||||
"description":"equal sign"
|
||||
},
|
||||
{
|
||||
"name":"&#63;",
|
||||
"description":"question mark"
|
||||
},
|
||||
{
|
||||
"name":"&lt;",
|
||||
"description":"Less than"
|
||||
},
|
||||
{
|
||||
"name":"&gt;",
|
||||
"description":"Greater than"
|
||||
},
|
||||
{
|
||||
"name":"&le;",
|
||||
"description":"Less than or Equal to"
|
||||
},
|
||||
{
|
||||
"name":"&ge;",
|
||||
"description":"Greater than or Equal to"
|
||||
},
|
||||
{
|
||||
"name":"&times;",
|
||||
"description":"Multiplication symbol"
|
||||
},
|
||||
{
|
||||
"name":"&divide;",
|
||||
"description":"Division symbol"
|
||||
},
|
||||
{
|
||||
"name":"&minus;",
|
||||
"description":"Minus symbol"
|
||||
},
|
||||
{
|
||||
"name":"&plusmn;",
|
||||
"description":"Plus/minus symbol"
|
||||
},
|
||||
{
|
||||
"name":"&ne;",
|
||||
"description":"Not Equal"
|
||||
},
|
||||
{
|
||||
"name":"&sup1;",
|
||||
"description":"Superscript 1"
|
||||
},
|
||||
{
|
||||
"name":"&sup2;",
|
||||
"description":"Superscript 2"
|
||||
},
|
||||
{
|
||||
"name":"&sup3;",
|
||||
"description":"Superscript 3"
|
||||
},
|
||||
{
|
||||
"name":"&frac12;",
|
||||
"description":"Fraction ½"
|
||||
},
|
||||
{
|
||||
"name":"&frac14;",
|
||||
"description":"Fraction ¼"
|
||||
},
|
||||
{
|
||||
"name":"&frac34;",
|
||||
"description":"Fraction ¾"
|
||||
},
|
||||
{
|
||||
"name":"&permil;",
|
||||
"description":"per mille"
|
||||
},
|
||||
{
|
||||
"name":"&deg;",
|
||||
"description":"Degree symbol"
|
||||
},
|
||||
{
|
||||
"name":"&radic;",
|
||||
"description":"square root"
|
||||
},
|
||||
{
|
||||
"name":"&infin;",
|
||||
"description":"Infinity"
|
||||
},
|
||||
{
|
||||
"name":"&larr;",
|
||||
"description":"left arrow"
|
||||
},
|
||||
{
|
||||
"name":"&uarr;",
|
||||
"description":"up arrow"
|
||||
},
|
||||
{
|
||||
"name":"&rarr;",
|
||||
"description":"right arrow"
|
||||
},
|
||||
{
|
||||
"name":"&darr;",
|
||||
"description":"down arrow"
|
||||
},
|
||||
{
|
||||
"name":"&harr;",
|
||||
"description":"left right arrow"
|
||||
},
|
||||
{
|
||||
"name":"&crarr;",
|
||||
"description":"carriage return arrow"
|
||||
},
|
||||
{
|
||||
"name":"&lceil;",
|
||||
"description":"left ceiling"
|
||||
},
|
||||
{
|
||||
"name":"&rceil;",
|
||||
"description":"right ceiling"
|
||||
},
|
||||
{
|
||||
"name":"&lfloor;",
|
||||
"description":"left floor"
|
||||
},
|
||||
{
|
||||
"name":"&rfloor;",
|
||||
"description":"right floor"
|
||||
},
|
||||
{
|
||||
"name":"&spades;",
|
||||
"description":"spade"
|
||||
},
|
||||
{
|
||||
"name":"&clubs;",
|
||||
"description":"club"
|
||||
},
|
||||
{
|
||||
"name":"&hearts;",
|
||||
"description":"heart"
|
||||
},
|
||||
{
|
||||
"name":"&diams;",
|
||||
"description":"diamond"
|
||||
},
|
||||
{
|
||||
"name":"&loz;",
|
||||
"description":"lozenge"
|
||||
},
|
||||
{
|
||||
"name":"&dagger;",
|
||||
"description":"dagger"
|
||||
},
|
||||
{
|
||||
"name":"&Dagger;",
|
||||
"description":"double dagger"
|
||||
},
|
||||
{
|
||||
"name":"&iexcl;",
|
||||
"description":"inverted exclamation mark"
|
||||
},
|
||||
{
|
||||
"name":"&iquest;",
|
||||
"description":"inverted question mark"
|
||||
},
|
||||
{
|
||||
"name":"&#338;",
|
||||
"description":"latin capital letter OE"
|
||||
},
|
||||
{
|
||||
"name":"&#339;",
|
||||
"description":"latin small letter oe"
|
||||
},
|
||||
{
|
||||
"name":"&#352;",
|
||||
"description":"latin capital letter S with caron"
|
||||
},
|
||||
{
|
||||
"name":"&#353;",
|
||||
"description":"latin small letter s with caron"
|
||||
},
|
||||
{
|
||||
"name":"&#376;",
|
||||
"description":"latin capital letter Y with diaeresis"
|
||||
},
|
||||
{
|
||||
"name":"&#402;",
|
||||
"description":"latin small f with hook - function"
|
||||
},
|
||||
{
|
||||
"name":"&not;",
|
||||
"description":"not sign"
|
||||
},
|
||||
{
|
||||
"name":"&ordf;",
|
||||
"description":"feminine ordinal indicator"
|
||||
},
|
||||
{
|
||||
"name":"&uml;",
|
||||
"description":"spacing diaeresis - umlaut"
|
||||
},
|
||||
{
|
||||
"name":"&macr;",
|
||||
"description":"spacing macron - overline"
|
||||
},
|
||||
{
|
||||
"name":"&acute;",
|
||||
"description":"acute accent - spacing acute"
|
||||
},
|
||||
{
|
||||
"name":"&Agrave;",
|
||||
"description":"latin capital letter A with grave"
|
||||
},
|
||||
{
|
||||
"name":"&Aacute;",
|
||||
"description":"latin capital letter A with acute"
|
||||
},
|
||||
{
|
||||
"name":"&Acirc;",
|
||||
"description":"latin capital letter A with circumflex"
|
||||
},
|
||||
{
|
||||
"name":"&Atilde;",
|
||||
"description":"latin capital letter A with tilde"
|
||||
},
|
||||
{
|
||||
"name":"&Auml;",
|
||||
"description":"latin capital letter A with diaeresis"
|
||||
},
|
||||
{
|
||||
"name":"&Aring;",
|
||||
"description":"latin capital letter A with ring above"
|
||||
},
|
||||
{
|
||||
"name":"&AElig;",
|
||||
"description":"latin capital letter AE"
|
||||
},
|
||||
{
|
||||
"name":"&Ccedil;",
|
||||
"description":"latin capital letter C with cedilla"
|
||||
},
|
||||
{
|
||||
"name":"&Egrave;",
|
||||
"description":"latin capital letter E with grave"
|
||||
},
|
||||
{
|
||||
"name":"&Eacute;",
|
||||
"description":"latin capital letter E with acute"
|
||||
},
|
||||
{
|
||||
"name":"&Ecirc;",
|
||||
"description":"latin capital letter E with circumflex"
|
||||
},
|
||||
{
|
||||
"name":"&Euml;",
|
||||
"description":"latin capital letter E with diaeresis"
|
||||
},
|
||||
{
|
||||
"name":"&Igrave;",
|
||||
"description":"latin capital letter I with grave"
|
||||
},
|
||||
{
|
||||
"name":"&Iacute;",
|
||||
"description":"latin capital letter I with acute"
|
||||
},
|
||||
{
|
||||
"name":"&Icirc;",
|
||||
"description":"latin capital letter I with circumflex"
|
||||
},
|
||||
{
|
||||
"name":"&Iuml;",
|
||||
"description":"latin capital letter I with diaeresis"
|
||||
},
|
||||
|
||||
{
|
||||
"name":"&ETH;",
|
||||
"description":"latin capital letter ETH"
|
||||
},
|
||||
{
|
||||
"name":"&Ntilde;",
|
||||
"description":"latin capital letter N with tilde"
|
||||
},
|
||||
{
|
||||
"name":"&Ograve;",
|
||||
"description":"latin capital letter O with grave"
|
||||
},
|
||||
{
|
||||
"name":"&Oacute;",
|
||||
"description":"latin capital letter O with acute"
|
||||
},
|
||||
{
|
||||
"name":"&Ocirc;",
|
||||
"description":"latin capital letter O with circumflex"
|
||||
},
|
||||
{
|
||||
"name":"&Otilde;",
|
||||
"description":"latin capital letter O with tilde"
|
||||
},
|
||||
{
|
||||
"name":"&Ouml;",
|
||||
"description":"latin capital letter O with diaeresis"
|
||||
},
|
||||
{
|
||||
"name":"&times;",
|
||||
"description":"multiplication sign"
|
||||
},
|
||||
{
|
||||
"name":"&Oslash;",
|
||||
"description":"latin capital letter O with slash"
|
||||
},
|
||||
{
|
||||
"name":"&Ugrave;",
|
||||
"description":"latin capital letter U with grave"
|
||||
},
|
||||
{
|
||||
"name":"&Uacute;",
|
||||
"description":"latin capital letter U with acute"
|
||||
},
|
||||
{
|
||||
"name":"&Ucirc;",
|
||||
"description":"latin capital letter U with circumflex"
|
||||
},
|
||||
{
|
||||
"name":"&Uuml;",
|
||||
"description":"latin capital letter U with diaeresis"
|
||||
},
|
||||
{
|
||||
"name":"&Yacute;",
|
||||
"description":"latin capital letter Y with acute"
|
||||
},
|
||||
{
|
||||
"name":"&THORN;",
|
||||
"description":"latin capital letter THORN"
|
||||
},
|
||||
{
|
||||
"name":"&szlig;",
|
||||
"description":"latin small letter sharp s - ess-zed"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"name":"&eth;",
|
||||
"description":"latin capital letter eth"
|
||||
},
|
||||
{
|
||||
"name":"&ntilde;",
|
||||
"description":"latin capital letter n with tilde"
|
||||
},
|
||||
{
|
||||
"name":"&ograve;",
|
||||
"description":"latin capital letter o with grave"
|
||||
},
|
||||
{
|
||||
"name":"&oacute;",
|
||||
"description":"latin capital letter o with acute"
|
||||
},
|
||||
{
|
||||
"name":"&ocirc;",
|
||||
"description":"latin capital letter o with circumflex"
|
||||
},
|
||||
{
|
||||
"name":"&otilde;",
|
||||
"description":"latin capital letter o with tilde"
|
||||
},
|
||||
{
|
||||
"name":"&ouml;",
|
||||
"description":"latin capital letter o with diaeresis"
|
||||
},
|
||||
{
|
||||
"name":"&times;",
|
||||
"description":"multiplication sign"
|
||||
},
|
||||
{
|
||||
"name":"&oslash;",
|
||||
"description":"latin capital letter o with slash"
|
||||
},
|
||||
{
|
||||
"name":"&ugrave;",
|
||||
"description":"latin capital letter u with grave"
|
||||
},
|
||||
{
|
||||
"name":"&uacute;",
|
||||
"description":"latin capital letter u with acute"
|
||||
},
|
||||
{
|
||||
"name":"&ucirc;",
|
||||
"description":"latin capital letter u with circumflex"
|
||||
},
|
||||
{
|
||||
"name":"&uuml;",
|
||||
"description":"latin capital letter u with diaeresis"
|
||||
},
|
||||
{
|
||||
"name":"&yacute;",
|
||||
"description":"latin capital letter y with acute"
|
||||
},
|
||||
{
|
||||
"name":"&thorn;",
|
||||
"description":"latin capital letter thorn"
|
||||
},
|
||||
{
|
||||
"name":"&yuml;",
|
||||
"description":"latin small letter y with diaeresis"
|
||||
},
|
||||
|
||||
{
|
||||
"name":"&agrave;",
|
||||
"description":"latin capital letter a with grave"
|
||||
},
|
||||
{
|
||||
"name":"&aacute;",
|
||||
"description":"latin capital letter a with acute"
|
||||
},
|
||||
{
|
||||
"name":"&acirc;",
|
||||
"description":"latin capital letter a with circumflex"
|
||||
},
|
||||
{
|
||||
"name":"&atilde;",
|
||||
"description":"latin capital letter a with tilde"
|
||||
},
|
||||
{
|
||||
"name":"&auml;",
|
||||
"description":"latin capital letter a with diaeresis"
|
||||
},
|
||||
{
|
||||
"name":"&aring;",
|
||||
"description":"latin capital letter a with ring above"
|
||||
},
|
||||
{
|
||||
"name":"&aelig;",
|
||||
"description":"latin capital letter ae"
|
||||
},
|
||||
{
|
||||
"name":"&ccedil;",
|
||||
"description":"latin capital letter c with cedilla"
|
||||
},
|
||||
{
|
||||
"name":"&egrave;",
|
||||
"description":"latin capital letter e with grave"
|
||||
},
|
||||
{
|
||||
"name":"&eacute;",
|
||||
"description":"latin capital letter e with acute"
|
||||
},
|
||||
{
|
||||
"name":"&ecirc;",
|
||||
"description":"latin capital letter e with circumflex"
|
||||
},
|
||||
{
|
||||
"name":"&euml;",
|
||||
"description":"latin capital letter e with diaeresis"
|
||||
},
|
||||
{
|
||||
"name":"&igrave;",
|
||||
"description":"latin capital letter i with grave"
|
||||
},
|
||||
{
|
||||
"name":"&Iacute;",
|
||||
"description":"latin capital letter i with acute"
|
||||
},
|
||||
{
|
||||
"name":"&icirc;",
|
||||
"description":"latin capital letter i with circumflex"
|
||||
},
|
||||
{
|
||||
"name":"&iuml;",
|
||||
"description":"latin capital letter i with diaeresis"
|
||||
},
|
||||
|
||||
{
|
||||
"name":"&#65;",
|
||||
"description":"A"
|
||||
},
|
||||
{
|
||||
"name":"&#66;",
|
||||
"description":"B"
|
||||
},
|
||||
{
|
||||
"name":"&#67;",
|
||||
"description":"C"
|
||||
},
|
||||
{
|
||||
"name":"&#68;",
|
||||
"description":"D"
|
||||
},
|
||||
{
|
||||
"name":"&#69;",
|
||||
"description":"E"
|
||||
},
|
||||
{
|
||||
"name":"&#70;",
|
||||
"description":"F"
|
||||
},
|
||||
{
|
||||
"name":"&#71;",
|
||||
"description":"G"
|
||||
},
|
||||
{
|
||||
"name":"&#72;",
|
||||
"description":"H"
|
||||
},
|
||||
{
|
||||
"name":"&#73;",
|
||||
"description":"I"
|
||||
},
|
||||
{
|
||||
"name":"&#74;",
|
||||
"description":"J"
|
||||
},
|
||||
{
|
||||
"name":"&#75;",
|
||||
"description":"K"
|
||||
},
|
||||
{
|
||||
"name":"&#76;",
|
||||
"description":"L"
|
||||
},
|
||||
{
|
||||
"name":"&#77;",
|
||||
"description":"M"
|
||||
},
|
||||
{
|
||||
"name":"&#78;",
|
||||
"description":"N"
|
||||
},
|
||||
{
|
||||
"name":"&#79;",
|
||||
"description":"O"
|
||||
},
|
||||
{
|
||||
"name":"&#80;",
|
||||
"description":"P"
|
||||
},
|
||||
{
|
||||
"name":"&#81;",
|
||||
"description":"Q"
|
||||
},
|
||||
{
|
||||
"name":"&#82;",
|
||||
"description":"R"
|
||||
},
|
||||
{
|
||||
"name":"&#83;",
|
||||
"description":"S"
|
||||
},
|
||||
{
|
||||
"name":"&#84;",
|
||||
"description":"T"
|
||||
},
|
||||
{
|
||||
"name":"&#85;",
|
||||
"description":"U"
|
||||
},
|
||||
{
|
||||
"name":"&#86;",
|
||||
"description":"V"
|
||||
},
|
||||
{
|
||||
"name":"&#87;",
|
||||
"description":"W"
|
||||
},
|
||||
{
|
||||
"name":"&#88;",
|
||||
"description":"X"
|
||||
},
|
||||
{
|
||||
"name":"&#89;",
|
||||
"description":"Y"
|
||||
},
|
||||
{
|
||||
"name":"&#90;",
|
||||
"description":"Z"
|
||||
},
|
||||
{
|
||||
"name":"&#91;",
|
||||
"description":"opening bracket"
|
||||
},
|
||||
{
|
||||
"name":"&#92;",
|
||||
"description":"backslash"
|
||||
},
|
||||
{
|
||||
"name":"&#93;",
|
||||
"description":"closing bracket"
|
||||
},
|
||||
{
|
||||
"name":"&#94;",
|
||||
"description":"caret - circumflex"
|
||||
},
|
||||
{
|
||||
"name":"&#95;",
|
||||
"description":"underscore"
|
||||
},
|
||||
|
||||
{
|
||||
"name":"&#96;",
|
||||
"description":"grave accent"
|
||||
},
|
||||
{
|
||||
"name":"&#97;",
|
||||
"description":"a"
|
||||
},
|
||||
{
|
||||
"name":"&#98;",
|
||||
"description":"b"
|
||||
},
|
||||
{
|
||||
"name":"&#99;",
|
||||
"description":"c"
|
||||
},
|
||||
{
|
||||
"name":"&#100;",
|
||||
"description":"d"
|
||||
},
|
||||
{
|
||||
"name":"&#101;",
|
||||
"description":"e"
|
||||
},
|
||||
{
|
||||
"name":"&#102;",
|
||||
"description":"f"
|
||||
},
|
||||
{
|
||||
"name":"&#103;",
|
||||
"description":"g"
|
||||
},
|
||||
{
|
||||
"name":"&#104;",
|
||||
"description":"h"
|
||||
},
|
||||
{
|
||||
"name":"&#105;",
|
||||
"description":"i"
|
||||
},
|
||||
{
|
||||
"name":"&#106;",
|
||||
"description":"j"
|
||||
},
|
||||
{
|
||||
"name":"&#107;",
|
||||
"description":"k"
|
||||
},
|
||||
{
|
||||
"name":"&#108;",
|
||||
"description":"l"
|
||||
},
|
||||
{
|
||||
"name":"&#109;",
|
||||
"description":"m"
|
||||
},
|
||||
{
|
||||
"name":"&#110;",
|
||||
"description":"n"
|
||||
},
|
||||
{
|
||||
"name":"&#111;",
|
||||
"description":"o"
|
||||
},
|
||||
{
|
||||
"name":"&#112;",
|
||||
"description":"p"
|
||||
},
|
||||
{
|
||||
"name":"&#113;",
|
||||
"description":"q"
|
||||
},
|
||||
{
|
||||
"name":"&#114;",
|
||||
"description":"r"
|
||||
},
|
||||
{
|
||||
"name":"&#115;",
|
||||
"description":"s"
|
||||
},
|
||||
{
|
||||
"name":"&#116;",
|
||||
"description":"t"
|
||||
},
|
||||
{
|
||||
"name":"&#117;",
|
||||
"description":"u"
|
||||
},
|
||||
{
|
||||
"name":"&#118;",
|
||||
"description":"v"
|
||||
},
|
||||
{
|
||||
"name":"&#119;",
|
||||
"description":"w"
|
||||
},
|
||||
{
|
||||
"name":"&#120;",
|
||||
"description":"x"
|
||||
},
|
||||
{
|
||||
"name":"&#121;",
|
||||
"description":"y"
|
||||
},
|
||||
{
|
||||
"name":"&#122;",
|
||||
"description":"z"
|
||||
},
|
||||
{
|
||||
"name":"&#123;",
|
||||
"description":"opening brace"
|
||||
},
|
||||
{
|
||||
"name":"&#124;",
|
||||
"description":"vertical bar"
|
||||
},
|
||||
{
|
||||
"name":"&#125;",
|
||||
"description":"closing brace"
|
||||
},
|
||||
{
|
||||
"name":"&#126;",
|
||||
"description":"equivalency sign - tilde"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,227 @@
|
||||
/*!
|
||||
* Image (upload) dialog plugin for Editor.md
|
||||
*
|
||||
* @file image-dialog.js
|
||||
* @author pandao
|
||||
* @version 1.3.4
|
||||
* @updateTime 2015-06-09
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
|
||||
var pluginName = "image-dialog";
|
||||
|
||||
exports.fn.imageDialog = 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 imageLang = lang.dialog.image;
|
||||
var classPrefix = this.classPrefix;
|
||||
var iframeName = classPrefix + "image-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.imageUploadURL + (settings.imageUploadURL.indexOf("?") >= 0 ? "&" : "?") + "guid=" + guid;
|
||||
|
||||
if (settings.crossDomainUpload)
|
||||
{
|
||||
action += "&callback=" + settings.uploadCallbackURL + "&dialog_id=editormd-image-dialog-" + guid;
|
||||
}
|
||||
|
||||
var dialogContent = ( (settings.imageUpload) ? "<form action=\"" + action +"\" target=\"" + iframeName + "\" method=\"post\" enctype=\"multipart/form-data\" class=\"" + classPrefix + "form\">" : "<div class=\"" + classPrefix + "form\">" ) +
|
||||
( (settings.imageUpload) ? "<iframe name=\"" + iframeName + "\" id=\"" + iframeName + "\" guid=\"" + guid + "\"></iframe>" : "" ) +
|
||||
"<label>" + imageLang.url + "</label>" +
|
||||
"<input type=\"text\" data-url />" + (function(){
|
||||
return (settings.imageUpload) ? "<div class=\"" + classPrefix + "file-input\">" +
|
||||
"<input type=\"file\" name=\"" + classPrefix + "image-file\" accept=\"image/*\" />" +
|
||||
"<input type=\"submit\" value=\"" + imageLang.uploadButton + "\" />" +
|
||||
"</div>" : "";
|
||||
})() +
|
||||
"<br/>" +
|
||||
"<label>" + imageLang.alt + "</label>" +
|
||||
"<input type=\"text\" value=\"" + selection + "\" data-alt />" +
|
||||
"<br/>" +
|
||||
"<label>" + imageLang.link + "</label>" +
|
||||
"<input type=\"text\" value=\"http://\" data-link />" +
|
||||
"<br/>" +
|
||||
( (settings.imageUpload) ? "</form>" : "</div>");
|
||||
|
||||
//var imageFooterHTML = "<button class=\"" + classPrefix + "btn " + classPrefix + "image-manager-btn\" style=\"float:left;\">" + imageLang.managerButton + "</button>";
|
||||
|
||||
dialog = this.createDialog({
|
||||
title : imageLang.title,
|
||||
width : (settings.imageUpload) ? 465 : 380,
|
||||
height : 254,
|
||||
name : dialogName,
|
||||
content : dialogContent,
|
||||
mask : settings.dialogShowMask,
|
||||
drag : settings.dialogDraggable,
|
||||
lockScreen : settings.dialogLockScreen,
|
||||
maskStyle : {
|
||||
opacity : settings.dialogMaskOpacity,
|
||||
backgroundColor : settings.dialogMaskBgColor
|
||||
},
|
||||
buttons : {
|
||||
enter : [lang.buttons.enter, function() {
|
||||
var url = this.find("[data-url]").val();
|
||||
var alt = this.find("[data-alt]").val();
|
||||
var link = this.find("[data-link]").val();
|
||||
|
||||
if (url === "")
|
||||
{
|
||||
alert(imageLang.imageURLEmpty);
|
||||
return false;
|
||||
}
|
||||
|
||||
var altAttr = (alt !== "") ? " \"" + alt + "\"" : "";
|
||||
|
||||
if (link === "" || link === "http://")
|
||||
{
|
||||
cm.replaceSelection("");
|
||||
}
|
||||
else
|
||||
{
|
||||
cm.replaceSelection("[](" + link + altAttr + ")");
|
||||
}
|
||||
|
||||
if (alt === "") {
|
||||
cm.setCursor(cursor.line, cursor.ch + 2);
|
||||
}
|
||||
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
//删除对话框
|
||||
this.remove();
|
||||
|
||||
return false;
|
||||
}],
|
||||
|
||||
cancel : [lang.buttons.cancel, function() {
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
//删除对话框
|
||||
this.remove();
|
||||
|
||||
return false;
|
||||
}]
|
||||
}
|
||||
});
|
||||
|
||||
dialog.attr("id", classPrefix + "image-dialog-" + guid);
|
||||
|
||||
if (!settings.imageUpload) {
|
||||
return ;
|
||||
}
|
||||
|
||||
var fileInput = dialog.find("[name=\"" + classPrefix + "image-file\"]");
|
||||
|
||||
fileInput.bind("change", function() {
|
||||
var fileName = fileInput.val();
|
||||
var isImage = new RegExp("(\\.(" + settings.imageFormats.join("|") + "))$", "i"); // /(\.(webp|jpg|jpeg|gif|bmp|png))$/
|
||||
|
||||
if (fileName === "")
|
||||
{
|
||||
alert(imageLang.uploadFileEmpty);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isImage.test(fileName))
|
||||
{
|
||||
alert(imageLang.formatNotAllowed + settings.imageFormats.join(", "));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
loading(true);
|
||||
|
||||
var submitHandler = function() {
|
||||
|
||||
var uploadIframe = document.getElementById(iframeName);
|
||||
|
||||
uploadIframe.onload = function() {
|
||||
|
||||
loading(false);
|
||||
|
||||
var body = (uploadIframe.contentWindow ? uploadIframe.contentWindow : uploadIframe.contentDocument).document.body;
|
||||
var json = (body.innerText) ? body.innerText : ( (body.textContent) ? body.textContent : null);
|
||||
|
||||
json = (typeof JSON.parse !== "undefined") ? JSON.parse(json) : eval("(" + json + ")");
|
||||
|
||||
if(!settings.crossDomainUpload)
|
||||
{
|
||||
if (json.success === 1)
|
||||
{
|
||||
dialog.find("[data-url]").val(json.url);
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(json.message);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
dialog.find("[type=\"submit\"]").bind("click", submitHandler).trigger("click");
|
||||
});
|
||||
}
|
||||
|
||||
dialog = editor.find("." + dialogName);
|
||||
dialog.find("[type=\"text\"]").val("");
|
||||
dialog.find("[type=\"file\"]").val("");
|
||||
dialog.find("[data-link]").val("http://");
|
||||
|
||||
this.dialogShowMask(dialog);
|
||||
this.dialogLockScreen();
|
||||
dialog.show();
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,133 @@
|
||||
/*!
|
||||
* Link dialog plugin for Editor.md
|
||||
*
|
||||
* @file link-dialog.js
|
||||
* @author pandao
|
||||
* @version 1.2.1
|
||||
* @updateTime 2015-06-09
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
|
||||
var pluginName = "link-dialog";
|
||||
|
||||
exports.fn.linkDialog = function() {
|
||||
|
||||
var _this = this;
|
||||
var cm = this.cm;
|
||||
var editor = this.editor;
|
||||
var settings = this.settings;
|
||||
var selection = cm.getSelection();
|
||||
var lang = this.lang;
|
||||
var linkLang = lang.dialog.link;
|
||||
var classPrefix = this.classPrefix;
|
||||
var dialogName = classPrefix + pluginName, dialog;
|
||||
|
||||
cm.focus();
|
||||
|
||||
if (editor.find("." + dialogName).length > 0)
|
||||
{
|
||||
dialog = editor.find("." + dialogName);
|
||||
dialog.find("[data-url]").val("http://");
|
||||
dialog.find("[data-title]").val(selection);
|
||||
|
||||
this.dialogShowMask(dialog);
|
||||
this.dialogLockScreen();
|
||||
dialog.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
var dialogHTML = "<div class=\"" + classPrefix + "form\">" +
|
||||
"<label>" + linkLang.url + "</label>" +
|
||||
"<input type=\"text\" value=\"http://\" data-url />" +
|
||||
"<br/>" +
|
||||
"<label>" + linkLang.urlTitle + "</label>" +
|
||||
"<input type=\"text\" value=\"" + selection + "\" data-title />" +
|
||||
"<br/>" +
|
||||
"</div>";
|
||||
|
||||
dialog = this.createDialog({
|
||||
title : linkLang.title,
|
||||
width : 380,
|
||||
height : 211,
|
||||
content : dialogHTML,
|
||||
mask : settings.dialogShowMask,
|
||||
drag : settings.dialogDraggable,
|
||||
lockScreen : settings.dialogLockScreen,
|
||||
maskStyle : {
|
||||
opacity : settings.dialogMaskOpacity,
|
||||
backgroundColor : settings.dialogMaskBgColor
|
||||
},
|
||||
buttons : {
|
||||
enter : [lang.buttons.enter, function() {
|
||||
var url = this.find("[data-url]").val();
|
||||
var title = this.find("[data-title]").val();
|
||||
|
||||
if (url === "http://" || url === "")
|
||||
{
|
||||
alert(linkLang.urlEmpty);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*if (title === "")
|
||||
{
|
||||
alert(linkLang.titleEmpty);
|
||||
return false;
|
||||
}*/
|
||||
|
||||
var str = "[" + title + "](" + url + " \"" + title + "\")";
|
||||
|
||||
if (title == "")
|
||||
{
|
||||
str = "[" + url + "](" + url + ")";
|
||||
}
|
||||
|
||||
cm.replaceSelection(str);
|
||||
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}],
|
||||
|
||||
cancel : [lang.buttons.cancel, function() {
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}]
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,111 @@
|
||||
/*!
|
||||
* Link dialog plugin for Editor.md
|
||||
*
|
||||
* @file link-dialog.js
|
||||
* @author pandao
|
||||
* @version 1.2.0
|
||||
* @updateTime 2015-03-07
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
|
||||
var $ = jQuery; // if using module loader(Require.js/Sea.js).
|
||||
|
||||
var langs = {
|
||||
"zh-cn" : {
|
||||
toolbar : {
|
||||
table : "表格"
|
||||
},
|
||||
dialog : {
|
||||
table : {
|
||||
title : "添加表格",
|
||||
cellsLabel : "单元格数",
|
||||
alignLabel : "对齐方式",
|
||||
rows : "行数",
|
||||
cols : "列数",
|
||||
aligns : ["默认", "左对齐", "居中对齐", "右对齐"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"zh-tw" : {
|
||||
toolbar : {
|
||||
table : "添加表格"
|
||||
},
|
||||
dialog : {
|
||||
table : {
|
||||
title : "添加表格",
|
||||
cellsLabel : "單元格數",
|
||||
alignLabel : "對齊方式",
|
||||
rows : "行數",
|
||||
cols : "列數",
|
||||
aligns : ["默認", "左對齊", "居中對齊", "右對齊"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"en" : {
|
||||
toolbar : {
|
||||
table : "Tables"
|
||||
},
|
||||
dialog : {
|
||||
table : {
|
||||
title : "Tables",
|
||||
cellsLabel : "Cells",
|
||||
alignLabel : "Align",
|
||||
rows : "Rows",
|
||||
cols : "Cols",
|
||||
aligns : ["Default", "Left align", "Center align", "Right align"]
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.fn.htmlEntities = function() {
|
||||
/*
|
||||
var _this = this; // this == the current instance object of Editor.md
|
||||
var lang = _this.lang;
|
||||
var settings = _this.settings;
|
||||
var editor = this.editor;
|
||||
var cursor = cm.getCursor();
|
||||
var selection = cm.getSelection();
|
||||
var classPrefix = this.classPrefix;
|
||||
|
||||
$.extend(true, this.lang, langs[this.lang.name]); // l18n
|
||||
this.setToolbar();
|
||||
|
||||
cm.focus();
|
||||
*/
|
||||
//....
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
/*!
|
||||
* Preformatted text dialog plugin for Editor.md
|
||||
*
|
||||
* @file preformatted-text-dialog.js
|
||||
* @author pandao
|
||||
* @version 1.2.0
|
||||
* @updateTime 2015-03-07
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
var cmEditor;
|
||||
var pluginName = "preformatted-text-dialog";
|
||||
|
||||
exports.fn.preformattedTextDialog = 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 classPrefix = this.classPrefix;
|
||||
var dialogLang = lang.dialog.preformattedText;
|
||||
var dialogName = classPrefix + pluginName, dialog;
|
||||
|
||||
cm.focus();
|
||||
|
||||
if (editor.find("." + dialogName).length > 0)
|
||||
{
|
||||
dialog = editor.find("." + dialogName);
|
||||
dialog.find("textarea").val(selection);
|
||||
|
||||
this.dialogShowMask(dialog);
|
||||
this.dialogLockScreen();
|
||||
dialog.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
var dialogContent = "<textarea placeholder=\"" + dialogLang.placeholder + "\" style=\"display:none;\">" + selection + "</textarea>";
|
||||
|
||||
dialog = this.createDialog({
|
||||
name : dialogName,
|
||||
title : dialogLang.title,
|
||||
width : 780,
|
||||
height : 540,
|
||||
mask : settings.dialogShowMask,
|
||||
drag : settings.dialogDraggable,
|
||||
content : dialogContent,
|
||||
lockScreen : settings.dialogLockScreen,
|
||||
maskStyle : {
|
||||
opacity : settings.dialogMaskOpacity,
|
||||
backgroundColor : settings.dialogMaskBgColor
|
||||
},
|
||||
buttons : {
|
||||
enter : [lang.buttons.enter, function() {
|
||||
var codeTexts = this.find("textarea").val();
|
||||
|
||||
if (codeTexts === "")
|
||||
{
|
||||
alert(dialogLang.emptyAlert);
|
||||
return false;
|
||||
}
|
||||
|
||||
codeTexts = codeTexts.split("\n");
|
||||
|
||||
for (var i in codeTexts)
|
||||
{
|
||||
codeTexts[i] = " " + codeTexts[i];
|
||||
}
|
||||
|
||||
codeTexts = codeTexts.join("\n");
|
||||
|
||||
if (cursor.ch !== 0) {
|
||||
codeTexts = "\r\n\r\n" + codeTexts;
|
||||
}
|
||||
|
||||
cm.replaceSelection(codeTexts);
|
||||
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}],
|
||||
cancel : [lang.buttons.cancel, function() {
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var cmConfig = {
|
||||
mode : "text/html",
|
||||
theme : settings.theme,
|
||||
tabSize : 4,
|
||||
autofocus : true,
|
||||
autoCloseTags : true,
|
||||
indentUnit : 4,
|
||||
lineNumbers : true,
|
||||
lineWrapping : true,
|
||||
extraKeys : {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
|
||||
foldGutter : true,
|
||||
gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
|
||||
matchBrackets : true,
|
||||
indentWithTabs : true,
|
||||
styleActiveLine : true,
|
||||
styleSelectedText : true,
|
||||
autoCloseBrackets : true,
|
||||
showTrailingSpace : true,
|
||||
highlightSelectionMatches : true
|
||||
};
|
||||
|
||||
var textarea = dialog.find("textarea");
|
||||
var cmObj = dialog.find(".CodeMirror");
|
||||
|
||||
if (dialog.find(".CodeMirror").length < 1)
|
||||
{
|
||||
cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig);
|
||||
cmObj = dialog.find(".CodeMirror");
|
||||
|
||||
cmObj.css({
|
||||
"float" : "none",
|
||||
margin : "0 0 5px",
|
||||
border : "1px solid #ddd",
|
||||
fontSize : settings.fontSize,
|
||||
width : "100%",
|
||||
height : "410px"
|
||||
});
|
||||
|
||||
cmEditor.on("change", function(cm) {
|
||||
textarea.val(cm.getValue());
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
cmEditor.setValue(cm.getSelection());
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
/*!
|
||||
* Reference link dialog plugin for Editor.md
|
||||
*
|
||||
* @file reference-link-dialog.js
|
||||
* @author pandao
|
||||
* @version 1.2.1
|
||||
* @updateTime 2015-06-09
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
|
||||
var pluginName = "reference-link-dialog";
|
||||
var ReLinkId = 1;
|
||||
|
||||
exports.fn.referenceLinkDialog = 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 dialogLang = lang.dialog.referenceLink;
|
||||
var classPrefix = this.classPrefix;
|
||||
var dialogName = classPrefix + pluginName, dialog;
|
||||
|
||||
cm.focus();
|
||||
|
||||
if (editor.find("." + dialogName).length < 1)
|
||||
{
|
||||
var dialogHTML = "<div class=\"" + classPrefix + "form\">" +
|
||||
"<label>" + dialogLang.name + "</label>" +
|
||||
"<input type=\"text\" value=\"[" + ReLinkId + "]\" data-name />" +
|
||||
"<br/>" +
|
||||
"<label>" + dialogLang.urlId + "</label>" +
|
||||
"<input type=\"text\" data-url-id />" +
|
||||
"<br/>" +
|
||||
"<label>" + dialogLang.url + "</label>" +
|
||||
"<input type=\"text\" value=\"http://\" data-url />" +
|
||||
"<br/>" +
|
||||
"<label>" + dialogLang.urlTitle + "</label>" +
|
||||
"<input type=\"text\" value=\"" + selection + "\" data-title />" +
|
||||
"<br/>" +
|
||||
"</div>";
|
||||
|
||||
dialog = this.createDialog({
|
||||
name : dialogName,
|
||||
title : dialogLang.title,
|
||||
width : 380,
|
||||
height : 296,
|
||||
content : dialogHTML,
|
||||
mask : settings.dialogShowMask,
|
||||
drag : settings.dialogDraggable,
|
||||
lockScreen : settings.dialogLockScreen,
|
||||
maskStyle : {
|
||||
opacity : settings.dialogMaskOpacity,
|
||||
backgroundColor : settings.dialogMaskBgColor
|
||||
},
|
||||
buttons : {
|
||||
enter : [lang.buttons.enter, function() {
|
||||
var name = this.find("[data-name]").val();
|
||||
var url = this.find("[data-url]").val();
|
||||
var rid = this.find("[data-url-id]").val();
|
||||
var title = this.find("[data-title]").val();
|
||||
|
||||
if (name === "")
|
||||
{
|
||||
alert(dialogLang.nameEmpty);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rid === "")
|
||||
{
|
||||
alert(dialogLang.idEmpty);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (url === "http://" || url === "")
|
||||
{
|
||||
alert(dialogLang.urlEmpty);
|
||||
return false;
|
||||
}
|
||||
|
||||
//cm.replaceSelection("[" + title + "][" + name + "]\n[" + name + "]: " + url + "");
|
||||
cm.replaceSelection("[" + name + "][" + rid + "]");
|
||||
|
||||
if (selection === "") {
|
||||
cm.setCursor(cursor.line, cursor.ch + 1);
|
||||
}
|
||||
|
||||
title = (title === "") ? "" : " \"" + title + "\"";
|
||||
|
||||
cm.setValue(cm.getValue() + "\n[" + rid + "]: " + url + title + "");
|
||||
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}],
|
||||
cancel : [lang.buttons.cancel, function() {
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dialog = editor.find("." + dialogName);
|
||||
dialog.find("[data-name]").val("[" + ReLinkId + "]");
|
||||
dialog.find("[data-url-id]").val("");
|
||||
dialog.find("[data-url]").val("http://");
|
||||
dialog.find("[data-title]").val(selection);
|
||||
|
||||
this.dialogShowMask(dialog);
|
||||
this.dialogLockScreen();
|
||||
dialog.show();
|
||||
|
||||
ReLinkId++;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,218 @@
|
||||
/*!
|
||||
* Table dialog plugin for Editor.md
|
||||
*
|
||||
* @file table-dialog.js
|
||||
* @author pandao
|
||||
* @version 1.2.1
|
||||
* @updateTime 2015-06-09
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
|
||||
var $ = jQuery;
|
||||
var pluginName = "table-dialog";
|
||||
|
||||
var langs = {
|
||||
"zh-cn" : {
|
||||
toolbar : {
|
||||
table : "表格"
|
||||
},
|
||||
dialog : {
|
||||
table : {
|
||||
title : "添加表格",
|
||||
cellsLabel : "单元格数",
|
||||
alignLabel : "对齐方式",
|
||||
rows : "行数",
|
||||
cols : "列数",
|
||||
aligns : ["默认", "左对齐", "居中对齐", "右对齐"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"zh-tw" : {
|
||||
toolbar : {
|
||||
table : "添加表格"
|
||||
},
|
||||
dialog : {
|
||||
table : {
|
||||
title : "添加表格",
|
||||
cellsLabel : "單元格數",
|
||||
alignLabel : "對齊方式",
|
||||
rows : "行數",
|
||||
cols : "列數",
|
||||
aligns : ["默認", "左對齊", "居中對齊", "右對齊"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"en" : {
|
||||
toolbar : {
|
||||
table : "Tables"
|
||||
},
|
||||
dialog : {
|
||||
table : {
|
||||
title : "Tables",
|
||||
cellsLabel : "Cells",
|
||||
alignLabel : "Align",
|
||||
rows : "Rows",
|
||||
cols : "Cols",
|
||||
aligns : ["Default", "Left align", "Center align", "Right align"]
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.fn.tableDialog = function() {
|
||||
var _this = this;
|
||||
var cm = this.cm;
|
||||
var editor = this.editor;
|
||||
var settings = this.settings;
|
||||
var path = settings.path + "../plugins/" + pluginName +"/";
|
||||
var classPrefix = this.classPrefix;
|
||||
var dialogName = classPrefix + pluginName, dialog;
|
||||
|
||||
$.extend(true, this.lang, langs[this.lang.name]);
|
||||
this.setToolbar();
|
||||
|
||||
var lang = this.lang;
|
||||
var dialogLang = lang.dialog.table;
|
||||
|
||||
var dialogContent = [
|
||||
"<div class=\"editormd-form\" style=\"padding: 13px 0;\">",
|
||||
"<label>" + dialogLang.cellsLabel + "</label>",
|
||||
dialogLang.rows + " <input type=\"number\" value=\"3\" class=\"number-input\" style=\"width:40px;\" max=\"100\" min=\"2\" data-rows /> ",
|
||||
dialogLang.cols + " <input type=\"number\" value=\"2\" class=\"number-input\" style=\"width:40px;\" max=\"100\" min=\"1\" data-cols /><br/>",
|
||||
"<label>" + dialogLang.alignLabel + "</label>",
|
||||
"<div class=\"fa-btns\"></div>",
|
||||
"</div>"
|
||||
].join("\n");
|
||||
|
||||
if (editor.find("." + dialogName).length > 0)
|
||||
{
|
||||
dialog = editor.find("." + dialogName);
|
||||
|
||||
this.dialogShowMask(dialog);
|
||||
this.dialogLockScreen();
|
||||
dialog.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog = this.createDialog({
|
||||
name : dialogName,
|
||||
title : dialogLang.title,
|
||||
width : 360,
|
||||
height : 226,
|
||||
mask : settings.dialogShowMask,
|
||||
drag : settings.dialogDraggable,
|
||||
content : dialogContent,
|
||||
lockScreen : settings.dialogLockScreen,
|
||||
maskStyle : {
|
||||
opacity : settings.dialogMaskOpacity,
|
||||
backgroundColor : settings.dialogMaskBgColor
|
||||
},
|
||||
buttons : {
|
||||
enter : [lang.buttons.enter, function() {
|
||||
var rows = parseInt(this.find("[data-rows]").val());
|
||||
var cols = parseInt(this.find("[data-cols]").val());
|
||||
var align = this.find("[name=\"table-align\"]:checked").val();
|
||||
var table = "";
|
||||
var hrLine = "------------";
|
||||
|
||||
var alignSign = {
|
||||
_default : hrLine,
|
||||
left : ":" + hrLine,
|
||||
center : ":" + hrLine + ":",
|
||||
right : hrLine + ":"
|
||||
};
|
||||
|
||||
if ( rows > 1 && cols > 0)
|
||||
{
|
||||
for (var r = 0, len = rows; r < len; r++)
|
||||
{
|
||||
var row = [];
|
||||
var head = [];
|
||||
|
||||
for (var c = 0, len2 = cols; c < len2; c++)
|
||||
{
|
||||
if (r === 1) {
|
||||
head.push(alignSign[align]);
|
||||
}
|
||||
|
||||
row.push(" ");
|
||||
}
|
||||
|
||||
if (r === 1) {
|
||||
table += "| " + head.join(" | ") + " |" + "\n";
|
||||
}
|
||||
|
||||
table += "| " + row.join( (cols === 1) ? "" : " | " ) + " |" + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
cm.replaceSelection(table);
|
||||
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}],
|
||||
|
||||
cancel : [lang.buttons.cancel, function() {
|
||||
this.hide().lockScreen(false).hideMask();
|
||||
|
||||
return false;
|
||||
}]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var faBtns = dialog.find(".fa-btns");
|
||||
|
||||
if (faBtns.html() === "")
|
||||
{
|
||||
var icons = ["align-justify", "align-left", "align-center", "align-right"];
|
||||
var _lang = dialogLang.aligns;
|
||||
var values = ["_default", "left", "center", "right"];
|
||||
|
||||
for (var i = 0, len = icons.length; i < len; i++)
|
||||
{
|
||||
var checked = (i === 0) ? " checked=\"checked\"" : "";
|
||||
var btn = "<a href=\"javascript:;\"><label for=\"editormd-table-dialog-radio"+i+"\" title=\"" + _lang[i] + "\">";
|
||||
btn += "<input type=\"radio\" name=\"table-align\" id=\"editormd-table-dialog-radio"+i+"\" value=\"" + values[i] + "\"" +checked + " /> ";
|
||||
btn += "<i class=\"fa fa-" + icons[i] + "\"></i>";
|
||||
btn += "</label></a>";
|
||||
|
||||
faBtns.append(btn);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,66 @@
|
||||
/*!
|
||||
* Test plugin for Editor.md
|
||||
*
|
||||
* @file test-plugin.js
|
||||
* @author pandao
|
||||
* @version 1.2.0
|
||||
* @updateTime 2015-03-07
|
||||
* {@link https://github.com/pandao/editor.md}
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var factory = function (exports) {
|
||||
|
||||
var $ = jQuery; // if using module loader(Require.js/Sea.js).
|
||||
|
||||
exports.testPlugin = function(){
|
||||
alert("testPlugin");
|
||||
};
|
||||
|
||||
exports.fn.testPluginMethodA = function() {
|
||||
/*
|
||||
var _this = this; // this == the current instance object of Editor.md
|
||||
var lang = _this.lang;
|
||||
var settings = _this.settings;
|
||||
var editor = this.editor;
|
||||
var cursor = cm.getCursor();
|
||||
var selection = cm.getSelection();
|
||||
var classPrefix = this.classPrefix;
|
||||
|
||||
cm.focus();
|
||||
*/
|
||||
//....
|
||||
|
||||
alert("testPluginMethodA");
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// CommonJS/Node.js
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
|
||||
{
|
||||
module.exports = factory;
|
||||
}
|
||||
else if (typeof define === "function") // AMD/CMD/Sea.js
|
||||
{
|
||||
if (define.amd) { // for Require.js
|
||||
|
||||
define(["editormd"], function(editormd) {
|
||||
factory(editormd);
|
||||
});
|
||||
|
||||
} else { // for Sea.js
|
||||
define(function(require) {
|
||||
var editormd = require("./../../editormd");
|
||||
factory(editormd);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
factory(window.editormd);
|
||||
}
|
||||
|
||||
})();
|
||||
Reference in new issue
Block a user