This repository was archived by the owner on Mar 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 529
Extending blocknote #518
Open
milaiwi
wants to merge
22
commits into
reorproject:main
Choose a base branch
from
milaiwi:extending-blocknote
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Extending blocknote #518
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
d1269bc
Fixed weird margin error on heading. Fixed list numbering bug
milaiwi 1a9dfce
Fixed weird margin error on headings. Fixed list numbering bug
milaiwi 62ad58b
Fixed pasting on non-media files.
milaiwi 6d88c62
Fixed pasting on non-media files.
milaiwi ad9638a
Merged with fix pasting
milaiwi b6c8aeb
Fixed header bugs and pasting bugs
milaiwi 08007bb
Working on cleaning up semantic-similarity
milaiwi 187dab5
Made structural changes to editor -- currentFilePatha and semanticCha…
milaiwi ea0e789
Hard coded double bracket linkage to a file with serialization and pa…
milaiwi 99e7611
Added dynamic linking, just need ot configure it and make it more cle…
milaiwi 44d735a
Able to link between files. Changed editor structure. Fixed logic aro…
milaiwi c1b9a31
Working LinkToolbarPositioner but need to change content that displays
milaiwi 6dddc7d
Added caching for link similar files
milaiwi 14272e1
Working linking between files. Need to create a difference between in…
milaiwi 8387172
Fixed internal and external linking
milaiwi 64878dd
Configuring link layout
milaiwi 5f69f60
Converting to Menu
milaiwi edc6c6c
LinkToolContent working but need to add keystrokes
milaiwi 428f768
Converted XStacks and YStacks to Menu
milaiwi 28f2e74
Add deduping for semanticService.ts
milaiwi 478256f
Extended blocknote. Added linking
milaiwi 68df180
Extended blocknote. Added linking
milaiwi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,19 +112,26 @@ export function GetFilesInfoListForListOfPaths(paths: string[]): FileInfo[] { | |
| return fileInfoListWithoutDuplicates | ||
| } | ||
|
|
||
| export function createFileRecursive(filePath: string, content: string, charset?: BufferEncoding): void { | ||
| export function createFileRecursive(filePath: string, content: string, charset?: BufferEncoding): FileInfo | null { | ||
| const dirname = path.dirname(filePath) | ||
|
|
||
| if (!fs.existsSync(dirname)) { | ||
| fs.mkdirSync(dirname, { recursive: true }) | ||
| } | ||
|
|
||
| if (fs.existsSync(filePath)) { | ||
| return | ||
| return null | ||
| } | ||
| const filePathWithExtension = addExtensionToFilenameIfNoExtensionPresent(filePath, markdownExtensions, '.md') | ||
|
|
||
| fs.writeFileSync(filePathWithExtension, content, charset) | ||
| return { | ||
| name: path.basename(filePathWithExtension), | ||
| path: filePathWithExtension, | ||
| relativePath: path.relative(dirname, filePathWithExtension), | ||
| dateModified: new Date(), | ||
| dateCreated: new Date(), | ||
| } | ||
| } | ||
|
|
||
| export function updateFileListForRenderer(win: BrowserWindow, directory: string): void { | ||
|
|
@@ -194,3 +201,26 @@ export function splitDirectoryPathIntoBaseAndRepo(fullPath: string) { | |
|
|
||
| return { localModelPath, repoName } | ||
| } | ||
|
|
||
| export function findFileRecursive(dir: string, filename: string): string | null { | ||
| const files = fs.readdirSync(dir) | ||
| const basename = path.parse(filename).name | ||
|
|
||
| for (const file of files) { | ||
| const fullPath = path.resolve(dir, file) | ||
| const stat = fs.statSync(fullPath) | ||
|
|
||
| if (stat.isDirectory()) { | ||
| const result = findFileRecursive(fullPath, filename) | ||
| if (result) return result | ||
| } else { | ||
| // Check if files match | ||
| const fileName = path.parse(file).name | ||
| if (fileName === basename) { | ||
| return fullPath | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return null | ||
| } | ||
|
Comment on lines
+205
to
+226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: The recursive file search doesn't handle file extensions, which could lead to incorrect matches when multiple files have the same basename but different extensions. |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,7 @@ import { StoreSchema } from '../electron-store/storeConfig' | |||||||||||||||||||||||||||||||||||||||||||||||||
| import { handleFileRename, updateFileInTable } from '../vector-database/tableHelperFunctions' | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| import { GetFilesInfoTree, createFileRecursive, isHidden, GetFilesInfoListForListOfPaths } from './filesystem' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { FileInfoTree, WriteFileProps, RenameFileProps, FileInfoWithContent } from './types' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { FileInfoTree, WriteFileProps, RenameFileProps, FileInfoWithContent, FileInfo } from './types' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import ImageStorage from './storage/ImageStore' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import VideoStorage from './storage/VideoStore' | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -145,8 +145,10 @@ const registerFileHandlers = (store: Store<StoreSchema>, _windowsManager: Window | |||||||||||||||||||||||||||||||||||||||||||||||||
| await updateFileInTable(windowInfo.dbTableClient, filePath) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| ipcMain.handle('create-file', async (event, filePath: string, content: string): Promise<void> => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| createFileRecursive(filePath, content, 'utf-8') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ipcMain.handle('create-file', async (event, filePath: string, content: string): Promise<FileInfo | undefined> => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const fileObject = createFileRecursive(filePath, content, 'utf-8') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (fileObject) return fileObject | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return undefined | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| ipcMain.handle('create-directory', async (event, dirPath: string): Promise<void> => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -217,6 +219,17 @@ const registerFileHandlers = (store: Store<StoreSchema>, _windowsManager: Window | |||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return result.filePaths | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| ipcMain.handle('get-file-info', (event, absolutePath: string, parentRelativePath: string): FileInfo => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const fileInfo = fs.statSync(absolutePath) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| name: path.basename(absolutePath), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| path: absolutePath, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| relativePath: parentRelativePath, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| dateModified: fileInfo.mtime, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| dateCreated: fileInfo.birthtime, // Add the birthtime property here | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+223
to
+232
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: get-file-info doesn't handle errors from fs.statSync which could crash the app. Should use try/catch
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| export default registerFileHandlers | ||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: The function now returns a FileInfo object with hardcoded dates. Consider using the actual file stats (mtime and birthtime) from fs.statSync() after file creation for accuracy.