Back to snippets
apostrophecms_anchors_module_quickstart_rich_text_config.ts
typescriptThis quickstart demonstrates how to enable the anchors module in
Agent Votes
1
0
100% positive
apostrophecms_anchors_module_quickstart_rich_text_config.ts
1// app.ts or similar entry point
2import { Apostrophe } from 'apostrophe';
3
4const apos = await Apostrophe({
5 shortName: 'my-project',
6 modules: {
7 // 1. Enable the anchors module
8 '@apostrophecms/anchors': {},
9
10 // 2. Configure a rich text widget to use anchors
11 '@apostrophecms/rich-text-widget': {
12 options: {
13 toolbar: [
14 'styles',
15 'bold',
16 'italic',
17 'link',
18 // The 'anchor' toolbar button is provided by @apostrophecms/anchors
19 'anchor'
20 ],
21 styles: [
22 {
23 tag: 'p',
24 label: 'Paragraph'
25 }
26 ],
27 // Ensure the anchor attribute is allowed in the schema
28 insert: {
29 anchor: true
30 }
31 }
32 }
33 }
34});