<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <title>编辑文档</title>
    <script type="text/javascript">
        window.editor = null;
        window.imageUploadURL = "{{urlfor "DocumentController.Upload" "identify" .Model.Identify}}";
        window.fileUploadURL = "{{urlfor "DocumentController.Upload" "identify" .Model.Identify}}";
        window.documentCategory = {{.Result}};
        window.book = {{.ModelResult}};
        window.selectNode = null;
        window.deleteURL = "{{urlfor "DocumentController.Delete" ":key" .Model.Identify}}";
        window.editURL = "{{urlfor "DocumentController.Content" ":key" .Model.Identify ":id" ""}}";
        window.editURI = "{{urlfor "DocumentController.Edit" ":key" .Model.Identify ":id" ""}}";
        window.releaseURL = "{{urlfor "BookController.Release" ":key" .Model.Identify}}";
        window.generateURL = "{{urlfor "BookController.Generate" ":key" .Model.Identify}}";//生成书籍文档
        window.sortURL = "{{urlfor "BookController.SaveSort" ":key" .Model.Identify}}";
        window.historyURL = "{{urlfor "DocumentController.History"}}";
        window.removeAttachURL = "{{urlfor "DocumentController.RemoveAttachment"}}";
        window.onpop=false;
        window.staticURL ="{{$.StaticDomain}}";
    </script>
    <!-- Bootstrap -->
    <link href="{{$.StaticDomain}}/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="{{$.StaticDomain}}/static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="{{$.StaticDomain}}/static/jstree/3.3.4/themes/default/style.min.css" rel="stylesheet">
    <link href="{{$.StaticDomain}}/static/editor.md/css/editormd.css" rel="stylesheet">
    <link href="{{$.StaticDomain}}/static/css/jstree.css" rel="stylesheet">
    <link href="{{$.StaticDomain}}/static/highlight/styles/zenburn.css" rel="stylesheet">
    <link href="{{$.StaticDomain}}/static/webuploader/webuploader.css" rel="stylesheet">
    <link href="/static/css/markdown.css?version={{$.Version}}" rel="stylesheet">
    <link href="/static/css/markdown.preview.css?version={{$.Version}}" rel="stylesheet">
    <script src="{{$.StaticDomain}}/static/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="{{$.StaticDomain}}/static/respond.js/1.4.2/respond.min.js"></script>
	<!-- 脑图 -->
	<link rel="stylesheet" href="/static/mind-map/mindmap.css">
    <style>
        .editormd-preview-container ol.linenums li code, .editormd-html-preview ol.linenums li code{
            line-height: 1.7;
        }
        .markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{
            font-weight: normal !important;
        }
        .markdown-body{font-size: 1.2em !important;line-height: 1.7;}
        .editormd-preview-container ol.linenums li, .editormd-html-preview ol.linenums li{
            min-height: 20px;
        }
        .markdown-body table th{font-weight: normal;}
        li.L1, li.L3, li.L5, li.L7, li.L9{background-color: transparent;}
        .markdown-body img{margin: 8px 0px;}

    </style>
</head>
<body>

