From 7fc09c667626914d944944cf2f26643eefa53c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E775174143?= <775174143@qq.com> Date: Tue, 9 Oct 2018 16:54:20 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E4=BB=A3=E7=A0=81=E6=8D=A2?= =?UTF-8?q?=E8=A1=8C=202.=E5=BA=95=E9=83=A8=E9=83=BD=E7=95=99=E7=9B=B8?= =?UTF-8?q?=E5=AF=B9=E5=9B=BA=E5=AE=9A=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/css/code_show.css | 4 +++- static/js/source.js | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/static/css/code_show.css b/static/css/code_show.css index 769f257..73cffe4 100644 --- a/static/css/code_show.css +++ b/static/css/code_show.css @@ -428,6 +428,7 @@ a:hover { height: 880px; overflow-x: hidden; overflow-y: visible; + padding-bottom: 600px; } .codeopration { @@ -473,7 +474,8 @@ a:hover { margin-top: 30px; padding: 30px; box-sizing: border-box; - overflow-y:auto; + overflow-y:auto; + padding-bottom: 300px; /* max-width: 370px; */ } diff --git a/static/js/source.js b/static/js/source.js index 451b13c..d3c36f7 100644 --- a/static/js/source.js +++ b/static/js/source.js @@ -527,6 +527,7 @@ function delete_anno(file_id,line_num,anno_id){ function add_annotation(item,file_id, line_num) { + // 获取当前是注释还是问题 function_name="add_annotation(this"+","+file_id+","+line_num+")" // make_button_disable($(item)) @@ -534,7 +535,13 @@ function add_annotation(item,file_id, line_num) { var selectValue = $(item).siblings(".put-select").find(".active").html().trim(); var text_context = "#addno-text-" + file_id+"-"+line_num; var content = $(text_context).val(); - + + //保留输入的换行符 + var a = content.replace(/\n|\r\n/g,"
"); + var reg=new RegExp("
","g"); + var newstr=a.replace(reg,"\n"); + + if (content.trim().length == 0) { alert("内容不能为空") $(item).attr('disabled',false); @@ -545,13 +552,13 @@ function add_annotation(item,file_id, line_num) { make_button_disable($("#issue-anno-submit")) if (selectValue == "注释") { // 向addAnnatation中发请求 - submit_annotation(file_id, line_num, content); + submit_annotation(file_id, line_num, newstr); deletelocalStorage("file_id"); deletelocalStorage("line_num"); deletelocalStorage("item_value"); deletelocalStorage("status_value"); } else { - submit_question(file_id, line_num, content); + submit_question(file_id, line_num, newstr); deletelocalStorage("issuefile_id"); deletelocalStorage("issueline_num"); deletelocalStorage("issueitem_value");