@okam/directus-flexible-content 1.1.0 → 1.2.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 (5) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.md +80 -0
  3. package/index.js +1 -19
  4. package/index.mjs +308 -12235
  5. package/package.json +45 -3
package/CHANGELOG.md ADDED
@@ -0,0 +1,104 @@
1
+ ## 1.1.0 (2024-10-04)
2
+
3
+
4
+ ### 🚀 Features
5
+
6
+ - updates & cleanup packages and dependancies ([#210](https://github.com/OKAMca/stack/pull/210))
7
+
8
+ - **directus-flexible-content:** added support for marks and inline blocks ([5ffa03a](https://github.com/OKAMca/stack/commit/5ffa03a))
9
+
10
+
11
+ ### 🩹 Fixes
12
+
13
+ - **directus-flexible-content:** typo and codegen config ([0141b1f](https://github.com/OKAMca/stack/commit/0141b1f))
14
+
15
+
16
+ ### ❤️ Thank You
17
+
18
+ - Jérôme Trottier
19
+ - Marie-Maxime Tanguay @marie-maxime
20
+
21
+ ## 1.0.6 (2024-08-30)
22
+
23
+
24
+ ### 🩹 Fixes
25
+
26
+ - added sup & sub to flexible editor ([c08398b](https://github.com/OKAMca/stack/commit/c08398b))
27
+
28
+
29
+ ### ❤️ Thank You
30
+
31
+ - Marie-Maxime Tanguay @marie-maxime
32
+ - mykimd @mykimd
33
+ - Pierre-Olivier Clerson @poclerson
34
+ - poclerson
35
+ - Yan Morin
36
+ - yanmorinokamca @yanmorinokamca
37
+
38
+ ## 1.0.5 (2024-07-17)
39
+
40
+
41
+ ### 🩹 Fixes
42
+
43
+ - **directus-flexible-content:** build fix ([9d38a63](https://github.com/OKAMca/stack/commit/9d38a63))
44
+
45
+
46
+ ### ❤️ Thank You
47
+
48
+ - Jérôme Trottier
49
+
50
+ ## 1.0.4 (2024-07-17)
51
+
52
+
53
+ ### 🩹 Fixes
54
+
55
+ - **directus-flexible-content:** support base block key for dispatching ([1e6344c](https://github.com/OKAMca/stack/commit/1e6344c))
56
+
57
+
58
+ ### ❤️ Thank You
59
+
60
+ - Jérôme Trottier
61
+
62
+ ## 1.0.3 (2024-07-11)
63
+
64
+
65
+ ### 🩹 Fixes
66
+
67
+ - **directus-flexible-editor:** fixed content injection and prop name ([91705fb](https://github.com/OKAMca/stack/commit/91705fb))
68
+
69
+
70
+ ### ❤️ Thank You
71
+
72
+ - Jérôme Trottier
73
+
74
+ ## 1.0.2 (2024-07-11)
75
+
76
+
77
+ ### 🩹 Fixes
78
+
79
+ - **directus-flexible-content:** remove use server uses ([9c62479](https://github.com/OKAMca/stack/commit/9c62479))
80
+
81
+
82
+ ### ❤️ Thank You
83
+
84
+ - Jérôme Trottier
85
+
86
+ ## 1.0.1 (2024-07-10)
87
+
88
+
89
+ ### 🩹 Fixes
90
+
91
+ - **publish:** add building packages step to workflow ([c9ce442](https://github.com/OKAMca/stack/commit/c9ce442))
92
+
93
+ - **directus-flexible-content:** add stack-ui and directus block to external deps ([5b41526](https://github.com/OKAMca/stack/commit/5b41526))
94
+
95
+
96
+ ### ❤️ Thank You
97
+
98
+ - Jérôme Trottier
99
+ - Pierre-Olivier Clerson @poclerson
100
+ - yanmorinokamca @yanmorinokamca
101
+
102
+ # 1.0.0 (2024-07-08)
103
+
104
+ This was a version bump only for directus-flexible-content to align it with other projects, there were no code changes.
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # directus-flexible-content
2
+
3
+ ## Exports
4
+ - FlexibleEditorContent (Component)
5
+ - TRenderingNodes (Type)
6
+ - JSONContent (Type)
7
+
8
+ ## FlexibleEditorContent Component
9
+
10
+ ### Props
11
+ | name | type | description |
12
+ |--------------------|-------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
13
+ | jsonContent | JSONContent | This prop takes in the json data returned from the flexible editor in directus. |
14
+ | editorNodes | EditorNodes[] \| undefined \| null | This prop takes in the editor nodes data from directus. |
15
+ | serializers | Extensions \| undefined | This prop takes in the different tiptap extensions that the flexible editor uses. There are already a bunch pre-installed in the package (see 'src/lib/components/FlexibleEditorContent/extensions') |
16
+ | config | TBlockSerializerConfig \| undefined | This takes in a BlockDispatcher config object for relation blocks placed in the flexible editor. |
17
+ | nodes | TRenderingNodes \| undefined | This takes in a config object for remapping default HTML semantic tags to React Components. |
18
+ | remappedAttributes | Record<string, string> \| undefined | This allows to remap HTML attributes to fix warnings or errors made by tiptap. |
19
+
20
+ ### Configuring the flexible editor inside directus :
21
+
22
+ - [Basic usage](https://github.com/formfcw/directus-extension-flexible-editor?tab=readme-ov-file#basic-usage)
23
+ - [With relation nodes](https://github.com/formfcw/directus-extension-flexible-editor?tab=readme-ov-file#usage-with-relation-nodes)
24
+ - [With relation nodes and exisiting items](https://github.com/formfcw/directus-extension-flexible-editor?tab=readme-ov-file#tutorial-relation-node-with-existing-items)
25
+
26
+ Adding blocks to the flexible editor options : the related blocks are handled in the Editor Nodes field beside the flexible editor field. You can add more collections by going in the relationship menu of the editor nodes and selecting additional collections in the associated collections section.
27
+
28
+
29
+ https://github.com/user-attachments/assets/576bdb52-f9bc-4835-ab2a-4c59995ae77f
30
+
31
+
32
+
33
+ Most of the time, if you want to insert blocks inside the flexible editor, you will need to follow the `With relation nodes and exisiting items` tutorial. Note that it is important to prefix related blocks for selection with `related_` so that a related block would look like `related_{block-collection}` so if you have a `block_faqs` your related collection key should be `related_block_faqs`.
34
+
35
+ IMPORTANT: when configuring the many to many relation inside your `related_{block-collection}` collection. The key of the field should always be `blocks`.
36
+ ![image](https://github.com/user-attachments/assets/716ef0e9-cf9c-4320-8d7f-6557e8946972)
37
+
38
+
39
+ ### Querying
40
+
41
+ Here is an example of what querying should look like :
42
+
43
+ ```graphql
44
+ flexible_editor
45
+ editor_nodes {
46
+ id
47
+ collection
48
+ item {
49
+ ... on related_block_quote {
50
+ id
51
+ blocks {
52
+ id # id should always be present in the query for the blocks otherwise the block will not be displayed.
53
+ item: block_quote_id { # You should always rename `block_[x]_id` to item
54
+ ...BlockQuote
55
+ }
56
+ }
57
+ }
58
+ ... on related_block_button {
59
+ id
60
+ blocks {
61
+ id
62
+ item: block_button_id {
63
+ ...BlockButton
64
+ }
65
+ }
66
+ }
67
+ ... on related_block_faqs {
68
+ id
69
+ blocks {
70
+ id
71
+ item: block_faqs_id {
72
+ ...BlockFaqs
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+