From 2c636bdd4d5d2e4b8c3ca18ca36c8e9bf93e01b9 Mon Sep 17 00:00:00 2001 From: machuanjia Date: Wed, 8 Mar 2017 11:33:58 +0800 Subject: [PATCH] add placeholder --- bower.json | 2 +- dist/wt-editor-min.js | 2 +- dist/wt-editor.js | 2 +- package.json | 2 +- src/js/editor.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 78180d1..763900d 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-wt-editor", - "version": "1.2.0", + "version": "1.2.1", "homepage": "https://github.com/WorktileTech/angular-wt-editor", "authors": [ "YCTech" diff --git a/dist/wt-editor-min.js b/dist/wt-editor-min.js index 1820457..28b55b8 100644 --- a/dist/wt-editor-min.js +++ b/dist/wt-editor-min.js @@ -1,4 +1,4 @@ var wtEditor=angular.module("wt-editor",["wt.editor.tpl","ui.bootstrap","monospaced.elastic"]); -String.prototype.repeat=function(e){return new Array(e+1).join(this)},angular.module("wt-editor").constant("wtEditorConfig",{fontSize:"16px",theme:"kuroir",maxHeight:600,className:"",autofocus:!0,type:"all",typeArray:{hs:["h1","h2","h3","h4","h5","h6"],simple:["bold","italic","link","divider","hr","quote","list","list-2"],complex:["heading","bold","italic","underline","strikethrough","divider","hr","quote","list","list-2","square","check-square","divider","link","image","code","table","divider","math","diagram","gantt","divider","preview"],all:["heading","bold","italic","underline","strikethrough","divider","hr","quote","list","list-2","square","check-square","divider","link","image","code","table","divider","math","diagram","gantt","divider","preview","expand"]},allButtons:{heading:{id:0,title:"标题",className:"fa fa-header",type:"headingFns",name:"heading"},bold:{id:1,title:"粗体",className:"fa fa-bold",modifier:"**",type:"styleFn",name:"bold"},italic:{id:2,title:"斜体",className:"fa fa-italic",modifier:"*",type:"styleFn",name:"italic"},underline:{id:3,title:"下划线",className:"fa fa-underline",modifier:"u",type:"styleFn",name:"underline"},strikethrough:{id:4,title:"删除线",className:"fa fa-strikethrough",modifier:"~~",type:"styleFn",name:"strikethrough"},h1:{id:5,title:"标题 1",className:"h1",level:"1",type:"headingFn",name:"h1"},h2:{id:6,title:"标题 2",className:"h2",level:"2",type:"headingFn",name:"h2"},h3:{id:7,title:"标题 3",className:"h3",level:"3",type:"headingFn",name:"h3"},h4:{id:8,title:"标题 4",className:"h4",level:"4",type:"headingFn",name:"h4"},h5:{id:9,title:"标题 5",className:"h5",level:"5",type:"headingFn",name:"h5"},h6:{id:10,title:"标题 6",className:"h6",level:"6",type:"headingFn",name:"h6"},hr:{id:11,title:"横线",className:"fa fa-minus",type:"styleFn",name:"hr"},quote:{id:12,title:"引用",className:"fa fa-quote-left",prefix:"> ",type:"styleFn",name:"quote"},list:{id:13,title:"无序列表",className:"fa fa-list-ul",prefix:"- ",type:"styleFn",name:"list"},"list-2":{id:14,title:"有序列表",className:"fa fa-list-ol",prefix:"1. ",type:"styleFn",name:"list-2"},square:{id:15,title:"未完成任务列表",className:"fa fa-square-o",prefix:"- [ ] ",type:"styleFn",name:"square"},"check-square":{id:16,title:"已完成任务列表",className:"fa fa-check-square-o",prefix:"- [x] ",type:"styleFn",name:"check-square"},link:{id:17,title:"链接",className:"fa fa-link",text:"链接文字",url:"http://example.com",type:"styleFn",name:"link"},image:{id:18,title:"图片",className:"fa fa-image",text:"图片描述",url:"http://example.com/example.png",type:"styleFn",name:"image"},code:{id:19,title:"代码",className:"fa fa-code",type:"styleFn",name:"code"},table:{id:20,title:"表格",className:"fa fa-table",type:"tableFn",name:"table"},emoji:{id:21,title:"Emoji 图标",className:"fa fa-smile-o",target:"emoji-modal",type:"emoji"},math:{id:22,title:"数学公式",className:"fa fa-superscript",sample:"E = mc^2",type:"mathFn",name:"math"},flow:{id:23,title:"流程图",className:"fa fa-long-arrow-right",type:"flowchart",name:"flow"},diagram:{id:24,title:"顺序图",className:"fa fa-exchange",type:"diagram",name:"diagram"},gantt:{id:25,title:"甘特图",className:"fa fa-sliders",type:"gantt",name:"gantt"},preview:{id:27,title:"预览",className:"fa fa-columns",type:"preview"},expand:{id:28,title:"最大化",title2:"还原",className:"fa fa-expand",type:"expand"},divider:{id:parseInt(1e6*Math.random()),type:"divider"}},extendButtons:{},quickSearch:{},hideButtons:[],additionalButtons:[],replaceButtons:[],locale:"zh-cn",language:{"en-us":{heading:"H1",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strike through",h1:"H1",h2:"H2",h3:"H3",h4:"H4",h5:"H5",h6:"H6",hr:"Hr",quote:"Quote",list:"Ul","list-2":"Ol",square:"Unfinished","check-square":"Completed",link:"Link","link-text":"Link",image:"Image","image-text":"Description",code:"Code",table:"Table",emoji:"Emoji",math:"Math",flow:"Flow",diagram:"Flowchart",gantt:"Gantt",preview:"Preview",max:"Max",original:"Reduction",col:"col",row:"row",diagram:"sequenceDiagram\nA->>B: How are you?\nB->>A: I am fine!",placeholder:"Content ..."},"zh-cn":{heading:"标题",bold:"粗体",italic:"斜体",underline:"下划线",strikethrough:"删除线",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6",hr:"横线",quote:"引用",list:"无序列表","list-2":"有序列表",square:"未完成任务列表","check-square":"已完成任务列表",link:"链接","link-text":"链接文字",image:"图片","image-text":"图片描述",code:"代码",table:"表格",emoji:"Emoji 图标",math:"数学公式",flow:"流程图",diagram:"顺序图",gantt:"甘特图",preview:"预览",max:"最大化",original:"还原",col:"列",row:"行",diagram:"sequenceDiagram\nA->>B: 你好吗?\nB->>A: 我很好3!",placeholder:"输入内容..."},"zh-tw":{heading:"標題",bold:"粗體",italic:"斜體",underline:"下劃線",strikethrough:"刪除線",h1:"標題 1",h2:"標題 2",h3:"標題 3",h4:"標題 4",h5:"標題 5",h6:"標題 6",hr:"橫線",quote:"引用",list:"無序列表","list-2":"有序列表",square:"未完成任務列表","check-square":"已完成任務列表",link:"鏈接","link-text":"鏈接文字",image:"圖片","image-text":"圖片描述",code:"代碼",table:"表格",emoji:"Emoji 圖標",math:"數學公式",flow:"流程圖",diagram:"順序圖",gantt:"甘特圖",preview:"預覽",max:"最大化",original:"還原",col:"列",row:"行",diagram:"sequenceDiagram\nA->>B: 你好嗎?\nB->>A: 我很好!",placeholder:"輸入內容..."},"ja-jp":{heading:"标题",bold:"粗体",italic:"斜体",underline:"下划线",strikethrough:"删除线",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6",hr:"横线",quote:"引用",list:"无序列表","list-2":"有序列表",square:"未完成任务列表","check-square":"已完成任务列表",link:"链接","link-text":"链接文字",image:"图片","image-text":"图片描述",code:"代码",table:"表格",emoji:"Emoji 图标",math:"数学公式",flow:"流程图",diagram:"顺序图",gantt:"甘特图",preview:"预览",max:"最大化",original:"还原",col:"列",row:"行",diagram:"sequenceDiagram\nA->>B: 你好吗?\nB->>A: 我很好3!",placeholder:"输入内容..."}},onShow:null,onPreview:null,onChange:null,emojis:[":blush:",":scream:",":smirk:",":smiley:",":stuck_out_tongue_closed_eyes:",":stuck_out_tongue_winking_eye:",":rage:",":disappointed:",":sob:",":kissing_heart:",":wink:",":pensive:",":confounded:",":flushed:",":relaxed:",":mask:",":heart:",":broken_heart:",":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:",":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:",":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:",":alien:",":angel:",":anger:",":angry:",":anguished:",":astonished:",":baby:",":blue_heart:",":blush:",":boom:",":bow:",":bowtie:",":boy:",":bride_with_veil:",":broken_heart:",":bust_in_silhouette:",":busts_in_silhouette:",":clap:",":cold_sweat:",":collision:",":confounded:",":confused:",":construction_worker:",":cop:",":couple_with_heart:",":couple:",":couplekiss:",":cry:",":crying_cat_face:",":cupid:",":dancer:",":dancers:",":dash:",":disappointed:",":dizzy_face:",":dizzy:",":droplet:",":ear:",":exclamation:",":expressionless:",":eyes:",":facepunch:",":family:",":fearful:",":feelsgood:",":feet:",":finnadie:",":fire:",":fist:",":flushed:",":frowning:",":girl:",":goberserk:",":godmode:",":green_heart:",":grey_exclamation:",":grey_question:",":grimacing:",":grin:",":grinning:",":guardsman:",":haircut:",":hand:",":hankey:",":hear_no_evil:",":heart_eyes_cat:",":heart_eyes:",":heart:",":heartbeat:",":heartpulse:",":hurtrealbad:",":hushed:",":imp:",":information_desk_person:",":innocent:",":japanese_goblin:",":japanese_ogre:",":joy_cat:",":joy:",":kiss:",":kissing_cat:",":kissing_closed_eyes:",":kissing_heart:",":kissing_smiling_eyes:",":kissing:",":laughing:",":lips:",":love_letter:",":man_with_gua_pi_mao:",":man_with_turban:",":man:",":mask:",":massage:",":metal:",":muscle:",":musical_note:",":nail_care:",":neckbeard:",":neutral_face:",":no_good:",":no_mouth:",":nose:",":notes:",":ok_hand:",":ok_woman:",":older_man:",":older_woman:",":open_hands:",":open_mouth:",":pensive:",":persevere:",":person_frowning:",":person_with_blond_hair:",":person_with_pouting_face:",":point_down:",":point_left:",":point_right:",":point_up_2:",":point_up:",":poop:",":pouting_cat:",":pray:",":princess:",":punch:",":purple_heart:",":question:",":rage:",":rage1:",":rage2:",":rage3:",":rage4:",":raised_hand:",":raised_hands:",":relaxed:",":relieved:",":revolving_hearts:",":runner:",":running:",":satisfied:",":scream_cat:",":scream:",":see_no_evil:",":shit:",":skull:",":sleeping:",":sleepy:",":smile_cat:",":smile:",":smiley_cat:",":smiley:",":smiling_imp:",":smirk_cat:",":smirk:",":sob:",":sparkling_heart:",":sparkles:",":speak_no_evil:",":speech_balloon:",":star:",":star2:",":stuck_out_tongue_closed_eyes:",":stuck_out_tongue_winking_eye:",":stuck_out_tongue:",":sunglasses:",":suspect:",":sweat_drops:",":sweat_smile:",":sweat:",":thought_balloon:",":-1:",":thumbsdown:",":thumbsup:",":+1:",":tired_face:",":tongue:",":triumph:",":trollface:",":two_hearts:",":two_men_holding_hands:",":two_women_holding_hands:",":unamused:",":v:",":walking:",":wave:",":weary:",":wink2:",":wink:",":woman:",":worried:",":yellow_heart:",":yum:",":zzz:",":109:",":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:",":100:",":1234:",":one:",":two:",":three:",":four:",":five:",":six:",":seven:",":eight:",":nine:",":keycap_ten:",":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:",":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:",":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:",":heavy_check_mark:",":ballot_box_with_check:",":radio_button:",":link:",":curly_loop:",":wavy_dash:",":part_alternation_mark:",":trident:",":black_square:",":white_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:"],emojRegx:/\:[a-z0-9_\-\+]+\:/g}).controller("wtEditorCtrl",["$scope","$timeout","wtEditorConfig","wtEditorService",function(e,t,a,n){this.initGantt=function(){n.initGantt()},this.initMarked=function(){n.initMarked()},this.setFullScreen=function(a,n){var i=$(e.vm.element);i.css(a?{left:0,top:0,right:0,bottom:0}:{width:"100%",height:"100%"}),t(function(){e.vm.editorHeight.height=$(e.vm.element).find(".wt-editor-container-code").height()+"px"})};var i=function(e){return e.replace(a.emojRegx,function(e){if(-1!==a.emojis.indexOf(e)){var t=String(e).slice(1,-1);return''+t+''}return e})};this.hasSelection=function(){var t=e.vm.editor;return t.selectionStart===t.selectionEnd?!1:!0},this.getSelection=function(){var t=e.vm.editor;return{target:t,start:t.selectionStart,end:t.selectionEnd,text:t.value.substring(t.selectionStart,t.selectionEnd)}},this.insertText=function(t,a,n){var i=e.vm.editor;i.focus();var r=i.value.substring(0,a),o=i.value.substring(n);e.value=r+t+o},this.clearSelection=function(){e.vm.editor.selectionStart=e.vm.editor.selectionEnd},this.setFocus=function(a,n){t(function(){e.vm.editor.selectionStart=a,e.vm.editor.selectionEnd=n})},this.isRowFirst=function(t){var a=e.vm.editor,n=a.value.substr(0,t),i=n.substr(n.lastIndexOf("\n")+1);return 0===i.length?!0:!1},this.getRowText=function(t){var a=e.vm.editor,n=a.value.substr(0,t),i=n.substr(n.lastIndexOf("\n")+1);return i},this.previewHTML=function(){var t=n.parseMarked(e.vm.editor.value);t=i(t),this.setHeight(),$(e.vm.element).find(".markdown-body").empty().append(t),n.parseMermaid(),a.onPreview&&a.onPreview(),e.vm.editor.focus()},this.setPriviewScroll=function(){},this.replaceContent=function(t,a){this.insertText(t,a.start,a.end),e.vm.editor.focus()},this.insertContent=function(t){var a=this.getSelection();this.insertText(t,a.start,a.end),e.vm.editor.focus()},this.insertQuickSearch=function(e,t){var a=this.getSelection();this.insertText(e,a.start-t.length,a.end),this.setFocus(a.start-t.length+e.length,a.start-t.length+e.length)},this.getContent=function(){return e.vm.editor.value},this.getLocaleText=function(e){var t=a.language[a.locale];if(t){var n=t[e];if(n)return n;console.log("text "+e+" none!")}else{console.log("locale "+a.locale+" none!"),t=a.language["zh-cn"];var n=t[e];if(n)return n;console.log("text "+e+" none!")}},this.setHeight=function(){e.vm.autoHeight&&(e.vm.editorHeight.height=$(e.vm.element).find(".wt-editor-container-code").height()+"px")}}]).directive("wtEditor",["wtEditorConfig","$timeout","$compile","$rootScope","$controller",function(e,t,a,n,i){return{require:["wtEditor","ngModel"],replace:!0,scope:{value:"=ngModel",config:"="},controller:"wtEditorCtrl",templateUrl:"wt-editor/editor.html",link:function(r,o,s,l){function c(e,t,a,n,i,r){if(-1!=a.text.indexOf("\n")&&n&&i&&r){a.text.length>0&&(a=l[0].getSelection());var o=a.text.replace(i,r),s=l[0].getRowText(a.start);l[0].insertText(o,a.start-s.length,a.end),l[0].setFocus(a.start+o.length,a.start+o.length)}else{a.text.length>0&&(l[0].clearSelection(),a=l[0].getSelection());var s=l[0].getRowText(a.start);l[0].insertText(e+" "+s,a.start-s.length,a.end),l[0].setFocus(a.start+e.length+1,a.start+e.length+1)}}r.maxHeight=e.maxHeight;var h=r.vm={element:o,value:r.value,emojiValue:"",faValue:"",toolbars:[],headers:[],editorHeight:{},header_action:!1,table_action:!1,tableMenu:[[[0,0],[0,1],[0,2],[0,3],[0,4],[0,5]],[[1,0],[1,1],[1,2],[1,3],[1,4],[1,5]],[[2,0],[2,1],[2,2],[2,3],[2,4],[2,5]],[[3,0],[3,1],[3,2],[3,3],[3,4],[3,5]],[[4,0],[4,1],[4,2],[4,3],[4,4],[4,5]]],tableActiveX:1,tableActiveY:1,autoHeight:r.config.autoHeight||!1,className:r.config.className};e.replaceButtons=[],e.additionalButtons=[],e.hideButtons=[],angular.extend(e,r.config),$(e.typeArray[e.type]).each(function(t,a){var n=e.allButtons[a];n||(n=e.extendButtons[a]),n&&(h.toolbars[h.toolbars.length]=n)}),$(e.typeArray.hs).each(function(t,a){var n=e.allButtons[a];n&&(h.headers[h.headers.length]=n)}),_.remove(h.toolbars,function(t){return t.id?-1!==_.indexOf(e.hideButtons,t.id):void 0}),e.replaceButtons.length>0&&$(e.replaceButtons).each(function(t){var a=e.replaceButtons[t];if(a.id){var n=_.findLastIndex(h.toolbars,function(e){return e.id===a.id});h.toolbars.splice(n,1,a)}}),e.additionalButtons.length>0&&$(e.additionalButtons).each(function(t){var a=e.additionalButtons[t];if(a.before){var n=_.findLastIndex(h.toolbars,function(e){return e.id===a.before});h.toolbars.splice(n,0,a)}else h.toolbars.push(a)}),h.editor=$(o).find(".wt-editor-textarea")[0];try{h.editor.setAttribute("placeholder",l[0].getLocaleText("placeholder"))}catch(d){}h.styleFn=function(e,t){var a=l[0].getSelection();switch(e){case"bold":if(l[0].hasSelection())if(-1!=a.text.indexOf("\n")){a=l[0].getSelection();var n=a.text.replace(/([^\n]+)([\n\s]*)/g,"**$1**$2"),i=l[0].getRowText(a.start);l[0].insertText(n,a.start-i.length,a.end),l[0].setFocus(a.start+n.length,a.start+n.length)}else l[0].insertText(" **"+a.text+"** ",a.start,a.end),l[0].setFocus(a.start,a.start+6+a.text.length);else{var i=l[0].getRowText(a.start);i.length>0?(l[0].insertText(" **** ",a.start,a.end),l[0].setFocus(a.start+3,a.start+3)):(l[0].insertText("****",a.start,a.end),l[0].setFocus(a.start+2,a.start+2))}break;case"italic":if(l[0].hasSelection())if(-1!=a.text.indexOf("\n")){a=l[0].getSelection();var n=a.text.replace(/([^\n]+)([\n\s]*)/g,"_$1_$2"),i=l[0].getRowText(a.start);l[0].insertText(n,a.start-i.length,a.end),l[0].setFocus(a.start+n.length,a.start+n.length)}else l[0].insertText(" _"+a.text+"_ ",a.start,a.end),l[0].setFocus(a.start,a.start+4+a.text.length);else{var i=l[0].getRowText(a.start);i.length>0?(l[0].insertText(" __ ",a.start,a.end,2,2),l[0].setFocus(a.start+2,a.start+2)):(l[0].insertText("__",a.start,a.end,1,1),l[0].setFocus(a.start+1,a.start+1))}break;case"underline":if(l[0].hasSelection())if(-1!=a.text.indexOf("\n")){a=l[0].getSelection();var n=a.text.replace(/([^\n]+)([\n\s]*)/g,"$1$2"),i=l[0].getRowText(a.start);l[0].insertText(n,a.start-i.length,a.end),l[0].setFocus(a.start+n.length,a.start+n.length)}else l[0].insertText(""+a.text+"",a.start,a.end),l[0].setFocus(a.start,a.start+7+a.text.length);else l[0].insertText("",a.start,a.end,3,4),l[0].setFocus(a.start+3,a.start+3);break;case"strikethrough":if(l[0].hasSelection())if(-1!=a.text.indexOf("\n")){a=l[0].getSelection();var n=a.text.replace(/([^\n]+)([\n\s]*)/g," ~~$1~~ $2"),i=l[0].getRowText(a.start);l[0].insertText(n,a.start-i.length,a.end),l[0].setFocus(a.start+n.length,a.start+n.length)}else l[0].insertText(" ~~"+a.text+"~~ ",a.start,a.end),l[0].setFocus(a.start,a.start+6+a.text.length);else{var i=l[0].getRowText(a.start);i.length>0?(l[0].insertText(" ~~~~ ",a.start,a.end),l[0].setFocus(a.start+3,a.start+3)):(l[0].insertText("~~~~",a.start,a.end),l[0].setFocus(a.start+2,a.start+2))}break;case"h1":c("#","",a,!0,/(.+)([\n]?)/g,"\n# $1$2\n"),h.header_action=!1;break;case"h2":c("##","",a,!0,/(.+)([\n]?)/g,"\n## $1$2\n"),h.header_action=!1;break;case"h3":c("###","",a,!0,/(.+)([\n]?)/g,"\n### $1$2\n"),h.header_action=!1;break;case"h4":c("####","",a,!0,/(.+)([\n]?)/g,"\n#### $1$2\n"),h.header_action=!1;break;case"h5":c("#####","",a,!0,/(.+)([\n]?)/g,"\n##### $1$2\n"),h.header_action=!1;break;case"h6":c("######","",a,!0,/(.+)([\n]?)/g,"\n###### $1$2\n"),h.header_action=!1;break;case"hr":a.text.length>0&&(l[0].clearSelection(),a=l[0].getSelection()),l[0].insertText("\n---\n",a.start,a.end),l[0].setFocus(a.start+5,a.start+5);break;case"quote":c(">","",a,!0,/(.+)([\n]?)/g,"\n> $1$2");break;case"list":c("-","",a,!0,/(.+)([\n]?)/g,"\n- $1$2");break;case"list-2":c("1.","",a,!0,/(.+)([\n]?)/g,"\n1. $1$2");break;case"square":c("- [ ] ","",a,!0,/(.+)([\n]?)/g,"- [ ] $1$2");break;case"check-square":c("- [x] ","",a,!0,/(.+)([\n]?)/g,"- [x] $1$2");break;case"link":var r="http://xxx.com",o=l[0].getLocaleText("link-text");a.text.length>0&&(-1!=a.text.indexOf("http")?r=a.text:o=a.text);var s="["+o+"]("+r+")";l[0].insertText(s,a.start,a.end),l[0].setFocus(a.start+s.length,a.start+s.length);break;case"image":var o=l[0].getLocaleText("image-text"),r="http://lesschat.com/x.png";a.text.length>0&&(-1!=a.text.indexOf("http")?r=a.text:o=a.text);var s="!["+o+"]("+r+")";l[0].insertText(s,a.start,a.end),l[0].setFocus(a.start+s.length,a.start+s.length);break;case"code":0===a.text.length?(l[0].insertText("\n```\n \n```\n",a.start,a.end),l[0].setFocus(a.start+6,a.start+6)):(l[0].insertText("`"+a.text+"`",a.start,a.end),l[0].setFocus(a.start+2+a.text.length,a.start+2+a.text.length));break;case"table":h.table_action=!0;break;case"math":var d=a.text;0==d.length&&(d="E = mc^2"),l[0].insertText("\n```math\n"+d+"\n```\n",a.start,a.end),l[0].setFocus(a.start+d.length+14,a.start+d.length+14);break;case"flow":var d=a.text;0==d.length&&(d="graph LR\nA-->B"),l[0].insertText("\n```\n"+d+"\n```\n",a.start,a.end),l[0].setFocus(a.start+d.length+10,a.start+d.length+10);break;case"diagram":var d=a.text;0==d.length&&(d=l[0].getLocaleText("diagram")),l[0].insertText("\n```\n"+d+"\n```\n",a.start,a.end),l[0].setFocus(a.start+d.length+10,a.start+d.length+10);break;case"gantt":var d=a.text;0==d.length&&(d="gantt\n",d+="dateFormat YYYY-MM-DD\n",d+="section S1\n",d+="T1: 2014-01-01, 9d\n",d+="section S2\n",d+="T2: 2014-01-11, 9d",d+="section S3\n",d+="T3: 2014-01-02, 9d"),l[0].insertText("\n```\n"+d+"\n```\n",a.start,a.end),l[0].setFocus(a.start+d.length+10,a.start+d.length+10)}},l[0].initGantt(),h.renderer=l[0].initMarked(),h.togglePreview=function(){h.isPreview=!h.isPreview,h.isPreview===!0&&t(function(){l[0].previewHTML()},50)},h.toggleFullScreen=function(){h.isFullscreen=!h.isFullscreen,h.isPreview===!0&&h.togglePreview(),l[0].setFullScreen(h.isFullscreen,h.editor)},h.insertEmoji=function(){h.emojiValue=h.emojiValue.trim(),/^:/.test(h.emojiValue)||(h.emojiValue=":"+h.emojiValue),/:$/.test(h.emojiValue)||(h.emojiValue=h.emojiValue+":");var e=l[0].getSelection();l[0].insertText(h.emojiValue,e.start,e.end),h.editor.focus(),h.emojiValue=""},h.insertFa=function(){if(h.faValue=h.faValue.trim(),h.faValue.length>0){var e=l[0].getSelection(),t="";l[0].insertText(t,e.start,e.end),h.editor.focus(),h.faValue=""}},r.$watch("value",function(a,n){if(h.editor&&a){var i=h.editor.value;e.onChange&&e.onChange(i),h.isPreview===!0&&t(function(){l[0].previewHTML()},128)}}),r.$watch("config.autofocus",function(e,t){e&&h.editor.focus()}),e.onShow&&e.onShow(),h.setHeaderLi=function(e){h.header_action=!h.header_action},h.setTableMemu=function(e,t){h.tableActiveX=e,h.tableActiveY=0==t?1:t},h.insertTable=function(){for(var e=h.tableActiveY,t=h.tableActiveX+1,a=l[0].getLocaleText("col"),n="---",i=l[0].getLocaleText("row"),r=0;e>r;r++)a+="| "+l[0].getLocaleText("col")+" ",n+="| --- ",i+="| "+l[0].getLocaleText("row")+" ";for(var o="",r=0;t>r;r++)o+=i+"\n";var s=a+"\n"+n+"\n"+o,c=l[0].getSelection();c.text.length>0&&(l[0].clearSelection(),c=l[0].getSelection()),l[0].isRowFirst(c.start)?(l[0].insertText("\n"+s+"\n\n",c.start,c.end),l[0].setFocus(c.start+s.length+2,c.start+s.length+2)):(l[0].insertText("\n\n"+s+"\n\n",c.start,c.end),l[0].setFocus(c.start+s.length+4,c.start+s.length+4)),h.table_action=!1},(_.find(h.toolbars,{id:0})||_.find(h.toolbars,{id:20}))&&$(document).click(function(e){var t=$(e.target);r.$apply(function(){t.hasClass("fa-header")||"h"==t.attr("flag")||(h.header_action=!1),t.hasClass("fa-table")||"table"==t.attr("flag")||(h.table_action=!1)})}),$(window).on("resize",_.throttle(function(){t(function(){h.editorHeight.height=$(o).find(".wt-editor-container-code").height()+"px"},50)},150)),$(h.editor).on("paste",function(t){t.stopPropagation();var a=[],i=t.originalEvent.clipboardData;if(i.items){for(var r=0;r0){var r=n.scope().$new();if(e.controller){var s={};s.$scope=r,s.editorInstance=l[0],i(e.controller,s),n.html(a(e.template)(r))}}}),h.editorHeight.height=$(o).find(".wt-editor-container-code").height()+"px",r.maxHeight=h.autoHeight?e.maxHeight:parseInt(h.editorHeight.height)>30?parseInt(h.editorHeight.height)-30:null,e.quickSearch&&e.quickSearch.bindAtWho&&e.quickSearch.bindAtWho(h.editor)},128)}}}]).service("wtEditorService",["wtEditorConfig",function(e){this.initGantt=function(){window.mermaid&&(mermaid.parseError=function(e,t){mermaid.error=e},mermaid.ganttConfig={numberSectionStyles:4,axisFormatter:[["%I:%M",function(e){return e.getHours()}],["w. %U",function(e){return 1==e.getDay()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%m-%y",function(e){return e.getMonth()}]]})},this.initMarked=function(){var e=new marked.Renderer;e.listitem=function(e){if(!/^\[[ x]\]\s/.test(e))return marked.Renderer.prototype.listitem(e);var t=$('');return/^\[x\]\s/.test(e)&&t.attr("checked",!0),$(marked.Renderer.prototype.listitem(e.substring(3))).addClass("task-list-item").prepend(t)[0].outerHTML},e.codespan=function(e){if(/^\$.+\$$/.test(e)){var t=/^\$(.+)\$$/.exec(e)[1],a=t.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'");try{return katex.renderToString(a,{displayMode:!1})}catch(n){return""+n+""}}return marked.Renderer.prototype.codespan.apply(this,arguments)},e.code=function(e,t,a,n){e=e.trim();var i=e.split(/\n/)[0].trim();if("math"===t){var r="";return e.split(/\n\n/).forEach(function(e){if(e=e.trim(),e.length>0)try{r+=katex.renderToString(e,{displayMode:!0})}catch(t){r+="
"+t+"
"}}),'
'+r+"
"}return"gantt"===i||"sequenceDiagram"===i||i.match(/^graph (?:TB|BT|RL|LR|TD);?$/)?("sequenceDiagram"===i&&(e+="\n"), +String.prototype.repeat=function(e){return new Array(e+1).join(this)},angular.module("wt-editor").constant("wtEditorConfig",{fontSize:"16px",theme:"kuroir",maxHeight:600,className:"",autofocus:!0,type:"all",typeArray:{hs:["h1","h2","h3","h4","h5","h6"],simple:["bold","italic","link","divider","hr","quote","list","list-2"],complex:["heading","bold","italic","underline","strikethrough","divider","hr","quote","list","list-2","square","check-square","divider","link","image","code","table","divider","math","diagram","gantt","divider","preview"],all:["heading","bold","italic","underline","strikethrough","divider","hr","quote","list","list-2","square","check-square","divider","link","image","code","table","divider","math","diagram","gantt","divider","preview","expand"]},allButtons:{heading:{id:0,title:"标题",className:"fa fa-header",type:"headingFns",name:"heading"},bold:{id:1,title:"粗体",className:"fa fa-bold",modifier:"**",type:"styleFn",name:"bold"},italic:{id:2,title:"斜体",className:"fa fa-italic",modifier:"*",type:"styleFn",name:"italic"},underline:{id:3,title:"下划线",className:"fa fa-underline",modifier:"u",type:"styleFn",name:"underline"},strikethrough:{id:4,title:"删除线",className:"fa fa-strikethrough",modifier:"~~",type:"styleFn",name:"strikethrough"},h1:{id:5,title:"标题 1",className:"h1",level:"1",type:"headingFn",name:"h1"},h2:{id:6,title:"标题 2",className:"h2",level:"2",type:"headingFn",name:"h2"},h3:{id:7,title:"标题 3",className:"h3",level:"3",type:"headingFn",name:"h3"},h4:{id:8,title:"标题 4",className:"h4",level:"4",type:"headingFn",name:"h4"},h5:{id:9,title:"标题 5",className:"h5",level:"5",type:"headingFn",name:"h5"},h6:{id:10,title:"标题 6",className:"h6",level:"6",type:"headingFn",name:"h6"},hr:{id:11,title:"横线",className:"fa fa-minus",type:"styleFn",name:"hr"},quote:{id:12,title:"引用",className:"fa fa-quote-left",prefix:"> ",type:"styleFn",name:"quote"},list:{id:13,title:"无序列表",className:"fa fa-list-ul",prefix:"- ",type:"styleFn",name:"list"},"list-2":{id:14,title:"有序列表",className:"fa fa-list-ol",prefix:"1. ",type:"styleFn",name:"list-2"},square:{id:15,title:"未完成任务列表",className:"fa fa-square-o",prefix:"- [ ] ",type:"styleFn",name:"square"},"check-square":{id:16,title:"已完成任务列表",className:"fa fa-check-square-o",prefix:"- [x] ",type:"styleFn",name:"check-square"},link:{id:17,title:"链接",className:"fa fa-link",text:"链接文字",url:"http://example.com",type:"styleFn",name:"link"},image:{id:18,title:"图片",className:"fa fa-image",text:"图片描述",url:"http://example.com/example.png",type:"styleFn",name:"image"},code:{id:19,title:"代码",className:"fa fa-code",type:"styleFn",name:"code"},table:{id:20,title:"表格",className:"fa fa-table",type:"tableFn",name:"table"},emoji:{id:21,title:"Emoji 图标",className:"fa fa-smile-o",target:"emoji-modal",type:"emoji"},math:{id:22,title:"数学公式",className:"fa fa-superscript",sample:"E = mc^2",type:"mathFn",name:"math"},flow:{id:23,title:"流程图",className:"fa fa-long-arrow-right",type:"flowchart",name:"flow"},diagram:{id:24,title:"顺序图",className:"fa fa-exchange",type:"diagram",name:"diagram"},gantt:{id:25,title:"甘特图",className:"fa fa-sliders",type:"gantt",name:"gantt"},preview:{id:27,title:"预览",className:"fa fa-columns",type:"preview"},expand:{id:28,title:"最大化",title2:"还原",className:"fa fa-expand",type:"expand"},divider:{id:parseInt(1e6*Math.random()),type:"divider"}},extendButtons:{},quickSearch:{},hideButtons:[],additionalButtons:[],replaceButtons:[],locale:"zh-cn",language:{"en-us":{heading:"H1",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strike through",h1:"H1",h2:"H2",h3:"H3",h4:"H4",h5:"H5",h6:"H6",hr:"Hr",quote:"Quote",list:"Ul","list-2":"Ol",square:"Unfinished","check-square":"Completed",link:"Link","link-text":"Link",image:"Image","image-text":"Description",code:"Code",table:"Table",emoji:"Emoji",math:"Math",flow:"Flow",diagram:"Flowchart",gantt:"Gantt",preview:"Preview",max:"Max",original:"Reduction",col:"col",row:"row",diagram:"sequenceDiagram\nA->>B: How are you?\nB->>A: I am fine!",placeholder:"Content ..."},"zh-cn":{heading:"标题",bold:"粗体",italic:"斜体",underline:"下划线",strikethrough:"删除线",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6",hr:"横线",quote:"引用",list:"无序列表","list-2":"有序列表",square:"未完成任务列表","check-square":"已完成任务列表",link:"链接","link-text":"链接文字",image:"图片","image-text":"图片描述",code:"代码",table:"表格",emoji:"Emoji 图标",math:"数学公式",flow:"流程图",diagram:"顺序图",gantt:"甘特图",preview:"预览",max:"最大化",original:"还原",col:"列",row:"行",diagram:"sequenceDiagram\nA->>B: 你好吗?\nB->>A: 我很好3!",placeholder:"输入内容..."},"zh-tw":{heading:"標題",bold:"粗體",italic:"斜體",underline:"下劃線",strikethrough:"刪除線",h1:"標題 1",h2:"標題 2",h3:"標題 3",h4:"標題 4",h5:"標題 5",h6:"標題 6",hr:"橫線",quote:"引用",list:"無序列表","list-2":"有序列表",square:"未完成任務列表","check-square":"已完成任務列表",link:"鏈接","link-text":"鏈接文字",image:"圖片","image-text":"圖片描述",code:"代碼",table:"表格",emoji:"Emoji 圖標",math:"數學公式",flow:"流程圖",diagram:"順序圖",gantt:"甘特圖",preview:"預覽",max:"最大化",original:"還原",col:"列",row:"行",diagram:"sequenceDiagram\nA->>B: 你好嗎?\nB->>A: 我很好!",placeholder:"輸入內容..."},"ja-jp":{heading:"标题",bold:"粗体",italic:"斜体",underline:"下划线",strikethrough:"删除线",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6",hr:"横线",quote:"引用",list:"无序列表","list-2":"有序列表",square:"未完成任务列表","check-square":"已完成任务列表",link:"链接","link-text":"链接文字",image:"图片","image-text":"图片描述",code:"代码",table:"表格",emoji:"Emoji 图标",math:"数学公式",flow:"流程图",diagram:"顺序图",gantt:"甘特图",preview:"预览",max:"最大化",original:"还原",col:"列",row:"行",diagram:"sequenceDiagram\nA->>B: 你好吗?\nB->>A: 我很好3!",placeholder:"输入内容..."}},onShow:null,onPreview:null,onChange:null,emojis:[":blush:",":scream:",":smirk:",":smiley:",":stuck_out_tongue_closed_eyes:",":stuck_out_tongue_winking_eye:",":rage:",":disappointed:",":sob:",":kissing_heart:",":wink:",":pensive:",":confounded:",":flushed:",":relaxed:",":mask:",":heart:",":broken_heart:",":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:",":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:",":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:",":alien:",":angel:",":anger:",":angry:",":anguished:",":astonished:",":baby:",":blue_heart:",":blush:",":boom:",":bow:",":bowtie:",":boy:",":bride_with_veil:",":broken_heart:",":bust_in_silhouette:",":busts_in_silhouette:",":clap:",":cold_sweat:",":collision:",":confounded:",":confused:",":construction_worker:",":cop:",":couple_with_heart:",":couple:",":couplekiss:",":cry:",":crying_cat_face:",":cupid:",":dancer:",":dancers:",":dash:",":disappointed:",":dizzy_face:",":dizzy:",":droplet:",":ear:",":exclamation:",":expressionless:",":eyes:",":facepunch:",":family:",":fearful:",":feelsgood:",":feet:",":finnadie:",":fire:",":fist:",":flushed:",":frowning:",":girl:",":goberserk:",":godmode:",":green_heart:",":grey_exclamation:",":grey_question:",":grimacing:",":grin:",":grinning:",":guardsman:",":haircut:",":hand:",":hankey:",":hear_no_evil:",":heart_eyes_cat:",":heart_eyes:",":heart:",":heartbeat:",":heartpulse:",":hurtrealbad:",":hushed:",":imp:",":information_desk_person:",":innocent:",":japanese_goblin:",":japanese_ogre:",":joy_cat:",":joy:",":kiss:",":kissing_cat:",":kissing_closed_eyes:",":kissing_heart:",":kissing_smiling_eyes:",":kissing:",":laughing:",":lips:",":love_letter:",":man_with_gua_pi_mao:",":man_with_turban:",":man:",":mask:",":massage:",":metal:",":muscle:",":musical_note:",":nail_care:",":neckbeard:",":neutral_face:",":no_good:",":no_mouth:",":nose:",":notes:",":ok_hand:",":ok_woman:",":older_man:",":older_woman:",":open_hands:",":open_mouth:",":pensive:",":persevere:",":person_frowning:",":person_with_blond_hair:",":person_with_pouting_face:",":point_down:",":point_left:",":point_right:",":point_up_2:",":point_up:",":poop:",":pouting_cat:",":pray:",":princess:",":punch:",":purple_heart:",":question:",":rage:",":rage1:",":rage2:",":rage3:",":rage4:",":raised_hand:",":raised_hands:",":relaxed:",":relieved:",":revolving_hearts:",":runner:",":running:",":satisfied:",":scream_cat:",":scream:",":see_no_evil:",":shit:",":skull:",":sleeping:",":sleepy:",":smile_cat:",":smile:",":smiley_cat:",":smiley:",":smiling_imp:",":smirk_cat:",":smirk:",":sob:",":sparkling_heart:",":sparkles:",":speak_no_evil:",":speech_balloon:",":star:",":star2:",":stuck_out_tongue_closed_eyes:",":stuck_out_tongue_winking_eye:",":stuck_out_tongue:",":sunglasses:",":suspect:",":sweat_drops:",":sweat_smile:",":sweat:",":thought_balloon:",":-1:",":thumbsdown:",":thumbsup:",":+1:",":tired_face:",":tongue:",":triumph:",":trollface:",":two_hearts:",":two_men_holding_hands:",":two_women_holding_hands:",":unamused:",":v:",":walking:",":wave:",":weary:",":wink2:",":wink:",":woman:",":worried:",":yellow_heart:",":yum:",":zzz:",":109:",":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:",":100:",":1234:",":one:",":two:",":three:",":four:",":five:",":six:",":seven:",":eight:",":nine:",":keycap_ten:",":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:",":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:",":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:",":heavy_check_mark:",":ballot_box_with_check:",":radio_button:",":link:",":curly_loop:",":wavy_dash:",":part_alternation_mark:",":trident:",":black_square:",":white_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:"],emojRegx:/\:[a-z0-9_\-\+]+\:/g}).controller("wtEditorCtrl",["$scope","$timeout","wtEditorConfig","wtEditorService",function(e,t,a,n){this.initGantt=function(){n.initGantt()},this.initMarked=function(){n.initMarked()},this.setFullScreen=function(a,n){var i=$(e.vm.element);i.css(a?{left:0,top:0,right:0,bottom:0}:{width:"100%",height:"100%"}),t(function(){e.vm.editorHeight.height=$(e.vm.element).find(".wt-editor-container-code").height()+"px"})};var i=function(e){return e.replace(a.emojRegx,function(e){if(-1!==a.emojis.indexOf(e)){var t=String(e).slice(1,-1);return''+t+''}return e})};this.hasSelection=function(){var t=e.vm.editor;return t.selectionStart===t.selectionEnd?!1:!0},this.getSelection=function(){var t=e.vm.editor;return{target:t,start:t.selectionStart,end:t.selectionEnd,text:t.value.substring(t.selectionStart,t.selectionEnd)}},this.insertText=function(t,a,n){var i=e.vm.editor;i.focus();var r=i.value.substring(0,a),o=i.value.substring(n);e.value=r+t+o},this.clearSelection=function(){e.vm.editor.selectionStart=e.vm.editor.selectionEnd},this.setFocus=function(a,n){t(function(){e.vm.editor.selectionStart=a,e.vm.editor.selectionEnd=n})},this.isRowFirst=function(t){var a=e.vm.editor,n=a.value.substr(0,t),i=n.substr(n.lastIndexOf("\n")+1);return 0===i.length?!0:!1},this.getRowText=function(t){var a=e.vm.editor,n=a.value.substr(0,t),i=n.substr(n.lastIndexOf("\n")+1);return i},this.previewHTML=function(){var t=n.parseMarked(e.vm.editor.value);t=i(t),this.setHeight(),$(e.vm.element).find(".markdown-body").empty().append(t),n.parseMermaid(),a.onPreview&&a.onPreview(),e.vm.editor.focus()},this.setPriviewScroll=function(){},this.replaceContent=function(t,a){this.insertText(t,a.start,a.end),e.vm.editor.focus()},this.insertContent=function(t){var a=this.getSelection();this.insertText(t,a.start,a.end),e.vm.editor.focus()},this.insertQuickSearch=function(e,t){var a=this.getSelection();this.insertText(e,a.start-t.length,a.end),this.setFocus(a.start-t.length+e.length,a.start-t.length+e.length)},this.getContent=function(){return e.vm.editor.value},this.getLocaleText=function(e){var t=a.language[a.locale];if(t){var n=t[e];if(n)return n;console.log("text "+e+" none!")}else{console.log("locale "+a.locale+" none!"),t=a.language["zh-cn"];var n=t[e];if(n)return n;console.log("text "+e+" none!")}},this.setHeight=function(){e.vm.autoHeight&&(e.vm.editorHeight.height=$(e.vm.element).find(".wt-editor-container-code").height()+"px")}}]).directive("wtEditor",["wtEditorConfig","$timeout","$compile","$rootScope","$controller",function(e,t,a,n,i){return{require:["wtEditor","ngModel"],replace:!0,scope:{value:"=ngModel",config:"="},controller:"wtEditorCtrl",templateUrl:"wt-editor/editor.html",link:function(r,o,s,l){function c(e,t,a,n,i,r){if(-1!=a.text.indexOf("\n")&&n&&i&&r){a.text.length>0&&(a=l[0].getSelection());var o=a.text.replace(i,r),s=l[0].getRowText(a.start);l[0].insertText(o,a.start-s.length,a.end),l[0].setFocus(a.start+o.length,a.start+o.length)}else{a.text.length>0&&(l[0].clearSelection(),a=l[0].getSelection());var s=l[0].getRowText(a.start);l[0].insertText(e+" "+s,a.start-s.length,a.end),l[0].setFocus(a.start+e.length+1,a.start+e.length+1)}}r.maxHeight=e.maxHeight;var h=r.vm={element:o,value:r.value,emojiValue:"",faValue:"",toolbars:[],headers:[],editorHeight:{},header_action:!1,table_action:!1,tableMenu:[[[0,0],[0,1],[0,2],[0,3],[0,4],[0,5]],[[1,0],[1,1],[1,2],[1,3],[1,4],[1,5]],[[2,0],[2,1],[2,2],[2,3],[2,4],[2,5]],[[3,0],[3,1],[3,2],[3,3],[3,4],[3,5]],[[4,0],[4,1],[4,2],[4,3],[4,4],[4,5]]],tableActiveX:1,tableActiveY:1,autoHeight:r.config.autoHeight||!1,className:r.config.className};e.replaceButtons=[],e.additionalButtons=[],e.hideButtons=[],angular.extend(e,r.config),$(e.typeArray[e.type]).each(function(t,a){var n=e.allButtons[a];n||(n=e.extendButtons[a]),n&&(h.toolbars[h.toolbars.length]=n)}),$(e.typeArray.hs).each(function(t,a){var n=e.allButtons[a];n&&(h.headers[h.headers.length]=n)}),_.remove(h.toolbars,function(t){return t.id?-1!==_.indexOf(e.hideButtons,t.id):void 0}),e.replaceButtons.length>0&&$(e.replaceButtons).each(function(t){var a=e.replaceButtons[t];if(a.id){var n=_.findLastIndex(h.toolbars,function(e){return e.id===a.id});h.toolbars.splice(n,1,a)}}),e.additionalButtons.length>0&&$(e.additionalButtons).each(function(t){var a=e.additionalButtons[t];if(a.before){var n=_.findLastIndex(h.toolbars,function(e){return e.id===a.before});h.toolbars.splice(n,0,a)}else h.toolbars.push(a)}),h.editor=$(o).find(".wt-editor-textarea")[0];try{h.editor.setAttribute("placeholder",e.placeholder?e.placeholder:l[0].getLocaleText("placeholder"))}catch(d){}h.styleFn=function(e,t){var a=l[0].getSelection();switch(e){case"bold":if(l[0].hasSelection())if(-1!=a.text.indexOf("\n")){a=l[0].getSelection();var n=a.text.replace(/([^\n]+)([\n\s]*)/g,"**$1**$2"),i=l[0].getRowText(a.start);l[0].insertText(n,a.start-i.length,a.end),l[0].setFocus(a.start+n.length,a.start+n.length)}else l[0].insertText(" **"+a.text+"** ",a.start,a.end),l[0].setFocus(a.start,a.start+6+a.text.length);else{var i=l[0].getRowText(a.start);i.length>0?(l[0].insertText(" **** ",a.start,a.end),l[0].setFocus(a.start+3,a.start+3)):(l[0].insertText("****",a.start,a.end),l[0].setFocus(a.start+2,a.start+2))}break;case"italic":if(l[0].hasSelection())if(-1!=a.text.indexOf("\n")){a=l[0].getSelection();var n=a.text.replace(/([^\n]+)([\n\s]*)/g,"_$1_$2"),i=l[0].getRowText(a.start);l[0].insertText(n,a.start-i.length,a.end),l[0].setFocus(a.start+n.length,a.start+n.length)}else l[0].insertText(" _"+a.text+"_ ",a.start,a.end),l[0].setFocus(a.start,a.start+4+a.text.length);else{var i=l[0].getRowText(a.start);i.length>0?(l[0].insertText(" __ ",a.start,a.end,2,2),l[0].setFocus(a.start+2,a.start+2)):(l[0].insertText("__",a.start,a.end,1,1),l[0].setFocus(a.start+1,a.start+1))}break;case"underline":if(l[0].hasSelection())if(-1!=a.text.indexOf("\n")){a=l[0].getSelection();var n=a.text.replace(/([^\n]+)([\n\s]*)/g,"$1$2"),i=l[0].getRowText(a.start);l[0].insertText(n,a.start-i.length,a.end),l[0].setFocus(a.start+n.length,a.start+n.length)}else l[0].insertText(""+a.text+"",a.start,a.end),l[0].setFocus(a.start,a.start+7+a.text.length);else l[0].insertText("",a.start,a.end,3,4),l[0].setFocus(a.start+3,a.start+3);break;case"strikethrough":if(l[0].hasSelection())if(-1!=a.text.indexOf("\n")){a=l[0].getSelection();var n=a.text.replace(/([^\n]+)([\n\s]*)/g," ~~$1~~ $2"),i=l[0].getRowText(a.start);l[0].insertText(n,a.start-i.length,a.end),l[0].setFocus(a.start+n.length,a.start+n.length)}else l[0].insertText(" ~~"+a.text+"~~ ",a.start,a.end),l[0].setFocus(a.start,a.start+6+a.text.length);else{var i=l[0].getRowText(a.start);i.length>0?(l[0].insertText(" ~~~~ ",a.start,a.end),l[0].setFocus(a.start+3,a.start+3)):(l[0].insertText("~~~~",a.start,a.end),l[0].setFocus(a.start+2,a.start+2))}break;case"h1":c("#","",a,!0,/(.+)([\n]?)/g,"\n# $1$2\n"),h.header_action=!1;break;case"h2":c("##","",a,!0,/(.+)([\n]?)/g,"\n## $1$2\n"),h.header_action=!1;break;case"h3":c("###","",a,!0,/(.+)([\n]?)/g,"\n### $1$2\n"),h.header_action=!1;break;case"h4":c("####","",a,!0,/(.+)([\n]?)/g,"\n#### $1$2\n"),h.header_action=!1;break;case"h5":c("#####","",a,!0,/(.+)([\n]?)/g,"\n##### $1$2\n"),h.header_action=!1;break;case"h6":c("######","",a,!0,/(.+)([\n]?)/g,"\n###### $1$2\n"),h.header_action=!1;break;case"hr":a.text.length>0&&(l[0].clearSelection(),a=l[0].getSelection()),l[0].insertText("\n---\n",a.start,a.end),l[0].setFocus(a.start+5,a.start+5);break;case"quote":c(">","",a,!0,/(.+)([\n]?)/g,"\n> $1$2");break;case"list":c("-","",a,!0,/(.+)([\n]?)/g,"\n- $1$2");break;case"list-2":c("1.","",a,!0,/(.+)([\n]?)/g,"\n1. $1$2");break;case"square":c("- [ ] ","",a,!0,/(.+)([\n]?)/g,"- [ ] $1$2");break;case"check-square":c("- [x] ","",a,!0,/(.+)([\n]?)/g,"- [x] $1$2");break;case"link":var r="http://xxx.com",o=l[0].getLocaleText("link-text");a.text.length>0&&(-1!=a.text.indexOf("http")?r=a.text:o=a.text);var s="["+o+"]("+r+")";l[0].insertText(s,a.start,a.end),l[0].setFocus(a.start+s.length,a.start+s.length);break;case"image":var o=l[0].getLocaleText("image-text"),r="http://lesschat.com/x.png";a.text.length>0&&(-1!=a.text.indexOf("http")?r=a.text:o=a.text);var s="!["+o+"]("+r+")";l[0].insertText(s,a.start,a.end),l[0].setFocus(a.start+s.length,a.start+s.length);break;case"code":0===a.text.length?(l[0].insertText("\n```\n \n```\n",a.start,a.end),l[0].setFocus(a.start+6,a.start+6)):(l[0].insertText("`"+a.text+"`",a.start,a.end),l[0].setFocus(a.start+2+a.text.length,a.start+2+a.text.length));break;case"table":h.table_action=!0;break;case"math":var d=a.text;0==d.length&&(d="E = mc^2"),l[0].insertText("\n```math\n"+d+"\n```\n",a.start,a.end),l[0].setFocus(a.start+d.length+14,a.start+d.length+14);break;case"flow":var d=a.text;0==d.length&&(d="graph LR\nA-->B"),l[0].insertText("\n```\n"+d+"\n```\n",a.start,a.end),l[0].setFocus(a.start+d.length+10,a.start+d.length+10);break;case"diagram":var d=a.text;0==d.length&&(d=l[0].getLocaleText("diagram")),l[0].insertText("\n```\n"+d+"\n```\n",a.start,a.end),l[0].setFocus(a.start+d.length+10,a.start+d.length+10);break;case"gantt":var d=a.text;0==d.length&&(d="gantt\n",d+="dateFormat YYYY-MM-DD\n",d+="section S1\n",d+="T1: 2014-01-01, 9d\n",d+="section S2\n",d+="T2: 2014-01-11, 9d",d+="section S3\n",d+="T3: 2014-01-02, 9d"),l[0].insertText("\n```\n"+d+"\n```\n",a.start,a.end),l[0].setFocus(a.start+d.length+10,a.start+d.length+10)}},l[0].initGantt(),h.renderer=l[0].initMarked(),h.togglePreview=function(){h.isPreview=!h.isPreview,h.isPreview===!0&&t(function(){l[0].previewHTML()},50)},h.toggleFullScreen=function(){h.isFullscreen=!h.isFullscreen,h.isPreview===!0&&h.togglePreview(),l[0].setFullScreen(h.isFullscreen,h.editor)},h.insertEmoji=function(){h.emojiValue=h.emojiValue.trim(),/^:/.test(h.emojiValue)||(h.emojiValue=":"+h.emojiValue),/:$/.test(h.emojiValue)||(h.emojiValue=h.emojiValue+":");var e=l[0].getSelection();l[0].insertText(h.emojiValue,e.start,e.end),h.editor.focus(),h.emojiValue=""},h.insertFa=function(){if(h.faValue=h.faValue.trim(),h.faValue.length>0){var e=l[0].getSelection(),t="";l[0].insertText(t,e.start,e.end),h.editor.focus(),h.faValue=""}},r.$watch("value",function(a,n){if(h.editor&&a){var i=h.editor.value;e.onChange&&e.onChange(i),h.isPreview===!0&&t(function(){l[0].previewHTML()},128)}}),r.$watch("config.autofocus",function(e,t){e&&h.editor.focus()}),e.onShow&&e.onShow(),h.setHeaderLi=function(e){h.header_action=!h.header_action},h.setTableMemu=function(e,t){h.tableActiveX=e,h.tableActiveY=0==t?1:t},h.insertTable=function(){for(var e=h.tableActiveY,t=h.tableActiveX+1,a=l[0].getLocaleText("col"),n="---",i=l[0].getLocaleText("row"),r=0;e>r;r++)a+="| "+l[0].getLocaleText("col")+" ",n+="| --- ",i+="| "+l[0].getLocaleText("row")+" ";for(var o="",r=0;t>r;r++)o+=i+"\n";var s=a+"\n"+n+"\n"+o,c=l[0].getSelection();c.text.length>0&&(l[0].clearSelection(),c=l[0].getSelection()),l[0].isRowFirst(c.start)?(l[0].insertText("\n"+s+"\n\n",c.start,c.end),l[0].setFocus(c.start+s.length+2,c.start+s.length+2)):(l[0].insertText("\n\n"+s+"\n\n",c.start,c.end),l[0].setFocus(c.start+s.length+4,c.start+s.length+4)),h.table_action=!1},(_.find(h.toolbars,{id:0})||_.find(h.toolbars,{id:20}))&&$(document).click(function(e){var t=$(e.target);r.$apply(function(){t.hasClass("fa-header")||"h"==t.attr("flag")||(h.header_action=!1),t.hasClass("fa-table")||"table"==t.attr("flag")||(h.table_action=!1)})}),$(window).on("resize",_.throttle(function(){t(function(){h.editorHeight.height=$(o).find(".wt-editor-container-code").height()+"px"},50)},150)),$(h.editor).on("paste",function(t){t.stopPropagation();var a=[],i=t.originalEvent.clipboardData;if(i.items){for(var r=0;r0){var r=n.scope().$new();if(e.controller){var s={};s.$scope=r,s.editorInstance=l[0],i(e.controller,s),n.html(a(e.template)(r))}}}),h.editorHeight.height=$(o).find(".wt-editor-container-code").height()+"px",r.maxHeight=h.autoHeight?e.maxHeight:parseInt(h.editorHeight.height)>30?parseInt(h.editorHeight.height)-30:null,e.quickSearch&&e.quickSearch.bindAtWho&&e.quickSearch.bindAtWho(h.editor)},128)}}}]).service("wtEditorService",["wtEditorConfig",function(e){this.initGantt=function(){window.mermaid&&(mermaid.parseError=function(e,t){mermaid.error=e},mermaid.ganttConfig={numberSectionStyles:4,axisFormatter:[["%I:%M",function(e){return e.getHours()}],["w. %U",function(e){return 1==e.getDay()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%m-%y",function(e){return e.getMonth()}]]})},this.initMarked=function(){var e=new marked.Renderer;e.listitem=function(e){if(!/^\[[ x]\]\s/.test(e))return marked.Renderer.prototype.listitem(e);var t=$('');return/^\[x\]\s/.test(e)&&t.attr("checked",!0),$(marked.Renderer.prototype.listitem(e.substring(3))).addClass("task-list-item").prepend(t)[0].outerHTML},e.codespan=function(e){if(/^\$.+\$$/.test(e)){var t=/^\$(.+)\$$/.exec(e)[1],a=t.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'");try{return katex.renderToString(a,{displayMode:!1})}catch(n){return""+n+""}}return marked.Renderer.prototype.codespan.apply(this,arguments)},e.code=function(e,t,a,n){e=e.trim();var i=e.split(/\n/)[0].trim();if("math"===t){var r="";return e.split(/\n\n/).forEach(function(e){if(e=e.trim(),e.length>0)try{r+=katex.renderToString(e,{displayMode:!0})}catch(t){r+="
"+t+"
"}}),'
'+r+"
"}return"gantt"===i||"sequenceDiagram"===i||i.match(/^graph (?:TB|BT|RL|LR|TD);?$/)?("sequenceDiagram"===i&&(e+="\n"), window.mermaid&&mermaid.parse(e)?'
'+e+"
":window.mermaid&&mermaid.error?'
'+mermaid.error+"
":void 0):marked.Renderer.prototype.code.apply(this,arguments)},e.html=function(e){var t=marked.Renderer.prototype.html.apply(this,arguments),a=$(t.bold());return a.html()},e.paragraph=function(e){var t=marked.Renderer.prototype.paragraph.apply(this,arguments),a=$(t.bold());return a.html()},marked.setOptions({renderer:e,gfm:!0,tables:!0,breaks:!0,pedantic:!1,sanitize:!1,smartLists:!0,smartypants:!0})},this.parseMarked=function(e){return marked(e)},this.parseMermaid=function(){window.mermaid&&mermaid.init()},this.setEditorExtendButtons=function(t){t&&(e.extendButtons=t)},this.setEditorQuickSearch=function(t){t&&(e.quickSearch=t)},this.setEditorParseImgUpload=function(t){t&&(e.parseImgUpload=t)},this.setEditorTypes=function(t){t&&angular.extend(e.typeArray,t)},this.getEditorType=function(){return e.type},this.setLocale=function(t){t&&(e.locale=t,"zh-cn"!=t&&_.forEach(e.allButtons,function(t,a){var n=e.language[e.locale];if(n){var i=n[a];if(i&&(t.title=i),t.text){var r=n[a+"-text"];r&&(t.text=r)}}}))},this.addLocale=function(t){t&&angular.extend(e.language,t)},this.setMaxHeight=function(t){t&&(e.maxHeight=t)},this.initManyMarkdowns=function(e,t){if(e&&t){e.stopPropagation();var a=$(e.target);a.hasClass("wt-editor-textarea")||a.hasClass("toolbar-icon")||_.forEach(t,function(e){e.showEditor=!1})}}}]); angular.module("wt.editor.tpl",[]).run(["$templateCache",function(e){e.put("wt-editor/editor.html",'
\r
\r
\r
    \r
  • \r \r \r\r \r\r
    \r
      \r
    • \r {{n.title}}\r
    • \r
    \r
    \r\r \r \r\r \r\r\r
    \r
      \r
    • \r \r
    • \r
    \r
    \r\r\r \r\r \r \r \r \r \r \r \r \r
  • \r
