Skip to content

Commit

Permalink
Merge pull request #290 from blinko-space/dev
Browse files Browse the repository at this point in the history
fix some issue
  • Loading branch information
blinko-space authored Dec 12, 2024
2 parents e61cf15 + bbd9bc0 commit ae7855a
Show file tree
Hide file tree
Showing 26 changed files with 600 additions and 93 deletions.
17 changes: 16 additions & 1 deletion public/locales/ar/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,5 +231,20 @@
"export": "التصدير",
"time-range": "النطاق الزمني",
"all": "الكل",
"exporting": "التصدير..."
"exporting": "التصدير...",
"has-image": "لديه صورة",
"has-link": "لديه رابط",
"filter-settings": "إعدادات التصفية",
"tag-status": "حالة العلامة",
"all-notes": "جميع الملاحظات",
"with-tags": "مع العلامات",
"without-tags": "بدون علامات",
"select-tags": "حدد العلامات",
"additional-conditions": "الشروط الإضافية",
"apply-filter": "تطبيق الفلتر",
"to": "إلى",
"start-date": "تاريخ البدء",
"end-date": "تاريخ الانتهاء",
"reset": "إعادة تعيين",
"no-condition": "لا توجد حالة"
}
17 changes: 16 additions & 1 deletion public/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,20 @@
"export": "Exportieren",
"time-range": "Zeitspanne",
"all": "Alle",
"exporting": "Exportieren..."
"exporting": "Exportieren...",
"has-image": "Hat Image",
"has-link": "Hat Link",
"filter-settings": "Filter-Einstellungen",
"tag-status": "Tag Status",
"all-notes": "Alle Anmerkungen",
"with-tags": "Mit Tags",
"without-tags": "Ohne Tags",
"select-tags": "Tags auswählen",
"additional-conditions": "Zusätzliche Bedingungen",
"apply-filter": "Filter anwenden",
"to": "An",
"start-date": "Datum des Beginns",
"end-date": "Enddatum",
"reset": "Zurücksetzen",
"no-condition": "Keine Bedingung"
}
17 changes: 16 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,20 @@
"export-format": "Export Format",
"time-range": "Time Range",
"all": "All",
"exporting": "Exporting..."
"exporting": "Exporting...",
"tag-status": "Tag Status",
"all-notes": "All Notes",
"with-tags": "With Tags",
"without-tags": "Without Tags",
"select-tags": "Select Tags",
"additional-conditions": "Additional Conditions",
"apply-filter": "Apply Filter",
"has-image": "Has Image",
"has-link": "Has Link",
"filter-settings": "Filter Settings",
"to": "To",
"reset": "Reset",
"start-date": "Start Date",
"end-date": "End Date",
"no-condition": "No Condition"
}
17 changes: 16 additions & 1 deletion public/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,20 @@
"export": "Exportar",
"time-range": "Intervalo de tiempo",
"all": "Todos",
"exporting": "Exportar..."
"exporting": "Exportar...",
"has-image": "Tiene Imagen",
"has-link": "Tiene enlace",
"filter-settings": "Ajustes de filtro",
"tag-status": "Estado de la etiqueta",
"all-notes": "Todas las notas",
"with-tags": "Con etiquetas",
"without-tags": "Sin etiquetas",
"select-tags": "Seleccionar etiquetas",
"additional-conditions": "Condiciones adicionales",
"apply-filter": "Aplicar filtro",
"to": "A",
"start-date": "Fecha de inicio",
"end-date": "Fecha final",
"reset": "Restablecer",
"no-condition": "Ninguna condición"
}
17 changes: 16 additions & 1 deletion public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,20 @@
"export": "Exportation",
"time-range": "Plage de temps",
"all": "Tous",
"exporting": "Exporter..."
"exporting": "Exporter...",
"has-image": "A l'image",
"has-link": "A le lien",
"filter-settings": "Paramètres du filtre",
"tag-status": "Statut de l'étiquette",
"all-notes": "Toutes les notes",
"with-tags": "Avec Tags",
"without-tags": "Sans étiquette",
"select-tags": "Sélectionner les étiquettes",
"additional-conditions": "Conditions supplémentaires",
"apply-filter": "Appliquer le filtre",
"to": "Pour",
"start-date": "Date de début",
"end-date": "Date de fin",
"reset": "Remise à zéro",
"no-condition": "Pas de condition"
}
17 changes: 16 additions & 1 deletion public/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,20 @@
"export": "輸出",
"time-range": "時間範囲",
"all": "すべて",
"exporting": "輸出..."
"exporting": "輸出...",
"has-image": "イメージ",
"has-link": "リンクあり",
"filter-settings": "フィルター設定",
"tag-status": "タグステータス",
"all-notes": "すべての注意事項",
"with-tags": "タグ付き",
"without-tags": "タグなし",
"select-tags": "タグを選択",
"additional-conditions": "追加条件",
"apply-filter": "フィルタを適用する",
"to": "",
"start-date": "開始日",
"end-date": "終了日",
"reset": "リセット",
"no-condition": "コンディションなし"
}
17 changes: 16 additions & 1 deletion public/locales/ko/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,20 @@
"export": "내보내기",
"time-range": "시간 범위",
"all": "모두",
"exporting": "내보내기..."
"exporting": "내보내기...",
"has-image": "이미지 있음",
"has-link": "링크 있음",
"filter-settings": "필터 설정",
"tag-status": "태그 상태",
"all-notes": "모든 메모",
"with-tags": "태그 포함",
"without-tags": "태그 없음",
"select-tags": "태그 선택",
"additional-conditions": "추가 조건",
"apply-filter": "필터 적용",
"to": "To",
"start-date": "시작 날짜",
"end-date": "종료 날짜",
"reset": "초기화",
"no-condition": "조건 없음"
}
17 changes: 16 additions & 1 deletion public/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,5 +225,20 @@
"export": "Exportação",
"time-range": "Intervalo de tempo",
"all": "Todos",
"exporting": "Exportar..."
"exporting": "Exportar...",
"has-image": "Tem imagem",
"has-link": "Tem ligação",
"filter-settings": "Definições do filtro",
"tag-status": "Estado da etiqueta",
"all-notes": "Todas as notas",
"with-tags": "Com etiquetas",
"without-tags": "Sem etiquetas",
"select-tags": "Selecionar etiquetas",
"additional-conditions": "Condições adicionais",
"apply-filter": "Aplicar filtro",
"to": "Para",
"start-date": "Data de início",
"end-date": "Data final",
"reset": "Reiniciar",
"no-condition": "Sem condição"
}
17 changes: 16 additions & 1 deletion public/locales/ru/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,20 @@
"export": "Экспорт",
"time-range": "Диапазон времени",
"all": "Все",
"exporting": "Экспорт..."
"exporting": "Экспорт...",
"has-image": "Имеет изображение",
"has-link": "Имеет ссылку",
"filter-settings": "Настройки фильтра",
"tag-status": "Статус тега",
"all-notes": "Все заметки",
"with-tags": "С тегами",
"without-tags": "Без тегов",
"select-tags": "Выберите теги",
"additional-conditions": "Дополнительные условия",
"apply-filter": "Применить фильтр",
"to": "На",
"start-date": "Дата начала",
"end-date": "Дата окончания",
"reset": "Сброс",
"no-condition": "Нет условий"
}
17 changes: 16 additions & 1 deletion public/locales/zh-TW/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,20 @@
"export": "导出",
"time-range": "时间范围",
"all": "全部",
"exporting": "正在导出..."
"exporting": "正在导出...",
"has-image": "有图像",
"has-link": "有链接",
"filter-settings": "过滤器设置",
"tag-status": "标签状态",
"all-notes": "所有说明",
"with-tags": "带标签",
"without-tags": "无标签",
"select-tags": "选择标签",
"additional-conditions": "附加条件",
"apply-filter": "应用过滤器",
"to": "",
"start-date": "开始日期",
"end-date": "结束日期",
"reset": "重置",
"no-condition": "无条件"
}
22 changes: 19 additions & 3 deletions public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"set-as-public": "设置为公开",
"unset-as-public": "取消公开",
"with-link": "带链接",
"has-file": "有文件",
"has-file": "包含文件",
"no-tag": "无标签",
"created-at": "",
"user-list": "用户列表",
Expand Down Expand Up @@ -165,7 +165,7 @@
"if-you-have-a-lot-of-notes-you-may-consume-a-certain-number-of-tokens": "如果您有大量笔记,您可能会消耗一定数量的代币",
"force-rebuild": "强制重建",
"force-rebuild-embedding-index": "强制重建将完全重建已索引的所有数据",
"embedding-model-description": "切换嵌入式模型后必须重建索引",
"embedding-model-description": "切换��入式模型后必须重建索引",
"top-k-description": "最终返回文件的最大数量",
"embedding-score-description": "查询的相似性阈值通常是欧氏总和距离",
"embedding-lambda-description": "查询结果多样性加权参数",
Expand Down Expand Up @@ -234,5 +234,21 @@
"export": "导出",
"time-range": "时间范围",
"all": "全部",
"exporting": "正在导出..."
"exporting": "正在导出...",
"filter-settings": "筛选设置",
"date-range": "时间范围",
"start-date": "开始日期",
"end-date": "结束日期",
"tag-status": "标签状态",
"all-notes": "所有笔记",
"with-tags": "包含标签",
"without-tags": "不包含标签",
"select-tags": "选择标签",
"additional-conditions": "附加条件",
"has-image": "包含图片",
"has-link": "包含链接",
"apply-filter": "应用筛选",
"to": "",
"reset": "重置",
"no-condition": "无条件"
}
4 changes: 3 additions & 1 deletion src/components/BlinkoCard/cardHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export const CardHeader = ({ blinkoItem, blinko, isShareMode, isExpanded }: Card
content={blinkoItem.content + `\n${blinkoItem.attachments?.map(i => window.location.origin + i.path).join('\n')}`}
/>

<ShareButton blinkoItem={blinkoItem} blinko={blinko} isIOSDevice={isIOSDevice} />
{!isShareMode && (
<ShareButton blinkoItem={blinkoItem} blinko={blinko} isIOSDevice={isIOSDevice} />
)}

{blinkoItem.isTop && (
<Icon
Expand Down
4 changes: 3 additions & 1 deletion src/components/BlinkoCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const BlinkoCard = observer(({ blinkoItem, isShareMode = false }: BlinkoC
const isPc = useMediaQuery('(min-width: 768px)');
const blinko = RootStore.Get(BlinkoStore);
const [isExpanded, setIsExpanded] = useState(false);
const { query, pathname } = useRouter();
const { pathname } = useRouter();

useHistoryBack({
state: isExpanded,
Expand Down Expand Up @@ -65,10 +65,12 @@ export const BlinkoCard = observer(({ blinkoItem, isShareMode = false }: BlinkoC
};

const handleContextMenu = () => {
if (isShareMode) return;
blinko.curSelectedNote = _.cloneDeep(blinkoItem);
};

const handleDoubleClick = (e: React.MouseEvent) => {
if (isShareMode) return;
blinko.curSelectedNote = _.cloneDeep(blinkoItem);
ShowEditBlinkoModel();
FocusEditor(true)
Expand Down
8 changes: 6 additions & 2 deletions src/components/BlinkoCard/noteContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,30 @@ import { MarkdownRender } from '@/components/Common/MarkdownRender';
import { FilesAttachmentRender } from "../Common/AttachmentRender";
import { Note } from '@/server/types';
import { BlinkoStore } from '@/store/blinkoStore';
import { observer } from 'mobx-react-lite';

interface NoteContentProps {
blinkoItem: Note;
blinko: BlinkoStore;
isExpanded?: boolean;
isShareMode?: boolean;
}

export const NoteContent = ({ blinkoItem, blinko, isExpanded }: NoteContentProps) => {
export const NoteContent = observer(({ blinkoItem, blinko, isExpanded, isShareMode }: NoteContentProps) => {
return (
<>
<MarkdownRender
content={blinkoItem.content}
onChange={(newContent) => {
if (isShareMode) return;
blinkoItem.content = newContent
blinko.upsertNote.call({ id: blinkoItem.id, content: newContent, refresh: false })
}}
isShareMode={isShareMode}
/>
<div className={blinkoItem.attachments?.length != 0 ? 'my-2' : ''}>
<FilesAttachmentRender files={blinkoItem.attachments ?? []} preview />
</div>
</>
);
};
});
15 changes: 7 additions & 8 deletions src/components/Common/Editor/editorStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ export class EditorStore {
}

replaceMarkdownTag = (text: string, forceFocus = false) => {
console.log('replaceMarkdownTag', this.mdxEditorRef)
if (this.mdxEditorRef?.current) {
if (this.lastRange) {
console.log('replaceMarkdownTag', this.lastRangeText)
const currentTextBeforeRange = this.lastRangeText.replace(/&#x20;/g, " ") ?? ''
const currentText = this.mdxEditorRef?.current!.getMarkdown().replace(/\\/g, '').replace(/&#x20;/g, " ")
const tag = currentTextBeforeRange.replace(helper.regex.isEndsWithHashTag, "#" + text + '&#x20;')
Expand Down Expand Up @@ -170,12 +168,13 @@ export class EditorStore {
handlePopTag = () => {
const selection = window.getSelection();
if (selection!.rangeCount > 0) {
if (!IsTagSelectVisible()) {
let lastRange = selection!.getRangeAt(0);
this.lastRange = lastRange
this.lastRangeText = lastRange.endContainer.textContent?.slice(0, lastRange.endOffset) ?? ''
this.lastSelection = selection
}
// if (!IsTagSelectVisible()) {
let lastRange = selection!.getRangeAt(0);
this.lastRange = lastRange
this.lastRangeText = lastRange.endContainer.textContent?.slice(0, lastRange.endOffset) ?? ''
// console.log('this.lastRangeText', this.lastRangeText)
this.lastSelection = selection
// }
const hasHashTagRegex = /#[^\s#]+/g
const endsWithBankRegex = /\s$/g
const currentText = this.lastRange?.startContainer.textContent?.slice(0, this.lastRange?.endOffset) ?? ''
Expand Down
8 changes: 5 additions & 3 deletions src/components/Common/MarkdownRender/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ interface CodeProps {
export const Code = ({ className, children, ...props }: CodeProps) => {
const { theme } = useTheme()
const match = /language-(\w+)/.exec(className || '');

return match ? (

const shouldHighlight = !className || className?.includes('language-') || className?.includes('hljs');

return shouldHighlight ? (
<div className="relative group">
<Copy content={String(children).replace(/\n$/, '')} size={16} className="absolute right-2 top-2 opacity-0 group-hover:opacity-100 transition-opacity" />
<SyntaxHighlighter
{...props}
PreTag="div"
children={String(children).replace(/\n$/, '')}
language={match[1]}
language={match ? match[1] : 'text'}
customStyle={{
borderRadius: '16px',
}}
Expand Down
Loading

0 comments on commit ae7855a

Please sign in to comment.