mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: make editor sticky
This commit is contained in:
@ -35,8 +35,12 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
|
|||||||
const matchedArr = [...memo.content.matchAll(MEMO_LINK_REG)];
|
const matchedArr = [...memo.content.matchAll(MEMO_LINK_REG)];
|
||||||
for (const matchRes of matchedArr) {
|
for (const matchRes of matchedArr) {
|
||||||
if (matchRes && matchRes.length === 3) {
|
if (matchRes && matchRes.length === 3) {
|
||||||
const id = matchRes[2];
|
const id = Number(matchRes[2]);
|
||||||
const memoTemp = memoService.getMemoById(Number(id));
|
if (id === memo.id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const memoTemp = memoService.getMemoById(id);
|
||||||
if (memoTemp) {
|
if (memoTemp) {
|
||||||
linkMemos.push({
|
linkMemos.push({
|
||||||
...memoTemp,
|
...memoTemp,
|
||||||
@ -51,6 +55,7 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
|
|||||||
const linkedMemos = await memoService.getLinkedMemos(memo.id);
|
const linkedMemos = await memoService.getLinkedMemos(memo.id);
|
||||||
setLinkedMemos(
|
setLinkedMemos(
|
||||||
linkedMemos
|
linkedMemos
|
||||||
|
.filter((m) => m.rowStatus === "NORMAL" && m.id !== memo.id)
|
||||||
.sort((a, b) => utils.getTimeStampByDate(b.createdTs) - utils.getTimeStampByDate(a.createdTs))
|
.sort((a, b) => utils.getTimeStampByDate(b.createdTs) - utils.getTimeStampByDate(a.createdTs))
|
||||||
.map((m) => ({
|
.map((m) => ({
|
||||||
...m,
|
...m,
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
.pretty-scroll-bar(2px, 0);
|
.pretty-scroll-bar(2px, 0);
|
||||||
z-index: 1;
|
|
||||||
|
|
||||||
&::placeholder {
|
&::placeholder {
|
||||||
padding-left: 2px;
|
padding-left: 2px;
|
||||||
@ -49,7 +48,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
> .tag-list {
|
> .tag-list {
|
||||||
@apply hidden flex-col justify-start items-start absolute top-6 left-0 mt-1 p-1 z-10 rounded w-32 max-h-52 overflow-auto bg-black;
|
@apply hidden flex-col justify-start items-start absolute top-6 left-0 mt-1 p-1 z-1 rounded w-32 max-h-52 overflow-auto bg-black;
|
||||||
|
|
||||||
> span {
|
> span {
|
||||||
@apply w-full text-white cursor-pointer rounded text-sm leading-6 px-2 hover:bg-gray-700;
|
@apply w-full text-white cursor-pointer rounded text-sm leading-6 px-2 hover:bg-gray-700;
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
@import "./mixin.less";
|
@import "./mixin.less";
|
||||||
|
|
||||||
.page-wrapper.home {
|
.page-wrapper.home {
|
||||||
@apply relative top-0 w-full h-screen overflow-y-auto;
|
@apply relative top-0 w-full h-screen overflow-y-auto overflow-x-hidden;
|
||||||
background-color: #f6f5f4;
|
background-color: #f6f5f4;
|
||||||
|
|
||||||
> .page-container {
|
> .page-container {
|
||||||
@apply relative w-full min-h-screen mx-auto flex flex-row justify-center items-start;
|
@apply relative w-full min-h-screen mx-auto flex flex-row justify-start sm:justify-center items-start;
|
||||||
|
|
||||||
>.sidebar-wrapper{
|
> .sidebar-wrapper {
|
||||||
@apply flex-shrink-0;
|
@apply flex-shrink-0;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .memos-wrapper {
|
> .memos-wrapper {
|
||||||
@apply relative w-full max-w-2xl min-h-full overflow-x-hidden flex flex-col justify-start items-start px-4 sm:pr-6;
|
@apply relative w-full max-w-2xl min-h-full flex flex-col justify-start items-start px-4 sm:pr-6;
|
||||||
|
|
||||||
|
> .memos-editor-wrapper {
|
||||||
|
@apply sticky top-0 w-full h-full flex flex-col justify-start items-start z-1;
|
||||||
|
background-color: #f6f5f4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
@apply flex flex-row justify-end items-center relative flex-shrink-0;
|
@apply flex flex-row justify-end items-center relative flex-shrink-0;
|
||||||
|
|
||||||
> .more-action-btns-wrapper {
|
> .more-action-btns-wrapper {
|
||||||
@apply hidden flex-col justify-start items-center absolute top-2 -right-4 z-10 flex-nowrap hover:flex p-3;
|
@apply hidden flex-col justify-start items-center absolute top-2 -right-4 flex-nowrap hover:flex p-3;
|
||||||
|
|
||||||
> .more-action-btns-container {
|
> .more-action-btns-container {
|
||||||
@apply w-28 h-auto p-1 whitespace-nowrap rounded-lg bg-white;
|
@apply w-28 h-auto p-1 whitespace-nowrap rounded-lg bg-white;
|
||||||
|
@ -2,15 +2,13 @@
|
|||||||
|
|
||||||
.section-header-container,
|
.section-header-container,
|
||||||
.memos-header-container {
|
.memos-header-container {
|
||||||
.flex(row, space-between, center);
|
@apply sticky top-4 flex flex-row justify-between items-center w-full h-10 flex-nowrap mt-4 mb-2 shrink-0 z-1;
|
||||||
@apply w-full h-10 flex-nowrap mt-4 mb-2 shrink-0;
|
|
||||||
|
|
||||||
> .title-container {
|
> .title-container {
|
||||||
@apply flex flex-row justify-start items-center mr-2 shrink-0 overflow-hidden;
|
@apply flex flex-row justify-start items-center mr-2 shrink-0 overflow-hidden;
|
||||||
|
|
||||||
> .action-btn {
|
> .action-btn {
|
||||||
@apply flex sm:hidden flex-row justify-center items-center w-6 h-6 mr-1 shrink-0;
|
@apply flex sm:hidden flex-row justify-center items-center w-6 h-6 mr-1 shrink-0 bg-transparent;
|
||||||
background-color: unset;
|
|
||||||
|
|
||||||
> .icon-img {
|
> .icon-img {
|
||||||
@apply w-5 h-auto;
|
@apply w-5 h-auto;
|
||||||
@ -18,12 +16,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
> .title-text {
|
> .title-text {
|
||||||
@apply font-bold text-lg leading-10 mr-2 text-ellipsis shrink-0 cursor-pointer overflow-hidden;
|
@apply font-bold text-lg leading-10 mr-2 text-ellipsis shrink-0 cursor-pointer overflow-hidden text-gray-700;
|
||||||
color: @text-black;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> .btns-container {
|
> .btns-container {
|
||||||
.flex(row, flex-end, center);
|
@apply flex flex-row justify-end items-center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
> .img-container {
|
> .img-container {
|
||||||
@apply w-full h-full flex flex-col justify-center items-center;
|
@apply w-full h-full p-4 flex flex-col justify-center items-center;
|
||||||
background-color: unset;
|
background-color: unset;
|
||||||
.hide-scroll-bar();
|
.hide-scroll-bar();
|
||||||
|
|
||||||
> img {
|
> img {
|
||||||
@apply h-auto w-auto max-w-full max-h-full p-4;
|
@apply h-auto w-auto max-w-full max-h-full shadow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,7 @@
|
|||||||
@apply w-96 max-w-full h-auto select-none relative flex flex-col justify-start items-start;
|
@apply w-96 max-w-full h-auto select-none relative flex flex-col justify-start items-start;
|
||||||
|
|
||||||
> .memo-shortcut-img {
|
> .memo-shortcut-img {
|
||||||
@apply absolute top-0 left-0 w-full h-auto rounded-b-lg;
|
@apply absolute top-0 left-0 w-full h-auto rounded-b-lg z-10;
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
> .time-text {
|
> .time-text {
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
> .action-btns-wrapper {
|
> .action-btns-wrapper {
|
||||||
@apply flex-col justify-start items-start absolute top-6 right-0 w-auto h-auto px-4 pt-3 hidden z-10;
|
@apply flex-col justify-start items-start absolute top-6 right-0 w-auto h-auto px-4 pt-3 hidden z-1;
|
||||||
|
|
||||||
> .action-btns-container {
|
> .action-btns-container {
|
||||||
@apply flex flex-col justify-start items-start w-24 h-auto p-1 whitespace-nowrap rounded-md bg-white shadow;
|
@apply flex flex-col justify-start items-start w-24 h-auto p-1 whitespace-nowrap rounded-md bg-white shadow;
|
||||||
|
@ -37,9 +37,11 @@ function Home() {
|
|||||||
<div className="page-container">
|
<div className="page-container">
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
<main className="memos-wrapper">
|
<main className="memos-wrapper">
|
||||||
<MemosHeader />
|
<div className="memos-editor-wrapper">
|
||||||
<MemoEditor />
|
<MemosHeader />
|
||||||
<MemoFilter />
|
<MemoEditor />
|
||||||
|
<MemoFilter />
|
||||||
|
</div>
|
||||||
<MemoList />
|
<MemoList />
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
@ -48,7 +48,8 @@ const memoService = {
|
|||||||
|
|
||||||
getLinkedMemos: async (memoId: MemoId): Promise<Memo[]> => {
|
getLinkedMemos: async (memoId: MemoId): Promise<Memo[]> => {
|
||||||
const { memos } = memoService.getState();
|
const { memos } = memoService.getState();
|
||||||
return memos.filter((m) => m.content.includes(`${memoId}`));
|
const regex = new RegExp(`[@(.+?)](${memoId})`);
|
||||||
|
return memos.filter((m) => m.content.match(regex));
|
||||||
},
|
},
|
||||||
|
|
||||||
createMemo: async (memoCreate: MemoCreate) => {
|
createMemo: async (memoCreate: MemoCreate) => {
|
||||||
|
@ -19,6 +19,7 @@ module.exports = {
|
|||||||
180: "45rem",
|
180: "45rem",
|
||||||
},
|
},
|
||||||
zIndex: {
|
zIndex: {
|
||||||
|
1: "1",
|
||||||
100: "100",
|
100: "100",
|
||||||
1000: "1000",
|
1000: "1000",
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user