diff --git a/src/main/kotlin/kr/lunaticbum/back/lun/model/Post.kt b/src/main/kotlin/kr/lunaticbum/back/lun/model/Post.kt index 59fc720..41a8d1e 100644 --- a/src/main/kotlin/kr/lunaticbum/back/lun/model/Post.kt +++ b/src/main/kotlin/kr/lunaticbum/back/lun/model/Post.kt @@ -96,8 +96,8 @@ class CommentService(private val commentRepository: CommentRepository) { interface PostRepository : ReactiveMongoRepository { fun findAllByModifyTime(time : Long? = 0): Flux fun findAllByPostingTrue(pageable: Pageable): Flux - fun findTop10ByOrderByReadCountDesc(): Flux - fun findTop10ByOrderByModifyTimeDesc(): Flux + fun findTop5ByOrderByReadCountDesc(): Flux + fun findTop5ByOrderByModifyTimeDesc(): Flux } @@ -124,15 +124,23 @@ class PostManager( return postRepository.findAllByPostingTrue(pageable).takeLast(20).buffer(20).blockLast(Duration.ofSeconds(30)) ?: listOf() } fun getTop10Posts(): Flux { - return postRepository.findTop10ByOrderByReadCountDesc().map { p -> + return postRepository.findTop5ByOrderByReadCountDesc().map { p -> p.title = URLDecoder.decode(p.title) + if (p.title?.isEmpty() == true) { + p.title = "무제(無題)" + } + println(p.title) p } } fun getRecent10Posts(): Flux { - return postRepository.findTop10ByOrderByModifyTimeDesc().map { p -> + return postRepository.findTop5ByOrderByModifyTimeDesc().map { p -> p.title = URLDecoder.decode(p.title) + if (p.title?.isEmpty() == true) { + p.title = "무제(無題)" + } + println(p.title) p } diff --git a/src/main/resources/static/css/blog.css b/src/main/resources/static/css/blog.css index 221b63b..77645fe 100644 --- a/src/main/resources/static/css/blog.css +++ b/src/main/resources/static/css/blog.css @@ -40,13 +40,18 @@ align-content: center; top: 0; bottom: 0; - color: white; + color: black; /*background: #40404564;*/ position: relative; - border: 1px solid #393b42; + border: 1px solid #ccc; height: var(--ButtonHeight); border-radius: 10px; - background: #00000044; + background: #fafbfc; +} + +#location_field { + line-height: initial; + height: initial; } /*#title_field {*/ /*font-size: 20px;*/ @@ -164,3 +169,65 @@ a.btn_layerClose:hover { /* border-radius: 10px;*/ /* background: #00000044;*/ /*}*/ + +.ql-font-sans-serif { font-family: Arial, Helvetica, sans-serif; } +.ql-font-serif { font-family: Georgia, serif; } +.ql-font-monospace { font-family: "Courier New", monospace; } +.ql-font-arial { font-family: Arial, sans-serif; } +.ql-font-georgia { font-family: Georgia, serif; } +.ql-font-comic-sans-ms { font-family: "Comic Sans MS", cursive, sans-serif; } +.ql-font-courier-new { font-family: "Courier New", Courier, monospace; } +.ql-font-roboto { + font-family: 'Roboto', sans-serif; +} +.ql-font-playfair-display { + font-family: 'Playfair Display', serif; +} + + +/* Quill 툴바 기본 정렬 및 스타일 통합 */ +.ql-toolbar.ql-snow { + display: flex; + flex-wrap: wrap; /* 툴바 요소가 넘칠 경우 줄바꿈 */ + align-items: center; + gap: 8px; /* 아이콘과 버튼 간 간격 */ + padding: 8px 12px; + border-radius: 10px 10px 0 0; + background: #fafbfc; +} + +#editor.ql-container.ql-snow { + display: flex; + flex-wrap: wrap; /* 툴바 요소가 넘칠 경우 줄바꿈 */ + align-items: center; + gap: 8px; /* 아이콘과 버튼 간 간격 */ + padding: 8px 12px; + border-radius: 10px 10px 10px 10px; + background: #fafbfc; +} + +/* 툴바 내 각 툴 그룹 사이 구분선 및 여백 */ +.ql-toolbar.ql-snow > span.ql-formats:not(:last-child) { + border-right: 1px solid #ddd; + margin-right: 18px; + padding-right: 10px; +} + +/* 폰트 선택기 및 드롭다운 스타일 */ +.ql-toolbar .ql-picker-label, +.ql-toolbar .ql-picker { + min-width: 2em; + height: 2.2em; + display: flex; + align-items: center; +} + +/* 툴바 버튼 스타일 */ +.ql-toolbar button { + min-width: 32px; + height: 32px; + margin: 0 2px; + display: flex; + align-items: center; + justify-content: center; +} diff --git a/src/main/resources/static/js/common.js b/src/main/resources/static/js/common.js index 090f081..b2a6c0a 100644 --- a/src/main/resources/static/js/common.js +++ b/src/main/resources/static/js/common.js @@ -25,7 +25,7 @@ document.addEventListener('DOMContentLoaded', function() { const a = document.createElement('a'); a.id = item.id; a.href = `${getMainPath()}/blog/viewer/${item.id}`; - a.textContent = `${item.title}[${year}/${month}/${day}]` + a.innerHTML = `${item.title}
[${year}/${month}/${day}]` li.appendChild(a); ul.appendChild(li); }); @@ -56,7 +56,7 @@ document.addEventListener('DOMContentLoaded', function() { const a = document.createElement('a'); a.id = item.id; a.href = `${getMainPath()}/blog/viewer/${item.id}`; - a.textContent = `${item.title}[${year}/${month}/${day}]` + a.innerHTML = `${item.title}
[${year}/${month}/${day}]` li.appendChild(a); ul.appendChild(li); }); @@ -393,16 +393,8 @@ function openLoginPopup(formType) { function closePopup() { document.getElementById('overlay').style.display = 'none'; } -// -// function submitForm(formType) { -// alert(formType === 'login' ? '로그인 시도' : '회원가입 시도'); -// closePopup(); -// } - function submitLoginForm() { - // const id = document.getElementById('loginId').value; - // const password = document.getElementById('loginPassword').value; let user_id = document.getElementById('loginId') let user_pw = document.getElementById('loginPassword') let rememberMe = document.getElementById('rememberMe') @@ -427,26 +419,16 @@ function submitLoginForm() { } } }) +} - // AJAX 요청 - // fetch('/login', { - // method: 'POST', - // headers: { - // 'Content-Type': 'application/json', - // }, - // body: JSON.stringify({ id, password }), - // }) - // .then(response => response.json()) - // .then(data => { - // if (data.success) { - // alert('로그인 성공!'); - // // 로그인 성공 후 처리 (예: 페이지 리다이렉트) - // } else { - // alert('로그인 실패: ' + data.message); - // } - // }) - // .catch(error => { - // console.error('Error:', error); - // alert('로그인 중 오류가 발생했습니다.'); - // }); +function isDelta(content) { + try { + // Delta는 JSON이면서 'ops'라는 키를 포함 + if (typeof content === "string") { + content = JSON.parse(content); + } + return typeof content === "object" && content.ops !== undefined; + } catch (e) { + return false; // JSON 파싱 실패하면 마크업(HTML)으로 간주 + } } \ No newline at end of file diff --git a/src/main/resources/templates/content/blog/viewer.html b/src/main/resources/templates/content/blog/viewer.html index 1122f8f..018c763 100644 --- a/src/main/resources/templates/content/blog/viewer.html +++ b/src/main/resources/templates/content/blog/viewer.html @@ -6,34 +6,80 @@ layout:decorate="~{layout/default_layout}" > - - + + + + + + + + + + + + + + @@ -62,7 +108,7 @@
- +

diff --git a/src/main/resources/templates/content/blog/write.html b/src/main/resources/templates/content/blog/write.html index cdebbf7..d498c11 100644 --- a/src/main/resources/templates/content/blog/write.html +++ b/src/main/resources/templates/content/blog/write.html @@ -6,119 +6,95 @@ layout:decorate="~{layout/default_layout}" > - - - - - + + + + + + + + +
- -

권한이 없는 뎁쇼?!

-
- -
- +
+
+
+
+ +

권한이 없는 뎁쇼?!

+
+ +
+ +
+
+
+
+
+
+
+ +
+

+
+
+
-
-
- -
-
-
-
- -
-

- +