<div class="m-manual manual-editor">
    <div class="manual-head" id="editormd-tools">
        <div class="editormd-group">
            <a href="{{urlfor "BookController.Index"}}" data-toggle="tooltip" data-title="返回"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>
        </div>
        <div class="editormd-group">
            <a href="javascript:;" id="markdown-save" data-toggle="tooltip" data-title="保存内容" class="disabled save"><i class="fa fa-save" aria-hidden="true" name="save"></i></a>
        </div>
        <div class="editormd-group">
            <a href="javascript:;" data-toggle="tooltip" data-title="发布书籍"><i class="fa fa-paper-plane" name="release" aria-hidden="true"></i></a>
        </div>
        {{/*<div class="editormd-group">*/}}
            {{/*<a href="javascript:;" data-toggle="tooltip" data-title="撤销 (Ctrl-Z)"><i class="fa fa-undo first" name="undo" unselectable="on"></i></a>*/}}
            {{/*<a href="javascript:;" data-toggle="tooltip" data-title="重做 (Ctrl-Y)"><i class="fa fa-repeat last" name="redo" unselectable="on"></i></a>*/}}
        {{/*</div>*/}}


        <div class="editormd-group">
            <a href="javascript:;" data-toggle="tooltip" data-title="无序列表"><i class="fa fa-list-ul first" name="list-ul" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="有序列表"><i class="fa fa-list-ol item" name="list-ol" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="横线"><i class="fa fa-minus last" name="hr" unselectable="on"></i></a>
        </div>

        <div class="editormd-group">
            <a href="javascript:;" data-toggle="tooltip" data-title="粗体"><i class="fa fa-bold first" name="bold" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="斜体"><i class="fa fa-italic item" name="italic" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="删除线"><i class="fa fa-strikethrough last" name="del" unselectable="on"></i></a>
        </div>

        <div class="editormd-group">
            <a href="javascript:;" data-toggle="tooltip" data-title="标题一"><i class="fa editormd-bold first" name="h1" unselectable="on">H1</i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="标题二"><i class="fa editormd-bold item" name="h2" unselectable="on">H2</i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="标题三"><i class="fa editormd-bold item" name="h3" unselectable="on">H3</i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="标题四"><i class="fa editormd-bold item" name="h4" unselectable="on">H4</i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="标题五"><i class="fa editormd-bold item" name="h5" unselectable="on">H5</i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="标题六"><i class="fa editormd-bold last" name="h6" unselectable="on">H6</i></a>
        </div>
        <div class="editormd-group">
            <a href="javascript:;" data-toggle="tooltip" data-title="链接"><i class="fa fa-link first" name="link" unselectable="on"></i></a>
            {{/*<a href="javascript:;" data-toggle="tooltip" data-title="引用链接"><i class="fa fa-anchor item" name="reference-link" unselectable="on"></i></a>*/}}
            <a href="javascript:;" data-toggle="tooltip" data-title="添加图片"><i class="fa fa-picture-o item" name="image" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="添加音频"><i class="fa fa-music item" name="audio" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="添加视频"><i class="fa fa-video-camera item" name="video" unselectable="on"></i></a>

            <a href="javascript:;" data-toggle="tooltip" data-title="行内代码"><i class="fa fa-code item" name="code" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="代码块" unselectable="on"><i class="fa fa-file-code-o item" name="code-block" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="添加表格"><i class="fa fa-table item" name="table" unselectable="on"></i></a>
{{/*            <a href="javascript:;" data-toggle="tooltip" data-title="流程图/组织架构图/思维导图"><i class="fa fa-sitemap item" name="mindmap" unselectable="on"></i></a>*/}}
            <a href="javascript:;" data-toggle="tooltip" data-title="GFM 任务列表"><i class="fa fa-tasks item" name="tasks" aria-hidden="true"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="引用"><i class="fa fa-quote-right item" name="quote" unselectable="on"></i></a>
			<a href="javascript:;" data-toggle="tooltip" data-title="附件"><i class="fa fa-paperclip item" aria-hidden="true" name="attachment"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="模板"><i class="fa fa-tachometer item" name="template"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="word转换为markdown"><i class="fa  fa-file-word-o item" name="word2md" aria-hidden="true"></i></a>
			<a href="javascript:;" data-toggle="tooltip" data-title="从office粘贴转换"><i class="fa  fa-file-excel-o item" name="Pasteoffice" aria-hidden="true"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="使用帮助"><i class="fa fa-question-circle-o last" aria-hidden="true" name="help"></i></a>
        </div>

        <div class="editormd-group">
            <a href="javascript:;" data-toggle="tooltip" data-title="边栏"><i class="fa fa-columns first" aria-hidden="true" name="sidebar"></i></a>
            {{/*<a href="javascript:;" data-toggle="tooltip" data-title="关闭实时预览"><i class="fa fa-eye-slash item" name="watch" unselectable="on"></i></a>*/}}
            <a href="javascript:;" data-toggle="tooltip" data-title="查看版本"><i class="fa fa-history item" name="history" aria-hidden="true"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="添加Git Commit"><i class="fa fa-comments-o item" name="commit" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="自动生成"><i class="fa fa-tripadvisor item" name="auto" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="爬虫采集"><i class="fa fa-bug item" name="spider" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="全局内容替换"><i class="fa fa-refresh item" name="replace" unselectable="on"></i></a>
            <a href="javascript:;" data-toggle="tooltip" data-title="目录排序"><i class="fa fa-sort-amount-asc last" name="summary" unselectable="on"></i></a>
        </div>

        {{/*<div class="editormd-group pull-right">*/}}
            {{/*<a href="javascript:;" data-toggle="tooltip" data-title="关闭实时预览"><i class="fa fa-eye-slash first" name="watch" unselectable="on"></i></a>*/}}
            {{/*<a href="javascript:;" data-toggle="tooltip" data-title="修改历史"><i class="fa fa-history item" name="history" aria-hidden="true"></i></a>*/}}
            {{/*<a href="javascript:;" data-toggle="tooltip" data-title="边栏"><i class="fa fa-columns item" aria-hidden="true" name="sidebar"></i></a>*/}}
            {{/*<a href="javascript:;" data-toggle="tooltip" data-title="使用帮助"><i class="fa fa-question-circle-o last" aria-hidden="true" name="help"></i></a>*/}}
        {{/*</div>*/}}

        <div class="editormd-group pull-right">
            <a href="javascript:;" data-toggle="tooltip" data-title="生成下载文档"><i class="fa fa-book" name="generate" aria-hidden="true"></i></a>
        </div>

        <div class="editormd-group">
            <a href="javascript:;" data-toggle="tooltip" data-title=""></a>
            <a href="javascript:;" data-toggle="tooltip" data-title=""></a>
        </div>

        <div class="clearfix"></div>
    </div>
    <div class="manual-body">
        <div class="manual-category" id="manualCategory">
            <div class="manual-nav">
                <div class="nav-item active"><i class="fa fa-bars" aria-hidden="true"></i> 文档</div>
                <div class="nav-plus pull-right" id="btnAddDocument" data-toggle="tooltip" data-title="创建文档" data-direction="right"><i class="fa fa-plus" aria-hidden="true"></i></div>
                <div class="clearfix"></div>
            </div>
            <div class="manual-tree" id="sidebar"> </div>
        </div>
        <div class="manual-editor-container" id="manualEditorContainer">
            <div class="manual-editormd">
                <div id="docEditor" class="manual-editormd-active"></div>
            </div>
            <div class="manual-editor-status">
                <div id="attachInfo" class="item">0 个附件</div>
            </div>
        </div>

    </div>
