From d4ac99487d7055142e9f7c0ba69f3221fb2b48a6 Mon Sep 17 00:00:00 2001 From: Seania Date: Fri, 1 Jul 2022 23:39:12 +0900 Subject: [PATCH] fix time library --- package.json | 5 + pnpm-lock.yaml | 305 ++++++++++++++++++ src/lib/components/ArticleList.svelte | 18 +- src/lib/components/Tiptap.svelte | 67 ++++ src/lib/types/dto/article.dto.ts | 2 +- .../[article=integer]/api/add-comment.ts | 0 .../[article=integer]/index.svelte | 5 + .../community/[id=integer]/api/write.ts | 22 +- .../community/[id=integer]/write.svelte | 12 +- src/routes/user/login.ts | 2 - 10 files changed, 415 insertions(+), 23 deletions(-) create mode 100644 src/lib/components/Tiptap.svelte create mode 100644 src/routes/community/[id=integer]/[article=integer]/api/add-comment.ts diff --git a/package.json b/package.json index 91f55cf..b3d3e15 100644 --- a/package.json +++ b/package.json @@ -39,8 +39,11 @@ }, "type": "module", "dependencies": { + "@skyra/timestamp": "^1.0.0", "@sveltejs/adapter-node": "next", "@sveltejs/kit": "next", + "@tiptap/core": "2.0.0-beta.181", + "@tiptap/starter-kit": "2.0.0-beta.190", "arangojs": "^7.8.0", "argon2": "^0.28.5", "date-fns": "^2.28.0", @@ -49,6 +52,7 @@ "dto-mapping": "^1.1.0", "froala-editor": "^4.0.12", "http-status-codes": "^2.2.0", + "javascript-time-ago": "^2.5.5", "js-base64": "^3.7.2", "js-cookie": "^3.0.1", "ky": "^0.31.0", @@ -57,6 +61,7 @@ "material-icons": "^1.11.3", "njwt": "^1.2.0", "polka": "^0.5.2", + "relative-time-format": "^1.1.4", "sass": "^1.53.0", "secure-random": "^1.1.2", "svelte-material-icons": "^2.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3cb0185..ebd2648 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,9 +2,12 @@ lockfileVersion: 5.4 specifiers: '@playwright/test': ^1.22.2 + '@skyra/timestamp': ^1.0.0 '@sveltejs/adapter-auto': next '@sveltejs/adapter-node': next '@sveltejs/kit': next + '@tiptap/core': 2.0.0-beta.181 + '@tiptap/starter-kit': 2.0.0-beta.190 '@types/js-cookie': ^3.0.2 '@types/lodash-es': ^4.17.6 '@types/secure-random': ^1.1.0 @@ -22,6 +25,7 @@ specifiers: eslint-plugin-svelte3: ^4.0.0 froala-editor: ^4.0.12 http-status-codes: ^2.2.0 + javascript-time-ago: ^2.5.5 js-base64: ^3.7.2 js-cookie: ^3.0.1 ky: ^0.31.0 @@ -33,6 +37,7 @@ specifiers: postcss: ^8.4.14 prettier: ^2.6.2 prettier-plugin-svelte: ^2.7.0 + relative-time-format: ^1.1.4 sass: ^1.53.0 secure-random: ^1.1.2 svelte: ^3.44.0 @@ -47,8 +52,11 @@ specifiers: wysiwyg-editor-node-sdk: ^4.0.12 dependencies: + '@skyra/timestamp': 1.0.0 '@sveltejs/adapter-node': 1.0.0-next.78 '@sveltejs/kit': 1.0.0-next.357_sass@1.53.0+svelte@3.48.0 + '@tiptap/core': 2.0.0-beta.181 + '@tiptap/starter-kit': 2.0.0-beta.190 arangojs: 7.8.0 argon2: 0.28.5 date-fns: 2.28.0 @@ -57,6 +65,7 @@ dependencies: dto-mapping: 1.1.0 froala-editor: 4.0.12 http-status-codes: 2.2.0 + javascript-time-ago: 2.5.5 js-base64: 3.7.2 js-cookie: 3.0.1 ky: 0.31.0 @@ -65,6 +74,7 @@ dependencies: material-icons: 1.11.3 njwt: 1.2.0 polka: 0.5.2 + relative-time-format: 1.1.4 sass: 1.53.0 secure-random: 1.1.2 svelte-material-icons: 2.0.2_svelte@3.48.0 @@ -217,6 +227,11 @@ packages: picomatch: 2.3.1 dev: false + /@skyra/timestamp/1.0.0: + resolution: {integrity: sha512-+qznTCEwwqmpp/7RypIzxH2z1ij9ZV/W5EZveC6yewGNtQxmfoNhjvPK2qujT32TUmy3FoakbDbTnO6pnOpG0g==} + engines: {node: '>=12', npm: '>=6'} + dev: false + /@sveltejs/adapter-auto/1.0.0-next.53: resolution: {integrity: sha512-LyaeU0rkcymGWvV/3K26AZxqG/+ZQHwa+hrx3xsbmOykjQ2WQPTXRVwmH23zV4A5ABvni76LRMsQOoqWzP3G9Q==} dependencies: @@ -303,6 +318,191 @@ packages: - supports-color dev: false + /@tiptap/core/2.0.0-beta.181: + resolution: {integrity: sha512-tbwRqjTVvY9v31TNAH6W0Njhr/OVwI28zWXmH55/USrwyU2CB1iCVfXktZKOhB+8WyvOaBv1JA5YplMIhstYTw==} + dependencies: + prosemirror-commands: 1.3.0 + prosemirror-keymap: 1.2.0 + prosemirror-model: 1.18.1 + prosemirror-schema-list: 1.2.0 + prosemirror-state: 1.4.1 + prosemirror-transform: 1.6.0 + prosemirror-view: 1.26.2 + dev: false + + /@tiptap/extension-blockquote/2.0.0-beta.29_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-zMYT5TtpKWav9VhTn4JLyMvXmhEdbD6on0MdhcTjRm0I5ugyR4ZbJwh2aelM7G9DZVYzB8jZU18OSDJmo7Af7w==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-bold/2.0.0-beta.28_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-DY8GOzw9xjmTFrnvTbgHUNxTnDfKrkDgrhe0SUvdkT2udntWp8umPdhPiD3vczLgHOJw6tX68qMRjbsR1ZPcHQ==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-bullet-list/2.0.0-beta.29_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-R8VB2l1ZB6VeGWx/t/04nBS5Wg3qjIDEZCpPihj2fccJOw99Lu0Ub2UJg/SfdGmeNNpBh4ZYYFv1g/XjyzlXKg==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-code-block/2.0.0-beta.42_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-4wzLup4mI8w9ypIceekUV/8g41cQIPn31qs1iC9u1/JuTkjMj/tA+TFUyp6IMugLxoI/P2DlTztU6/6m7n9DyQ==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + prosemirror-state: 1.4.1 + dev: false + + /@tiptap/extension-code/2.0.0-beta.28_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-QPJ2Gwb1+3NgcC1ZIhvVcb+FsnWWDu5VZXTKXM4mz892i9V2x48uHg5anPiUV6pcolXsW1F5VNbXIHGTUUO6CQ==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-document/2.0.0-beta.17_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-L6sg0FNchbtIpQkCSjMmItVGs3/vep8Fq56WRtDc1wBSGUSmtHaxQG7F2FZLnNIUMuvzVMRD81m2vYG73WkY6A==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-dropcursor/2.0.0-beta.29_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-I+joyoFB8pfdXUPLMqdNO08nlB5m2lbu0VQ5dpqdi/HzgVThMZPZA1cW0X8vAUvrALs5/JFRiFoR9hrLN5R5ng==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + prosemirror-dropcursor: 1.5.0 + dev: false + + /@tiptap/extension-gapcursor/2.0.0-beta.39_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-oCyz5WEeQXrEIoa1WXaD52yf1EwMFCXaK1cVzFgUj8lkXJ+nJj+O/Zp0Mg+9/MVR0LYu/kifqVorKNXM4AFA/g==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + prosemirror-gapcursor: 1.3.0 + dev: false + + /@tiptap/extension-hard-break/2.0.0-beta.33_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-41xf0vSV9hcyTFd01ItLq/CjhjgmOFLCrO3UWN/P2E/cIxuDTyXcvjTE/KXeqRCOV3OYd9fVr0wO91hc8Ij1Yg==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-heading/2.0.0-beta.29_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-q92jYcsT5bPhvuQaB0h44Z9r+Ii22tDYo082KMVnR4+tknHT/3xx+p4JC8KHjh+/5W8Quyafqy6mS8L8VX0zsQ==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-history/2.0.0-beta.26_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-ly19uwvdmXG8Fw1KcavXIHi3Qx6JBASOR7394zghOEpW3atpY8nd/8I373rZ8eDUcGOClfaF7bCx2xvIotAAnw==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + prosemirror-history: 1.3.0 + dev: false + + /@tiptap/extension-horizontal-rule/2.0.0-beta.36_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-o+Zp7dcn3zAQhtlhZiFB69mTHuH3ZRbGEF7Cbf1D3uX1izotni5zIZbPaFFUT4r6OmVe/vDDt/nopfcGc10ktQ==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + prosemirror-state: 1.4.1 + dev: false + + /@tiptap/extension-italic/2.0.0-beta.28_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-/pKRiCfewh7nqiXRD3N4hQHfGrGNOiWPFYZfY35bSpvTms7PDb/MF7xT1CWW23hSpY31BBS+R/a66vlR/gqu7Q==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-list-item/2.0.0-beta.23_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-AkzvdELz3ZnrlZM0r9+ritBDOnAjXHR/8zCZhW0ZlWx4zyKPMsNG5ygivY+xr4QT65NEGRT8P8b2zOhXrMjjMQ==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-ordered-list/2.0.0-beta.30_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-GRxGQdq1u0Rp5N8TjthCqoZ//460m343A0HCN7UwfQOnX7Ipv0UJemwNkSHWrl7Pexym9vy3yPWgrn7oRRmgEw==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-paragraph/2.0.0-beta.26_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-WcYsuUa7LLfk0vi7I1dVjdMRu53B52FMMqd+UL1qPdDKVkU3DBsZVwPj+yyfQyqN8Mc/xyg9VacGaiKFLmWNDg==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-strike/2.0.0-beta.29_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-zqFuY7GfNmZ/KClt6kxQ+msGo3syqucP/Xnlihxi+/h/G+oTvEwyOIXCtDOltvxcsWH/TUsdr5vzLp0j+Mdc6Q==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/extension-text/2.0.0-beta.17_o5tsmp445vozplpzqkrs3pmjeq: + resolution: {integrity: sha512-OyKL+pqWJEtjyd9/mrsuY1kZh2b3LWpOQDWKtd4aWR4EA0efmQG+7FPwcIeAVEh7ZoqM+/ABCnPjN6IjzIrSfg==} + peerDependencies: + '@tiptap/core': ^2.0.0-beta.1 + dependencies: + '@tiptap/core': 2.0.0-beta.181 + dev: false + + /@tiptap/starter-kit/2.0.0-beta.190: + resolution: {integrity: sha512-jaFMkE6mjCHmCJsXUyLiXGYRVDcHF+PbH/5hEu1riUIAT0Hmm7uak5TYsPeuoCVN7P/tmDEBbBRASZ5CzEQpvw==} + dependencies: + '@tiptap/core': 2.0.0-beta.181 + '@tiptap/extension-blockquote': 2.0.0-beta.29_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-bold': 2.0.0-beta.28_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-bullet-list': 2.0.0-beta.29_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-code': 2.0.0-beta.28_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-code-block': 2.0.0-beta.42_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-document': 2.0.0-beta.17_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-dropcursor': 2.0.0-beta.29_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-gapcursor': 2.0.0-beta.39_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-hard-break': 2.0.0-beta.33_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-heading': 2.0.0-beta.29_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-history': 2.0.0-beta.26_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-horizontal-rule': 2.0.0-beta.36_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-italic': 2.0.0-beta.28_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-list-item': 2.0.0-beta.23_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-ordered-list': 2.0.0-beta.30_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-paragraph': 2.0.0-beta.26_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-strike': 2.0.0-beta.29_o5tsmp445vozplpzqkrs3pmjeq + '@tiptap/extension-text': 2.0.0-beta.17_o5tsmp445vozplpzqkrs3pmjeq + dev: false + /@types/js-cookie/3.0.2: resolution: {integrity: sha512-6+0ekgfusHftJNYpihfkMu8BWdeHs9EOJuGcSofErjstGPfPGEu9yTu4t460lTzzAMl2cM5zngQJqPMHbbnvYA==} dev: true @@ -1643,6 +1843,12 @@ packages: /isexe/2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + /javascript-time-ago/2.5.5: + resolution: {integrity: sha512-vZWIEKTPDcxH2B+ZVBK4AIuHkDcUoV80L9d+1WsRmp68hMXym0cQrf45WCP4mKgZjVGxTio7uYeDTkveX3DzlA==} + dependencies: + relative-time-format: 1.1.4 + dev: false + /js-base64/3.7.2: resolution: {integrity: sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ==} dev: false @@ -2056,6 +2262,10 @@ packages: word-wrap: 1.2.3 dev: true + /orderedmap/2.0.0: + resolution: {integrity: sha512-buf4PoAMlh45b8a8gsGy/X6w279TSqkyAS0C0wdTSJwFSU+ljQFJON5I8NfjLHoCXwpSROIo2wr0g33T+kQshQ==} + dev: false + /os-homedir/1.0.2: resolution: {integrity: sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==} engines: {node: '>=0.10.0'} @@ -2225,6 +2435,89 @@ packages: engines: {node: '>= 0.6.0'} dev: false + /prosemirror-commands/1.3.0: + resolution: {integrity: sha512-BwBbZ5OAScPcm0x7H8SPbqjuEJnCU2RJT9LDyOiiIl/3NbL1nJZI4SFNHwU2e/tRr2Xe7JsptpzseqvZvToLBQ==} + dependencies: + prosemirror-model: 1.18.1 + prosemirror-state: 1.4.1 + prosemirror-transform: 1.6.0 + dev: false + + /prosemirror-dropcursor/1.5.0: + resolution: {integrity: sha512-vy7i77ddKyXlu8kKBB3nlxLBnsWyKUmQIPB5x8RkYNh01QNp/qqGmdd5yZefJs0s3rtv5r7Izfu2qbtr+tYAMQ==} + dependencies: + prosemirror-state: 1.4.1 + prosemirror-transform: 1.6.0 + prosemirror-view: 1.26.3 + dev: false + + /prosemirror-gapcursor/1.3.0: + resolution: {integrity: sha512-9Tdx83xB2W4Oqchm12FtCkSizbqvi64cjs1I9TRPblqdA5TUWoVZ4ZI+t71Jh6HSEh4cDMPzx3UwfryJtKlb/w==} + dependencies: + prosemirror-keymap: 1.2.0 + prosemirror-model: 1.18.1 + prosemirror-state: 1.4.1 + prosemirror-view: 1.26.3 + dev: false + + /prosemirror-history/1.3.0: + resolution: {integrity: sha512-qo/9Wn4B/Bq89/YD+eNWFbAytu6dmIM85EhID+fz9Jcl9+DfGEo8TTSrRhP15+fFEoaPqpHSxlvSzSEbmlxlUA==} + dependencies: + prosemirror-state: 1.4.1 + prosemirror-transform: 1.6.0 + rope-sequence: 1.3.3 + dev: false + + /prosemirror-keymap/1.2.0: + resolution: {integrity: sha512-TdSfu+YyLDd54ufN/ZeD1VtBRYpgZnTPnnbY+4R08DDgs84KrIPEPbJL8t1Lm2dkljFx6xeBE26YWH3aIzkPKg==} + dependencies: + prosemirror-state: 1.4.1 + w3c-keyname: 2.2.4 + dev: false + + /prosemirror-model/1.18.1: + resolution: {integrity: sha512-IxSVBKAEMjD7s3n8cgtwMlxAXZrC7Mlag7zYsAKDndAqnDScvSmp/UdnRTV/B33lTCVU3CCm7dyAn/rVVD0mcw==} + dependencies: + orderedmap: 2.0.0 + dev: false + + /prosemirror-schema-list/1.2.0: + resolution: {integrity: sha512-8PT/9xOx1HHdC7fDNNfhQ50Z8Mzu7nKyA1KCDltSpcZVZIbB0k7KtsHrnXyuIhbLlScoymBiLZ00c5MH6wdFsA==} + dependencies: + prosemirror-model: 1.18.1 + prosemirror-state: 1.4.1 + prosemirror-transform: 1.6.0 + dev: false + + /prosemirror-state/1.4.1: + resolution: {integrity: sha512-U/LBDW2gNmVa07sz/D229XigSdDQ5CLFwVB1Vb32MJbAHHhWe/6pOc721faI17tqw4pZ49i1xfY/jEZ9tbIhPg==} + dependencies: + prosemirror-model: 1.18.1 + prosemirror-transform: 1.6.0 + dev: false + + /prosemirror-transform/1.6.0: + resolution: {integrity: sha512-MAp7AjsjEGEqQY0sSMufNIUuEyB1ZR9Fqlm8dTwwWwpEJRv/plsKjWXBbx52q3Ml8MtaMcd7ic14zAHVB3WaMw==} + dependencies: + prosemirror-model: 1.18.1 + dev: false + + /prosemirror-view/1.26.2: + resolution: {integrity: sha512-CGKw+GadkfSBEwRAJTHCEKJ4DlV6/3IhAdjpwGyZHUHtbP7jX4Ol4zmi7xa2c6GOabDlIJLYXJydoNYLX7lNeQ==} + dependencies: + prosemirror-model: 1.18.1 + prosemirror-state: 1.4.1 + prosemirror-transform: 1.6.0 + dev: false + + /prosemirror-view/1.26.3: + resolution: {integrity: sha512-349cR05mXW67xhzmrP1ddEyOCyEuOCkLeo17Bwgw8dWWdGYwT6oTAGJuk/hdc3OSTIUpUPjHLvE4mjP45IIkTg==} + dependencies: + prosemirror-model: 1.18.1 + prosemirror-state: 1.4.1 + prosemirror-transform: 1.6.0 + dev: false + /pseudomap/1.0.2: resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==} dev: false @@ -2304,6 +2597,10 @@ packages: engines: {node: '>=8'} dev: true + /relative-time-format/1.1.4: + resolution: {integrity: sha512-WRWEDEZFTD/95oYMd58kzlYHI6QzexMpPkxvi4/P+NLdzli/tteNonmAa5jYLm8ehJVTGiM2siNg7i1Dkn/gDw==} + dev: false + /resolve-from/4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} @@ -2354,6 +2651,10 @@ packages: fsevents: 2.3.2 dev: false + /rope-sequence/1.3.3: + resolution: {integrity: sha512-85aZYCxweiD5J8yTEbw+E6A27zSnLPNDL0WfPdw3YYodq7WjnTKo0q4dtyQ2gz23iPT8Q9CUyJtAaUNcTxRf5Q==} + dev: false + /run-parallel/1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: @@ -2829,6 +3130,10 @@ packages: fsevents: 2.3.2 dev: false + /w3c-keyname/2.2.4: + resolution: {integrity: sha512-tOhfEwEzFLJzf6d1ZPkYfGj+FWhIpBux9ppoP3rlclw3Z0BZv3N7b7030Z1kYth+6rDuAsXUFr+d0VE6Ed1ikw==} + dev: false + /web-streams-polyfill/3.2.1: resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==} engines: {node: '>= 8'} diff --git a/src/lib/components/ArticleList.svelte b/src/lib/components/ArticleList.svelte index 2f1d2d8..8bf9a06 100644 --- a/src/lib/components/ArticleList.svelte +++ b/src/lib/components/ArticleList.svelte @@ -1,25 +1,29 @@ diff --git a/src/lib/components/Tiptap.svelte b/src/lib/components/Tiptap.svelte new file mode 100644 index 0000000..3dbb3cf --- /dev/null +++ b/src/lib/components/Tiptap.svelte @@ -0,0 +1,67 @@ + + +
+ + {#if editor} + + + + {/if} + +
+
+ + \ No newline at end of file diff --git a/src/lib/types/dto/article.dto.ts b/src/lib/types/dto/article.dto.ts index dadab3e..ca14d00 100644 --- a/src/lib/types/dto/article.dto.ts +++ b/src/lib/types/dto/article.dto.ts @@ -17,6 +17,6 @@ export class ArticleDto { @SafeType({type: String}) content?: string; - @SafeType({type: Array}) + // @SafeType({type: Array}) tags?: string[]; } \ No newline at end of file diff --git a/src/routes/community/[id=integer]/[article=integer]/api/add-comment.ts b/src/routes/community/[id=integer]/[article=integer]/api/add-comment.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/community/[id=integer]/[article=integer]/index.svelte b/src/routes/community/[id=integer]/[article=integer]/index.svelte index 197bb6a..cf1f7e6 100644 --- a/src/routes/community/[id=integer]/[article=integer]/index.svelte +++ b/src/routes/community/[id=integer]/[article=integer]/index.svelte @@ -23,4 +23,9 @@
{@html article.content}
+ + +
+

댓글...

+
\ No newline at end of file diff --git a/src/routes/community/[id=integer]/api/write.ts b/src/routes/community/[id=integer]/api/write.ts index 6b2d13f..801c9da 100644 --- a/src/routes/community/[id=integer]/api/write.ts +++ b/src/routes/community/[id=integer]/api/write.ts @@ -1,5 +1,5 @@ import type {RequestEvent, RequestHandlerOutput} from '@sveltejs/kit'; -import _ from 'lodash-es'; +import _, {isEmpty} from 'lodash-es'; import HttpStatus from 'http-status-codes'; import db from '$lib/database/instance'; import {aql} from 'arangojs'; @@ -30,8 +30,6 @@ export async function post({request, params, locals}: RequestEvent): Promise !isEmpty(v); + const filtered = tags.filter(isNotEmpty); + console.log('filtered:',filtered); + const mapped = filtered.map(v => v.trim()); + console.log(mapped); + return this.body.tags?.filter(v => v.length > 0).map(v => v.trim()) ?? []; } get content(): string | undefined { - return this.body.content; + return this.body.content?.trim(); } private get isBoardExists(): Promise { @@ -120,7 +123,6 @@ class WriteRequest { board: this.boardId, }; - const cursor = await db.query(aql`INSERT ${data} INTO articles return NEW`); const {_key} = await cursor.next(); diff --git a/src/routes/community/[id=integer]/write.svelte b/src/routes/community/[id=integer]/write.svelte index 9388e9b..26847ba 100644 --- a/src/routes/community/[id=integer]/write.svelte +++ b/src/routes/community/[id=integer]/write.svelte @@ -19,14 +19,18 @@