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.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.rubocop.yml +8 -0
  4. data/.yardopts +11 -0
  5. data/CLAUDE.md +141 -0
  6. data/README.md +409 -0
  7. data/Rakefile +19 -0
  8. data/app/assets/javascripts/inkpen/controllers/editor_controller.js +2050 -0
  9. data/app/assets/javascripts/inkpen/controllers/sticky_toolbar_controller.js +667 -0
  10. data/app/assets/javascripts/inkpen/controllers/toolbar_controller.js +693 -0
  11. data/app/assets/javascripts/inkpen/export/html.js +637 -0
  12. data/app/assets/javascripts/inkpen/export/index.js +30 -0
  13. data/app/assets/javascripts/inkpen/export/markdown.js +697 -0
  14. data/app/assets/javascripts/inkpen/export/pdf.js +372 -0
  15. data/app/assets/javascripts/inkpen/extensions/advanced_table.js +640 -0
  16. data/app/assets/javascripts/inkpen/extensions/block_commands.js +300 -0
  17. data/app/assets/javascripts/inkpen/extensions/block_gutter.js +338 -0
  18. data/app/assets/javascripts/inkpen/extensions/callout.js +303 -0
  19. data/app/assets/javascripts/inkpen/extensions/columns.js +403 -0
  20. data/app/assets/javascripts/inkpen/extensions/database.js +990 -0
  21. data/app/assets/javascripts/inkpen/extensions/document_section.js +352 -0
  22. data/app/assets/javascripts/inkpen/extensions/drag_handle.js +407 -0
  23. data/app/assets/javascripts/inkpen/extensions/embed.js +629 -0
  24. data/app/assets/javascripts/inkpen/extensions/enhanced_image.js +566 -0
  25. data/app/assets/javascripts/inkpen/extensions/export_commands.js +271 -0
  26. data/app/assets/javascripts/inkpen/extensions/file_attachment.js +593 -0
  27. data/app/assets/javascripts/inkpen/extensions/inkpen_table/index.js +58 -0
  28. data/app/assets/javascripts/inkpen/extensions/inkpen_table/inkpen_table.js +638 -0
  29. data/app/assets/javascripts/inkpen/extensions/inkpen_table/inkpen_table_cell.js +100 -0
  30. data/app/assets/javascripts/inkpen/extensions/inkpen_table/inkpen_table_header.js +100 -0
  31. data/app/assets/javascripts/inkpen/extensions/inkpen_table/table_constants.js +152 -0
  32. data/app/assets/javascripts/inkpen/extensions/inkpen_table/table_helpers.js +254 -0
  33. data/app/assets/javascripts/inkpen/extensions/inkpen_table/table_menu.js +282 -0
  34. data/app/assets/javascripts/inkpen/extensions/preformatted.js +239 -0
  35. data/app/assets/javascripts/inkpen/extensions/section.js +281 -0
  36. data/app/assets/javascripts/inkpen/extensions/section_title.js +126 -0
  37. data/app/assets/javascripts/inkpen/extensions/slash_commands.js +439 -0
  38. data/app/assets/javascripts/inkpen/extensions/table_of_contents.js +474 -0
  39. data/app/assets/javascripts/inkpen/extensions/toggle_block.js +332 -0
  40. data/app/assets/javascripts/inkpen/index.js +87 -0
  41. data/app/assets/stylesheets/inkpen/advanced_table.css +514 -0
  42. data/app/assets/stylesheets/inkpen/animations.css +626 -0
  43. data/app/assets/stylesheets/inkpen/block_gutter.css +265 -0
  44. data/app/assets/stylesheets/inkpen/callout.css +359 -0
  45. data/app/assets/stylesheets/inkpen/columns.css +314 -0
  46. data/app/assets/stylesheets/inkpen/database.css +658 -0
  47. data/app/assets/stylesheets/inkpen/document_section.css +305 -0
  48. data/app/assets/stylesheets/inkpen/drag_drop.css +220 -0
  49. data/app/assets/stylesheets/inkpen/editor.css +652 -0
  50. data/app/assets/stylesheets/inkpen/embed.css +468 -0
  51. data/app/assets/stylesheets/inkpen/enhanced_image.css +453 -0
  52. data/app/assets/stylesheets/inkpen/export.css +499 -0
  53. data/app/assets/stylesheets/inkpen/file_attachment.css +347 -0
  54. data/app/assets/stylesheets/inkpen/footnotes.css +136 -0
  55. data/app/assets/stylesheets/inkpen/inkpen_table.css +608 -0
  56. data/app/assets/stylesheets/inkpen/preformatted.css +215 -0
  57. data/app/assets/stylesheets/inkpen/search_replace.css +58 -0
  58. data/app/assets/stylesheets/inkpen/section.css +236 -0
  59. data/app/assets/stylesheets/inkpen/slash_menu.css +252 -0
  60. data/app/assets/stylesheets/inkpen/sticky_toolbar.css +314 -0
  61. data/app/assets/stylesheets/inkpen/toc.css +386 -0
  62. data/app/assets/stylesheets/inkpen/toggle.css +260 -0
  63. data/app/helpers/inkpen/editor_helper.rb +114 -0
  64. data/app/views/inkpen/_editor.html.erb +139 -0
  65. data/config/importmap.rb +170 -0
  66. data/docs/.DS_Store +0 -0
  67. data/docs/CHANGELOG.md +571 -0
  68. data/docs/FEATURES.md +436 -0
  69. data/docs/ROADMAP.md +3029 -0
  70. data/docs/VISION.md +235 -0
  71. data/docs/extensions/INKPEN_TABLE.md +482 -0
  72. data/docs/thinking/CORRECTED_NO_VUE.md +756 -0
  73. data/docs/thinking/EXECUTIVE_SUMMARY.md +403 -0
  74. data/docs/thinking/INKPEN_CODE_SAMPLES.md +1479 -0
  75. data/docs/thinking/INKPEN_MASTER_GUIDE.md +891 -0
  76. data/docs/thinking/README_START_HERE.md +341 -0
  77. data/lib/inkpen/configuration.rb +175 -0
  78. data/lib/inkpen/editor.rb +204 -0
  79. data/lib/inkpen/engine.rb +32 -0
  80. data/lib/inkpen/extensions/base.rb +109 -0
  81. data/lib/inkpen/extensions/code_block_syntax.rb +177 -0
  82. data/lib/inkpen/extensions/document_section.rb +111 -0
  83. data/lib/inkpen/extensions/forced_document.rb +183 -0
  84. data/lib/inkpen/extensions/mention.rb +155 -0
  85. data/lib/inkpen/extensions/preformatted.rb +111 -0
  86. data/lib/inkpen/extensions/section.rb +139 -0
  87. data/lib/inkpen/extensions/slash_commands.rb +100 -0
  88. data/lib/inkpen/extensions/table.rb +182 -0
  89. data/lib/inkpen/extensions/task_list.rb +145 -0
  90. data/lib/inkpen/sticky_toolbar.rb +157 -0
  91. data/lib/inkpen/toolbar.rb +145 -0
  92. data/lib/inkpen/version.rb +5 -0
  93. data/lib/inkpen.rb +101 -0
  94. data/sig/inkpen.rbs +4 -0
  95. metadata +165 -0