\r
\r
\r
\r
\r \r
\r
\r
\r
\r
\r
\r')}]); \ No newline at end of file diff --git a/dist/wt-editor.js b/dist/wt-editor.js index be94518..2ceac27 100644 --- a/dist/wt-editor.js +++ b/dist/wt-editor.js @@ -679,7 +679,7 @@ angular.module("wt-editor") vm.editor = $(element).find('.wt-editor-textarea')[0]; try{ - vm.editor.setAttribute('placeholder',controller[0].getLocaleText('placeholder')); + vm.editor.setAttribute('placeholder',wtEditorConfig.placeholder?wtEditorConfig.placeholder:controller[0].getLocaleText('placeholder')); }catch(e){} //插入方法 diff --git a/package.json b/package.json index a47d4da..f7bb81d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-wt-editor", - "version": "1.2.0", + "version": "1.2.1", "description": "angular-wt-editor =================", "main": "index.js", "scripts": { diff --git a/src/js/editor.js b/src/js/editor.js index bf27a54..d442d3d 100644 --- a/src/js/editor.js +++ b/src/js/editor.js @@ -677,7 +677,7 @@ angular.module("wt-editor") vm.editor = $(element).find('.wt-editor-textarea')[0]; try{ - vm.editor.setAttribute('placeholder',controller[0].getLocaleText('placeholder')); + vm.editor.setAttribute('placeholder',wtEditorConfig.placeholder?wtEditorConfig.placeholder:controller[0].getLocaleText('placeholder')); }catch(e){} //插入方法