1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

Добавили заметки в сайдбар (#126)

* added notes sidebar

* added note dropping and editing

* added sidebar navigation

* handling sidebarchanges over time

* using router back for closing sidebar

* fixed tripping inside single sidebar

* added superpowers toggle to sidebar

* user button opens sidebar now

* added profile cover for profile sidebar

* removed profile sidebar completely

* ran prettier over project

* added note not found error literal
This commit is contained in:
muerwre 2022-08-12 14:07:19 +07:00 committed by GitHub
parent fe3db608d6
commit 5d34090238
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 1241 additions and 664 deletions

View file

@ -9,22 +9,20 @@ import { stripHTMLTags } from '~/utils/stripHTMLTags';
export const formatTextSanitizeYoutube = (text: string): string =>
text.replace(
/(https?:\/\/(www\.)?(youtube\.com|youtu\.be)\/(watch)?(\?v=)?[\w\-&=]+)/gim,
'\n$1\n'
'\n$1\n',
);
/**
* Removes HTML tags
*/
export const formatTextSanitizeTags = (text: string): string => stripHTMLTags(text);
export const formatTextSanitizeTags = (text: string): string =>
stripHTMLTags(text);
/**
* Returns clickable usernames
*/
export const formatTextClickableUsernames = (text: string): string =>
text.replace(
/~([\wа-яА-Я-]+)/giu,
`<span class="username" onClick="window.postMessage({ type: '${EventMessageType.OpenProfile}', username: '$1'});">~$1</span>`
);
text.replace(/~([\wа-яА-Я-]+)/giu, `<span class="username">~$1</span>`);
/**
* Makes gray comments
@ -41,10 +39,13 @@ export const formatTextComments = (text: string): string =>
*/
export const formatTextTodos = (text: string): string =>
text
.replace(/\/\/\s*(todo|туду):?\s*([^\n]+)/gim, '// <span class="todo">$1</span> $2')
.replace(
/\/\/\s*(todo|туду):?\s*([^\n]+)/gim,
'// <span class="todo">$1</span> $2',
)
.replace(
/\/\/\s*(done|сделано|сделал|готово|fixed|пофикшено|фиксед):?\s*([^\n]+)/gim,
'// <span class="done">$1</span> $2'
'// <span class="done">$1</span> $2',
);
/**
@ -56,7 +57,8 @@ export const formatExclamations = (text: string): string =>
/**
* Replaces -- with dash
*/
export const formatTextDash = (text: string): string => text.replace(' -- ', ' — ');
export const formatTextDash = (text: string): string =>
text.replace(' -- ', ' — ');
/**
* Formats with markdown