-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: improve development experience and add performance optimizations #327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
WinJayX
wants to merge
1
commit into
plait-board:develop
Choose a base branch
from
WinJayX:feature/improve-development-experience
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+625
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # Contributor Covenant Code of Conduct | ||
|
|
||
| ## Our Pledge | ||
|
|
||
| We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. | ||
|
|
||
| We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. | ||
|
|
||
| ## Our Standards | ||
|
|
||
| Examples of behavior that contributes to a positive environment for our community include: | ||
|
|
||
| * Demonstrating empathy and kindness toward other people | ||
| * Being respectful of differing opinions, viewpoints, and experiences | ||
| * Giving and gracefully accepting constructive feedback | ||
| * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience | ||
| * Focusing on what is best not just for us as individuals, but for the overall community | ||
|
|
||
| Examples of unacceptable behavior include: | ||
|
|
||
| * The use of sexualized language or imagery, and sexual attention or advances of any kind | ||
| * Trolling, insulting or derogatory comments, and personal or political attacks | ||
| * Public or private harassment | ||
| * Publishing others' private information, such as a physical or email address, without their explicit permission | ||
| * Other conduct which could reasonably be considered inappropriate in a professional setting | ||
|
|
||
| ## Enforcement Responsibilities | ||
|
|
||
| Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. | ||
|
|
||
| Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. | ||
|
|
||
| ## Scope | ||
|
|
||
| This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. | ||
|
|
||
| ## Enforcement | ||
|
|
||
| Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. | ||
|
|
||
| All community leaders are obligated to respect the privacy and security of the reporter of any incident. | ||
|
|
||
| ## Enforcement Guidelines | ||
|
|
||
| Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: | ||
|
|
||
| ### 1. Correction | ||
| **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. | ||
|
|
||
| **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. | ||
|
|
||
| ### 2. Warning | ||
| **Community Impact**: A violation through a single incident or series of actions. | ||
|
|
||
| **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. | ||
|
|
||
| ### 3. Temporary Ban | ||
| **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. | ||
|
|
||
| **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. | ||
|
|
||
| ### 4. Permanent Ban | ||
| **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. | ||
|
|
||
| **Consequence**: A permanent ban from any sort of public interaction within the community. | ||
|
|
||
| ## Attribution | ||
|
|
||
| This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. | ||
|
|
||
| Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). | ||
|
|
||
| [homepage]: https://www.contributor-covenant.org | ||
|
|
||
| For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # Contributing to Drawnix | ||
|
|
||
| Thank you for your interest in contributing to Drawnix! This document provides guidelines and information for contributors. | ||
|
|
||
| ## Code of Conduct | ||
|
|
||
| This project follows the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. | ||
|
|
||
| ## How to Contribute | ||
|
|
||
| ### Reporting Bugs | ||
|
|
||
| Before creating bug reports, please check existing issues to avoid duplicates. When creating a bug report, please include: | ||
|
|
||
| - **Use a clear and descriptive title** | ||
| - **Describe the exact steps to reproduce the problem** | ||
| - **Provide specific examples to demonstrate the steps** | ||
| - **Describe the behavior you observed after following the steps** | ||
| - **Explain which behavior you expected to see instead and why** | ||
| - **Include screenshots and animated GIFs if possible** | ||
| - **Include your operating system and browser information** | ||
|
|
||
| ### Suggesting Enhancements | ||
|
|
||
| Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include: | ||
|
|
||
| - **Use a clear and descriptive title** | ||
| - **Provide a step-by-step description of the suggested enhancement** | ||
| - **Provide specific examples to demonstrate the steps** | ||
| - **Describe the current behavior and explain which behavior you expected to see instead** | ||
| - **Explain why this enhancement would be useful** | ||
| - **List some other applications where this enhancement exists** | ||
|
|
||
| ### Pull Requests | ||
|
|
||
| - Fill in the required template | ||
| - Do not include issue numbers in the PR title | ||
| - Include screenshots and animated GIFs in your pull request whenever possible | ||
| - Follow the JavaScript styleguide | ||
| - Include thoughtfully-worded, well-structured tests | ||
| - Document new code based on the Documentation Styleguide | ||
| - End all files with a newline | ||
|
|
||
| ## Development Setup | ||
|
|
||
| 1. Fork and clone the repository | ||
| 2. Install dependencies: `npm install` | ||
| 3. Start the development server: `npm run start` | ||
| 4. Make your changes | ||
| 5. Run tests: `npm run test` | ||
| 6. Run linting: `npm run lint` | ||
|
|
||
| ## Styleguides | ||
|
|
||
| ### Git Commit Messages | ||
|
|
||
| - Use the present tense ("Add feature" not "Added feature") | ||
| - Use the imperative mood ("Move cursor to..." not "Moves cursor to...") | ||
| - Limit the first line to 72 characters or less | ||
| - Reference issues and pull requests liberally after the first line | ||
|
|
||
| ### JavaScript Styleguide | ||
|
|
||
| - Use semicolons | ||
| - Use 2 spaces for indentation | ||
| - Use single quotes for strings | ||
| - Use trailing commas | ||
| - Use meaningful variable and function names | ||
| - Use const/let instead of var | ||
| - Use arrow functions when appropriate | ||
|
|
||
| ### Documentation Styleguide | ||
|
|
||
| - Use [Markdown](https://daringfireball.net/projects/markdown/) | ||
| - Use present tense ("This function does..." not "This function will do...") | ||
| - Use active voice ("The user clicks the button" not "The button is clicked by the user") | ||
| - Use clear and concise language | ||
| - Include code examples when helpful | ||
|
|
||
| ## Community | ||
|
|
||
| - [GitHub Discussions](https://github.com/plait-board/drawnix/discussions) - General discussion | ||
| - [GitHub Issues](https://github.com/plait-board/drawnix/issues) - Bug reports and feature requests | ||
|
|
||
| ## License | ||
|
|
||
| By contributing to Drawnix, you agree that your contributions will be licensed under the MIT License. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| # Development Guide | ||
|
|
||
| This guide will help you get started with developing Drawnix locally. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Node.js 18+ | ||
| - npm or yarn | ||
| - Git | ||
|
|
||
| ## Getting Started | ||
|
|
||
| 1. **Clone the repository** | ||
| ```bash | ||
| git clone https://github.com/plait-board/drawnix.git | ||
| cd drawnix | ||
| ``` | ||
|
|
||
| 2. **Install dependencies** | ||
| ```bash | ||
| npm install | ||
| ``` | ||
|
|
||
| 3. **Start development server** | ||
| ```bash | ||
| npm run start | ||
| ``` | ||
|
|
||
| 4. **Open your browser** | ||
| Navigate to `http://localhost:4200` to see the application. | ||
|
|
||
| ## Project Structure | ||
|
|
||
| ``` | ||
| drawnix/ | ||
| ├── apps/ | ||
| │ ├── web/ # Main web application | ||
| │ └── web-e2e/ # End-to-end tests | ||
| ├── packages/ | ||
| │ ├── drawnix/ # Core drawnix package | ||
| │ ├── react-board/ # React board components | ||
| │ └── react-text/ # Text rendering components | ||
| ├── scripts/ # Build and deployment scripts | ||
| └── dist/ # Build output | ||
| ``` | ||
|
|
||
| ## Available Scripts | ||
|
|
||
| - `npm run start` - Start development server | ||
| - `npm run build` - Build all packages | ||
| - `npm run build:web` - Build web application only | ||
| - `npm run lint` - Run ESLint on all packages | ||
| - `npm run test` - Run tests | ||
| - `npm run release` - Release new version | ||
|
|
||
| ## Development Tips | ||
|
|
||
| ### Hotkey Shortcuts | ||
|
|
||
| The application supports various keyboard shortcuts for better user experience: | ||
|
|
||
| - `Ctrl/Cmd + S` - Save as JSON | ||
| - `Ctrl/Cmd + Shift + E` - Export as image | ||
| - `Ctrl/Cmd + Z` - Undo | ||
| - `Ctrl/Cmd + Shift + Z` - Redo | ||
| - `Ctrl/Cmd + U` - Add image | ||
| - `Ctrl/Cmd + Backspace/Delete` - Clear canvas | ||
|
|
||
| ### Tool Shortcuts | ||
|
|
||
| - `H` - Hand tool | ||
| - `V` - Selection tool | ||
| - `M` - Mind map tool | ||
| - `E` - Eraser tool | ||
| - `P` - Pen tool | ||
| - `A` - Arrow tool | ||
| - `R` - Rectangle tool | ||
| - `O` - Oval tool | ||
| - `T` - Text tool | ||
|
|
||
| ## Contributing | ||
|
|
||
| 1. Fork the repository | ||
| 2. Create a feature branch (`git checkout -b feature/amazing-feature`) | ||
| 3. Make your changes | ||
| 4. Run tests (`npm run test`) | ||
| 5. Run linting (`npm run lint`) | ||
| 6. Commit your changes (`git commit -m 'Add amazing feature'`) | ||
| 7. Push to the branch (`git push origin feature/amazing-feature`) | ||
| 8. Open a Pull Request | ||
|
|
||
| ## Code Style | ||
|
|
||
| - Use TypeScript for all new code | ||
| - Follow ESLint configuration | ||
| - Use Prettier for code formatting | ||
| - Write tests for new features | ||
| - Follow existing naming conventions | ||
|
|
||
| ## Testing | ||
|
|
||
| Run the test suite: | ||
| ```bash | ||
| npm run test | ||
| ``` | ||
|
|
||
| Run end-to-end tests: | ||
| ```bash | ||
| npm run e2e | ||
| ``` | ||
|
|
||
| ## Building for Production | ||
|
|
||
| ```bash | ||
| npm run build | ||
| ``` | ||
|
|
||
| The built files will be in the `dist/` directory. | ||
|
|
||
| ## Docker Development | ||
|
|
||
| You can also run the application using Docker: | ||
|
|
||
| ```bash | ||
| docker pull pubuzhixing/drawnix:latest | ||
| docker run -p 4200:4200 pubuzhixing/drawnix:latest | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Common Issues | ||
|
|
||
| 1. **Port already in use** | ||
| - Change the port in `apps/web/vite.config.ts` | ||
| - Or kill the process using the port | ||
|
|
||
| 2. **Dependencies not installing** | ||
| - Clear npm cache: `npm cache clean --force` | ||
| - Delete `node_modules` and `package-lock.json` | ||
| - Run `npm install` again | ||
|
|
||
| 3. **Build errors** | ||
| - Check TypeScript errors: `npx tsc --noEmit` | ||
| - Run linting: `npm run lint` | ||
| - Check for missing dependencies | ||
|
|
||
| ### Getting Help | ||
|
|
||
| - Check existing [Issues](https://github.com/plait-board/drawnix/issues) | ||
| - Create a new issue if your problem isn't already reported | ||
| - Join discussions in the repository | ||
|
|
||
| ## Architecture | ||
|
|
||
| Drawnix is built on top of the Plait framework and uses a plugin-based architecture: | ||
|
|
||
| - **Core**: Base drawing functionality | ||
| - **Plugins**: Extensible features (mind maps, freehand drawing, etc.) | ||
| - **React Components**: UI layer built with React | ||
| - **Slate**: Rich text editing capabilities | ||
|
|
||
| This architecture allows for: | ||
| - Multiple UI framework support (Angular, React) | ||
| - Integration with different rich text frameworks | ||
| - Fine-grained reusable plugins | ||
| - Extensible drawing board applications | ||
|
|
||
| ## Performance Tips | ||
|
|
||
| - Use React.memo for expensive components | ||
| - Implement virtual scrolling for large canvases | ||
| - Optimize image loading and caching | ||
| - Use Web Workers for heavy computations | ||
| - Implement proper cleanup in useEffect hooks | ||
|
|
||
| --- | ||
|
|
||
| Happy coding! 🎨 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.