Public
Like
moiPosterImproved
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of fix-editor-input branch: v13View latest version
A tool to create and manage moi.md files for Val Town vals.
This branch addresses critical usability issues with the editors in the MoiPoster tool:
-
Input Focus Issues: Previously, when editing input fields in the moi.md editor, the input would sometimes lose focus and freeze up, making it difficult to type smoothly.
-
Save Functionality Problems: After the initial input focus fix, there was an issue where saving would reset content to defaults or not save the latest changes.
- The editor was trying to update the content in real-time with every keystroke
- Each update was triggering a re-render, which would cause the input to lose focus
- State synchronization issues between components caused saving problems
- Content wasn't properly transferred between components during save operations
-
MoiEditor.tsx:
- Removed the
isUserEditingstate and automatic real-time updates - Added an explicit "Update Preview" button to apply changes when ready
- Simplified the change handling logic to avoid excessive state updates
- Removed the
-
QuickEditor.tsx:
- Similar to MoiEditor, replaced real-time updates with an explicit update button
- Simplified event handling to prevent focus issues
- Separated content editing from preview updates
-
MoiEditorModal.tsx:
- Added local state to better manage content changes
- Implemented content reference tracking to prevent loss of edits
- Added safeguards to ensure latest content is always saved
- Improved handling of editor type switching
- Added sync points to ensure content is preserved during close/save operations
-
App.tsx:
- Added a reference-based approach to track the latest content reliably
- Implemented more robust content change handling with proper state tracking
- Fixed save functionality to use the most up-to-date content
- Added console logs for debugging content flow
- Open a val in the editor
- Try typing in any of the input fields - you should now be able to type smoothly without the cursor jumping or input freezing
- When you're ready to see your changes in the preview, click the "Update Preview" button
- Make several edits to different fields and save - all changes should be properly preserved
- Try editing, then directly clicking save without updating preview - changes should still be saved correctly
Tool to manage moi.md files for Val Town content.
- Browse your vals
- Create and edit moi.md files
- Preview changes
- Quickly update frontmatter
- Save directly to your Val
The moi.md file is a special Markdown file that Val Town uses to display information about your val on the platform, especially for the build.moi page.
- Add your Val Town API key
- Browse and select a val
- Create or edit the moi.md file
- Save your changes