mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-07 16:34:26 +00:00
Refactor common functions
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
pullChanges,
|
||||
lookupFileByName,
|
||||
} from '../services/api';
|
||||
import { isImageFile } from '../utils/fileHelpers';
|
||||
|
||||
const DEFAULT_FILE = {
|
||||
name: 'New File.md',
|
||||
@@ -14,11 +15,6 @@ const DEFAULT_FILE = {
|
||||
content: '# Welcome to NovaMD\n\nStart editing here!',
|
||||
};
|
||||
|
||||
const isImageFile = (filePath) => {
|
||||
const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.svg'];
|
||||
return imageExtensions.some((ext) => filePath.toLowerCase().endsWith(ext));
|
||||
};
|
||||
|
||||
const useFileManagement = (gitEnabled = false) => {
|
||||
const [content, setContent] = useState(DEFAULT_FILE.content);
|
||||
const [files, setFiles] = useState([]);
|
||||
|
||||
Reference in New Issue
Block a user