mirror of
https://github.com/khairul169/code-share.git
synced 2026-10-24 11:53:58 +07:00
fix: add readonly mode to editor
This commit is contained in:
@@ -58,12 +58,12 @@ const FileListing = () => {
|
||||
<ActionButton icon={FiMoreVertical} />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start">
|
||||
<DropdownMenuItem>Upload File</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
{/* <DropdownMenuItem>Upload File</DropdownMenuItem> */}
|
||||
{/* <DropdownMenuSeparator /> */}
|
||||
<DropdownMenuItem onClick={() => settingsDialog.setState(true)}>
|
||||
Project Settings
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem>Download Project</DropdownMenuItem>
|
||||
{/* <DropdownMenuItem>Download Project</DropdownMenuItem> */}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
|
||||
@@ -47,8 +47,13 @@ const FileViewer = ({ id }: Props) => {
|
||||
filename={data.filename}
|
||||
path={data.path}
|
||||
value={data.content || ""}
|
||||
isReadOnly={!project.isMutable}
|
||||
formatOnSave
|
||||
onChange={(val) => {
|
||||
if (!project.isMutable) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateFileContent.mutate({
|
||||
projectId: project.id,
|
||||
id,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { createContext, useContext } from "react";
|
||||
import type { ProjectSchema } from "~/server/db/schema/project";
|
||||
|
||||
type TProjectContext = {
|
||||
project: ProjectSchema;
|
||||
project: ProjectSchema & { isMutable: boolean };
|
||||
isCompact?: boolean;
|
||||
isEmbed?: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user