</div>
<!-- Modal -->
<div class="modal fade" id="addDocumentModal" tabindex="-1" role="dialog" aria-labelledby="addDocumentModalLabel">
    <div class="modal-dialog" role="document">
        <form method="post" action="{{urlfor "DocumentController.Create" ":key" .Model.Identify}}" id="addDocumentForm" class="form-horizontal">
            <input type="hidden" name="identify" value="{{.Model.Identify}}">
            <input type="hidden" name="doc_id" value="0">
            <input type="hidden" name="parent_id" value="0">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">添加文档</h4>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label class="col-sm-2 control-label">文档名称 <span class="error-message">*</span></label>
                    <div class="col-sm-10">
                        <input type="text" name="doc_name" id="documentName" placeholder="文档名称" class="form-control"  maxlength="50">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">文档标识</label>
                    <div class="col-sm-10">
                        <input type="text" name="doc_identify" id="documentIdentify" placeholder="文档唯一标识" class="form-control" maxlength="50">
                        <p style="color: #999;font-size: 12px;">文档标识只能是数字、字母，以及“-”、“_”和“.”等字符，并且不能是纯数字</p>
                    </div>

                </div>
            </div>
            <div class="modal-footer">
                <span id="add-error-message" class="error-message"></span>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="submit" class="btn btn-primary" id="btnSaveDocument" data-loading-text="保存中...">立即保存</button>
            </div>
        </div>
        </form>
    </div>
