зеркало из
https://github.com/rs-pro/activeadmin-quill_editor.git
synced 2026-09-03 18:25:51 +03:00
refactor: Remove jQuery dependency and consolidate JavaScript assets
- Rename vendor JS file to activeadmin/quill_editor.js to avoid conflicts - Update import alias to use 'activeadmin/quill_editor' for consistency - Remove jQuery-dependent legacy file (quill_editor_input.js) - Simplify engine asset configuration - only one JS file now - Update documentation with correct paths and import names - All functionality preserved with vanilla JavaScript BREAKING CHANGE: Drops support for jQuery-based initialization. Applications using the legacy jQuery initialization will need to update to the new module-based approach. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Этот коммит содержится в:
@@ -1,97 +0,0 @@
|
||||
# Session Summary - ActiveAdmin Quill Editor Modernization
|
||||
|
||||
## Context
|
||||
We analyzed replacing Trumbowyg with Quill for ActiveAdmin 4.x and Rails 8 compatibility. After evaluating SunEditor (too large at 450KB after removing source maps) and Quill.js (~200KB), we chose to modernize the existing `activeadmin_quill_editor` gem.
|
||||
|
||||
## Important Discoveries
|
||||
1. **Existing Test App**: The gem already has a full Rails test application at `spec/dummy/` (not using Combustion)
|
||||
2. **Existing Tests**: Comprehensive system tests already exist in `spec/system/`
|
||||
3. **Existing Formtastic Input**: `QuillEditorInput` class already exists, just needs jQuery removal
|
||||
|
||||
## Key Decisions Made
|
||||
|
||||
1. **Use Quill.js** instead of SunEditor
|
||||
- Quill: ~200KB minified
|
||||
- Clean delta-based architecture
|
||||
- No jQuery dependency for the core library
|
||||
- Existing gem foundation to build upon
|
||||
|
||||
2. **Serve assets directly from vendor/assets**
|
||||
- No NPM package needed initially
|
||||
- Propshaft automatically serves from vendor/assets and app/assets
|
||||
- Simple drop-in integration
|
||||
|
||||
3. **Follow activeadmin_trumbowyg patterns**
|
||||
- Combustion-based test app
|
||||
- Modern CI with matrix testing (Ruby 3.3/3.4, Rails 7.x/8.x)
|
||||
- Comprehensive GitHub Actions setup with caching
|
||||
- ESBuild for test app assets
|
||||
|
||||
## Files Created
|
||||
- `/data/activeadmin-quill_editor/docs/activeadmin-4-propshaft-update.md` - Complete migration guide
|
||||
- `/data/activeadmin-quill_editor/docs/session-summary.md` - This summary
|
||||
|
||||
## Next Steps
|
||||
|
||||
### Immediate Tasks
|
||||
1. Download Quill 2.x assets and place in vendor/assets
|
||||
2. Create new JavaScript initializer without jQuery
|
||||
3. Update Formtastic input class (already exists, just needs updates)
|
||||
4. Update existing spec/dummy test app for Propshaft/Rails 8
|
||||
5. Configure GitHub Actions CI/CD
|
||||
|
||||
### Implementation Order
|
||||
1. **Asset Setup** (vendor/assets structure)
|
||||
2. **JavaScript Modernization** (remove jQuery)
|
||||
3. **Test App Updates** (spec/dummy with Propshaft)
|
||||
4. **CI/CD Setup** (GitHub Actions with matrix)
|
||||
5. **Documentation Update** (README, examples)
|
||||
|
||||
### Testing Strategy
|
||||
- Use existing spec/dummy Rails app (no Combustion needed)
|
||||
- Update existing system tests, add missing cases from trumbowyg
|
||||
- Matrix test against Ruby 3.3/3.4
|
||||
- Test Rails 7.x and 8.x with ActiveAdmin 4.x beta
|
||||
- Consider adding Playwright for modern browser tests
|
||||
- SimpleCov for coverage with SonarQube integration
|
||||
|
||||
## Technical Notes
|
||||
|
||||
### Propshaft Asset Serving
|
||||
- Gems can provide assets in `vendor/assets` and `app/assets`
|
||||
- Propshaft automatically includes these paths in load path
|
||||
- No compilation needed for vendored assets
|
||||
- Digest stamping handled automatically
|
||||
|
||||
### JavaScript API Changes
|
||||
Replace jQuery-based initialization:
|
||||
```javascript
|
||||
// Old (jQuery)
|
||||
$(document).ready(initQuillEditors);
|
||||
|
||||
// New (Vanilla)
|
||||
document.addEventListener('DOMContentLoaded', initQuillEditors);
|
||||
document.addEventListener('turbo:load', initQuillEditors);
|
||||
```
|
||||
|
||||
### Form Input Usage
|
||||
```ruby
|
||||
f.input :content, as: :quill_editor, input_html: {
|
||||
data: {
|
||||
options: {
|
||||
theme: 'snow',
|
||||
modules: { toolbar: [...] }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Resources
|
||||
- Quill.js 2.x: https://quilljs.com/
|
||||
- Propshaft docs: https://github.com/rails/propshaft
|
||||
- Reference gems:
|
||||
- /data/activeadmin_trumbowyg (modern CI/test setup)
|
||||
- /data/activeadmin-searchable_select (alternative patterns)
|
||||
|
||||
## Contact for Questions
|
||||
Review the comprehensive guide at `activeadmin-4-propshaft-update.md` for complete implementation details.
|
||||
@@ -63,8 +63,8 @@ try {
|
||||
}
|
||||
|
||||
// Import the Quill Editor initialization module from the gem
|
||||
// This imports from vendor/assets/javascripts/activeadmin_quill_editor.js
|
||||
import QuillEditorModule from 'activeadmin_quill_editor';
|
||||
// This imports from vendor/assets/javascripts/activeadmin/quill_editor.js
|
||||
import QuillEditorModule from 'activeadmin/quill_editor';
|
||||
|
||||
// Now that Quill is available, initialize the editors
|
||||
// This ensures proper initialization order without setTimeout hacks
|
||||
@@ -130,7 +130,7 @@ const config = {
|
||||
},
|
||||
// CRITICAL: Use alias to import the gem's JavaScript from vendor/assets
|
||||
alias: {
|
||||
'activeadmin_quill_editor': path.join(gemPath, 'vendor/assets/javascripts/activeadmin_quill_editor.js')
|
||||
'activeadmin/quill_editor': path.join(gemPath, 'vendor/assets/javascripts/activeadmin/quill_editor.js')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user