Merge pull request #23 from tanabe/feature/full-screen

Feature/full screen
This commit is contained in:
Hideaki Tanabe 2020-10-27 01:17:51 +09:00 committed by GitHub
commit dedf4fb837
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 73 additions and 69 deletions

View File

@ -8,6 +8,12 @@ html, body {
font-size: 1em; font-size: 1em;
line-height: 1.5em; line-height: 1.5em;
background-color: #444; background-color: #444;
height: 100%;
overflow: hidden;
}
body {
overscroll-behavior: none;
} }
h1, h2, h3, h4, h5, h6, p { h1, h2, h3, h4, h5, h6, p {
@ -34,9 +40,13 @@ img {
} }
#header { #header {
padding: 10px 0 ; position: fixed;
z-index: 1000;
top: 0;
left: 0;
background-color: #444; background-color: #444;
width: 100%; width: 100%;
padding: 10px;
text-align: center; text-align: center;
} }
@ -46,84 +56,66 @@ img {
} }
#container { #container {
min-height: 100%; position: absolute;
height: auto !important; width: 100%;
height: 100%;
width: 1100px;
padding: 20px;
margin: 0 auto; margin: 0 auto;
background-color: #fff; background-color: #fff;
border-radius: 10px; overflow: hidden;
} }
#container .section { #editor-wrapper {
margin-bottom: 20px; border-right: 10px solid #eee;
} }
#content .mode { #preview-wrapper {
border: 1px solid #ddd; padding-left: 10px;
border-radius: 3px;
width: 535px;
display: inline-block;
vertical-align: top;
} }
#content .mode .content { .column {
padding: 10px;
}
#preview {
margin-left: 20px;
}
#leftColumn {
float: left;
width: 700px;
}
#rightColumn {
width: 240px;
float: right;
}
textarea#markdown {
padding: 0; padding: 0;
margin: 0; margin: 0;
width: 100%; white-space: nowrap;
height: 400px; display: inline-block;
overflow: auto; width: 50%;
font-size: 15px; vertical-align: top;
border: none; overflow-y: scroll;
/* border: 2px solid #D1D1BC;*/
resize: vertical;
outline: none;
} }
#editor {
width: 100%;
}
#footer { #footer {
clear: both; padding: 5px;
z-index: 1001;
position: absolute;
bottom: 0;
left: 0;
width: 100%; width: 100%;
padding: 10px;
background-color: #444; background-color: #444;
color: #fff; color: #fff;
text-align: center; text-align: center;
display: flex;
justify-content: center;
align-items: center;
} }
#footer #copyright { #footer #copyright {
font-size: 12px;
color: #999; color: #999;
} }
#copyright img {
width: 16px;
display: block;
padding: 0;
margin: 0;
}
#footer #copyright a { #footer #copyright a {
font-size: 12px; display: block;
padding: 0;
margin: 0;
font-size:0;
color: #999; color: #999;
} }
#footer #copyright a:hover { #footer #copyright a:hover {
color: #fff; color: #fff;
text-decoration: underline; text-decoration: none;
} }

View File

@ -27,12 +27,10 @@
</div> </div>
<div id="container"> <div id="container">
<div id="content" class="section">
<div id="edit" class="mode"> <div id="edit" class="column">
<div class="content"> <div id="editor-wrapper">
<div id="editor"># Markdown syntax guide
<div id="editor"># Markdown syntax guide
## Headers ## Headers
@ -56,16 +54,16 @@ _You **can** combine them_
* Item 1 * Item 1
* Item 2 * Item 2
* Item 2a * Item 2a
* Item 2b * Item 2b
### Ordered ### Ordered
1. Item 1 1. Item 1
1. Item 2 1. Item 2
1. Item 3 1. Item 3
1. Item 3a 1. Item 3a
1. Item 3b 1. Item 3b
## Images ## Images
@ -99,14 +97,12 @@ alert(message);
## Inline code ## Inline code
This web site is using `markedjs/marked`.</div> This web site is using `markedjs/marked`.</div>
</div>
</div> </div>
</div><!-- Do not insert new line here --><div id="preview" class="column">
<div id="preview" class="mode"> <div id="preview-wrapper">
<div id="output" class="content markdown-body"> <div id="output" class="content markdown-body">
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,20 +1,35 @@
$(function() { $(function() {
var isEdited = false; let isEdited = false;
let adjustScreen = () => {
let screenHeight = $(window).height();
let headerHeight = $('#header').outerHeight();
let footerHeight = $('#footer').outerHeight();
let containerHeight = screenHeight - headerHeight - footerHeight;
$('#container').css({ top: `${headerHeight}px` });
$('.column').css({ height: `${containerHeight}px`});
};
$(window).resize(() => {
adjustScreen();
});
// Setup editor // Setup editor
var editor = ace.edit('editor'); let editor = ace.edit('editor');
editor.getSession().setUseWrapMode(true); editor.getSession().setUseWrapMode(true);
editor.renderer.setScrollMargin(10, 10, 10, 10);
editor.setOptions({ editor.setOptions({
maxLines: Infinity, maxLines: Infinity,
indentedSoftWrap: false, indentedSoftWrap: false,
fontSize: 14, fontSize: 14,
autoScrollEditorIntoView: true,
theme: 'ace/theme/github', theme: 'ace/theme/github',
// TODO consider some options // TODO consider some options
}); });
editor.on('change', () => { editor.on('change', () => {
isEdited = true; isEdited = true;
convert(); convert();
adjustScreen();
}); });
let convert = () => { let convert = () => {
@ -31,4 +46,5 @@ $(function() {
}); });
convert(); convert();
adjustScreen();
}); });