inkpen 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.rubocop.yml +8 -0
- data/.yardopts +11 -0
- data/CLAUDE.md +141 -0
- data/README.md +409 -0
- data/Rakefile +19 -0
- data/app/assets/javascripts/inkpen/controllers/editor_controller.js +2050 -0
- data/app/assets/javascripts/inkpen/controllers/sticky_toolbar_controller.js +667 -0
- data/app/assets/javascripts/inkpen/controllers/toolbar_controller.js +693 -0
- data/app/assets/javascripts/inkpen/export/html.js +637 -0
- data/app/assets/javascripts/inkpen/export/index.js +30 -0
- data/app/assets/javascripts/inkpen/export/markdown.js +697 -0
- data/app/assets/javascripts/inkpen/export/pdf.js +372 -0
- data/app/assets/javascripts/inkpen/extensions/advanced_table.js +640 -0
- data/app/assets/javascripts/inkpen/extensions/block_commands.js +300 -0
- data/app/assets/javascripts/inkpen/extensions/block_gutter.js +338 -0
- data/app/assets/javascripts/inkpen/extensions/callout.js +303 -0
- data/app/assets/javascripts/inkpen/extensions/columns.js +403 -0
- data/app/assets/javascripts/inkpen/extensions/database.js +990 -0
- data/app/assets/javascripts/inkpen/extensions/document_section.js +352 -0
- data/app/assets/javascripts/inkpen/extensions/drag_handle.js +407 -0
- data/app/assets/javascripts/inkpen/extensions/embed.js +629 -0
- data/app/assets/javascripts/inkpen/extensions/enhanced_image.js +566 -0
- data/app/assets/javascripts/inkpen/extensions/export_commands.js +271 -0
- data/app/assets/javascripts/inkpen/extensions/file_attachment.js +593 -0
- data/app/assets/javascripts/inkpen/extensions/inkpen_table/index.js +58 -0
- data/app/assets/javascripts/inkpen/extensions/inkpen_table/inkpen_table.js +638 -0
- data/app/assets/javascripts/inkpen/extensions/inkpen_table/inkpen_table_cell.js +100 -0
- data/app/assets/javascripts/inkpen/extensions/inkpen_table/inkpen_table_header.js +100 -0
- data/app/assets/javascripts/inkpen/extensions/inkpen_table/table_constants.js +152 -0
- data/app/assets/javascripts/inkpen/extensions/inkpen_table/table_helpers.js +254 -0
- data/app/assets/javascripts/inkpen/extensions/inkpen_table/table_menu.js +282 -0
- data/app/assets/javascripts/inkpen/extensions/preformatted.js +239 -0
- data/app/assets/javascripts/inkpen/extensions/section.js +281 -0
- data/app/assets/javascripts/inkpen/extensions/section_title.js +126 -0
- data/app/assets/javascripts/inkpen/extensions/slash_commands.js +439 -0
- data/app/assets/javascripts/inkpen/extensions/table_of_contents.js +474 -0
- data/app/assets/javascripts/inkpen/extensions/toggle_block.js +332 -0
- data/app/assets/javascripts/inkpen/index.js +87 -0
- data/app/assets/stylesheets/inkpen/advanced_table.css +514 -0
- data/app/assets/stylesheets/inkpen/animations.css +626 -0
- data/app/assets/stylesheets/inkpen/block_gutter.css +265 -0
- data/app/assets/stylesheets/inkpen/callout.css +359 -0
- data/app/assets/stylesheets/inkpen/columns.css +314 -0
- data/app/assets/stylesheets/inkpen/database.css +658 -0
- data/app/assets/stylesheets/inkpen/document_section.css +305 -0
- data/app/assets/stylesheets/inkpen/drag_drop.css +220 -0
- data/app/assets/stylesheets/inkpen/editor.css +652 -0
- data/app/assets/stylesheets/inkpen/embed.css +468 -0
- data/app/assets/stylesheets/inkpen/enhanced_image.css +453 -0
- data/app/assets/stylesheets/inkpen/export.css +499 -0
- data/app/assets/stylesheets/inkpen/file_attachment.css +347 -0
- data/app/assets/stylesheets/inkpen/footnotes.css +136 -0
- data/app/assets/stylesheets/inkpen/inkpen_table.css +608 -0
- data/app/assets/stylesheets/inkpen/preformatted.css +215 -0
- data/app/assets/stylesheets/inkpen/search_replace.css +58 -0
- data/app/assets/stylesheets/inkpen/section.css +236 -0
- data/app/assets/stylesheets/inkpen/slash_menu.css +252 -0
- data/app/assets/stylesheets/inkpen/sticky_toolbar.css +314 -0
- data/app/assets/stylesheets/inkpen/toc.css +386 -0
- data/app/assets/stylesheets/inkpen/toggle.css +260 -0
- data/app/helpers/inkpen/editor_helper.rb +114 -0
- data/app/views/inkpen/_editor.html.erb +139 -0
- data/config/importmap.rb +170 -0
- data/docs/.DS_Store +0 -0
- data/docs/CHANGELOG.md +571 -0
- data/docs/FEATURES.md +436 -0
- data/docs/ROADMAP.md +3029 -0
- data/docs/VISION.md +235 -0
- data/docs/extensions/INKPEN_TABLE.md +482 -0
- data/docs/thinking/CORRECTED_NO_VUE.md +756 -0
- data/docs/thinking/EXECUTIVE_SUMMARY.md +403 -0
- data/docs/thinking/INKPEN_CODE_SAMPLES.md +1479 -0
- data/docs/thinking/INKPEN_MASTER_GUIDE.md +891 -0
- data/docs/thinking/README_START_HERE.md +341 -0
- data/lib/inkpen/configuration.rb +175 -0
- data/lib/inkpen/editor.rb +204 -0
- data/lib/inkpen/engine.rb +32 -0
- data/lib/inkpen/extensions/base.rb +109 -0
- data/lib/inkpen/extensions/code_block_syntax.rb +177 -0
- data/lib/inkpen/extensions/document_section.rb +111 -0
- data/lib/inkpen/extensions/forced_document.rb +183 -0
- data/lib/inkpen/extensions/mention.rb +155 -0
- data/lib/inkpen/extensions/preformatted.rb +111 -0
- data/lib/inkpen/extensions/section.rb +139 -0
- data/lib/inkpen/extensions/slash_commands.rb +100 -0
- data/lib/inkpen/extensions/table.rb +182 -0
- data/lib/inkpen/extensions/task_list.rb +145 -0
- data/lib/inkpen/sticky_toolbar.rb +157 -0
- data/lib/inkpen/toolbar.rb +145 -0
- data/lib/inkpen/version.rb +5 -0
- data/lib/inkpen.rb +101 -0
- data/sig/inkpen.rbs +4 -0
- metadata +165 -0
data/docs/VISION.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Inkpen Vision
|
|
2
|
+
|
|
3
|
+
> A Rails-native TipTap editor that makes rich content editing feel native to your application.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Philosophy
|
|
8
|
+
|
|
9
|
+
Inkpen follows three core principles:
|
|
10
|
+
|
|
11
|
+
1. **Rails-native**: Works with importmap-rails, Stimulus, and POROs. No npm/webpack required.
|
|
12
|
+
2. **Progressive enhancement**: Start simple, enable features as needed.
|
|
13
|
+
3. **Convention over configuration**: Sensible defaults, easy overrides.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Architecture
|
|
18
|
+
|
|
19
|
+
### The Stack
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
23
|
+
│ Your Rails Application │
|
|
24
|
+
├─────────────────────────────────────────────────────────────┤
|
|
25
|
+
│ Inkpen Gem (Rails Engine) │
|
|
26
|
+
│ ├── Ruby Layer (POROs) │
|
|
27
|
+
│ │ ├── Editor → Main configuration object │
|
|
28
|
+
│ │ ├── Toolbar → Bubble/fixed toolbar config │
|
|
29
|
+
│ │ ├── StickyToolbar → Bottom bar with block insertions │
|
|
30
|
+
│ │ ├── Configuration → Global defaults │
|
|
31
|
+
│ │ └── Extensions/* → Ruby config for each extension │
|
|
32
|
+
│ ├── Stimulus Controllers │
|
|
33
|
+
│ │ ├── editor_controller.js → TipTap lifecycle │
|
|
34
|
+
│ │ ├── toolbar_controller.js → Floating toolbar │
|
|
35
|
+
│ │ └── sticky_toolbar_controller.js → Fixed bottom bar │
|
|
36
|
+
│ └── TipTap Extensions (JavaScript) │
|
|
37
|
+
│ ├── Core (bold, italic, heading, lists, etc.) │
|
|
38
|
+
│ ├── Blocks (section, callout, toggle, columns) │
|
|
39
|
+
│ ├── Media (enhanced_image, file_attachment, embed) │
|
|
40
|
+
│ ├── Data (database, table_of_contents, advanced_table) │
|
|
41
|
+
│ └── Utilities (slash_commands, block_gutter, drag_handle)│
|
|
42
|
+
├─────────────────────────────────────────────────────────────┤
|
|
43
|
+
│ TipTap / ProseMirror │
|
|
44
|
+
└─────────────────────────────────────────────────────────────┘
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Extension Philosophy
|
|
48
|
+
|
|
49
|
+
Each extension is:
|
|
50
|
+
- **Self-contained**: Own Ruby class, JS file, and CSS
|
|
51
|
+
- **Opt-in**: Enable via `extensions: [:name]` in configuration
|
|
52
|
+
- **Composable**: Extensions work together without tight coupling
|
|
53
|
+
- **Lazy-loadable**: Advanced extensions (like export) load on demand
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Understanding "Blocks" and "Sections"
|
|
58
|
+
|
|
59
|
+
Inkpen builds on TipTap/ProseMirror, which models documents as a tree of nodes. This influences how we think about blocks and sections:
|
|
60
|
+
|
|
61
|
+
### Blocks (What We Have)
|
|
62
|
+
|
|
63
|
+
In TipTap terms, a "block" is any block-level node:
|
|
64
|
+
- **Standard blocks**: paragraph, heading, blockquote, code_block
|
|
65
|
+
- **List blocks**: bullet_list, ordered_list, task_list
|
|
66
|
+
- **Custom blocks**: callout, toggle_block, columns, database
|
|
67
|
+
|
|
68
|
+
Each block can have:
|
|
69
|
+
- NodeView for custom rendering (drag handles, controls, etc.)
|
|
70
|
+
- Attributes for configuration
|
|
71
|
+
- Commands for manipulation
|
|
72
|
+
|
|
73
|
+
**Inkpen provides**: Slash commands, drag handles, block gutter UI, and block commands (duplicate, delete) for managing blocks.
|
|
74
|
+
|
|
75
|
+
### Sections: Two Approaches
|
|
76
|
+
|
|
77
|
+
There are two valid patterns for "sections" in TipTap:
|
|
78
|
+
|
|
79
|
+
#### 1. Layout Sections (Inkpen's Current Approach)
|
|
80
|
+
|
|
81
|
+
Our `Section` extension is a **layout wrapper** that controls visual presentation:
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<section data-width="wide" data-spacing="spacious">
|
|
85
|
+
<p>Content inside gets this width and spacing</p>
|
|
86
|
+
</section>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Use cases:
|
|
90
|
+
- Page builder layouts (narrow reading width, full-width media)
|
|
91
|
+
- Vertical rhythm control (spacing between content areas)
|
|
92
|
+
- Visual theming per section
|
|
93
|
+
|
|
94
|
+
This is what we call **"page builder" sections**.
|
|
95
|
+
|
|
96
|
+
#### 2. Content Grouping Sections (Alternative Pattern)
|
|
97
|
+
|
|
98
|
+
A true "document outline" section is a **container node** with a title + content:
|
|
99
|
+
|
|
100
|
+
```html
|
|
101
|
+
<section>
|
|
102
|
+
<h2>Section Title</h2>
|
|
103
|
+
<p>Paragraph one...</p>
|
|
104
|
+
<p>Paragraph two...</p>
|
|
105
|
+
</section>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
In ProseMirror terms: `content: 'sectionTitle block*'`
|
|
109
|
+
|
|
110
|
+
Use cases:
|
|
111
|
+
- Collapsible document sections
|
|
112
|
+
- Outline navigation
|
|
113
|
+
- Notion-style pages with headers that group content
|
|
114
|
+
- Export to structured formats
|
|
115
|
+
|
|
116
|
+
This is what we call **"document" sections**.
|
|
117
|
+
|
|
118
|
+
### Which Do You Need?
|
|
119
|
+
|
|
120
|
+
| Use Case | Approach | Extension |
|
|
121
|
+
|----------|----------|-----------|
|
|
122
|
+
| Control content width | Layout Section | `section` |
|
|
123
|
+
| Add spacing between areas | Layout Section | `section` |
|
|
124
|
+
| Collapsible content | Toggle Block | `toggle_block` |
|
|
125
|
+
| Group blocks under a heading | Document Section | Future: `document_section` |
|
|
126
|
+
| Notion-style page outline | Document Section | Future: `document_section` |
|
|
127
|
+
| Drag multiple blocks together | Document Section | Future: `document_section` |
|
|
128
|
+
|
|
129
|
+
**Current status**: Inkpen has layout sections and toggle blocks. True document sections could be added as a separate extension.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Extension Categories
|
|
134
|
+
|
|
135
|
+
### Core Extensions
|
|
136
|
+
Always available, provide basic rich text:
|
|
137
|
+
- bold, italic, strike, underline, link
|
|
138
|
+
- heading, bullet_list, ordered_list
|
|
139
|
+
- blockquote, code_block, horizontal_rule, hard_break
|
|
140
|
+
|
|
141
|
+
### Block Extensions
|
|
142
|
+
Custom block types with NodeView UIs:
|
|
143
|
+
- `section` - Layout width/spacing control
|
|
144
|
+
- `callout` - Highlighted info/warning/tip boxes
|
|
145
|
+
- `toggle_block` - Collapsible details/summary
|
|
146
|
+
- `columns` - Multi-column layouts
|
|
147
|
+
- `preformatted` - Plain text for ASCII art
|
|
148
|
+
|
|
149
|
+
### Media Extensions
|
|
150
|
+
Rich media handling:
|
|
151
|
+
- `enhanced_image` - Resizable, captioned, alignable images
|
|
152
|
+
- `file_attachment` - File uploads with type icons
|
|
153
|
+
- `embed` - Social/web embeds (YouTube, Twitter, etc.)
|
|
154
|
+
|
|
155
|
+
### Data Extensions
|
|
156
|
+
Structured data:
|
|
157
|
+
- `advanced_table` - Enhanced tables with styling
|
|
158
|
+
- `database` - Notion-style inline databases
|
|
159
|
+
- `table_of_contents` - Auto-generated navigation
|
|
160
|
+
|
|
161
|
+
### Utility Extensions
|
|
162
|
+
Editor enhancements:
|
|
163
|
+
- `slash_commands` - "/" command palette
|
|
164
|
+
- `block_gutter` - Left gutter with + and drag handle
|
|
165
|
+
- `drag_handle` - Block reordering
|
|
166
|
+
- `block_commands` - Selection, duplication, deletion
|
|
167
|
+
- `export_commands` - Keyboard shortcuts for export
|
|
168
|
+
|
|
169
|
+
### Export Extensions
|
|
170
|
+
Content portability:
|
|
171
|
+
- `export/markdown` - GFM Markdown export/import
|
|
172
|
+
- `export/html` - Clean HTML5 export
|
|
173
|
+
- `export/pdf` - PDF generation
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Design Decisions
|
|
178
|
+
|
|
179
|
+
### Why Ruby POROs?
|
|
180
|
+
|
|
181
|
+
Extensions have a Ruby layer because:
|
|
182
|
+
1. **Configuration**: Set defaults in initializers, per-editor overrides in views
|
|
183
|
+
2. **Type safety**: Ruby validation before JSON serialization
|
|
184
|
+
3. **Testability**: Unit test extension config without browser
|
|
185
|
+
4. **Consistency**: Same pattern as other Rails objects
|
|
186
|
+
|
|
187
|
+
### Why Lazy Loading?
|
|
188
|
+
|
|
189
|
+
Export modules use `import()` because:
|
|
190
|
+
1. **Optional**: Not every editor needs export
|
|
191
|
+
2. **Size**: Export code adds weight to main bundle
|
|
192
|
+
3. **Dependencies**: PDF export optionally loads html2pdf.js
|
|
193
|
+
|
|
194
|
+
### Why Stimulus?
|
|
195
|
+
|
|
196
|
+
Stimulus controllers because:
|
|
197
|
+
1. **Rails standard**: Works with Turbo, importmap
|
|
198
|
+
2. **Lifecycle**: Clean connect/disconnect hooks
|
|
199
|
+
3. **Values API**: Data attributes for configuration
|
|
200
|
+
4. **Events**: Controller communication via dispatch
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Roadmap Philosophy
|
|
205
|
+
|
|
206
|
+
### Current Focus (v0.7.x)
|
|
207
|
+
- Stability and polish
|
|
208
|
+
- MadeMySite integration
|
|
209
|
+
- Bug fixes and refinements
|
|
210
|
+
|
|
211
|
+
### Near Term (v0.8.x)
|
|
212
|
+
- Document sections (content grouping)
|
|
213
|
+
- Enhanced collaboration features
|
|
214
|
+
- Performance optimizations
|
|
215
|
+
|
|
216
|
+
### Future (v1.0+)
|
|
217
|
+
- Real-time collaboration
|
|
218
|
+
- Version history
|
|
219
|
+
- AI-assisted writing
|
|
220
|
+
- Plugin ecosystem
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Contributing
|
|
225
|
+
|
|
226
|
+
When adding features:
|
|
227
|
+
|
|
228
|
+
1. **Start with Ruby**: Create extension PORO in `lib/inkpen/extensions/`
|
|
229
|
+
2. **Add JavaScript**: Create TipTap extension in `app/assets/javascripts/inkpen/extensions/`
|
|
230
|
+
3. **Style it**: Add CSS in `app/assets/stylesheets/inkpen/`
|
|
231
|
+
4. **Register it**: Add to `ADVANCED_EXTENSIONS` in `configuration.rb`
|
|
232
|
+
5. **Test it**: Add tests in `test/`
|
|
233
|
+
6. **Document it**: Update CHANGELOG.md and ROADMAP.md
|
|
234
|
+
|
|
235
|
+
Follow the patterns in CLAUDE.md for code style.
|