Skip to content

Commit 6605237

Browse files
committed
public: support split view
1 parent ab5ce2d commit 6605237

File tree

6 files changed

+24
-6
lines changed

6 files changed

+24
-6
lines changed

TODO.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
- [x] share with /gossa?id=uuid -> access /gossa/uuid/main.go or /gossa/uuid/main_test.go, access /gossa/uuid/ssa.html
1111
- [x] ~~Better Editor: Monaco Editor~~ maybe not?
1212
- [x] Containerized deployment
13-
- [x] Support Go Modules
13+
- [x] Support Go Modules
14+
- [x] Flexible split view

public/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>The Go SSA Playground</title>
77
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
8+
<script src="https://unpkg.com/split.js/dist/split.min.js"></script>
89
<script src="/gossa/linedtext.js"></script>
910
<link rel="icon" href="/gossa/favicon.png">
1011
<link rel="stylesheet" href="/gossa/style.css">

public/linedtext.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
/* Wrap the text area in the elements we need */
2727
textarea.wrap("<div class='linedtextarea' style='height:100%; overflow:hidden'></div>");
28-
textarea.width("95%");
29-
textarea.parent().prepend("<div class='lines' style='width:5%'></div>");
28+
textarea.width("calc(100% - 30px)");
29+
textarea.parent().prepend("<div class='lines' style='width:30px'></div>");
3030
var linesDiv = textarea.parent().find(".lines");
3131

3232
var scroll = function(tn) {

public/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ function loadCode() {
142142
}
143143
loadCode() // load content if access with id
144144

145+
Split(['#snippet', '#output'], {
146+
sizes: [30, 70],
147+
})
148+
145149
// TODO: dragable scroll
146150
// let wholePage = document.querySelector('body');
147151
// let el = document.querySelector("#ssa").contentDocument.querySelector('body');

public/style.css

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ input[type=button]:focus {
8686
#main {
8787
padding-top: 50px;
8888
display: flex;
89-
height: calc(100vh - 50px);
9089
flex-direction: row;
90+
height: calc(100vh - 50px);
9191
overflow: auto;
9292
}
9393
#snippet {
94-
flex: 30%;
9594
padding: 10px;
9695
background: rgba(255, 252, 221, 0.81);
9796
}
@@ -103,7 +102,6 @@ input[type=button]:focus {
103102
margin: 0 5px;
104103
}
105104
#output {
106-
flex: 70%;
107105
background-color: #f1f1f1;
108106
}
109107
#outputMsg {
@@ -133,6 +131,20 @@ input[type=button]:focus {
133131
color: lightgray;
134132
}
135133

134+
/* Split view */
135+
136+
.gutter {
137+
background-color: #eee;
138+
width: 5px;
139+
background-repeat: no-repeat;
140+
background-position: 50%;
141+
}
142+
143+
.gutter.gutter-horizontal {
144+
background-image: url('/gossa/vertical.png');
145+
cursor: col-resize;
146+
}
147+
136148
/* Dark Mode Toggle */
137149

138150
/* The switch - the box around the slider */

public/vertical.png

91 Bytes
Loading

0 commit comments

Comments
 (0)