Skip to content

Commit 9fa64f5

Browse files
committed
[fix] 修复示例editor页面,展开左侧菜单,点击示例,未隐藏源码的问题
review by luox
1 parent 66d0cfd commit 9fa64f5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

examples/js/editor.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.*/
22
$(document).ready(function () {
33
window.initI18N(function(){
4-
var pageConfig = getActiveExampleConfig();
5-
initPage(pageConfig);
4+
initPage();
65
bindEvents();
76
sidebarScrollFix();
87
});
@@ -11,10 +10,9 @@ $(document).ready(function () {
1110
var aceEditor;
1211
var containExamples = true;
1312

14-
function initPage(pageConfig) {
15-
var showCode = pageConfig.showCode;
13+
function initPage() {
1614
initSideBar();
17-
initEditor(showCode);
15+
initEditor();
1816
screenResize();
1917
}
2018

@@ -60,10 +58,11 @@ function screenResize() {
6058

6159
//初始化编辑器
6260
function initCodeEditor(showCode) {
61+
const codeBtn = document.getElementById("showCodeBtn");
6362
if(showCode === false){
63+
codeBtn.classList.add('hide');
6464
return
6565
}
66-
const codeBtn = document.getElementById("showCodeBtn");
6766
codeBtn.classList.remove('hide');
6867
if (!aceEditor) {
6968
aceEditor = ace.edit("editor");
@@ -79,9 +78,10 @@ function initCodeEditor(showCode) {
7978
}
8079

8180
//初始化编辑器以及预览内容
82-
function initEditor(showCode) {
81+
function initEditor() {
82+
var pageConfig = getActiveExampleConfig();
8383
loadExampleHtml();
84-
initCodeEditor(showCode);
84+
initCodeEditor(pageConfig.showCode);
8585
}
8686

8787
function loadExampleHtml() {

0 commit comments

Comments
 (0)