</div>
<div class="modal fade" id="uploadAttachModal" tabindex="-1" role="dialog" aria-labelledby="uploadAttachModalLabel">
    <div class="modal-dialog" role="document">
        <form method="post" id="uploadAttachModalForm" class="form-horizontal">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">上传附件</h4>
                </div>
                <div class="modal-body">
                    <div class="attach-drop-panel">
                        <div class="upload-container" id="filePicker"><i class="fa fa-upload" aria-hidden="true"></i></div>
                    </div>
                    <div class="attach-list" id="attachList">
                        <template v-for="item in lists">
                            <div class="attach-item" :id="item.attachment_id">
                                <template v-if="item.state == 'wait'">
                                    <div class="progress">
                                        <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100">
                                            <span class="sr-only">0% Complete (success)</span>
                                        </div>
                                    </div>
                                </template>
                                <template v-else-if="item.state == 'error'">
                                    <span class="error-message">${item.message}</span>
                                    <button type="button" class="btn btn-sm close" @click="removeAttach(item.attachment_id)">
                                        <i class="fa fa-remove" aria-hidden="true"></i>
                                    </button>
                                </template>
                                <template v-else>
                                    <a :href="item.http_path" target="_blank" :title="item.file_name">${item.file_name}</a>
                                    <span class="text">(${ formatBytes(item.file_size) })</span>
                                    <span class="error-message">${item.message}</span>
                                    <button type="button" class="btn btn-sm close" @click="removeAttach(item.attachment_id)">
                                        <i class="fa fa-remove" aria-hidden="true"></i>
                                    </button>
                                    <div class="clearfix"></div>
                                </template>
                            </div>
                        </template>
                    </div>
                </div>
                <div class="modal-footer">
                    <span id="add-error-message" class="error-message"></span>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="btnUploadAttachFile" data-dismiss="modal">确定</button>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- Modal -->
<div class="modal fade" id="documentHistoryModal" tabindex="-1" role="dialog" aria-labelledby="documentHistoryModalModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">文档历史记录</h4>
            </div>
            <div class="modal-body text-center" id="historyList">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="documentTemplateModal" tabindex="-1" role="dialog" aria-labelledby="请选择模板类型" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="modal-title">请选择模板类型</h4>
            </div>
            <div class="modal-body template-list">
                <div class="container">
                    <div class="section">
                        <a data-type="normal" href="javascript:;"><i class="fa fa-file-o"></i></a>
                        <h3><a data-type="normal" href="javascript:;">普通文档</a></h3>
                        <ul>
                            <li>默认类型</li>
                            <li>简单的文本文档</li>
                        </ul>
                    </div>
                    <div class="section">
                        <a data-type="api" href="javascript:;"><i class="fa fa-file-code-o"></i></a>
                        <h3><a data-type="api" href="javascript:;">API文档</a></h3>
                        <ul>
                            <li>用于API文档速写</li>
                            <li>支持代码高亮</li>
                        </ul>
                    </div>
                    <div class="section">
                        <a data-type="code" href="javascript:;"><i class="fa fa-book"></i></a>

                        <h3><a data-type="code" href="javascript:;">数据字典</a></h3>
                        <ul>
                            <li>用于数据字典显示</li>
                            <li>表格支持</li>
                        </ul>
                    </div>
                </div>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>

