From 4d87ef8544e37ccb38267fd930d72e4001cce25d Mon Sep 17 00:00:00 2001 From: Minho Date: Sat, 20 Jan 2018 15:57:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bootstrap-wysiwyg/bootstrap-wysiwyg.js | 9 ++- views/document/new_html_edit_template.tpl | 73 +++++++++++++++++-- 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/static/bootstrap/plugins/bootstrap-wysiwyg/bootstrap-wysiwyg.js b/static/bootstrap/plugins/bootstrap-wysiwyg/bootstrap-wysiwyg.js index bdd2c0f9..ac13d9ad 100644 --- a/static/bootstrap/plugins/bootstrap-wysiwyg/bootstrap-wysiwyg.js +++ b/static/bootstrap/plugins/bootstrap-wysiwyg/bootstrap-wysiwyg.js @@ -89,7 +89,10 @@ var nodeName = selection.commonAncestorContainer.parentNode.nodeName; if(nodeName === 'CODE' || nodeName === 'PRE'){ return insertEmpty(selection.parentNode); - } + }else if(nodeName === "DIV" || nodeName === "P"){ + return insertHtml('
'); + } + console.log(nodeName); }catch (e){ console.log(selection) console.log("enterKeyHandle:" + e); @@ -227,6 +230,7 @@ editor.change && editor.change(); } }else{ + console.log(html) execCommand('insertHTML',html); } }; @@ -259,6 +263,7 @@ insertHtml(args); saveSelection(); }; + this.insertHtml = insertHtml; return this; }; $.fn.wysiwyg.defaults = { @@ -274,7 +279,7 @@ 'ctrl+j meta+j': 'justifyfull', 'shift+tab': 'outdent', 'tab': 'indent', - 'return':'enterAction' + 'return':'enterAction' }, toolbarSelector: '[data-role=editor-toolbar]', commandRole: 'edit', diff --git a/views/document/new_html_edit_template.tpl b/views/document/new_html_edit_template.tpl index 9549e27e..5bb91341 100644 --- a/views/document/new_html_edit_template.tpl +++ b/views/document/new_html_edit_template.tpl @@ -41,6 +41,19 @@ #docEditor {overflow:auto;border: 1px solid #ddd; height: 100%;outline:none;padding: 5px;} .btn-info{background-color: #ffffff !important;} .btn-info>i{background-color: #cacbcd !important; color: #393939 !important; box-shadow: inset 0 0 0 1px transparent,inset 0 0 0 0 rgba(34,36,38,.15);} + .editor-wrapper>pre{padding: 0;} + .editor-wrapper .editor-code{ + font-size: 13px; + line-height: 1.8em; + color: #dcdcdc; + border-radius: 3px; + display: block; + overflow-x: auto; + padding: 0.5em; + background: #3f3f3f; + } + .editor-wrapper-selected .editor-code{border: 1px solid #1e88e5;} + @@ -80,7 +93,7 @@ - + @@ -127,11 +140,8 @@ 开发缘起是公司IT部门需要一款简单实用的项目接口文档管理和分享的系统。其功能和界面源于 kancloud 。 可以用来储存日常接口文档,数据库字典,手册说明等文档。内置项目管理,用户管理,权限管理等功能,能够满足大部分中小团队的文档管理需求。 -
-                        
-                            f
-                        
-                    
+
f
+

@@ -141,6 +151,25 @@
+ + + +