Browse Source

Merge branch 'master' of https://github.com/iapt-platform/mint

bhikkhu-kosalla-china 4 years ago
parent
commit
f1cda30aed

+ 2 - 1
app/studio/js/editor.js

@@ -185,7 +185,8 @@ function dict_active(obj, dictIndex) {
 }
 
 function editor_windowsInit() {
-	$("see").click(function () {
+	renderChannelList();
+	$("see").on("click",function () {
 		var to = $(this).attr("to");
 		var link;
 		if (to) {

+ 11 - 1
app/studio/plugin/system_layout/gui.html

@@ -25,7 +25,17 @@
 				<use xlink:href="svg/icon.svg#ic_add"></use>
 			</svg>
 		</p>
-		<div id="layout_channel" class="submenu_details"></div>
+		<div id="layout_channel" class="submenu_details">
+			<div>
+				<button onclick='renderChannelList()'>
+				<svg class='icon' style='fill: var(--box-bg-color1)'>
+				<use xlink:href='../../node_modules/bootstrap-icons/bootstrap-icons.svg#arrow-clockwise'>
+				</svg>
+				<?php echo $_local->gui->refresh; ?>
+				</button>
+			</div>
+			<div id="layout_channel_innter"></div>
+		</div>
 	</div>
 	<!--end of sandhi-->
 

+ 1 - 9
app/studio/plugin/system_layout/module_function.js

@@ -291,14 +291,6 @@ function channelDisplayAll(obj) {
 
 function renderChannelList(){
 	let html ="";
-	html += "<div>";
-	html +="<button onclick='renderChannelList()'>";
-	html += "<svg class='icon' style='fill: var(--box-bg-color1)'>";
-	html += "<use xlink:href='../../node_modules/bootstrap-icons/bootstrap-icons.svg#arrow-clockwise'>";
-	html += "</svg>" ;
-	html += gLocal.gui.refresh;
-	html +="</button>";
-	html +="</div>";
 	html += "<input type='checkbox' id='layout_channel_display_all' checked channel_id='-1' onclick=\"channelDisplayAll(this)\" />全选</li>"
 	html +="<ul id='layout_channel_display'>";
 	html += "<li><input type='checkbox' checked channel_id='0' onclick=\"channelDisplay(this)\" />其他</li>"
@@ -307,6 +299,6 @@ function renderChannelList(){
 			html += "<li><input type='checkbox' checked channel_id='"+iterator.id+"' onclick=\"channelDisplay(this)\" />"+iterator.name+"</li>"
 		}
 		html +="</ul>";
-		$("#layout_channel").html(html);
+		$("#layout_channel_innter").html(html);
 	}
 }

+ 9 - 7
app/term/note.js

@@ -2228,7 +2228,7 @@ function text_input_textarea_focuse(el){
 			break;
 			case "Enter":
 				if(menu.style.display=="block"){
-					term_insert(term_filterd_data[menuFocusIndex-1]);
+					term_insert(term_filterd_data[menuFocusIndex]);
 					return false;
 				}
 				if (e.ctrlKey) {
@@ -2283,8 +2283,8 @@ function text_input_textarea_focuse(el){
 		if( menu.style.display=="block"){
 			let pos1=str1.lastIndexOf("[[");
 			let pos2=str1.lastIndexOf("]]");
-			if(pos1==-1 || (pos2!=-1 || pos2>pos1)){
-				//光标前没有[[ 光标在[[]] 之后
+			if(pos1==-1 || (pos1!=-1 && pos2>pos1)){
+				//光标前没有[[ 光标在[[]] 之后
 				term_at_menu_hide();
 			}
 		}
@@ -2315,6 +2315,7 @@ function text_input_textarea_focuse(el){
 
 }
 function term_at_menu_show(cursor){
+	menuFocusIndex=0;
 	let menu = term_input_text.parentElement.querySelector('.menu');
 	menu.style.display="block";
 	menu.style.top=cursor.offsetTop+20+"px";
@@ -2358,7 +2359,7 @@ function TermAtRenderMenu(params) {
 	let focusIndex = params.focus%term_data.length;
 	for (const it of term_data) {
 		if(term_input=="" || it.word.indexOf(term_input)==0 || it.en.indexOf(term_input)==0){
-			index++;
+			
 			html +="<li ";
 			if(focusIndex==index){
 				html +="class='trem_focus' "
@@ -2366,7 +2367,7 @@ function TermAtRenderMenu(params) {
 			html += "onclick=\"term_insert('"+it.word+"')\" ";
 			
 			html +=">";
-			html +=index+ ". ";
+			html += (index+1)+ ". ";
 			if(it.exist>0){
 				html += "<b>"+it.word+"</b>";
 			}else{
@@ -2374,11 +2375,12 @@ function TermAtRenderMenu(params) {
 			}
 			html +="<li>";
 			term_filterd_data.push(it.word);
-			if(index>_term_max_menu){
+			if(index >= _term_max_menu){
 				break;
 			}
+			index++;
 		}
-
+		
 	}
 	return html;
 }