inkpen 0.8.1 → 0.8.3
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 +4 -4
- data/README.md +48 -0
- data/app/assets/javascripts/inkpen.bundle.js +336 -342
- data/app/assets/javascripts/inkpen.bundle.js.map +4 -4
- data/lib/inkpen/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f2b2d7c2657d94cf09267ba1623de494e1fed19349433a2185d901259224d9c
|
|
4
|
+
data.tar.gz: 266dcb58ef1b3feedf4fdf9164d380307e465d4f09dcc026515ec1a726fcd489
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c21807eebda1ca64e48c47508c090a5f14b315292da3fccc5ba8f989d219f2d4c9e598ac4d9d183241e1fc987794e69df1add4f1de5777e473c069d18aee0a1f
|
|
7
|
+
data.tar.gz: 1db7aa4eee124f24ed2b44985b8a4e391247d771b7c7a23bf6d97ff67c277ce514497ab589ed273facbd19c3e8c7ad2e42d1973c9b7e4583fe49b6ec6d8666ba
|
data/README.md
CHANGED
|
@@ -27,6 +27,26 @@ Then run:
|
|
|
27
27
|
bundle install
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
### Stylesheets (important — must be included by the host)
|
|
31
|
+
|
|
32
|
+
The gem ships a separate stylesheet at `inkpen/editor.css`. **It is not auto-loaded** by your host app's layout. You must include it yourself, typically in `app/views/layouts/application.html.erb`:
|
|
33
|
+
|
|
34
|
+
```erb
|
|
35
|
+
<%= stylesheet_link_tag "inkpen/editor", "data-turbo-track": "reload" %>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If you have other layouts (fullscreen tool layouts, custom marketing layouts, etc.) and Inkpen mounts on any view they render, **each layout must include the stylesheet**. Forgetting this is the most common "the editor renders but looks broken" failure mode — TipTap mounts fine in JS, but no Inkpen styles apply.
|
|
39
|
+
|
|
40
|
+
If you also use any of the visual extensions below, include their stylesheets too (Sprockets `*= require inkpen/<name>` or Propshaft `<%= stylesheet_link_tag "inkpen/<name>" %>`):
|
|
41
|
+
|
|
42
|
+
- `inkpen/advanced_table`, `inkpen/inkpen_table` — table styles
|
|
43
|
+
- `inkpen/callout`, `inkpen/columns`, `inkpen/database`, `inkpen/document_section` — block extensions
|
|
44
|
+
- `inkpen/drag_drop`, `inkpen/block_gutter`, `inkpen/sticky_toolbar` — chrome
|
|
45
|
+
- `inkpen/embed`, `inkpen/enhanced_image`, `inkpen/file_attachment`, `inkpen/footnotes`, `inkpen/toc` — content blocks
|
|
46
|
+
- `inkpen/mention`, `inkpen/slash_menu`, `inkpen/preformatted`, `inkpen/search_replace`, `inkpen/section`, `inkpen/toggle`, `inkpen/markdown_mode`, `inkpen/export`, `inkpen/animations` — UX
|
|
47
|
+
|
|
48
|
+
Only `inkpen/editor` is added to the asset precompile list automatically; everything else opts in.
|
|
49
|
+
|
|
30
50
|
## Configuration
|
|
31
51
|
|
|
32
52
|
Configure Inkpen globally in an initializer:
|
|
@@ -303,6 +323,34 @@ The editor is controlled by `inkpen--editor` Stimulus controller. Connect it to
|
|
|
303
323
|
</div>
|
|
304
324
|
```
|
|
305
325
|
|
|
326
|
+
The `extensions-value` array gates which TipTap extensions the editor instantiates. The full bundle ships every extension, but unconfigured ones don't run — they just sit in the bundle. (A future spec — `02-lazy-load-and-extension-gating` in the planning surface — will gate the bundle download too, so a lite editor downloads only what it asks for. As of `0.8.x` the gate is runtime-only, not bundle-time.)
|
|
327
|
+
|
|
328
|
+
Supported extension names: `bold`, `italic`, `link`, `heading`, `bullet_list`, `ordered_list`, `task_list`, `code_block`, `code`, `strike`, `underline`, `subscript`, `superscript`, `highlight`, `typography`, `placeholder`, `blockquote`, `horizontal_rule`, `hard_break`, `history`, `dropcursor`, `gapcursor`, `image`, `youtube`, `character_count`, `bubble_menu`, `floating_menu`, `mention`, `table`, `inkpen_table`, `task_item`, `callout`, `columns`, `database`, `document_section`, `embed`, `enhanced_image`, `file_attachment`, `slash_commands`, `block_commands`, `block_gutter`, `drag_handle`, `toggle_block`, `preformatted`, `section`, `section_title`, `table_of_contents`, `export_commands`, `content_embed`.
|
|
329
|
+
|
|
330
|
+
### Public events
|
|
331
|
+
|
|
332
|
+
The editor controller dispatches `CustomEvent`s that bubble up the DOM, so any ancestor element (including the host's `application.js`) can listen with `element.addEventListener("inkpen:<name>", handler)`. All events include `detail.controller` pointing at the dispatching `EditorController` instance.
|
|
333
|
+
|
|
334
|
+
| Event | When it fires | Payload (`detail`) |
|
|
335
|
+
| --- | --- | --- |
|
|
336
|
+
| `inkpen:ready` | Editor is mounted and ready to use | `{ editor }` |
|
|
337
|
+
| `inkpen:change` | Content changed | `{ content, title, subtitle, body, wordCount, characterCount }` |
|
|
338
|
+
| `inkpen:focus` | Editor gained focus | `{}` |
|
|
339
|
+
| `inkpen:blur` | Editor lost focus | `{}` |
|
|
340
|
+
| `inkpen:selection-change` | Selection or marks changed | `{ selection, marks }` |
|
|
341
|
+
| `inkpen:autosave` | Autosave fired | `{ content, timestamp }` |
|
|
342
|
+
| `inkpen:mode-change` | WYSIWYG/split/markdown view toggled | `{ mode, previousMode }` |
|
|
343
|
+
| `inkpen:error` | Recoverable error | `{ kind, error?, message? }` |
|
|
344
|
+
| `inkpen:slash-command` | User picked an item from the `/` slash menu | `{ commandId, range, editor }` |
|
|
345
|
+
| `inkpen:export-success` | Export action succeeded | `{ message }` |
|
|
346
|
+
| `inkpen:export-error` | Export action failed | `{ message }` |
|
|
347
|
+
| `inkpen:widget-inserted` | Sticky-toolbar widget inserted | `{ type, data }` |
|
|
348
|
+
| `inkpen:insert-widget`, `inkpen:request-file`, `inkpen:request-image`, `inkpen:request-embed` | Sticky-toolbar requests host to handle an action | varies; see `sticky_toolbar_controller.js` |
|
|
349
|
+
|
|
350
|
+
`inkpen:error` is the most useful one to wire to a host-side error tracker — log it globally so any future failure mode is visible. Today's `kind` values include `module-load` (a TipTap module failed to import) and `markdown-import` (reserved for the future markdown-import path).
|
|
351
|
+
|
|
352
|
+
`inkpen:slash-command` is how host code adds custom slash-menu actions. The `commandId` is whatever you registered in the slash-commands extension config; intercept the event, prevent default if your code handles it, otherwise let the editor's default action run.
|
|
353
|
+
|
|
306
354
|
## Architecture
|
|
307
355
|
|
|
308
356
|
```
|