diff --git a/manifest.json b/manifest.json index 400109f..670b0ba 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "gridexplorer", "name": "GridExplorer", - "version": "2.7.5", + "version": "2.7.6", "minAppVersion": "1.1.0", "description": "Browse note files in a grid view.", "author": "Devon22", diff --git a/package-lock.json b/package-lock.json index 9582307..fe1ac57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gridexplorer", - "version": "2.7.5", + "version": "2.7.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gridexplorer", - "version": "2.7.5", + "version": "2.7.6", "license": "MIT", "devDependencies": { "@types/node": "^16.11.6", diff --git a/package.json b/package.json index 308ad87..44c98a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gridexplorer", - "version": "2.7.5", + "version": "2.7.6", "description": "Browse note files in a grid view.", "main": "main.js", "scripts": { diff --git a/src/GridView.ts b/src/GridView.ts index c64de77..035c8ce 100644 --- a/src/GridView.ts +++ b/src/GridView.ts @@ -12,6 +12,7 @@ import { showFolderRenameModal } from './modal/folderRenameModal'; import { moveFolderSuggestModal } from './modal/moveFolderSuggestModal'; import { showSearchModal } from './modal/searchModal'; import { CustomModeModal } from './modal/customModeModal'; +import { ShortcutSelectionModal } from './modal/shortcutSelectionModal'; import { FloatingAudioPlayer } from './floatingAudioPlayer'; import { t } from './translations'; @@ -57,9 +58,8 @@ export class GridView extends ItemView { baseCardLayout: 'horizontal' | 'vertical' = 'horizontal'; // 使用者在設定或 UI 中選擇的基礎卡片樣式(不受資料夾臨時覆蓋影響) cardLayout: 'horizontal' | 'vertical' = 'horizontal'; // 目前實際使用的卡片樣式(可能被資料夾 metadata 臨時覆蓋) private renderToken: number = 0; // 用於取消尚未完成之批次排程的遞增令牌 - // 筆記檢視相關 - private isShowingNote: boolean = false; - private noteViewContainer: HTMLElement | null = null; + private isShowingNote: boolean = false; // 是否正在顯示筆記 + private noteViewContainer: HTMLElement | null = null; // 筆記檢視容器 constructor(leaf: WorkspaceLeaf, plugin: GridExplorerPlugin) { super(leaf); @@ -171,7 +171,8 @@ export class GridView extends ItemView { } } - // 當 resetScroll 為 true 時,會將捲動位置重置到最頂部 + // resetScroll 為 true 時,會將捲動位置重置到最頂部 + // recordHistory 為 false 時,不會將當前狀態加入歷史記錄 async setSource(mode: string, path = '', resetScroll = false, recordHistory = true) { // 如果新的狀態與當前狀態相同,則不進行任何操作 if (this.sourceMode === mode && this.sourcePath === path) { @@ -474,6 +475,14 @@ export class GridView extends ItemView { } }); }); + // 新增捷徑 + menu.addItem((item) => { + item.setTitle(t('new_shortcut')) + .setIcon('shuffle') + .onClick(async () => { + this.showShortcutSelectionModal(); + }); + }); menu.showAtMouseEvent(event); }); @@ -2222,6 +2231,15 @@ export class GridView extends ItemView { } fileEl.style.height = '100%'; } + + // 如果 frontmatter 中存在 redirect 欄位,將圖示設為 shuffle + const redirectValue = metadata?.redirect; + if (redirectValue) { + const iconContainer = fileEl.querySelector('.ge-icon-container'); + if (iconContainer) { + setIcon(iconContainer as HTMLElement, 'shuffle'); + } + } } imageUrl = await findFirstImageInNote(this.app, content); @@ -2705,7 +2723,46 @@ export class GridView extends ItemView { } } else { // 開啟文件檔案 - this.app.workspace.getLeaf().openFile(file); + const fileCache = this.app.metadataCache.getFileCache(file); + const redirectType = fileCache?.frontmatter?.type; + const redirectPath = fileCache?.frontmatter?.redirect; + + if (redirectType && typeof redirectPath === 'string' && redirectPath.trim() !== '') { + let target; + + if (redirectType === 'file') { + if (redirectPath.startsWith('[[') && redirectPath.endsWith(']]')) { + const noteName = redirectPath.slice(2, -2); + target = this.app.metadataCache.getFirstLinkpathDest(noteName, file.path); + } else { + target = this.app.vault.getAbstractFileByPath(normalizePath(redirectPath)); + } + + if (target instanceof TFile) { + this.app.workspace.getLeaf().openFile(target); + } else { + new Notice(`${t('target_not_found')}: ${redirectPath}`); + } + } + else if (redirectType === 'folder') { + // 判斷redirectPath是否為資料夾 + if (this.app.vault.getAbstractFileByPath(normalizePath(redirectPath)) instanceof TFolder) { + this.setSource('folder', redirectPath, true); + this.clearSelection(); + } else { + new Notice(`${t('target_not_found')}: ${redirectPath}`); + } + } else if (redirectType === 'mode') { + // 判斷redirectPath是否為模式 + this.setSource(redirectPath, '', true); + this.clearSelection(); + } else { + new Notice(`${t('target_not_found')}: ${redirectPath}`); + } + } else { + // 沒有 redirect 就正常開啟當前檔案 + this.app.workspace.getLeaf().openFile(file); + } } } }); @@ -3181,6 +3238,56 @@ export class GridView extends ItemView { this.isShowingNote = false; } + // 顯示捷徑選擇 Modal + showShortcutSelectionModal() { + const modal = new ShortcutSelectionModal(this.app, this.plugin, async (option) => { + await this.createShortcut(option); + }); + modal.open(); + } + + // 創建捷徑檔案 + private async createShortcut(option: { type: 'mode' | 'folder' | 'file'; value: string; display: string; }) { + try { + // 生成不重複的檔案名稱 + let counter = 0; + let shortcutName = `${option.display}`; + let newPath = `${shortcutName}.md`; + while (this.app.vault.getAbstractFileByPath(newPath)) { + counter++; + shortcutName = `${option.display} ${counter}`; + newPath = `${shortcutName}.md`; + } + + // 創建新檔案 + const newFile = await this.app.vault.create(newPath, ''); + + // 使用 processFrontMatter 來更新 frontmatter + await this.app.fileManager.processFrontMatter(newFile, (frontmatter: any) => { + if (option.type === 'mode') { + frontmatter.type = 'mode'; + frontmatter.redirect = option.value; + } else if (option.type === 'folder') { + frontmatter.type = 'folder'; + frontmatter.redirect = option.value; + } else if (option.type === 'file') { + const link = this.app.fileManager.generateMarkdownLink( + this.app.vault.getAbstractFileByPath(option.value) as TFile, + "" + ); + frontmatter.type = "file"; + frontmatter.redirect = link; + } + }); + + new Notice(`${t('shortcut_created')}: ${shortcutName}`); + + } catch (error) { + console.error('Create shortcut error', error); + new Notice(t('Failed to create shortcut')); + } + } + // 保存視圖狀態 getState() { return { @@ -3201,6 +3308,7 @@ export class GridView extends ItemView { hideHeaderElements: this.hideHeaderElements, showDateDividers: this.showDateDividers, showNoteTags: this.showNoteTags, + recentSources: this.recentSources, } }; } @@ -3223,6 +3331,7 @@ export class GridView extends ItemView { this.hideHeaderElements = state.state.hideHeaderElements ?? false; this.showDateDividers = state.state.showDateDividers ?? this.plugin.settings.dateDividerMode !== 'none'; this.showNoteTags = state.state.showNoteTags ?? this.plugin.settings.showNoteTags; + this.recentSources = state.state.recentSources ?? []; this.render(); } } diff --git a/src/main.ts b/src/main.ts index 9f7572c..dee9301 100644 --- a/src/main.ts +++ b/src/main.ts @@ -144,6 +144,7 @@ export default class GridExplorerPlugin extends Plugin { }); } if (file instanceof TFile) { + // 開啟筆記 menu.addItem(item => { item.setTitle(t('open_in_grid_view')); item.setIcon('grid'); @@ -190,6 +191,27 @@ export default class GridExplorerPlugin extends Plugin { }); } }); + // 搜尋選取的筆記名稱 + const link = this.app.fileManager.generateMarkdownLink(file, ""); + const truncatedText = file.basename.length > 20 ? file.basename.substring(0, 20) + '...' : file.basename; + const menuItemTitle = t('search_selection_in_grid_view').replace('...', `「[[${truncatedText}]]」`); // 假設翻譯中有...代表要替換的部分,或者直接格式化 + menu.addItem(item => { + item + .setTitle(menuItemTitle) + .setIcon('search') + .setSection?.("view") + .onClick(async () => { + // 取得或啟用 GridView + const view = await this.activateView('',''); + if (view instanceof GridView) { + // 設定搜尋模式和關鍵字 + view.searchQuery = link; + // 重新渲染視圖 + view.render(true); // resetScroll = true + } + }); + }); + // 顯示筆記屬性 menu.addItem((item) => { item .setTitle(t('set_note_attribute')) diff --git a/src/modal/noteSettingsModal.ts b/src/modal/noteSettingsModal.ts index 4230c91..89ef662 100644 --- a/src/modal/noteSettingsModal.ts +++ b/src/modal/noteSettingsModal.ts @@ -124,6 +124,15 @@ export class NoteSettingsModal extends Modal { // 按鈕區域 const buttonSetting = new Setting(contentEl); + // 支援多檔案時仍顯示新增重定向筆記按鈕 + buttonSetting.addButton(button => { + button + .setButtonText(t('create_shortcut')) + .onClick(async () => { + await this.createShortcut(); + }); + }); + // 顯示確認按鈕在右側 buttonSetting.addButton(button => { button @@ -136,6 +145,46 @@ export class NoteSettingsModal extends Modal { }); } + // 創建重定向筆記 + private async createShortcut() { + try { + for (const originalFile of this.files) { + const originalName = originalFile.basename; + const extension = originalFile.extension; + + // 生成不重複的新檔案路徑 + let counter = 0; + let redirectName = `📄 ${originalName}`; + let newPath = `${originalFile.parent?.path || ''}/${redirectName}.${extension}`; + while (this.app.vault.getAbstractFileByPath(newPath)) { + counter++; + redirectName = `${originalName} ${counter}`; + newPath = `${originalFile.parent?.path || ''}/${redirectName}.${extension}`; + } + + // 創建新檔案(先不包含 frontmatter) + const newFile = await this.app.vault.create(newPath, ''); + + // 使用 processFrontMatter 來更新 frontmatter + await this.app.fileManager.processFrontMatter(newFile, (frontmatter: any) => { + // 設置 redirect 和 summary + const link = this.app.fileManager.generateMarkdownLink(originalFile, ""); + frontmatter.type = "file"; + frontmatter.redirect = link; + }); + } + + // 等待一小段時間以確保 metadata cache 已更新 + setTimeout(() => {}, 200); + + // 關閉 modal + this.close(); + + } catch (error) { + console.error('Create redirect note error', error); + } + } + // 讀取現有筆記的設定 async loadAttributes() { try { diff --git a/src/modal/shortcutSelectionModal.ts b/src/modal/shortcutSelectionModal.ts new file mode 100644 index 0000000..aa6d358 --- /dev/null +++ b/src/modal/shortcutSelectionModal.ts @@ -0,0 +1,161 @@ +import { App, Modal, TFolder, TFile, FuzzySuggestModal } from 'obsidian'; +import GridExplorerPlugin from '../main'; +import { t } from '../translations'; + +interface ShortcutOption { + type: 'mode' | 'folder' | 'file'; + value: string; + display: string; +} + +export class ShortcutSelectionModal extends Modal { + plugin: GridExplorerPlugin; + onSubmit: (option: ShortcutOption) => void; + + constructor(app: App, plugin: GridExplorerPlugin, onSubmit: (option: ShortcutOption) => void) { + super(app); + this.plugin = plugin; + this.onSubmit = onSubmit; + } + + onOpen() { + const { contentEl } = this; + contentEl.empty(); + + // 添加標題 + contentEl.createEl('h2', { text: t('create_shortcut') }); + + // 資料夾選擇按鈕 + const folderButton = contentEl.createDiv('shortcut-option-button'); + folderButton.createSpan({ text: `📂 ${t('select_folder')}`}); + + // 點擊資料夾按鈕時打開資料夾選擇模態框 + folderButton.addEventListener('click', () => { + new FolderSuggestionModal(this.app, (folder) => { + // 當選擇資料夾後,調用回調並關閉模態框 + this.onSubmit({ + type: 'folder', + value: folder.path, + display: `📂 ${folder.name}` + }); + this.close(); + }).open(); + }); + + // 檔案選擇按鈕 + const fileButton = contentEl.createDiv('shortcut-option-button'); + fileButton.createSpan({ text: `📄 ${t('select_file')}`}); + + // 點擊檔案按鈕時打開檔案選擇模態框 + fileButton.addEventListener('click', () => { + new FileSuggestionModal(this.app, (file) => { + // 當選擇檔案後,調用回調並關閉模態框 + this.onSubmit({ + type: 'file', + value: file.path, + display: `📄 ${file.basename}` + }); + this.close(); + }).open(); + }); + + // 初始化模式選項,先添加自定義模式 + const modeOptions: ShortcutOption[] = []; + + // 添加所有自定義模式 + this.plugin.settings.customModes.forEach(mode => { + modeOptions.push({ + type: 'mode', + value: mode.internalName, + display: `🧩 ${mode.displayName}` + }); + }); + + // 添加內建模式 + modeOptions.push( + { type: 'mode', value: 'bookmarks', display: `📑 ${t('bookmarks_mode')}` }, + { type: 'mode', value: 'search', display: `🔎 ${t('search_results')}` }, + { type: 'mode', value: 'backlinks', display: `🔗 ${t('backlinks_mode')}` }, + { type: 'mode', value: 'outgoinglinks', display: `🔗 ${t('outgoinglinks_mode')}` }, + { type: 'mode', value: 'all-files', display: `📔 ${t('all_files_mode')}` }, + { type: 'mode', value: 'recent-files', display: `📅 ${t('recent_files_mode')}` }, + { type: 'mode', value: 'random-note', display: `🎲 ${t('random_note_mode')}` }, + { type: 'mode', value: 'tasks', display: `☑️ ${t('tasks_mode')}` } + ); + + if (modeOptions.length > 0) { + // 創建區塊容器 + const section = contentEl.createDiv('shortcut-section'); + + // 為每個選項創建按鈕 + modeOptions.forEach(option => { + const button = section.createDiv('shortcut-option-button'); + + // 添加顯示文字 + button.createSpan({ text: option.display }); + + // 點擊事件處理 + button.addEventListener('click', () => { + this.onSubmit(option); + this.close(); + }); + }); + } + } + + onClose() { + const { contentEl } = this; + contentEl.empty(); + } +} + +// 選擇資料夾 +class FolderSuggestionModal extends FuzzySuggestModal { + onSubmit: (folder: TFolder) => void; + + constructor(app: App, onChoose: (folder: TFolder) => void) { + super(app); + this.onSubmit = onChoose; + } + + // 獲取所有可選的資料夾 + getItems(): TFolder[] { + return this.app.vault.getAllLoadedFiles().filter((file): file is TFolder => file instanceof TFolder); + } + + // 獲取資料夾的顯示文本 + getItemText(folder: TFolder): string { + return folder.path; + } + + // 當選擇資料夾時調用 + onChooseItem(folder: TFolder, evt: MouseEvent | KeyboardEvent) { + this.onSubmit(folder); + } +} + +// 選擇檔案 +class FileSuggestionModal extends FuzzySuggestModal { + // 提交回調函數 + onSubmit: (file: TFile) => void; + + constructor(app: App, onChoose: (file: TFile) => void) { + super(app); + this.onSubmit = onChoose; + } + + // 獲取所有可選的 Markdown 檔案 + getItems(): TFile[] { + return this.app.vault.getMarkdownFiles(); + } + + // 獲取檔案的顯示文本 + getItemText(file: TFile): string { + return file.path; + } + + // 當選擇檔案時調用 + onChooseItem(file: TFile, evt: MouseEvent | KeyboardEvent) { + this.onSubmit(file); + } +} diff --git a/src/settings.ts b/src/settings.ts index 95f6118..4cb8824 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -114,8 +114,8 @@ export const DEFAULT_SETTINGS: GallerySettings = { dateDividerMode: 'none', // 預設不使用日期分隔器 showCodeBlocksInSummary: false, // 預設不在摘要中顯示程式碼區塊 folderNoteDisplaySettings: 'default', // 預設不處理資料夾筆記 - interceptAllTagClicks: false, // 預設不攔截所有tag點擊事件 - interceptBreadcrumbClicks: false, // 預設不攔截Breadcrumb點擊事件 + interceptAllTagClicks: true, // 預設攔截所有tag點擊事件 + interceptBreadcrumbClicks: true, // 預設攔截Breadcrumb點擊事件 customModes: [ { internalName: 'custom-1750837329297', diff --git a/src/translations.ts b/src/translations.ts index 00c340f..dc9c238 100644 --- a/src/translations.ts +++ b/src/translations.ts @@ -38,6 +38,7 @@ export const TRANSLATIONS: Translations = { 'new_note': '新增筆記', 'new_folder': '新增資料夾', 'new_canvas': '新增畫布', + 'new_shortcut': '新增捷徑', 'delete_folder': '刪除資料夾', 'move_folder': '搬移資料夾', 'select_destination_folder': '選擇目標資料夾', @@ -160,6 +161,7 @@ export const TRANSLATIONS: Translations = { 'custom_mode_dataview_code_desc': '輸入 Dataviewjs 代碼以取得檔案列表', 'custom_mode_sub_options': '自訂模式子選項', 'custom_mode_fields_placeholder': '輸入 frontmatter 欄位名稱,用逗號分隔 (如: date,category,status) (可選)', + 'dataview_plugin_not_enabled': 'Dataview 外掛未啟用', 'show_bookmarks_mode': '顯示書籤模式', 'show_search_mode': '顯示搜尋結果模式', 'show_backlinks_mode': '顯示反向連結模式', @@ -183,11 +185,6 @@ export const TRANSLATIONS: Translations = { // 隱藏頂部元素 'hide_header_elements': '隱藏頂部元素', - - // 顯示"返回上層資料夾"選項設定 - 'show_parent_folder_item': '顯示「返回上層資料夾」', - 'show_parent_folder_item_desc': '在網格的第一項顯示「返回上層資料夾」選項', - 'parent_folder': '上層資料夾', // 預設開啟位置設定 'default_open_location': '預設開啟位置', @@ -230,6 +227,14 @@ export const TRANSLATIONS: Translations = { 'no_files': '沒有找到任何檔案', 'filter_folders': '篩選資料夾...', + // 快捷方式選擇對話框 + 'create_shortcut': '建立捷徑', + 'select_folder': '選擇資料夾', + 'select_file': '選擇檔案', + 'target_not_found': '目標未找到', + 'shortcut_created': '捷徑已建立', + 'failed_to_create_shortcut': '建立捷徑失敗', + // 資料夾筆記設定對話框 'folder_note_settings': '資料夾筆記設定', 'folder_sort_type': '資料夾排序方式', @@ -307,6 +312,7 @@ export const TRANSLATIONS: Translations = { 'new_note': 'New note', 'new_folder': 'New folder', 'new_canvas': 'New canvas', + 'new_shortcut': 'New shortcut', 'delete_folder': 'Delete Folder', 'move_folder': 'Move Folder', 'select_destination_folder': 'Select destination folder', @@ -429,6 +435,7 @@ export const TRANSLATIONS: Translations = { 'custom_mode_dataview_code_desc': 'Enter a Dataview query to get the list of files', 'custom_mode_sub_options': 'Custom Mode Sub Options', 'custom_mode_fields_placeholder': 'Enter frontmatter field names, separated by commas (e.g. date,category,status) (optional)', + 'dataview_plugin_not_enabled': 'Dataview plugin is not enabled', 'show_bookmarks_mode': 'Show bookmarks mode', 'show_search_mode': 'Show search results mode', 'show_backlinks_mode': 'Show backlinks mode', @@ -453,11 +460,6 @@ export const TRANSLATIONS: Translations = { // Hide header elements setting 'hide_header_elements': 'Hide header elements', - // Show "Parent Folder" option setting - 'show_parent_folder_item': 'Show "Parent Folder" item', - 'show_parent_folder_item_desc': 'Show a "Parent Folder" item as the first item in the grid', - 'parent_folder': 'Parent Folder', - // Default open location setting 'default_open_location': 'Default open location', 'default_open_location_desc': 'Set the default location to open the grid view', @@ -499,6 +501,14 @@ export const TRANSLATIONS: Translations = { 'no_files': 'No files found', 'filter_folders': 'Filter folders...', + // Shortcut Selection Dialog + 'create_shortcut': 'Create Shortcut', + 'select_folder': 'Select Folder', + 'select_file': 'Select File', + 'target_not_found': 'Target not found', + 'shortcut_created': 'Shortcut created', + 'failed_to_create_shortcut': 'Failed to create shortcut', + // Folder Note Settings Dialog 'folder_note_settings': 'Folder Note Settings', 'folder_sort_type': 'Folder Sort Type', @@ -576,6 +586,7 @@ export const TRANSLATIONS: Translations = { 'new_note': '新建笔记', 'new_folder': '新建文件夹', 'new_canvas': '新建画布', + 'new_shortcut': '新建快捷方式', 'delete_folder': '删除文件夹', 'untitled': '未命名', 'files': '个文件', @@ -696,6 +707,7 @@ export const TRANSLATIONS: Translations = { 'custom_mode_dataview_code_desc': '输入 Dataviewjs 代码以获取文件列表', 'custom_mode_sub_options': '自定义模式子选项', 'custom_mode_fields_placeholder': '输入 frontmatter 栏位名称,用逗号分隔 (如: date,category,status) (可选)', + 'dataview_plugin_not_enabled': 'Dataview 外掛未啟用', 'show_bookmarks_mode': '显示书签模式', 'show_search_mode': '显示搜索结果模式', 'show_backlinks_mode': '显示反向链接模式', @@ -720,11 +732,6 @@ export const TRANSLATIONS: Translations = { // 隐藏頂部元素 'hide_header_elements': '隱藏頂部元素', - // 显示"返回上级文件夹"选项设置 - 'show_parent_folder_item': '显示「返回上级文件夹」', - 'show_parent_folder_item_desc': '在网格的第一项显示「返回上级文件夹」选项', - 'parent_folder': '上级文件夹', - // 默认打开位置设置 'default_open_location': '默认打开位置', 'default_open_location_desc': '设置网格视图默认打开的位置', @@ -766,6 +773,14 @@ export const TRANSLATIONS: Translations = { 'no_files': '没有找到任何文件', 'filter_folders': '筛选文件夹...', + // 快捷方式选择对话框 + 'create_shortcut': '创建快捷方式', + 'select_folder': '选择文件夹', + 'select_file': '选择文件', + 'target_not_found': '目标未找到', + 'shortcut_created': '快捷方式已创建', + 'failed_to_create_shortcut': '创建快捷方式失败', + // 文件夹笔记设置对话框 'folder_note_settings': '文件夹笔记设置', 'folder_sort_type': '文件夹排序方式', @@ -843,6 +858,7 @@ export const TRANSLATIONS: Translations = { 'new_note': '新規ノート', 'new_folder': '新規フォルダ', 'new_canvas': '新規キャンバス', + 'new_shortcut': '新規ショートカット', 'delete_folder': '削除フォルダ', 'untitled': '無題', 'files': 'ファイル', @@ -963,6 +979,7 @@ export const TRANSLATIONS: Translations = { 'custom_mode_dataview_code_desc': 'ファイルリストを取得する Dataviewjs コードを入力', 'custom_mode_sub_options': 'カスタムモード子選択肢', 'custom_mode_fields_placeholder': 'frontmatterのフィールド名をカンマ区切りで入力 (例: date,category,status) (任意)', + 'dataview_plugin_not_enabled': 'Dataview プラグインが有効になっていません', 'show_bookmarks_mode': 'ブックマークモードを表示', 'show_search_mode': '検索結果モードを表示', 'show_backlinks_mode': 'バックリンクモードを表示', @@ -987,11 +1004,6 @@ export const TRANSLATIONS: Translations = { // 隠す頂部元素 'hide_header_elements': '頂部元素を隠す', - // "親フォルダ"オプション設定を表示 - 'show_parent_folder_item': '「親フォルダ」項目を表示', - 'show_parent_folder_item_desc': 'グリッドの最初の項目として「親フォルダ」項目を表示します', - 'parent_folder': '親フォルダ', - // 開く場所設定 'default_open_location': 'デフォルトの開く場所', 'default_open_location_desc': 'グリッドビューを開くデフォルトの場所を設定', @@ -1033,6 +1045,14 @@ export const TRANSLATIONS: Translations = { 'no_files': 'ファイルが見つかりません', 'filter_folders': 'フォルダをフィルタリング...', + // ショートカット選択ダイアログ + 'create_shortcut': 'ショートカットを作成', + 'select_folder': 'フォルダを選択', + 'select_file': 'ファイルを選択', + 'target_not_found': '目標が見つかりません', + 'shortcut_created': 'ショートカットが作成されました', + 'failed_to_create_shortcut': 'ショートカットの作成に失敗しました', + // フォルダーノート設定ダイアログ 'folder_note_settings': 'フォルダーノート設定', 'folder_sort_type': 'フォルダの並び替え', @@ -1111,6 +1131,7 @@ export const TRANSLATIONS: Translations = { 'new_note': 'Новая заметка', 'new_folder': 'Новая папка', 'new_canvas': 'Новый канвас', + 'new_shortcut': 'Новый ярлык', 'delete_folder': 'Удалить папку', 'untitled': 'Без названия', 'files': 'файлы', @@ -1231,6 +1252,7 @@ export const TRANSLATIONS: Translations = { 'custom_mode_dataview_code_desc': 'Введите код Dataview для получения списка файлов', 'custom_mode_sub_options': 'Подопции пользовательского режима', 'custom_mode_fields_placeholder': 'Введите названия полей frontmatter через запятую (напр.: date,category,status) (необязательно)', + 'dataview_plugin_not_enabled': 'Dataview плагин не включен', 'show_bookmarks_mode': 'Показывать режим закладок', 'show_search_mode': 'Показывать режим результатов поиска', 'show_backlinks_mode': 'Показывать режим обратных ссылок', @@ -1255,11 +1277,6 @@ export const TRANSLATIONS: Translations = { // Hide header elements setting 'hide_header_elements': 'Скрыть элементы заголовка', - // Show "Parent Folder" option setting - 'show_parent_folder_item': 'Показывать элемент "Родительская папка"', - 'show_parent_folder_item_desc': 'Показывать элемент "Родительская папка" первым в сетке', - 'parent_folder': 'Родительская папка', - // Default open location setting 'default_open_location': 'Место открытия по умолчанию', 'default_open_location_desc': 'Установите место открытия сеточного вида по умолчанию', @@ -1301,6 +1318,14 @@ export const TRANSLATIONS: Translations = { 'no_files': 'Файлы не найдены', 'filter_folders': 'Фильтровать папки...', + // + 'create_shortcut': 'Создать ярлик', + 'select_folder': 'Выбрать папку', + 'select_file': 'Выбрать файл', + 'target_not_found': 'Цель не найдена', + 'shortcut_created': 'Ярлик создан', + 'failed_to_create_shortcut': 'Не удалось создать ярлик', + // Folder Note Settings Dialog 'folder_note_settings': 'Настройки заметки папки', 'folder_sort_type': 'Тип сортировки папки', @@ -1378,6 +1403,7 @@ export const TRANSLATIONS: Translations = { 'new_note': 'Нова нотатка', 'new_folder': 'Нова папка', 'new_canvas': 'Новий канвас', + 'new_shortcut': 'Новий ярлик', 'delete_folder': 'Видалити папку', 'untitled': 'Без назви', 'files': 'файли', @@ -1498,6 +1524,7 @@ export const TRANSLATIONS: Translations = { 'custom_mode_dataview_code_desc': 'Введіть код Dataview для отримання списку файлів', 'custom_mode_sub_options': 'Підпараметри користувацького режиму', 'custom_mode_fields_placeholder': 'Введіть назви полів frontmatter через кому (напр.: date,category,status) (необязательно)', + 'dataview_plugin_not_enabled': 'Dataview плагін не включений', 'show_bookmarks_mode': 'Показувати режим закладок', 'show_search_mode': 'Показувати режим результатів пошуку', 'show_backlinks_mode': 'Показувати режим зворотних посилань', @@ -1522,11 +1549,6 @@ export const TRANSLATIONS: Translations = { // Hide header elements setting 'hide_header_elements': 'Скрыть элементы заголовка', - // Show "Parent Folder" option setting - 'show_parent_folder_item': 'Показувати елемент "Батьківська папка"', - 'show_parent_folder_item_desc': 'Показувати елемент "Батьківська папка" першим у сітці', - 'parent_folder': 'Батьківська папка', - // Default open location setting 'default_open_location': 'Місце відкриття за замовчуванням', 'default_open_location_desc': 'Встановіть місце відкриття сіткового вигляду за замовчуванням', @@ -1568,6 +1590,14 @@ export const TRANSLATIONS: Translations = { 'no_files': 'Файли не знайдено', 'filter_folders': 'Фільтрувати папки...', + // Shortcut Selection Dialog + 'create_shortcut': 'Створити ярлик', + 'select_folder': 'Вибрати папку', + 'select_file': 'Вибрати файл', + 'target_not_found': 'Цель не знайдена', + 'shortcut_created': 'Ярлик створений', + 'failed_to_create_shortcut': 'Не вдалося створити ярлик', + // Folder Note Settings Dialog 'folder_note_settings': 'Налаштування нотатки папки', 'folder_sort_type': 'Тип сортування папки', diff --git a/styles.css b/styles.css index 1464f4d..3ce59f2 100644 --- a/styles.css +++ b/styles.css @@ -1737,7 +1737,7 @@ a.ge-current-folder:hover { color: var(--text-normal); } -.ge-note-content > p:first-of-type { +.ge-note-content > p:nth-child(2) { margin-block-start: 0; } @@ -1817,4 +1817,57 @@ a.ge-current-folder:hover { .is-mobile .ge-note-view-container::-webkit-scrollbar { display: none !important; width: 0 !important; +} + +/* --------------------------------------------------------------------------- */ + +/* 捷徑選擇 Modal Shortcut Selection Modal */ +.shortcut-section { + margin-bottom: 20px; +} + +.shortcut-section h3 { + margin: 0 0 10px 0; + color: var(--text-normal); + font-size: 14px; + font-weight: 600; + border-bottom: 1px solid var(--background-modifier-border); + padding-bottom: 5px; +} + +.shortcut-option-button { + display: flex; + align-items: center; + gap: 10px; + padding: 8px 12px; + margin: 2px 0; + background-color: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-radius: var(--button-radius); + cursor: pointer; + transition: background-color 0.2s, transform 0.1s; +} + +.shortcut-option-button:hover { + background-color: var(--background-modifier-hover); + transform: translateY(-1px); +} + +.shortcut-option-button:active { + transform: translateY(0); +} + +.shortcut-option-icon { + display: flex; + align-items: center; + justify-content: center; + width: 16px; + height: 16px; + color: var(--text-muted); + flex-shrink: 0; +} + +.shortcut-option-icon svg { + width: 16px; + height: 16px; } \ No newline at end of file diff --git a/versions.json b/versions.json index 2df6e7c..f7ad216 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ { - "2.7.5": "1.1.0" + "2.7.6": "1.1.0" } \ No newline at end of file