From 13684488ef577135e70ec38c6d08494b35f6675b Mon Sep 17 00:00:00 2001 From: email Date: Tue, 29 Mar 2022 21:24:44 +0800 Subject: [PATCH] fix: convert raw memo --- web/src/less/memo-content.less | 56 ++++----------------------------- web/src/services/memoService.ts | 5 ++- 2 files changed, 8 insertions(+), 53 deletions(-) diff --git a/web/src/less/memo-content.less b/web/src/less/memo-content.less index 71e9d0e9..cddf47a4 100644 --- a/web/src/less/memo-content.less +++ b/web/src/less/memo-content.less @@ -2,70 +2,26 @@ .memo-content-text { .flex(column, flex-start, flex-start); - width: 100%; - word-wrap: break-word; - word-break: break-word; - white-space: pre-wrap; + @apply w-full whitespace-pre-wrap break-words; > p { - display: inline-block; - width: 100%; - height: auto; - margin-bottom: 4px; - font-size: 15px; - line-height: 24px; - min-height: 24px; - white-space: pre-wrap; + @apply inline-block w-full h-auto mb-1 text-base leading-6 whitespace-pre-wrap; } .tag-span { - display: inline-block; - width: auto; - padding: 0 6px; - line-height: 24px; - font-size: 13px; - border: none; - border-radius: 4px; - color: @text-blue; - background-color: @bg-light-blue; - cursor: pointer; - vertical-align: bottom; - - &:hover { - background-color: @text-blue; - color: white; - } + @apply inline-block w-auto px-2 text-sm leading-6 border-none rounded mr-1 cursor-pointer text-blue-600 bg-blue-50 hover:text-white hover:bg-blue-600; } .memo-link-text { - display: inline-block; - color: @text-blue; - font-weight: bold; - border-bottom: none; - text-decoration: none; - cursor: pointer; - - &:hover { - opacity: 0.8; - } + @apply inline-block text-blue-600 cursor-pointer font-bold border-none no-underline hover:opacity-80; } .counter-block, .todo-block { - display: inline-block; - text-align: center; - width: 1.4rem; - @apply font-mono; + @apply inline-block text-center w-6 font-mono; } pre { - width: 100%; - margin: 4px 0; - padding: 8px 12px; - border-radius: 4px; - font-size: 15px; - line-height: 1.5; - background-color: #f6f5f4; - white-space: pre-wrap; + @apply w-full mt-1 py-2 px-3 rounded text-sm bg-gray-100 whitespace-pre-wrap; } } diff --git a/web/src/services/memoService.ts b/web/src/services/memoService.ts index 578db3b3..b0e73ab8 100644 --- a/web/src/services/memoService.ts +++ b/web/src/services/memoService.ts @@ -17,9 +17,7 @@ class MemoService { } const data = await api.getMyMemos(); - const memos: Model.Memo[] = data.map((m) => { - return this.convertResponseModelMemo(m); - }); + const memos: Model.Memo[] = data.map((m) => this.convertResponseModelMemo(m)); appStore.dispatch({ type: "SET_MEMOS", payload: { @@ -138,6 +136,7 @@ class MemoService { private convertResponseModelMemo(memo: Model.Memo): Model.Memo { return { ...memo, + id: String(memo.id), createdAt: utils.getDataStringWithTs(memo.createdTs), updatedAt: utils.getDataStringWithTs(memo.updatedTs), };