Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: make toolbar title editable

thecodrrb2c9a655f270
diff --git a/apps/web/src/components/animated/index.js b/apps/web/src/components/animated/index.js
index 346ed4122..9f420c955 100644
--- a/apps/web/src/components/animated/index.js
+++ b/apps/web/src/components/animated/index.js
@@ -1,9 +1,11 @@
import { m as motion } from "framer-motion";
-import * as Rebass from "rebass";
+import { Flex, Box, Image, Text } from "rebass";
+import { Input } from "@rebass/forms";
export default {
- Flex: motion.custom(Rebass.Flex),
- Box: motion.custom(Rebass.Box),
- Image: motion.custom(Rebass.Image),
- Text: motion.custom(Rebass.Text),
+ Flex: motion.custom(Flex),
+ Box: motion.custom(Box),
+ Image: motion.custom(Image),
+ Text: motion.custom(Text),
+ Input: motion.custom(Input),
};
diff --git a/apps/web/src/components/editor/toolbar.js b/apps/web/src/components/editor/toolbar.js
index 4f86e7962..65ee5486d 100644
--- a/apps/web/src/components/editor/toolbar.js
+++ b/apps/web/src/components/editor/toolbar.js
@@ -14,6 +14,7 @@ function Toolbar(props) {
const [redoable, setRedoable] = useState(false);
const isFocusMode = useAppStore((store) => store.isFocusMode);
const toggleFocusMode = useAppStore((store) => store.toggleFocusMode);
+ const setSession = useStore((store) => store.setSession);
const toggleProperties = useStore((store) => store.toggleProperties);
const clearSession = useStore((store) => store.clearSession);
const title = useStore((store) => store.session.title);
@@ -98,15 +99,28 @@ function Toolbar(props) {
clearSession();
}}
/>
- <Animated.Text
+ <Animated.Input
ml={[2, 2, 0]}
initial={{ opacity: isTitleVisible ? 1 : 0 }}
animate={{ opacity: isTitleVisible ? 1 : 0 }}
transition={{ duration: 0.5 }}
fontWeight="heading"
- >
- {title}
- </Animated.Text>
+ fontSize="heading"
+ defaultValue={title}
+ color="text"
+ onChange={(e) => {
+ const title = e.target.value;
+ setSession((state) => {
+ state.session.title = title;
+ });
+ }}
+ sx={{
+ p: 0,
+ borderWidth: 0,
+ borderRadius: 0,
+ ":focus": { borderWidth: 0 },
+ }}
+ />
</Flex>
<Flex justifyContent="flex-end">
{tools.map((tool) => (