<!-- Modal -->
<div class="modal fade" id="ModalSpider" tabindex="-1" role="dialog" aria-labelledby="ModalSpiderLabel">
    <div class="modal-dialog" role="document">
        <form method="post" action="{{urlfor "BaseController.Crawl"}}" class="form-horizontal">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="ModalSpiderLabel">内容采集</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">链接地址 <span class="error-message">*</span></label>
                        <div class="col-sm-10">
                            <input type="text" name="url" placeholder="请输入链接地址" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">采集模式</label>
                        <div class="col-sm-10">
                            <label class="radio-inline">
                                <input type="radio" name="force" value="0" checked> 极速模式
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="force" value="1"> 强力模式
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">内容提取</label>
                        <div class="col-sm-10">
                            <label class="radio-inline">
                                <input type="radio" name="intelligence" value="1" checked> 智能提取
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="intelligence" value="0"> 全文提取
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="intelligence" value="2"> DIY模式
                            </label>
                        </div>
                    </div>
                    <div class="form-group form-group-diy" style="display: none;">
                        <label class="col-sm-2 control-label">选择器</label>
                        <div class="col-sm-10">
                            <input type="text" name="diy" placeholder="请输入选择器" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">内容类型</label>
                        <div class="col-sm-10">
                            <label class="radio-inline">
                                <input type="radio" name="type" value="0" checked> markdown
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="type" value="1"> html
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="type" value="2"> 纯文本
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="help-block">
                            <ol>
                                <li>内容采集一般耗时在10秒左右，请耐心等待</li>
                                <li>如果采集的链接页面内容使用js渲染，请使用"强力模式"进行采集</li>
                                <li>内容类型，是指采集到的内容最后返回到编辑器的类型</li>
                                <li>当前采集功能不是很强大，我们会继续优化和升级该功能</li>
                            </ol>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <span id="add-error-message" class="error-message"></span>
                    <button type="reset" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-primary" id="btnCrawl" data-loading-text="采集中...">立即采集</button>
                </div>
            </div>
        </form>
    </div>
</div>


<!-- Modal -->
<div class="modal fade" id="ModalReplace" tabindex="-1" role="dialog" aria-labelledby="ModalReplaceLabel">
    <div class="modal-dialog" role="document">
        <form method="post" action="{{urlfor "BookController.Replace" ":key" $.Model.Identify}}" class="form-horizontal">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="ModalReplaceLabel">全局内容替换</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">源字符串 <span class="error-message">*</span></label>
                        <div class="col-sm-10">
                            <textarea name="src" class="form-control" rows="3" placeholder="请输入被替换的内容"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">替换内容</label>
                        <div class="col-sm-10">
                            <textarea name="dst" class="form-control" rows="3" placeholder="请输入要替换成的内容"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="help-block">
                            <ol>
                                <li>全局内容替换，将会替换掉整个书籍的对应字符串内容</li>
                                <li>内容替换时长因书籍章节内容数目不同而不同</li>
                                <li>内容替换之后，请再次执行发布操作，以便能看到替换后的效果</li>
                            </ol>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <span id="add-error-message" class="error-message"></span>
                    <button type="reset" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-primary" id="btnReplace" data-loading-text="替换中...">立即替换</button>
                </div>
            </div>
        </form>
    </div>
</div>


<!-- Modal -->
<div class="modal fade" id="ModalMulti" tabindex="-1" role="dialog" aria-labelledby="ModalMultiLabel">
    <div class="modal-dialog" role="document">
        <form method="post" action="{{urlfor "DocumentController.CreateMulti"}}" class="form-horizontal">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="ModalMultiLabel">批量添加章节</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <div class="col-sm-12">
                            <input type="hidden" name="book_id" value="{{.Model.BookId}}">
                            <textarea name="content" placeholder="chxx 第xx章 数据库之从删库到跑路" rows="6" class="form-control"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-12 help-block">
                            <div>说明</div>
                            <ol>
                                <li>每行一个章节，并以第一个空格分割章节标识和章节标题</li>
                                <li>多个章节，请换行输入</li>
                                <li>每一行的格式，形如"ch01 第一章 Go语言从入门到精通"，这里，"ch01"则是章节标识，第一个空格以后的"第一章 Go语言从入门到精通"则是章节标题</li>
                                <li>如果章节标识已存在，则不会添加该章节</li>
                                <li>文档标识只能是数字、字母，以及“-”、“_”和“.”等字符，并且不能是纯数字</li>
                            </ol>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <span id="add-error-message" class="error-message"></span>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-primary" id="btnMulti" data-loading-text="...">添加</button>
                </div>
            </div>
        </form>
    </div>
</div>

