diff --git a/app/src/main/resources/static/assets/js/app.mjs b/app/src/main/resources/static/assets/js/app.mjs index 08a4d85..55409e1 100644 --- a/app/src/main/resources/static/assets/js/app.mjs +++ b/app/src/main/resources/static/assets/js/app.mjs @@ -1 +1 @@ -const t=window.location.pathname;document.addEventListener("DOMContentLoaded",(function(){var t=document.title;t=t.split("-",1),document.getElementById("page-title").innerText=t,"๋ถ„๋ฆฌใ……ใ„ฑ"==t&&(document.getElementById("navbar-mobile-arrow").style.display="none",document.getElementById("page-title").innerText="๐Ÿชด")})),document.body.addEventListener("htmx:configRequest",(function(t){if(t.detail.headers.accept="text/html-partial","get"!==t.detail.verb){const e=document.querySelector("meta[name='_csrf_header']").getAttribute("content");t.detail.headers[e]=document.querySelector("meta[name='_csrf']").getAttribute("content")}})),("/"===t||t.startsWith("/dictionary"))&&import("./dictionary/algolia.mjs").then((t=>{t.init()})),t.startsWith("/community/")&&(import("./community/editorjs.umd.min.js").then((()=>{import("./community/editor.mjs").then((t=>{t.init()}))})),import("./community/jquery.timeago.min.js").then((()=>{import("./community/time-ago.mjs").then((t=>{t.init()}))}))),t.startsWith("/community/write")&&import("./community/post-color-changer.mjs").then((t=>{t.init()})); \ No newline at end of file +const t=window.location.pathname;if(document.addEventListener("DOMContentLoaded",(function(){var t=document.title;t=t.split("-",1),document.getElementById("page-title").innerText=t,"๋ถ„๋ฆฌใ……ใ„ฑ"==t&&(document.getElementById("navbar-mobile-arrow").style.display="none",document.getElementById("page-title").innerText="๐Ÿชด")})),document.body.addEventListener("htmx:configRequest",(function(t){if(t.detail.headers.accept="text/html-partial","get"!==t.detail.verb){const e=document.querySelector("meta[name='_csrf_header']").getAttribute("content");t.detail.headers[e]=document.querySelector("meta[name='_csrf']").getAttribute("content")}})),("/"===t||t.startsWith("/dictionary"))&&import("./dictionary/algolia.mjs").then((t=>{t.init()})),t.startsWith("/community/")){let e=!t.endsWith("write");import("./community/editorjs.umd.min.js").then((()=>{import("./community/editor.mjs").then((t=>{t.init(e)}))})),import("./community/jquery.timeago.min.js").then((()=>{import("./community/time-ago.mjs").then((t=>{t.init()}))}))}t.startsWith("/community/write")&&import("./community/post-color-changer.mjs").then((t=>{t.init()})); \ No newline at end of file diff --git a/app/src/main/resources/static/assets/js/community/editor.mjs b/app/src/main/resources/static/assets/js/community/editor.mjs index b792c8e..79c05ff 100644 --- a/app/src/main/resources/static/assets/js/community/editor.mjs +++ b/app/src/main/resources/static/assets/js/community/editor.mjs @@ -1 +1 @@ -import e from"https://cdn.jsdelivr.net/npm/@editorjs/attaches/+esm";import t from"https://cdn.jsdelivr.net/npm/@editorjs/checklist/+esm";import n from"https://cdn.jsdelivr.net/npm/@editorjs/code/+esm";import o from"https://cdn.jsdelivr.net/npm/@editorjs/delimiter/+esm";import r from"https://cdn.jsdelivr.net/npm/@editorjs/embed/+esm";import i from"https://cdn.jsdelivr.net/npm/@editorjs/header/+esm";import d from"https://cdn.jsdelivr.net/npm/@editorjs/image/+esm";import s from"https://cdn.jsdelivr.net/npm/@editorjs/inline-code/+esm";import l from"https://cdn.jsdelivr.net/npm/@editorjs/link/+esm";import a from"https://cdn.jsdelivr.net/npm/@editorjs/list/+esm";import c from"https://cdn.jsdelivr.net/npm/@editorjs/marker/+esm";import m from"https://cdn.jsdelivr.net/npm/@editorjs/quote/+esm";import p from"https://cdn.jsdelivr.net/npm/@editorjs/raw/+esm";import u from"https://cdn.jsdelivr.net/npm/@editorjs/table/+esm";import h from"https://cdn.jsdelivr.net/npm/@editorjs/warning/+esm";export function init(){document.addEventListener("htmx:afterSwap",(function(){let f=document.getElementById("form").getAttribute("data-content"),g="true"===document.getElementById("form").getAttribute("data-edit"),v=(document.querySelector("meta[name='_csrf_header']").getAttribute("content"),document.querySelector("meta[name='_csrf']").getAttribute("content")),j=new EditorJS({holder:"editorjs",readOnly:g,tools:{checklist:{class:t,inlineToolbar:!0},code:{class:n,shortcut:"CMD+SHIFT+D"},delimiter:o,embed:r,header:{class:i,inlineToolbar:["link"],config:{placeholder:"Header"},shortcut:"CMD+SHIFT+H"},image:{class:d,config:{field:"file",additionalRequestHeaders:{"X-XSRF-TOKEN":v},endpoints:{byFile:"/api/editor/upload/file",byUrl:"/api/editor/upload/url"}}},attaches:{class:e,config:{field:"file",additionalRequestHeaders:{"X-XSRF-TOKEN":v},endpoint:"/api/editor/upload/file"}},inlineCode:{class:s,shortcut:"CMD+SHIFT+M"},linkTool:{class:l,additionalRequestHeaders:{"X-XSRF-TOKEN":v},config:{endpoint:"/api/editor/link-preview"}},list:{class:a,inlineToolbar:!0},marker:{class:c,shortcut:"CMD+SHIFT+M"},quote:{class:m,inlineToolbar:!0},raw:p,table:{class:u,inlineToolbar:!0},warning:h},onReady:function(){var e=JSON.parse(f);null!=e?j.render(e):(f=function(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o{document.getElementById("editorjs-content").value=JSON.stringify(e,null,0)})).catch((e=>{console.error("Saving error",e)}))}))}))} \ No newline at end of file +import e from"https://cdn.jsdelivr.net/npm/@editorjs/attaches/+esm";import t from"https://cdn.jsdelivr.net/npm/@editorjs/checklist/+esm";import n from"https://cdn.jsdelivr.net/npm/@editorjs/code/+esm";import o from"https://cdn.jsdelivr.net/npm/@editorjs/delimiter/+esm";import r from"https://cdn.jsdelivr.net/npm/@editorjs/embed/+esm";import i from"https://cdn.jsdelivr.net/npm/@editorjs/header/+esm";import d from"https://cdn.jsdelivr.net/npm/@editorjs/image/+esm";import l from"https://cdn.jsdelivr.net/npm/@editorjs/inline-code/+esm";import s from"https://cdn.jsdelivr.net/npm/@editorjs/link/+esm";import a from"https://cdn.jsdelivr.net/npm/@editorjs/list/+esm";import m from"https://cdn.jsdelivr.net/npm/@editorjs/marker/+esm";import c from"https://cdn.jsdelivr.net/npm/@editorjs/quote/+esm";import p from"https://cdn.jsdelivr.net/npm/@editorjs/raw/+esm";import u from"https://cdn.jsdelivr.net/npm/@editorjs/table/+esm";import h from"https://cdn.jsdelivr.net/npm/@editorjs/warning/+esm";export function init(e){let t=document.querySelector("meta[name='_csrf']").getAttribute("content"),n=setInterval((function(){document.getElementById("editorjs")&&(f(e,t),document.addEventListener("htmx:afterSwap",(function(){f(e,t)})),clearInterval(n))}),10)}function f(f,g){let v=new EditorJS({holder:"editorjs",readOnly:f,tools:{checklist:{class:t,inlineToolbar:!0},code:{class:n,shortcut:"CMD+SHIFT+D"},delimiter:o,embed:r,header:{class:i,inlineToolbar:["link"],config:{placeholder:"Header"},shortcut:"CMD+SHIFT+H"},image:{class:d,config:{field:"file",additionalRequestHeaders:{"X-XSRF-TOKEN":g},endpoints:{byFile:"/api/editor/upload/file",byUrl:"/api/editor/upload/url"}}},attaches:{class:e,config:{field:"file",additionalRequestHeaders:{"X-XSRF-TOKEN":g},endpoint:"/api/editor/upload/file"}},inlineCode:{class:l,shortcut:"CMD+SHIFT+M"},linkTool:{class:s,additionalRequestHeaders:{"X-XSRF-TOKEN":g},config:{endpoint:"/api/editor/link-preview"}},list:{class:a,inlineToolbar:!0},marker:{class:m,shortcut:"CMD+SHIFT+M"},quote:{class:c,inlineToolbar:!0},raw:p,table:{class:u,inlineToolbar:!0},warning:h},onReady:function(){let e=document.getElementById("form").getAttribute("data-content"),t=JSON.parse(e);null!=t?v.render(t):null!=e&&(t=JSON.parse(e),v.render(t))},onChange:function(){1!=f&&v.save().then((function(e){})).catch((function(e){console.error("Saving error",e)}))},rendered:function(){},i18n:{messages:{ui:{blockTunes:{toggler:{"Click to tune":"์˜ต์…˜ ํ™•์žฅ","or drag to move":"๋˜๋Š” ๋“œ๋ž˜๊ทธํ•˜์—ฌ ์ด๋™"}},inlineToolbar:{converter:{"Convert to":"๋ณ€ํ™˜ํ•˜๊ธฐ"}},toolbar:{toolbox:{Add:"์ถ”๊ฐ€"}},popover:{Filter:"ํ•„ํ„ฐ","Nothing found":"์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"}},toolNames:{Text:"ํ…์ŠคํŠธ",Heading:"์ œ๋ชฉ",List:"๋ฆฌ์ŠคํŠธ",Warning:"๊ฒฝ๊ณ ",Checklist:"์ฒดํฌ๋ฆฌ์ŠคํŠธ",Quote:"์ธ์šฉ๋ฌธ",Code:"์ฝ”๋“œ",Delimiter:"๊ตฌ๋ถ„์„ ","Raw HTML":"HTML",Table:"ํ…Œ์ด๋ธ”",Link:"๋งํฌ",Marker:"๋งˆ์ปค",Bold:"๊ตต๊ฒŒ",Italic:"๊ธฐ์šธ์ž„",InlineCode:"์ธ๋ผ์ธ ์ฝ”๋“œ",Image:"์ด๋ฏธ์ง€",Attachment:"์ฒจ๋ถ€"},tools:{warning:{Title:"์ œ๋ชฉ",Message:"๋ฉ”์‹œ์ง€"},link:{"Add a link":"๋งํฌ ์ถ”๊ฐ€"},stub:{"The block can not be displayed correctly.":"๋ธ”๋ก์„ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ํ‘œ์‹œํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."},image:{Caption:"์บก์…˜","Select an Image":"์ด๋ฏธ์ง€ ์„ ํƒ","With border":"ํ…Œ๋‘๋ฆฌ ์ถ”๊ฐ€","Stretch image":"์ด๋ฏธ์ง€ ํ™•์žฅ","With background":"๋ฐฐ๊ฒฝ ์ถ”๊ฐ€"},code:{"Enter a code":"์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”"},linkTool:{Link:"๋งํฌ","Couldn't fetch the link data":"๋งํฌ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค","Couldn't get this link data, try the other one":"์ด ๋งํฌ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ๋งํฌ๋ฅผ ์‹œ๋„ํ•˜์„ธ์š”","Wrong response format from the server":"์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ์ž˜๋ชป๋œ ์‘๋‹ต ํ˜•์‹"},header:{Header:"ํ—ค๋”ฉ"},paragraph:{"Enter something":"๋‚ด์šฉ์„ ์ž…๋ ฅํ•˜์„ธ์š”"},list:{Ordered:"๋ฒˆํ˜ธ",Unordered:"๊ธ€๋จธ๋ฆฌ"},quote:{"Enter a quote":"์ธ์šฉ์ ˆ ์ž…๋ ฅ","Enter a caption":"์บก์…˜ ์ž…๋ ฅ"},attachment:{"File upload failed":"ํŒŒ์ผ์„ ์˜ฌ๋ฆฌ์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค","Select file to upload":"ํŒŒ์ผ์„ ์„ ํƒํ•˜์—ฌ ์—…๋กœ๋“œ"},table:{"With headings":"ํ—ค๋”ฉ ์ถ”๊ฐ€","Without headings":"ํ—ค๋”ฉ ์‚ญ์ œ"}},blockTunes:{delete:{Delete:"์‚ญ์ œ","Click to delete":"ํด๋ฆญํ•˜์—ฌ ์‚ญ์ œ"},moveUp:{"Move up":"์œ„๋กœ ์ด๋™"},moveDown:{"Move down":"์•„๋ž˜๋กœ ์ด๋™"}}}}}),j=document.getElementById("save-button");return null!=j&&j.addEventListener("click",(function(){v.save().then((e=>{document.getElementById("editorjs-content").value=JSON.stringify(e,null,0)})).catch((e=>{console.error("Saving error",e)}))})),v} \ No newline at end of file diff --git a/app/src/main/resources/static/assets/js/community/post-color-changer.mjs b/app/src/main/resources/static/assets/js/community/post-color-changer.mjs index cec59a8..e689b70 100644 --- a/app/src/main/resources/static/assets/js/community/post-color-changer.mjs +++ b/app/src/main/resources/static/assets/js/community/post-color-changer.mjs @@ -1 +1 @@ -export function init(){let t=document.getElementById("post-color"),e=document.querySelector(".card");null!=t&&t.addEventListener("input",(function(){e.style.backgroundColor=this.value}))} \ No newline at end of file +export function init(){document.addEventListener("htmx:afterSwap",(function(){let t=document.getElementById("post-color"),e=document.querySelector(".card");null!=t&&t.addEventListener("input",(function(){e.style.backgroundColor=this.value}))}))} \ No newline at end of file diff --git a/app/src/main/resources/templates/base/header.html b/app/src/main/resources/templates/base/header.html index 01360ee..35dc09f 100644 --- a/app/src/main/resources/templates/base/header.html +++ b/app/src/main/resources/templates/base/header.html @@ -43,4 +43,4 @@ Auto - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/resources/templates/base/layout.html b/app/src/main/resources/templates/base/layout.html index 86d17b8..e605f34 100644 --- a/app/src/main/resources/templates/base/layout.html +++ b/app/src/main/resources/templates/base/layout.html @@ -5,4 +5,5 @@ -๋ถ„๋ฆฌใ……ใ„ฑ
\ No newline at end of file + +๋ถ„๋ฆฌใ……ใ„ฑ
\ No newline at end of file diff --git a/app/src/main/resources/templates/community/content.html b/app/src/main/resources/templates/community/content.html index 7d7e067..eb7a0c5 100644 --- a/app/src/main/resources/templates/community/content.html +++ b/app/src/main/resources/templates/community/content.html @@ -1,4 +1,4 @@ -๐Ÿ“‘ - ๋ถ„๋ฆฌใ……ใ„ฑ
+๐Ÿ“‘ - ๋ถ„๋ฆฌใ……ใ„ฑ
๋‹‰๋„ค์ž„ @@ -7,7 +7,7 @@ ์กฐํšŒ์ˆ˜ -์ข‹์•„์š”
\ No newline at end of file +
\ No newline at end of file diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/PostRender.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/PostRender.java index 1de2d62..8e30615 100644 --- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/PostRender.java +++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/PostRender.java @@ -17,6 +17,7 @@ import blisgo.usecase.request.post.RemovePost; import blisgo.usecase.request.post.UpdatePost; import java.util.Map; +import java.util.random.RandomGenerator; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; @@ -81,6 +82,9 @@ public ModelAndView post( model.addAttribute("post", mapper.toDTO(post)); } + model.addAttribute( + "color", "#%06x".formatted(RandomGenerator.getDefault().nextInt(0xffffff + 1))); + return new ModelAndView(routes(Folder.COMMUNITY, edit ? Page.WRITE : Page.CONTENT) + fragment(Fragment.POST)); } diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/view/CommunityView.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/view/CommunityView.java index 7b8f4be..9051742 100644 --- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/view/CommunityView.java +++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/view/CommunityView.java @@ -2,7 +2,6 @@ import blisgo.infrastructure.internal.ui.base.Router; import java.util.Map; -import java.util.random.RandomGenerator; import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; @@ -35,8 +34,6 @@ public ModelAndView write(@RequestParam(required = false) Long postId, Model mod model.addAttribute("postId", postId); } - return new ModelAndView( - routes(Folder.COMMUNITY, Page.WRITE), - Map.of("color", "#%06x".formatted(RandomGenerator.getDefault().nextInt(0xffffff + 1)))); + return new ModelAndView(routes(Folder.COMMUNITY, Page.WRITE)); } } diff --git "a/\353\266\204\353\246\254\343\205\205\343\204\261V4.bsdesign" "b/\353\266\204\353\246\254\343\205\205\343\204\261V4.bsdesign" index a9fc191..ad5ca4c 100644 Binary files "a/\353\266\204\353\246\254\343\205\205\343\204\261V4.bsdesign" and "b/\353\266\204\353\246\254\343\205\205\343\204\261V4.bsdesign" differ