Просмотр исходного кода

以channel方式打开时在标题位置显示拥有者名字和channel name

visuddhinanda 3 лет назад
Родитель
Сommit
8b017cd0e0
1 измененных файлов с 19 добавлено и 0 удалено
  1. 19 0
      public/app/studio/js/editor.js

+ 19 - 0
public/app/studio/js/editor.js

@@ -273,6 +273,7 @@ function editor_windowsInit() {
 		case "openchannal":
 		case "openchannel":
 			editor_openChannal(g_book, g_para, g_channal);
+			render_channel_info(g_channal);
 			break;
 		case "import":
 			if (g_filename.length > 0) {
@@ -4099,6 +4100,24 @@ function editor_openChannal(book, para, channal) {
 		}
 	);
 }
+
+function render_channel_info(channel_id){
+	fetch('/api/v2/channel/'+channel_id,{
+        method: 'GET',
+        credentials: 'include',
+        headers: {
+            'Content-Type': 'application/json'
+        }
+    })
+  .then(response => response.json())
+  .then(function(data){
+      console.log(data);
+		let result = data.data;
+		if(data.ok==true){
+			$("#editor_doc_title").html("/" + data.data.owner_info.nickname + "/" + data.data.name);
+		}
+  });
+}
 //open project begin
 var editor_openProjectXmlHttp = null;
 function editor_openProject(strFileId, filetype) {