<!-- word2md -->
<div class="modal fade" id="word2md" tabindex="-1" role="dialog" aria-labelledby="ModalReplaceLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
		<form  class="form-horizontal" id="word2mdform">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span></button>
				<h1 class="modal-title" id="ModalReplaceLabel" style="text-align:center;">word转换为markdown</h1>
				<input id="document" type="file" accept=".docx"/></div>
			<div class="modal-body" style="overflow-y:auto; height:400px;">
			<div id="output" class="well">
          </div>
			</div>
			<div class="modal-footer">
			<h3 style="margin-top:0px;text-align:center;">信息提示</h3>
          <div id="messages" class="well" align="left">
          </div>
				<div class="modal-footer">
				<button type="button" class="btn btn-primary" id="btnhtml2md" >确定</button>
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button></div>
			</div>

		</form>
		</div>
	</div>
</div>


<!-- Pasteoffice -->
<div class="modal fade" id="Pasteoffice" tabindex="-1" role="dialog" aria-labelledby="ModalReplaceLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
		<form  class="form-horizontal" id="Pasteofficeform">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span></button>
				<h1 class="modal-title" id="ModalReplaceLabel" style="text-align:center;">将office/html内容粘贴在下方</h1>
				</div>
			<div class="modal-body" style="overflow-y:auto; height:400px;">
			<textarea name="Pastearea" id="Pastearea" style="height:150px;width:100%"></textarea>
			<h2 style="margin-top:0px;text-align:center;"><button type="button" class="btn btn-info" id="HtmlToMarkdown" >转成markdown</button></h2>
			<textarea id="officeoutmd" style="height:150px;width:100%"></textarea>
			</div>
			<div class="modal-footer">
				<div class="modal-footer">
				<button type="button" class="btn btn-primary" id="office2md" >确定</button>
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button></div>
			</div>
		
		</form>
		</div>
	</div>
</div>

<!-- Modal -->
<!-- 这个Modal主要用于显示思维导图的备注信息。 -->
<div class="modal fade" id="ModalNote" tabindex="-1" role="dialog" aria-labelledby="ModalReplaceLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span></button>
				<h1 class="modal-title" id="ModalReplaceLabel" style="align:center;">思维导图备注</h1></div>
			<div class="modal-body" style="overflow-y:auto; height:400px;"></div>
			<div class="modal-footer">
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button></div>
			</div>
		</div>
	</div>
</div>

<!-- 该div主要用于，点击编辑器时的思维导图按钮时，直接显示一段帮助信息 -->
<div style="display:none;" id="mindmaphelp">
>[warning]mindmap 参数说明：
语法：描述写在` ```mindmap` 和` ``` `之间
各`选项`用“选项名”：“选项值”分开，各选项间用空格分割
`size:`指定显示流程图的大小,可选值为“mindmap-sm”、“mindmap-md”、“mindmap-lg”
`Theme:`流程图主题，可选项为：“classic”、“classic-compact”、“fish”、“fresh-blue”、“fresh-blue-compat”、“fresh-green”、“fresh-green-compat”、“fresh-pink”、“fresh-pink-compat”、“fresh-purple”、“fresh-purple-compat”、“fresh-red”、“fresh-red-compat”、“fresh-soil”、“fresh-soil-compat”、“snow”、“snow-compact”、“tianpan”、“tianpan-compact”、“wire”，默认值为“fresh-blue”。
`Template:`流程图模板，支持“default”、"fresh-blue"、“filetree”、"fish-bone"、“right”、“structure”、“tianpan”，默认值为"fresh-blue"。
`protocol:`指定的用于解析数据的数据协议（默认内置三种数据协议 “json”、“text” 和 “markdown”的支持),改造后，支持markdown中的“list”写法，如`- 根节点`,一共四种支持。
`tmpshow`这个参数主要用于显示输入原始数据，建议使用list写法的时候开启，默认隐藏，只支持"true"。

**提示：建议在完成思维导图后，将上述文本删除。**

```mindmap size:mindmap-md  Theme:fresh-blue  Template:default  protocol:markdown  tmpshow:false


```

------------

</div>


<template id="template-normal">
{{template "document/template_normal.html"}}
</template>
<template id="template-api">
{{template "document/template_api.html"}}
</template>
<template id="template-code">
{{template "document/template_code.html"}}
</template>

