<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="tinyMCE_imgmap.ascx.cs" Inherits="Mvcb2b.admin.tinyMCE_imgmap" %>
<script type="text/javascript" src="<%=Webd%>editors/tiny_mce3.5/tiny_mce.js"></script>
<script type="text/javascript">
var  tistu=true;
var isie2 = (navigator.appName == "Microsoft Internet Explorer");
var isie11= navigator.userAgent.indexOf('Trident/') != -1 && (navigator.userAgent.indexOf('rv:') != -1 || navigator.appName.indexOf('Netscape') != -1);
var isEdge = navigator.userAgent.indexOf('Edge/') != -1;
if (isie2 || isie11 ||  isEdge)
   tistu=false;
    var editorpath = "<%=Webd%>editors/"
    tinyMCE.init({
        mode: "exact", theme: "advanced", language: "zh", elements: "<%=txtContent.ClientID %>",
        //工具栏
        //相应 内联弹出式窗口,全屏,上下文菜单,图片,清理,表情,表格
        plugins: "imgmap,fullscreen,preview",
       // plugins: "imgmap,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",
        theme_advanced_buttons1: "code,fullscreen,cut,copy,paste,undo,redo,preview,imgmap",
        theme_advanced_buttons2: "",
        theme_advanced_buttons3: "",

        button_tile_map: false,
        theme_advanced_toolbar_location: "top", //编辑器在顶部
        theme_advanced_toolbar_align: "left", //工具栏按钮靠左
        theme_advanced_statusbar_location: "bottom", //状态栏显示底部	
        plugin_insertdate_dateFormat: "%Y-%m-%d",
        plugin_insertdate_timeFormat: "%H:%M:%S",
        //width|height| 去掉
        //  extended_valid_elements: "img[usemap|class|id|src|border=0|alt|title|hspace|vspace|align|onmouseover|onmouseout|name],map[id|name],area[shape|alt|coords|href|target]",
        extended_valid_elements: "img[usemap|class|id|src|border=0|alt|title|hspace|vspace|align|onmouseover|onmouseout|name],map[id|name],area[shape|alt|coords|href|target]",
        theme_advanced_resizing: true, //可以动态调整编辑器大小

        // Style formats
        style_formats: [
			{ title: 'Bold text', inline: 'b' },
			{ title: 'Red text', inline: 'span', styles: { color: '#ff0000'} },
			{ title: 'Red header', block: 'h1', styles: { color: '#ff0000'} },
			{ title: 'Example 1', inline: 'span', classes: 'example1' },
			{ title: 'Example 2', inline: 'span', classes: 'example2' },
			{ title: 'Table styles' },
			{ title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
		],
        paste_auto_cleanup_on_paste:tistu,
        //  skin: "o2k7",
        auto_cleanup_word: true,
        file_browser_callback: "fileBrowserCallBack",
        //file_browser_callback : "myCustomFileBrowser",
        theme_advanced_resize_horizontal: true, //水平调整编辑器
        theme_advanced_resizing: true, //调整开关	
        nonbreaking_force_tab: true,
        apply_source_formatting: true,
        relative_urls: false
    });

    //功能：获取TinyMce编辑器的内容
    //返回：内容字符串；如果失败，返回空字符串
    function GetTinyMceContent(editorId) {
        // return tinyMCE.getInstanceById(editorId).getBody().innerHTML;
        return tinyMCE.get(editorId).getContent();	
    }
    //功能：设置TinyMce编辑器的内容
    //参数：editorId——编辑器的id
    function SetTinyMceContent(editorId, content) {
        tinyMCE.getInstanceById(editorId).getBody().innerHTML = content;
    }
    function GetContent() {
        return GetTinyMceContent('<%=txtContent.ClientID %>');
    }
    function SetContent(content) {
        SetTinyMceContent('<%=txtContent.ClientID %>', content);
    }
    //插入内容
    function InsertContent(content) {
        // tinyMCE.execCommand('mceInsertContent',false, content);
        tinyMCE.execCommand('mceInsertRawHTML', false, content);

    }
    function InsertImage() {
        // tinyMCE.execCommand('mceInsertContent',false, content);
        tinyMCE.execCommand('mceImage', false, null);
    }   
</script>
<asp:TextBox runat="Server" ID="txtContent" Height="617px"  Width="100%" TextMode="MultiLine" />
<div style="width:auto;color:#2970D8;padding-top:5px;padding-bottom:3px;padding-left:3px;line-height:18px;min-height:18px;height:auto!important;height:18px;">
- 只有在编辑器中可以看到图片顶部才能选中图片（即滚动条拉到顶部）或者鼠标双击图片选中! <br />
- 对于Chrome浏览器，请点击图片右上角来选中图片。
- 对于IE6浏览器，请点击图片左上角来选中图片。
</div>
<div style="width:auto;color:#2970D8;padding-top:5px;padding-bottom:3px;padding-left:3px;line-height:18px;height:18px;float:left;">步骤：  1. 鼠标点击图片,选中图片; 2. 鼠标点击热点编辑按钮：</div>
<div style="width:20%;color:#2970D8;padding-top:3px;padding-bottom:3px;padding-left:3px;line-height:20px;height:20px; float:left;"><img src="../editors/tiny_mce3.5/plugins/imgmap/images/tinymce_button.gif"  alt="" align="absmiddle"  /></div>