add: document save button

This commit is contained in:
Pooja Belaramani 2024-12-17 11:26:35 +05:30
parent b9ec0acab4
commit 34ea352e4e

View File

@ -8,6 +8,7 @@ import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/acti
import Markdown from 'components/MarkDown';
import CodeEditor from 'components/CodeEditor';
import StyledWrapper from './StyledWrapper';
import { IconDeviceFloppy } from '@tabler/icons';
const Docs = ({ collection }) => {
const dispatch = useDispatch();
@ -15,6 +16,7 @@ const Docs = ({ collection }) => {
const [isEditing, setIsEditing] = useState(false);
const docs = get(collection, 'root.docs', '');
const preferences = useSelector((state) => state.app.preferences);
const { theme, storedTheme } = useTheme();
const toggleViewMode = () => {
setIsEditing((prev) => !prev);
@ -33,8 +35,13 @@ const Docs = ({ collection }) => {
return (
<StyledWrapper className="mt-1 h-full w-full relative">
<div className="editing-mode mb-2" role="tab" onClick={toggleViewMode}>
<div className="editing-mode mb-2 flex justify-between items-center" role="tab" onClick={toggleViewMode}>
{isEditing ? 'Preview' : 'Edit'}
{isEditing ?
<button onClick={onSave}>
<IconDeviceFloppy color={theme.requestTabs.icon.color} />
</button>
: null}
</div>
{isEditing ? (