<script src="{{$.StaticDomain}}/static/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>
<script src="{{$.StaticDomain}}/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{$.StaticDomain}}/static/vuejs/vue.min.js" type="text/javascript"></script>
<script src="{{$.StaticDomain}}/static/webuploader/webuploader.min.js" type="text/javascript"></script>
<script src="{{$.StaticDomain}}/static/jstree/3.3.4/jstree.min.js" type="text/javascript"></script>
<script src="{{$.StaticDomain}}/static/editor.md/editormd.js" type="text/javascript"></script>
<script src="{{$.StaticDomain}}/static/layer/layer.js" type="text/javascript" ></script>
<script src="{{$.StaticDomain}}/static/js/jquery.form.js" type="text/javascript"></script>
<script src="/static/js/editor.js?version={{$.Version}}" type="text/javascript"></script>
<script src="/static/js/markdown.js?version={{$.Version}}" type="text/javascript"></script>

<!-- 脑图 -->
<script src="{{$.StaticDomain}}/static/mind-map/kity.min.js" type="text/javascript"></script>
<script src="{{$.StaticDomain}}/static/mind-map/kityminder.core.min.js" type="text/javascript"></script>
<script src="{{$.StaticDomain}}/static/mind-map/mindmap.min.js?version={{$.Version}}" type="text/javascript"></script>
<script src="{{$.StaticDomain}}/static/word2md/turndown.js?version={{$.Version}}"></script>
<script src="{{$.StaticDomain}}/static/word2md/turndown-plugin-gfm.js?version={{$.Version}}"></script>
<script src="{{$.StaticDomain}}/static/word2md/mammoth.browser.js?version={{$.Version}}"></script>
<script src="{{$.StaticDomain}}/static/word2md/word2md.js?version={{$.Version}}"></script>

<script type="text/javascript">
    $(function () {

        $("[name=intelligence]").click(function () {
            if($(this).val()=="2"){
                $(".form-group-diy").fadeIn();
            }else{
                $(".form-group-diy").hide();
            }
        })

        $("#attachInfo").on("click",function () {
            $("#uploadAttachModal").modal("show");
        });
        window.uploader = null;

        $("#uploadAttachModal").on("shown.bs.modal",function () {
            if(window.uploader === null){
                try {
                    window.uploader = WebUploader.create({
                        auto: true,
                        dnd : true,
                        swf: '/static/webuploader/Uploader.swf',
                        server: '{{urlfor "DocumentController.Upload"}}',
                        formData : { "identify" : {{.Model.Identify}},"doc_id" :  window.selectNode.id },
                        pick: "#filePicker",
                        fileVal : "editormd-file-file",
                        fileNumLimit : 1,
                        compress : false
                    }).on("beforeFileQueued",function (file) {
                        uploader.reset();
                    }).on( 'fileQueued', function( file ) {
                        var item = {
                            state : "wait",
                            attachment_id : file.id,
                            file_size : file.size,
                            file_name : file.name,
                            message : "正在上传"
                        };
                        window.vueApp.lists.splice(0,0,item);

                    }).on("uploadError",function (file,reason) {
                        for(var i in window.vueApp.lists){
                            var item = window.vueApp.lists[i];
                            if(item.attachment_id == file.id){
                                item.state = "error";
                                item.message = "上传失败";
                                break;
                            }
                        }

                    }).on("uploadSuccess",function (file, res) {
                        for(var index in window.vueApp.lists){
                            var item = window.vueApp.lists[index];
                            if(item.attachment_id === file.id){
                                if(res.errcode === 0) {
                                    window.vueApp.lists.splice(index, 1, res.attach);

                                }else{
                                    item.message = res.message;
                                    item.state = "error";
                                }
                                break;
                            }
                        }

                    }).on("beforeFileQueued",function (file) {

                    }).on("uploadComplete",function () {

                    }).on("uploadProgress",function (file, percentage) {
                        var $li = $( '#'+file.id ),
                            $percent = $li.find('.progress .progress-bar');

                        $percent.css( 'width', percentage * 100 + '%' );
                    });
                }catch(e){
                    console.log(e);
                }
            }
        });
    });
</script>
</body>
</html>