-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented setting button to enable the following functions: 1. Set editor theme 2. Adjust editor font size 3. Modify output font size 4. Define editor key bindings Also chagne the backgroud color of help dropdown menu.
- Loading branch information
1 parent
dad6b42
commit abfed2c
Showing
6 changed files
with
244 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.modal { | ||
display: none; /* Hidden by default */ | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
z-index: 100; | ||
background-color: rgba(0, 0, 0, 0.4); | ||
width: 100%; | ||
height: 100%; | ||
overflow: auto; | ||
} | ||
|
||
/* Modal Content/Box */ | ||
.modal-content { | ||
position: relative; | ||
margin: 10% auto; | ||
border: 1px solid #888; | ||
border-radius: 5px; | ||
background-color: #fefefe; | ||
width: 50%; | ||
} | ||
|
||
#modal-setting-header { | ||
margin-bottom: 20px; | ||
background-color: rgb(241, 241, 241); | ||
padding: 16px 20px; | ||
} | ||
|
||
#modal-setting-header > p { | ||
font-weight: 600; | ||
font-size: 30px; | ||
font-family: 'Roboto', sans-serif; | ||
} | ||
|
||
.close { | ||
position: absolute; | ||
top: 10px; | ||
right: 10px; | ||
cursor: pointer; | ||
padding: 8px; | ||
font-size: 25px; | ||
} | ||
|
||
.modal-one-content { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
padding: 11px 28px; | ||
} | ||
|
||
.modal-one-content > p, | ||
.modal-one-content > select { | ||
margin-left: 10px; | ||
font-weight: 400; | ||
font-size: 17px; | ||
font-family: 'Roboto', sans-serif; | ||
} | ||
|
||
.modal-one-content:first-child { | ||
background-color: red; | ||
} | ||
|
||
.modal-one-content:last-child { | ||
margin-bottom: 30px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { generateHtml } from './editor.js' | ||
const modal = document.getElementById('setting-modal') | ||
const editor = ace.edit('editor') /* global ace */ | ||
|
||
export function openSettingModal(event) { | ||
event.preventDefault() | ||
|
||
modal.style.display = 'block' | ||
|
||
// Close the modal when clicking outside of it | ||
window.onclick = function (event) { | ||
if (event.target === modal) { | ||
modal.style.display = 'none' | ||
} | ||
} | ||
} | ||
|
||
export function closeSetting() { | ||
modal.style.display = 'none' | ||
} | ||
|
||
export function themeSelect(event) { | ||
const themeSelect = document.getElementById('theme-select') | ||
const selectedValue = themeSelect.value | ||
|
||
editor.setTheme('ace/theme/' + selectedValue) | ||
} | ||
|
||
export function editorFontSizeSelect(event) { | ||
const themeSelect = document.getElementById('editor-font-size-select') | ||
const selectedValue = themeSelect.value | ||
|
||
editor.setOptions({ fontSize: selectedValue }) | ||
} | ||
|
||
export function outputFontSizeSelect(event) { | ||
const themeSelect = document.getElementById('output-font-size-select') | ||
const selectedValue = themeSelect.value | ||
|
||
window.outputFontSize = 'html {font-size: calc(' + selectedValue + ');}' | ||
|
||
generateHtml() | ||
} | ||
|
||
export function fontSizeSelect(event) { | ||
const themeSelect = document.getElementById('editor-font-size-select') | ||
const selectedValue = themeSelect.value | ||
|
||
editor.setOptions({ fontSize: selectedValue }) | ||
} | ||
|
||
export function editorInputSelect(event) { | ||
const themeSelect = document.getElementById('editor-input-select') | ||
const selectedEditorInput = themeSelect.value | ||
|
||
editor.setKeyboardHandler('ace/keyboard/' + selectedEditorInput) | ||
} |