This commit is contained in:
lunaticbum
2024-11-07 14:01:21 +09:00
parent 075e5b50c8
commit a02349f7a1
5 changed files with 40 additions and 34 deletions
@@ -14,12 +14,16 @@
let onChange = () => {console.log(editor.getMarkdown())}
document.addEventListener("DOMContentLoaded", onLoaded);
function onLoaded() {
baseData.title = urldecode([[${srcPost.title}]]);
baseData.content = urldecode([[${srcPost.content}]]);
var h = document.querySelector('#main_layer').getBoundingClientRect().height + 'px'
baseData.title = [[${srcPost.title}]];
baseData.content = [[${srcPost.content}]];
baseData.firstPostLon = [[${srcPost.firstPostLon}]];
baseData.firstPostLat = [[${srcPost.firstPostLat}]];
document.getElementById('location_field').textContent = "Lat: " + baseData.firstPostLat + ", Lon: " + baseData.firstPostLon;
$('#title_layer').text(baseData.title)
var h = document.querySelector('#main_layer').getBoundingClientRect().height * 0.7
editor = new toastui.Editor({
el: document.querySelector('#editor'),
height: '500px',
height: h+ 'px',
width:'100%',
viewer: true,
usageStatistics : false,
@@ -27,21 +31,18 @@
theme:"dark",
});
}
function save() {
console.log(editor.getHTML())
}
</script>
</th:block>
<th:block layout:fragment="content" id="content">
<div id="main_layer">
<input id="title_layer" />
<label id="title_layer" class="write_option" ></label>
<div id="editor" ></div>
<div id="hashtag_layer">
<select > </select>
<input id="hashtag" />
</div>
<div id="controll_layer" >
<button onclick="save()">asdsad</button>
<div class="write_controllbox">
<div class="write_option btn-example" to="#popLayer1" onclick="openPopup(this)" ></div>
<div style="width: 15px" ></div>
<div class="write_option btn-example" to="#popLayer2" onclick="openPopup(this)" id="hashtag_field"></div>
<div style="width: 15px" ></div>
<label class="write_option" readonly id="location_field"></label>
</div>
</div>
</th:block>
@@ -30,11 +30,7 @@
console.log(style.getPropertyValue('--FooterHeight'))
console.log(style.getPropertyValue('--TopHeight'))
var editorHeght = (
document.querySelector('#main_layer').getBoundingClientRect().height -
(
Number(style.getPropertyValue('--ButtonHegit').replace("px","") * 3)
+ Number(style.getPropertyValue('--TopHeight').replace("px",""))
)
document.querySelector('#main_layer').getBoundingClientRect().height * 0.7
)
editor = new toastui.Editor({
@@ -115,8 +111,10 @@
<div class="write_controllbox">
<div class="write_option btn-example" to="#popLayer1" onclick="openPopup(this)" ></div>
<div style="width: 15px" ></div>
<div class="write_option btn-example" to="#popLayer2" onclick="openPopup(this)" id="hashtag_field"></div>
<label for="location_field"></label><input class="write_option" readonly id="location_field"/>
<div style="width: 15px" ></div>
<label class="write_option" readonly id="location_field"></label>
</div>
<h1><button id="save" class="write_option" style="width: 100%; position: relative" onclick="save()">저장하셈</button></h1>
</th:block>