Skip to content

Commit

Permalink
fix: handle front content load
Browse files Browse the repository at this point in the history
  • Loading branch information
laigasus committed May 9, 2024
1 parent f0bea4f commit c17a08e
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import e from"https://cdn.jsdelivr.net/npm/@editorjs/list/+esm";import t from"https://cdn.jsdelivr.net/npm/@editorjs/header/+esm";import n from"https://cdn.jsdelivr.net/npm/@editorjs/table/+esm";import o from"https://cdn.jsdelivr.net/npm/@editorjs/image/+esm";import r from"https://cdn.jsdelivr.net/npm/@editorjs/embed/+esm";import i from"https://cdn.jsdelivr.net/npm/@editorjs/code/+esm";import d from"https://cdn.jsdelivr.net/npm/@editorjs/quote/+esm";import s from"https://cdn.jsdelivr.net/npm/@editorjs/delimiter/+esm";import l from"https://cdn.jsdelivr.net/npm/@editorjs/warning/+esm";import a from"https://cdn.jsdelivr.net/npm/@editorjs/link/+esm";import c from"https://cdn.jsdelivr.net/npm/@editorjs/attaches/+esm";import m from"https://cdn.jsdelivr.net/npm/@editorjs/checklist/+esm";import p from"https://cdn.jsdelivr.net/npm/@editorjs/inline-code/+esm";import u from"https://cdn.jsdelivr.net/npm/@editorjs/marker/+esm";import h from"https://cdn.jsdelivr.net/npm/@editorjs/raw/+esm";export function init(){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:m,inlineToolbar:!0},code:{class:i,shortcut:"CMD+SHIFT+D"},delimiter:s,embed:r,header:{class:t,inlineToolbar:["link"],config:{placeholder:"Header"},shortcut:"CMD+SHIFT+H"},image:{class:o,config:{field:"file",additionalRequestHeaders:{"X-XSRF-TOKEN":v},endpoints:{byFile:"/api/editor/upload/file",byUrl:"/api/editor/upload/url"}}},attaches:{class:c,config:{field:"file",additionalRequestHeaders:{"X-XSRF-TOKEN":v},endpoint:"/api/editor/upload/file"}},inlineCode:{class:p,shortcut:"CMD+SHIFT+M"},linkTool:{class:a,additionalRequestHeaders:{"X-XSRF-TOKEN":v},config:{endpoint:"/api/editor/link-preview"}},list:{class:e,inlineToolbar:!0},marker:{class:u,shortcut:"CMD+SHIFT+M"},quote:{class:d,inlineToolbar:!0},raw:h,table:{class:n,inlineToolbar:!0},warning:l},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<n.length;o++){for(var r=n[o];" "==r.charAt(0);)r=r.substring(1,r.length);if(0==r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}return null}("editorjsContentBackup"),null!=f&&(e=JSON.parse(f),j.render(e)))},onChange:function(){j.save().then((function(e){!function(e,t,n){var o="";if(n){var r=new Date;r.setTime(r.getTime()+60*n*1e3),o="; expires="+r.toUTCString()}document.cookie=e+"="+encodeURIComponent(t||"")+o+"; path=/"}("editorjsContentBackup",JSON.stringify(e),1)})).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":"아래로 이동"}}}}}),b=document.getElementById("save-button");null!=b&&b.addEventListener("click",(function(){j.save().then((e=>{document.getElementById("editorjs-content").value=JSON.stringify(e,null,0)})).catch((e=>{console.error("Saving error",e)}))}))}
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<n.length;o++){for(var r=n[o];" "==r.charAt(0);)r=r.substring(1,r.length);if(0==r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}return null}("editorjsContentBackup"),null!=f&&(e=JSON.parse(f),j.render(e)))},onChange:function(){j.save().then((function(e){!function(e,t,n){var o="";if(n){var r=new Date;r.setTime(r.getTime()+60*n*1e3),o="; expires="+r.toUTCString()}document.cookie=e+"="+encodeURIComponent(t||"")+o+"; path=/"}("editorjsContentBackup",JSON.stringify(e),1)})).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":"아래로 이동"}}}}}),b=document.getElementById("save-button");null!=b&&b.addEventListener("click",(function(){j.save().then((e=>{document.getElementById("editorjs-content").value=JSON.stringify(e,null,0)})).catch((e=>{console.error("Saving error",e)}))}))}))}
6 changes: 3 additions & 3 deletions app/src/main/resources/templates/base/header.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html><html data-bs-theme="dark" lang="ko" xmlns:th="https://www.thymeleaf.org/" xmlns:sec="https://www.thymeleaf.org/extras/spring-security"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, shrink-to-fit=0, user-scalable=0, initial-scale=1"><title>분리ㅅㄱ</title><meta name="theme-color" content="#ffffff"><link rel="canonical" href="https://blisgo.org/templates/base/header.html"><meta property="og:url" content="https://blisgo.org/templates/base/header.html"><meta name="twitter:description" content="분리배출 도우미 사전"><meta name="twitter:image" content="https://blisgo.org/assets/img/favicon/512x512.png"><meta name="twitter:title" content="분리ㅅㄱ"><meta name="twitter:card" content="summary_large_image"><meta property="og:type" content="website"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta property="og:image" content="https://blisgo.org/assets/img/favicon/512x512.png"><meta name="description" content="분리배출 도우미">
<!DOCTYPE html><html data-bs-theme="light" lang="ko" xmlns:th="https://www.thymeleaf.org/" xmlns:sec="https://www.thymeleaf.org/extras/spring-security"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, shrink-to-fit=0, user-scalable=0, initial-scale=1"><title>분리ㅅㄱ</title><meta name="theme-color" content="#ffffff"><link rel="canonical" href="https://blisgo.org/templates/base/header.html"><meta property="og:url" content="https://blisgo.org/templates/base/header.html"><meta name="twitter:description" content="분리배출 도우미 사전"><meta name="twitter:image" content="https://blisgo.org/assets/img/favicon/512x512.png"><meta name="twitter:title" content="분리ㅅㄱ"><meta name="twitter:card" content="summary_large_image"><meta property="og:type" content="website"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta property="og:image" content="https://blisgo.org/assets/img/favicon/512x512.png"><meta name="description" content="분리배출 도우미">
<script type="application/ld+json">{"@context":"http://schema.org","@type":"WebSite","name":"분리ㅅㄱ","url":"https://blisgo.org"}</script><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="/assets/img/favicon/180x180.png"><link rel="icon" type="image/png" sizes="16x16" href="/assets/img/favicon/16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="/assets/img/favicon/32x32.png"><link rel="icon" type="image/png" sizes="180x180" href="/assets/img/favicon/180x180.png"><link rel="icon" type="image/png" sizes="192x192" href="/assets/img/favicon/192x192.png"><link rel="icon" type="image/png" sizes="512x512" href="/assets/img/favicon/512x512.png"><link rel="stylesheet" href="/assets/bootstrap/css/bootstrap.min.css"></head><body><header th:fragment="header"><nav class="navbar navbar-expand-lg fixed-top bg-body shadow-sm justify-content-between" id="transmenu"><div class="container"><a class="navbar-brand d-flex d-lg-none align-items-center logo" id="navbar-mobile-back" rel="prev" href="javascript:history.back();"><svg xmlns="https://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 16 16" class="bi bi-chevron-left me-2" id="navbar-mobile-arrow">
<path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"></path>
</svg><span id="page-title"></span></a><a class="navbar-brand d-none d-lg-inline logo" id="navbar-brand" th:href="@{~/}" rel="prev" th:text="#{base.header.logo}">분리ㅅㄱ</a><button data-bs-toggle="collapse" class="navbar-toggler collapsed mr-auto p-0" data-bs-target="#navbar-collapse" id="navbar-toggle"><span class="visually-hidden">Toggle navigation</span><span class="navbar-toggler-icon"></span></button><div class="collapse navbar-collapse" id="navbar-collapse"><ul class="navbar-nav ms-auto"><li class="nav-item"><div class="vstack gap-2 pt-2" sec:authorize="isAuthenticated()"><div class="row g-0 d-lg-none"><div class="col-auto"><a th:href="@{~/profile}"><div class="vstack position-relative"><img class="img-fluid border rounded border-0" id="accounticon-mobile-image" src="https://i.pravatar.cc/200" width="60px" alt="profile" th:src="${#authentication?.principal?.userInfo?.picture}"></div></a></div><div class="col align-self-center ps-2" th:href="@{~/profile}"><a class="text-decoration-none" th:href="@{~/profile}"><div class="vstack"><div><h6 class="d-inline" th:text="${#authentication?.principal?.userInfo?.nickName}">옥재욱</h6><h6 class="text-muted" th:text="${#authentication?.principal?.userInfo?.email}">[email protected]</h6></div></div></a></div><div class="col-auto d-flex align-items-center" sec:authorize="isAuthenticated()"><a class="btn text-decoration-none p-0" role="button" th:href="@{~/logout}"><svg xmlns="https://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 16 16" class="bi bi-box-arrow-right fs-4 text-muted">
</svg><small class="fs-6" id="page-title">&nbsp;</small></a><a class="navbar-brand d-none d-lg-inline logo" id="navbar-brand" th:href="@{~/}" rel="prev" th:text="#{base.header.logo}">분리ㅅㄱ</a><button data-bs-toggle="collapse" class="navbar-toggler collapsed mr-auto p-0" data-bs-target="#navbar-collapse" id="navbar-toggle"><span class="visually-hidden">Toggle navigation</span><span class="navbar-toggler-icon"></span></button><div class="collapse navbar-collapse" id="navbar-collapse"><ul class="navbar-nav ms-auto"><li class="nav-item"><div class="vstack gap-2 pt-2" sec:authorize="isAuthenticated()"><div class="row g-0 d-lg-none"><div class="col-auto"><a th:href="@{~/profile}"><div class="vstack position-relative"><img class="img-fluid border rounded border-0" id="accounticon-mobile-image" src="https://i.pravatar.cc/200" width="60px" alt="profile" th:src="${#authentication?.principal?.userInfo?.picture}"></div></a></div><div class="col align-self-center ps-2" th:href="@{~/profile}"><a class="text-decoration-none" th:href="@{~/profile}"><div class="vstack"><div><h6 class="d-inline" th:text="${#authentication?.principal?.userInfo?.nickName}">옥재욱</h6><h6 class="text-muted" th:text="${#authentication?.principal?.userInfo?.email}">[email protected]</h6></div></div></a></div><div class="col-auto d-flex align-items-center" sec:authorize="isAuthenticated()"><a class="btn text-decoration-none p-0" role="button" th:href="@{~/logout}"><svg xmlns="https://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 16 16" class="bi bi-box-arrow-right fs-4 text-muted">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0z"></path>
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"></path>
</svg></a></div></div><hr class="d-lg-none m-0"></div></li><li class="nav-item" id="dictionary"><a class="nav-link" data-bs-toggle="tooltip" data-bss-tooltip="" data-bs-placement="bottom" th:href="@{~/dictionary}" title="분리배출 사전입니다" th:title="#{base.header.nav.dictionary.title}" th:text="#{base.header.nav.dictionary.text}">사전</a></li><li class="nav-item" id="board"><a class="nav-link" data-bs-toggle="tooltip" data-bss-tooltip="" data-bs-placement="bottom" th:href="@{~/community}" title="커뮤니티입니다" th:title="#{base.header.nav.community.title}" th:text="#{base.header.nav.community.text}">커뮤니티</a></li><li class="nav-item" id="login" sec:authorize="isAnonymous()"><a class="nav-link" data-bs-toggle="tooltip" data-bss-tooltip="" data-bs-placement="bottom" id="login-flag" th:href="@{~/login}" title="회원이용시 다양한 혜택을 이용할 수 있습니다" th:text="#{base.header.nav.login.text}" th:title="#{base.header.nav.login.title}">로그인</a></li><li class="nav-item me-2" id="profile"><div class="nav-item dropstart d-none d-lg-block" id="accounticon-desktop" sec:authorize="isAuthenticated()"><a aria-expanded="false" data-bs-toggle="dropdown" class="text-decoration-none text-reset"><img class="img-fluid rounded-circle" id="accounticon-desktop-image" src="https://i.pravatar.cc/200" width="40px" height="40px" alt="profile" th:src="${#authentication?.principal?.userInfo?.picture}"></a><div class="dropdown-menu"><h6 class="dropdown-header"><span class="fs-6 fw-semibold d-block mb-1" th:text="${#authentication?.principal?.userInfo?.nickName}">닉네임</span><span class="d-block" th:text="${#authentication?.principal?.userInfo?.email}">이메일</span></h6><a class="dropdown-item" th:href="@{~/profile}" th:text="#{base.header.nav.profile.member}">내 계정</a><a class="dropdown-item" th:href="@{~/logout}" th:text="#{base.header.nav.profile.logout}">로그아웃</a></div></div></li><li class="nav-item d-flex align-items-center"><div class="theme-switcher nav-item dropdown"><a class="link-body-emphasis" aria-expanded="false"
Expand Down Expand Up @@ -43,4 +43,4 @@
<span th:text="#{base.header.nav.theme.auto.text}">Auto</span>
</a>
</div>
</div></li></ul></div></div></nav></header><script src="/assets/js/jquery.min.js"></script><script src="/assets/bootstrap/js/bootstrap.min.js"></script><script src="/assets/js/script.min.js"></script><script src="/assets/js/community/editorjs.umd.min.js"></script><script src="/assets/js/community/jquery.timeago.min.js"></script><script src="/assets/js/community/editor.mjs" type="module"></script><script src="/assets/js/community/post-color-changer.mjs" type="module"></script><script src="/assets/js/community/time-ago.mjs" type="module"></script><script src="/assets/js/dictionary/algolia.mjs" type="module"></script></body></html>
</div></li></ul></div></div></nav></header><script src="/assets/js/jquery.min.js"></script><script src="/assets/bootstrap/js/bootstrap.min.js"></script><script src="/assets/js/script.min.js"></script><script src="/assets/js/cmmn/htmx.min.js"></script><script src="/assets/js/cmmn/theme-switch.mjs" type="module"></script><script src="/assets/js/cmmn/toast.mjs" type="module"></script></body></html>
Loading

0 comments on commit c17a08e

Please sign in to comment.