94 lines
3.7 KiB
HTML
Raw Normal View History

2024-10-07 18:47:23 +09:00
<!DOCTYPE html>
2024-10-10 17:37:22 +09:00
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout/default_layout}"
>
<head>
2024-10-07 18:47:23 +09:00
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>
2024-10-10 17:37:22 +09:00
<script type="text/javascript" th:src="@{/js/toast-ui.js}"></script>
<link th:href="@{/css/toast-ui.css}" rel="stylesheet" />
<link th:href="@{/css/toast-ui-dark.css}" rel="stylesheet" />
<!-- <link rel="stylesheet" href="https://uicdn.toast.com/editor/latest/toastui-editor-dark.css" />-->
2024-10-07 18:47:23 +09:00
<script th:inline="javascript">
2024-10-08 14:43:49 +09:00
let editor
2024-10-10 17:37:22 +09:00
let onChange = () => {console.log(editor.getMarkdown())}
document.addEventListener("DOMContentLoaded", onLoaded);
2024-10-07 18:47:23 +09:00
function onLoaded() {
2024-10-08 14:43:49 +09:00
var h = document.querySelector('#content').getBoundingClientRect().height + 'px'
editor = new toastui.Editor({
2024-10-07 18:47:23 +09:00
el: document.querySelector('#editor'),
2024-10-08 14:43:49 +09:00
previewStyle: 'tab',
2024-10-07 18:47:23 +09:00
height: '500px',
2024-10-08 14:43:49 +09:00
width:'100%',
theme:'dark',
2024-10-07 18:47:23 +09:00
usageStatistics : false,
2024-10-08 14:43:49 +09:00
toolbar:null,
initialValue:
"# 제목 " +"\n" +
"평문 사이에 **볼드체** *이탤릭체*"+"\n" +
"~~어디쓰지~~"+"\n" +
"***"+"\n" +
"### 모라모라 " +"\n" +
"> 으흐흠..." +"\n" +
"* 쓸까?" +"\n" +
"1. 첫번째" +"\n" +
"* [x] 체크하자" +"\n" +
"* [ ] 체크하자" +"\n" +
" \|dd\|cc\|ff\|\n" +
" \|\-\-\-\|\-\-\-\|\-\-\-\|\n" +
" \|aa\|s\|s\|" +"\n" +
"[링크다](https://youtube.com)" +"\n" +
"`var test = 'real test'`" +"\n" +
"```\n" +
"let test= = 'real test'\n" +
"```"
,
2024-10-10 17:37:22 +09:00
theme:"dark",
2024-10-08 14:43:49 +09:00
initialEditType:"wysiwyg",
2024-10-07 18:47:23 +09:00
hooks: {
addImageBlobHook: (blob, callback) => {
const formData = new FormData();
formData.append('file', blob);
2024-10-10 17:37:22 +09:00
let url = 'post/images/';
2024-10-07 18:47:23 +09:00
$.ajax({
type: 'POST',
enctype: 'multipart/form-data',
2024-10-10 17:37:22 +09:00
url: 'post/imageUpload',
2024-10-07 18:47:23 +09:00
data: formData,
dataType: 'json',
processData: false,
contentType: false,
cache: false,
timeout: 600000,
success: function (data) {
url += data.fileName;
callback(url, '사진 대체 텍스트 입력');
},
error: function (e) {
callback('image_load_fail', '사진 대체 텍스트 입력');
}
});
}
}
});
}
2024-10-08 14:43:49 +09:00
function save() {
2024-10-10 17:37:22 +09:00
console.log(editor.getHTML())
2024-10-08 14:43:49 +09:00
}
2024-10-07 18:47:23 +09:00
</script>
2024-10-10 17:37:22 +09:00
</head>
<div layout:fragment="content" id="content">
<input id="title_layer" />
<div id="editor" ></div>
2024-10-08 14:43:49 +09:00
<div id="hashtag_layer">
2024-10-10 17:37:22 +09:00
<select > </select>
<input id="hashtag" />
2024-10-08 14:43:49 +09:00
</div>
2024-10-10 17:37:22 +09:00
<div id="controll_layer" >
2024-10-08 14:43:49 +09:00
<button onclick="save()">asdsad</button>
2024-10-07 18:47:23 +09:00
</div>
2024-10-08 14:43:49 +09:00
</div>
2024-10-10 17:37:22 +09:00
</html>