data/docs/FEATURES.md ADDED
@@ -0,0 +1,436 @@
1
+ # Inkpen Features
2
+
3
+ > **Version:** 0.8.0
4
+ > **A Notion-style block editor for Rails**
5
+
6
+ Inkpen is a TipTap-based rich text editor gem that provides Notion-like editing capabilities for Rails applications.
7
+
8
+ ---
9
+
10
+ ## Table of Contents
11
+
12
+ - [Core Features](#core-features)
13
+ - [Block Types](#block-types)
14
+ - [Extensions](#extensions)
15
+ - [Export/Import](#exportimport)
16
+ - [Keyboard Shortcuts](#keyboard-shortcuts)
17
+ - [Configuration](#configuration)
18
+
19
+ ---
20
+
21
+ ## Core Features
22
+
23
+ ### Block-Based Editing
24
+ - Notion-style block architecture
25
+ - Each paragraph, heading, list, etc. is a draggable block
26
+ - Block selection and multi-block operations
27
+ - Duplicate blocks with `Cmd+D`
28
+
29
+ ### Slash Commands
30
+ - Type `/` to open command palette
31
+ - Filter commands by typing
32
+ - Keyboard navigation (arrows, Enter, Escape)
33
+ - 7 command groups: Basic, Lists, Blocks, Media, Data, Advanced, Export
34
+
35
+ ### Drag & Drop
36
+ - Reorder blocks by dragging from gutter handle
37
+ - Visual drop indicator
38
+ - Keyboard shortcuts: `Cmd+Shift+Arrow` to move blocks
39
+ - Edge scrolling near viewport edges
40
+
41
+ ### Block Gutter
42
+ - Left-side controls for each block
43
+ - Drag handle (⋮⋮) for reordering
44
+ - Plus button (+) to insert new blocks
45
+ - Shows on hover, always visible on mobile
46
+
47
+ ---
48
+
49
+ ## Block Types
50
+
51
+ ### Basic Blocks
52
+ | Block | Slash Command | Keyboard Shortcut |
53
+ |-------|---------------|-------------------|
54
+ | Paragraph | `/text` | - |
55
+ | Heading 1 | `/heading1`, `/h1` | - |
56
+ | Heading 2 | `/heading2`, `/h2` | - |
57
+ | Heading 3 | `/heading3`, `/h3` | - |
58
+
59
+ ### Lists
60
+ | Block | Slash Command | Description |
61
+ |-------|---------------|-------------|
62
+ | Bullet List | `/bullet` | Unordered list |
63
+ | Numbered List | `/numbered` | Ordered list |
64
+ | Task List | `/task`, `/todo` | Checklist with checkboxes |
65
+
66
+ ### Content Blocks
67
+ | Block | Slash Command | Keyboard Shortcut |
68
+ |-------|---------------|-------------------|
69
+ | Blockquote | `/quote` | - |
70
+ | Code Block | `/code` | - |
71
+ | Preformatted | `/plain` | `Cmd+Shift+P` |
72
+ | Divider | `/divider`, `/hr` | - |
73
+ | Callout (Info) | `/info` | `Cmd+Shift+O` |
74
+ | Callout (Warning) | `/warning` | - |
75
+ | Callout (Tip) | `/tip` | - |
76
+
77
+ ### Layout Blocks
78
+ | Block | Slash Command | Keyboard Shortcut |
79
+ |-------|---------------|-------------------|
80
+ | Section | `/section` | `Cmd+Shift+S` |
81
+ | 2 Columns | `/columns2` | `Cmd+Shift+C` |
82
+ | 3 Columns | `/columns3` | - |
83
+ | Toggle | `/toggle` | `Cmd+Shift+T` |
84
+
85
+ ### Media Blocks
86
+ | Block | Slash Command | Description |
87
+ |-------|---------------|-------------|
88
+ | Image | `/image` | Resizable with captions |
89
+ | File | `/file` | File attachment with icons |
90
+ | YouTube | `/youtube` | Embedded video |
91
+ | Embed | `/embed` | Social media embeds |
92
+ | Twitter/X | `/twitter` | Tweet embed |
93
+ | Instagram | `/instagram` | Post embed |
94
+ | Figma | `/figma` | Design embed |
95
+ | Loom | `/loom` | Video embed |
96
+ | CodePen | `/codepen` | Code demo embed |
97
+ | Spotify | `/spotify` | Music embed |
98
+
99
+ ### Data Blocks
100
+ | Block | Slash Command | Description |
101
+ |-------|---------------|-------------|
102
+ | Table | `/table` | Basic table |
103
+ | InkpenTable | `/table` | Notion-style tables with handles, menus, colors |
104
+ | Database | `/database` | Notion-style inline database |
105
+ | Kanban Board | `/kanban` | Database with board view |
106
+ | Gallery | `/gallery` | Database with gallery view |
107
+ | Table of Contents | `/toc` | Auto-generated navigation |
108
+
109
+ ---
110
+
111
+ ## Extensions
112
+
113
+ ### 17 Custom Extensions
114
+
115
+ | Extension | Version | Description |
116
+ |-----------|---------|-------------|
117
+ | Section | v0.2.2 | Page-builder style width/spacing controls |
118
+ | Preformatted | v0.3.0 | ASCII art and whitespace preservation |
119
+ | Slash Commands | v0.3.0 | Notion-style command palette |
120
+ | Block Gutter | v0.3.1 | Drag handles and plus buttons |
121
+ | Drag Handle | v0.3.2 | Block reordering via drag & drop |
122
+ | Toggle Block | v0.3.3 | Collapsible content blocks |
123
+ | Columns | v0.3.3 | Multi-column layouts |
124
+ | Callout | v0.3.3 | Highlighted tip/warning/info blocks |
125
+ | Block Commands | v0.4.0 | Block selection and duplication |
126
+ | Enhanced Image | v0.5.0 | Resizable images with captions |
127
+ | File Attachment | v0.5.0 | File uploads with type icons |
128
+ | Embed | v0.5.0 | Social media embeds |
129
+ | Advanced Table | v0.6.0 | Professional table features (deprecated) |
130
+ | Table of Contents | v0.6.0 | Auto-generated heading navigation |
131
+ | Database | v0.6.0 | Notion-style inline databases |
132
+ | Export Commands | v0.7.0 | Export keyboard shortcuts |
133
+ | **InkpenTable** | v0.8.0 | Notion-style tables with handles & menus |
134
+
135
+ ### Database Features
136
+ - **Property Types:** Text, Number, Select, Date, Checkbox, URL
137
+ - **Views:** Table, List, Gallery, Board (Kanban)
138
+ - **Operations:** Add/edit/delete rows, add properties
139
+ - **Styling:** Color-coded select tags
140
+
141
+ ### InkpenTable Features (v0.8.0+)
142
+ - **Row/Column handles** with context menus
143
+ - **Quick add buttons** ("+ New row", "+")
144
+ - **Text colors** (9 options: gray, red, orange, yellow, green, blue, purple, pink)
145
+ - **Background colors** (9 matching options)
146
+ - Column alignment (left, center, right)
147
+ - Table caption/title
148
+ - Border style variants (default, striped, borderless, minimal)
149
+ - Sticky header behavior
150
+ - Dark mode support
151
+
152
+ > **Note:** InkpenTable replaces both `table` and `advanced_table` extensions.
153
+ > See [InkpenTable Documentation](extensions/INKPEN_TABLE.md) for details.
154
+
155
+ ---
156
+
157
+ ## Export/Import
158
+
159
+ ### Supported Formats
160
+
161
+ | Format | Export | Import | Copy |
162
+ |--------|--------|--------|------|
163
+ | Markdown | ✅ | ✅ | ✅ |
164
+ | HTML | ✅ | - | ✅ |
165
+ | PDF | ✅ | - | - |
166
+
167
+ ### Markdown Export
168
+ - GitHub-Flavored Markdown (GFM)
169
+ - Frontmatter support (YAML metadata)
170
+ - Table conversion to GFM syntax
171
+ - Task list checkbox syntax
172
+ - Callout to GFM alert syntax (`> [!NOTE]`)
173
+ - Toggle block to `<details>` HTML
174
+
175
+ ### HTML Export
176
+ - Clean semantic HTML5
177
+ - Optional inline CSS styling
178
+ - Configurable class prefixes
179
+ - Theme support (light/dark/auto)
180
+ - Print-optimized styles
181
+
182
+ ### PDF Export
183
+ - Client-side generation (html2pdf.js)
184
+ - Fallback to print dialog
185
+ - Page sizes: A4, Letter, Legal, A3, A5
186
+ - Portrait/landscape orientation
187
+ - Configurable margins
188
+ - Footer with page numbers
189
+
190
+ ### Export Methods
191
+
192
+ ```javascript
193
+ // Via editor controller
194
+ editor.exportMarkdown()
195
+ editor.downloadAsMarkdown('document.md')
196
+ editor.copyAsMarkdown()
197
+ editor.importMarkdown(markdownString)
198
+
199
+ editor.exportHTML()
200
+ editor.downloadAsHTML('document.html')
201
+ editor.copyAsHTML()
202
+
203
+ editor.exportPDF()
204
+ editor.downloadAsPDF('document.pdf')
205
+ ```
206
+
207
+ ### Export Slash Commands
208
+ When `export_commands` extension is enabled:
209
+ - `/export markdown` - Download as .md
210
+ - `/export html` - Download as .html
211
+ - `/export pdf` - Download as .pdf
212
+ - `/copy markdown` - Copy to clipboard
213
+ - `/copy html` - Copy to clipboard
214
+
215
+ ---
216
+
217
+ ## Keyboard Shortcuts
218
+
219
+ ### Text Formatting
220
+ | Shortcut | Action |
221
+ |----------|--------|
222
+ | `Cmd+B` | Bold |
223
+ | `Cmd+I` | Italic |
224
+ | `Cmd+U` | Underline |
225
+ | `Cmd+Shift+S` | Strikethrough |
226
+ | `Cmd+E` | Inline code |
227
+ | `Cmd+K` | Insert link |
228
+
229
+ ### Block Operations
230
+ | Shortcut | Action |
231
+ |----------|--------|
232
+ | `/` | Open slash menu |
233
+ | `Cmd+D` | Duplicate block |
234
+ | `Cmd+Shift+ArrowUp` | Move block up |
235
+ | `Cmd+Shift+ArrowDown` | Move block down |
236
+ | `Backspace` (empty) | Delete block |
237
+
238
+ ### Block Insertion
239
+ | Shortcut | Action |
240
+ |----------|--------|
241
+ | `Cmd+Shift+S` | Insert section |
242
+ | `Cmd+Shift+P` | Toggle preformatted |
243
+ | `Cmd+Shift+T` | Insert toggle / TOC |
244
+ | `Cmd+Shift+C` | Insert 2 columns |
245
+ | `Cmd+Shift+O` | Insert info callout |
246
+
247
+ ### Table Shortcuts
248
+ | Shortcut | Action |
249
+ |----------|--------|
250
+ | `Cmd+Shift+L` | Align cell left |
251
+ | `Cmd+Shift+E` | Align cell center |
252
+ | `Cmd+Shift+R` | Align cell right |
253
+ | `Tab` | Next cell |
254
+ | `Shift+Tab` | Previous cell |
255
+
256
+ ### Export Shortcuts
257
+ | Shortcut | Action |
258
+ |----------|--------|
259
+ | `Cmd+Alt+M` | Download Markdown |
260
+ | `Cmd+Alt+H` | Download HTML |
261
+ | `Cmd+Alt+P` | Download PDF |
262
+ | `Cmd+Alt+Shift+M` | Copy Markdown |
263
+ | `Cmd+Alt+Shift+H` | Copy HTML |
264
+
265
+ ---
266
+
267
+ ## Configuration
268
+
269
+ ### Basic Setup
270
+
271
+ ```erb
272
+ <%= inkpen_editor form, :content,
273
+ toolbar: :sticky,
274
+ extensions: [:slash_commands, :block_gutter, :drag_handle] %>
275
+ ```
276
+
277
+ ### Enable All Features
278
+
279
+ ```ruby
280
+ # config/initializers/inkpen.rb
281
+ Inkpen.configure do |config|
282
+ config.extensions = [
283
+ # Core
284
+ :bold, :italic, :strike, :underline, :link,
285
+ :heading, :bullet_list, :ordered_list, :blockquote,
286
+ :code_block, :horizontal_rule, :hard_break,
287
+
288
+ # Lists
289
+ :task_list,
290
+
291
+ # Blocks
292
+ :section, :preformatted, :toggle_block, :columns, :callout,
293
+
294
+ # Media
295
+ :enhanced_image, :file_attachment, :embed, :youtube,
296
+
297
+ # Data
298
+ :table, :advanced_table, :database, :table_of_contents,
299
+
300
+ # UI
301
+ :slash_commands, :block_gutter, :drag_handle, :block_commands,
302
+
303
+ # Export
304
+ :export_commands
305
+ ]
306
+ end
307
+ ```
308
+
309
+ ### Sticky Toolbar with Export
310
+
311
+ ```erb
312
+ <div data-controller="inkpen--editor inkpen--sticky-toolbar"
313
+ data-inkpen--sticky-toolbar-show-export-value="true"
314
+ data-inkpen--sticky-toolbar-export-formats-value='["markdown","html","pdf"]'>
315
+ </div>
316
+ ```
317
+
318
+ ---
319
+
320
+ ## File Structure
321
+
322
+ ```
323
+ app/assets/javascripts/inkpen/
324
+ ├── controllers/
325
+ │ ├── editor_controller.js
326
+ │ ├── toolbar_controller.js
327
+ │ └── sticky_toolbar_controller.js
328
+ ├── extensions/
329
+ │ ├── section.js
330
+ │ ├── preformatted.js
331
+ │ ├── slash_commands.js
332
+ │ ├── block_gutter.js
333
+ │ ├── drag_handle.js
334
+ │ ├── toggle_block.js
335
+ │ ├── columns.js
336
+ │ ├── callout.js
337
+ │ ├── block_commands.js
338
+ │ ├── enhanced_image.js
339
+ │ ├── file_attachment.js
340
+ │ ├── embed.js
341
+ │ ├── advanced_table.js # deprecated
342
+ │ ├── table_of_contents.js
343
+ │ ├── database.js
344
+ │ ├── document_section.js
345
+ │ ├── export_commands.js
346
+ │ └── inkpen_table/ # v0.8.0 - Notion-style tables
347
+ │ ├── index.js
348
+ │ ├── inkpen_table.js
349
+ │ ├── inkpen_table_cell.js
350
+ │ ├── inkpen_table_header.js
351
+ │ ├── table_menu.js
352
+ │ ├── table_helpers.js
353
+ │ └── table_constants.js
354
+ ├── export/
355
+ │ ├── index.js
356
+ │ ├── markdown.js
357
+ │ ├── html.js
358
+ │ └── pdf.js
359
+ └── index.js
360
+
361
+ app/assets/stylesheets/inkpen/
362
+ ├── editor.css
363
+ ├── sticky_toolbar.css
364
+ ├── section.css
365
+ ├── preformatted.css
366
+ ├── slash_menu.css
367
+ ├── block_gutter.css
368
+ ├── drag_drop.css
369
+ ├── toggle.css
370
+ ├── columns.css
371
+ ├── callout.css
372
+ ├── animations.css
373
+ ├── enhanced_image.css
374
+ ├── file_attachment.css
375
+ ├── embed.css
376
+ ├── advanced_table.css # deprecated
377
+ ├── inkpen_table.css # v0.8.0
378
+ ├── toc.css
379
+ ├── database.css
380
+ ├── document_section.css
381
+ └── export.css
382
+ ```
383
+
384
+ ---
385
+
386
+ ## Browser Support
387
+
388
+ - Chrome 80+
389
+ - Firefox 75+
390
+ - Safari 13+
391
+ - Edge 80+
392
+
393
+ ## Accessibility
394
+
395
+ - Keyboard navigation for all menus
396
+ - ARIA attributes for screen readers
397
+ - Reduced motion support (`prefers-reduced-motion`)
398
+ - Focus indicators
399
+
400
+ ## Mobile Support
401
+
402
+ - Touch-friendly targets (32px minimum)
403
+ - Always-visible gutter on mobile
404
+ - Responsive column stacking
405
+ - Optimized animations
406
+
407
+ ---
408
+
409
+ ## Comparison with Notion
410
+
411
+ | Feature | Notion | Inkpen |
412
+ |---------|--------|--------|
413
+ | Block-based editing | ✅ | ✅ |
414
+ | Slash commands | ✅ | ✅ |
415
+ | Drag & drop blocks | ✅ | ✅ |
416
+ | Toggle blocks | ✅ | ✅ |
417
+ | Callouts | ✅ | ✅ |
418
+ | Columns | ✅ | ✅ |
419
+ | Tables | ✅ | ✅ |
420
+ | Database blocks | ✅ | ✅ |
421
+ | Kanban boards | ✅ | ✅ |
422
+ | Table of contents | ✅ | ✅ |
423
+ | Social embeds | ✅ | ✅ |
424
+ | File attachments | ✅ | ✅ |
425
+ | Markdown export | ✅ | ✅ |
426
+ | PDF export | ✅ | ✅ |
427
+ | Comments | ✅ | ❌ |
428
+ | Real-time collaboration | ✅ | ❌ |
429
+ | Version history | ✅ | ❌ |
430
+ | AI features | ✅ | ❌ |
431
+
432
+ ---
433
+
434
+ ## License
435
+
436
+ MIT License - See LICENSE file for details.