mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-07 16:34:26 +00:00
Migrate utils to ts
This commit is contained in:
7
app/src/types/api.ts
Normal file
7
app/src/types/api.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
API_BASE_URL: string;
|
||||
}
|
||||
}
|
||||
|
||||
export const API_BASE_URL = window.API_BASE_URL;
|
||||
36
app/src/types/file.ts
Normal file
36
app/src/types/file.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
export enum FileAction {
|
||||
Create = 'create',
|
||||
Delete = 'delete',
|
||||
Rename = 'rename',
|
||||
}
|
||||
|
||||
export enum FileExtension {
|
||||
Markdown = '.md',
|
||||
JPG = '.jpg',
|
||||
JPEG = '.jpeg',
|
||||
PNG = '.png',
|
||||
GIF = '.gif',
|
||||
WebP = '.webp',
|
||||
SVG = '.svg',
|
||||
}
|
||||
|
||||
export const IMAGE_EXTENSIONS = [
|
||||
FileExtension.JPG,
|
||||
FileExtension.JPEG,
|
||||
FileExtension.PNG,
|
||||
FileExtension.GIF,
|
||||
FileExtension.WebP,
|
||||
FileExtension.SVG,
|
||||
];
|
||||
|
||||
export interface DefaultFile {
|
||||
name: string;
|
||||
path: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_FILE: DefaultFile = {
|
||||
name: 'New File.md',
|
||||
path: 'New File.md',
|
||||
content: '# Welcome to NovaMD\n\nStart editing here!',
|
||||
};
|
||||
18
app/src/types/markdown.ts
Normal file
18
app/src/types/markdown.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export enum InlineContainerType {
|
||||
Paragraph = 'paragraph',
|
||||
ListItem = 'listItem',
|
||||
TableCell = 'tableCell',
|
||||
Blockquote = 'blockquote',
|
||||
Heading = 'heading',
|
||||
Emphasis = 'emphasis',
|
||||
Strong = 'strong',
|
||||
Delete = 'delete',
|
||||
}
|
||||
|
||||
export const INLINE_CONTAINER_TYPES = new Set<InlineContainerType>(
|
||||
Object.values(InlineContainerType)
|
||||
);
|
||||
|
||||
export const MARKDOWN_REGEX = {
|
||||
WIKILINK: /(!?)\[\[(.*?)\]\]/g,
|
||||
} as const;
|
||||
5
app/src/types/modal.ts
Normal file
5
app/src/types/modal.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export enum ModalType {
|
||||
NewFile = 'newFile',
|
||||
DeleteFile = 'deleteFile',
|
||||
CommitMessage = 'commitMessage',
|
||||
}
|
||||
4
app/src/types/theme.ts
Normal file
4
app/src/types/theme.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export enum Theme {
|
||||
Light = 'light',
|
||||
Dark = 'dark',
|
||||
}
|
||||
32
app/src/types/workspace.ts
Normal file
32
app/src/types/workspace.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Theme } from './theme';
|
||||
|
||||
export interface WorkspaceSettings {
|
||||
theme: Theme;
|
||||
autoSave: boolean;
|
||||
gitEnabled: boolean;
|
||||
gitUrl: string;
|
||||
gitUser: string;
|
||||
gitToken: string;
|
||||
gitAutoCommit: boolean;
|
||||
gitCommitMsgTemplate: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_WORKSPACE_SETTINGS: WorkspaceSettings = {
|
||||
theme: Theme.Light,
|
||||
autoSave: false,
|
||||
gitEnabled: false,
|
||||
gitUrl: '',
|
||||
gitUser: '',
|
||||
gitToken: '',
|
||||
gitAutoCommit: false,
|
||||
gitCommitMsgTemplate: '${action} ${filename}',
|
||||
};
|
||||
|
||||
export interface Workspace extends WorkspaceSettings {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_WORKSPACE: Workspace = {
|
||||
name: '',
|
||||
...DEFAULT_WORKSPACE_SETTINGS,
|
||||
};
|
||||
Reference in New Issue
Block a user