@amazeelabs/silverback-gutenberg 2.6.2

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 (94) hide show
  1. package/CHANGELOG.md +983 -0
  2. package/drupal/silverback_gutenberg/README.md +439 -0
  3. package/drupal/silverback_gutenberg/composer.json +20 -0
  4. package/drupal/silverback_gutenberg/config/install/silverback_gutenberg.settings.yml +1 -0
  5. package/drupal/silverback_gutenberg/config/schema/silverback_gutenberg.schema.yml +13 -0
  6. package/drupal/silverback_gutenberg/css/gutenberg-tweaks.css +46 -0
  7. package/drupal/silverback_gutenberg/directives.gql +40 -0
  8. package/drupal/silverback_gutenberg/directives.graphql +46 -0
  9. package/drupal/silverback_gutenberg/js/base.js +24 -0
  10. package/drupal/silverback_gutenberg/js/gutenberg-tweaks.js +154 -0
  11. package/drupal/silverback_gutenberg/silverback_gutenberg.api.php +76 -0
  12. package/drupal/silverback_gutenberg/silverback_gutenberg.info.yml +8 -0
  13. package/drupal/silverback_gutenberg/silverback_gutenberg.libraries.yml +14 -0
  14. package/drupal/silverback_gutenberg/silverback_gutenberg.module +97 -0
  15. package/drupal/silverback_gutenberg/silverback_gutenberg.services.yml +29 -0
  16. package/drupal/silverback_gutenberg/src/Annotation/GutenbergBlockMutator.php +39 -0
  17. package/drupal/silverback_gutenberg/src/Annotation/GutenbergValidator.php +37 -0
  18. package/drupal/silverback_gutenberg/src/Annotation/GutenbergValidatorRule.php +37 -0
  19. package/drupal/silverback_gutenberg/src/Attribute/GutenbergBlockMutator.php +29 -0
  20. package/drupal/silverback_gutenberg/src/BlockMutator/BlockMutatorBase.php +24 -0
  21. package/drupal/silverback_gutenberg/src/BlockMutator/BlockMutatorInterface.php +41 -0
  22. package/drupal/silverback_gutenberg/src/BlockMutator/BlockMutatorManager.php +114 -0
  23. package/drupal/silverback_gutenberg/src/BlockMutator/BlockMutatorManagerInterface.php +30 -0
  24. package/drupal/silverback_gutenberg/src/BlockMutator/EntityBlockMutatorBase.php +189 -0
  25. package/drupal/silverback_gutenberg/src/BlockSerializer.php +84 -0
  26. package/drupal/silverback_gutenberg/src/Controller/LinkitAutocomplete.php +84 -0
  27. package/drupal/silverback_gutenberg/src/Directives.php +74 -0
  28. package/drupal/silverback_gutenberg/src/EditorBlocksProcessor.php +53 -0
  29. package/drupal/silverback_gutenberg/src/GutenbergValidation/GutenbergCardinalityValidatorInterface.php +19 -0
  30. package/drupal/silverback_gutenberg/src/GutenbergValidation/GutenbergCardinalityValidatorTrait.php +221 -0
  31. package/drupal/silverback_gutenberg/src/GutenbergValidation/GutenbergValidatorBase.php +24 -0
  32. package/drupal/silverback_gutenberg/src/GutenbergValidation/GutenbergValidatorInterface.php +65 -0
  33. package/drupal/silverback_gutenberg/src/GutenbergValidation/GutenbergValidatorManager.php +37 -0
  34. package/drupal/silverback_gutenberg/src/GutenbergValidation/GutenbergValidatorRuleInterface.php +20 -0
  35. package/drupal/silverback_gutenberg/src/GutenbergValidation/GutenbergValidatorRuleManager.php +37 -0
  36. package/drupal/silverback_gutenberg/src/LinkProcessor.php +405 -0
  37. package/drupal/silverback_gutenberg/src/LinkedContentExtractor.php +35 -0
  38. package/drupal/silverback_gutenberg/src/Normalizer/GutenbergContentEntityNormalizer.php +123 -0
  39. package/drupal/silverback_gutenberg/src/Plugin/EntityUsage/Track/GutenbergContentTrackTrait.php +51 -0
  40. package/drupal/silverback_gutenberg/src/Plugin/EntityUsage/Track/GutenbergLinkedContent.php +96 -0
  41. package/drupal/silverback_gutenberg/src/Plugin/EntityUsage/Track/GutenbergMediaEmbed.php +63 -0
  42. package/drupal/silverback_gutenberg/src/Plugin/EntityUsage/Track/GutenbergReferencedContent.php +101 -0
  43. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/DataProducer/EditorBlockAttribute.php +42 -0
  44. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/DataProducer/EditorBlockChildren.php +32 -0
  45. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/DataProducer/EditorBlockHtml.php +30 -0
  46. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/DataProducer/EditorBlockMedia.php +159 -0
  47. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/DataProducer/EditorBlockType.php +29 -0
  48. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/DataProducer/EditorBlocks.php +127 -0
  49. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/Directive/EditorBlockAttribute.php +29 -0
  50. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/Directive/EditorBlockChildren.php +21 -0
  51. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/Directive/EditorBlockMarkup.php +21 -0
  52. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/Directive/EditorBlockMedia.php +21 -0
  53. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/Directive/EditorBlockType.php +21 -0
  54. package/drupal/silverback_gutenberg/src/Plugin/GraphQL/Directive/EditorBlocks.php +36 -0
  55. package/drupal/silverback_gutenberg/src/Plugin/GutenbergBlockMutator/MediaBlockMutator.php +30 -0
  56. package/drupal/silverback_gutenberg/src/Plugin/GutenbergBlockMutator/NodeBlockMutator.php +25 -0
  57. package/drupal/silverback_gutenberg/src/Plugin/GutenbergBlockMutator/TermReferenceBlockMutator.php +104 -0
  58. package/drupal/silverback_gutenberg/src/Plugin/Linkit/Matcher/SilverbackMatcherTrait.php +69 -0
  59. package/drupal/silverback_gutenberg/src/Plugin/Linkit/Matcher/SilverbackMediaMatcher.php +53 -0
  60. package/drupal/silverback_gutenberg/src/Plugin/Linkit/Matcher/SilverbackNodeMatcher.php +19 -0
  61. package/drupal/silverback_gutenberg/src/Plugin/Validation/Constraint/Gutenberg.php +15 -0
  62. package/drupal/silverback_gutenberg/src/Plugin/Validation/Constraint/GutenbergValidator.php +210 -0
  63. package/drupal/silverback_gutenberg/src/Plugin/Validation/GutenbergValidatorRule/Email.php +28 -0
  64. package/drupal/silverback_gutenberg/src/Plugin/Validation/GutenbergValidatorRule/Required.php +29 -0
  65. package/drupal/silverback_gutenberg/src/ReferencedContentExtractor.php +67 -0
  66. package/drupal/silverback_gutenberg/src/Routing/RouteSubscriber.php +17 -0
  67. package/drupal/silverback_gutenberg/src/Service/MediaService.php +27 -0
  68. package/drupal/silverback_gutenberg/src/SilverbackGutenbergServiceProvider.php +28 -0
  69. package/drupal/silverback_gutenberg/src/Utils.php +30 -0
  70. package/drupal/silverback_gutenberg/src/WebformMessageManager.php +29 -0
  71. package/drupal/silverback_gutenberg/tests/graphql/.graphqlrc.json +5 -0
  72. package/drupal/silverback_gutenberg/tests/graphql/queries/editor.gql +30 -0
  73. package/drupal/silverback_gutenberg/tests/graphql/schema.graphqls +37 -0
  74. package/drupal/silverback_gutenberg/tests/modules/silverback_gutenberg_test_validator/silverback_gutenberg_test_validator.info.yml +9 -0
  75. package/drupal/silverback_gutenberg/tests/modules/silverback_gutenberg_test_validator/src/Plugin/Validation/GutenbergValidator/ColumnValidator.php +42 -0
  76. package/drupal/silverback_gutenberg/tests/modules/silverback_gutenberg_test_validator/src/Plugin/Validation/GutenbergValidator/GroupValidator.php +50 -0
  77. package/drupal/silverback_gutenberg/tests/modules/silverback_gutenberg_test_validator/src/Plugin/Validation/GutenbergValidator/LinkValidator.php +43 -0
  78. package/drupal/silverback_gutenberg/tests/src/Kernel/BlockValidationRuleTest.php +194 -0
  79. package/drupal/silverback_gutenberg/tests/src/Kernel/EditorDirectivesTest.php +255 -0
  80. package/drupal/silverback_gutenberg/tests/src/Kernel/GutenbergLinkedContentEUTrackTest.php +133 -0
  81. package/drupal/silverback_gutenberg/tests/src/Kernel/GutenbergReferencedContentEUTrackTest.php +225 -0
  82. package/drupal/silverback_gutenberg/tests/src/Kernel/LinkProcessorTest.php +284 -0
  83. package/drupal/silverback_gutenberg/tests/src/Kernel/MediaNormalizerTest.php +174 -0
  84. package/drupal/silverback_gutenberg/tests/src/Traits/SampleAssetTrait.php +15 -0
  85. package/drupal/silverback_gutenberg/tests/src/Unit/BlockSerializerTest.php +27 -0
  86. package/drupal/silverback_gutenberg/tests/src/Unit/BlockValidatorCardinalityTest.php +1537 -0
  87. package/drupal/silverback_gutenberg/tests/src/Unit/EditorBlocksProcessorTest.php +159 -0
  88. package/drupal/silverback_gutenberg/tests/src/Unit/LinkedContentExtractorTest.php +65 -0
  89. package/drupal/silverback_gutenberg/tests/src/Unit/ReferencedContentExtractorTest.php +248 -0
  90. package/drupal/silverback_gutenberg/tests/src/assets/media/data.json +4 -0
  91. package/drupal/silverback_gutenberg/tests/src/assets/media/source.html +71 -0
  92. package/drupal/silverback_gutenberg/tests/src/assets/media/target.html +71 -0
  93. package/package.json +16 -0
  94. package/turbo.json +15 -0
@@ -0,0 +1,159 @@
1
+ <?php
2
+
3
+ namespace Drupal\silverback_gutenberg\Tests\Unit;
4
+
5
+ use Drupal\silverback_gutenberg\EditorBlocksProcessor;
6
+ use Drupal\Tests\UnitTestCase;
7
+
8
+ class EditorBlocksProcessorTest extends UnitTestCase {
9
+
10
+ public function testNoBlocks() {
11
+ $this->assertEquals(
12
+ EditorBlocksProcessor::processsIgnoredBlocks([], []),
13
+ []
14
+ );
15
+ }
16
+
17
+ public function testNoIgnoredBlocks() {
18
+ $input = [
19
+ [
20
+ 'blockName' => 'custom/a',
21
+ ],
22
+ [
23
+ 'blockName' => 'custom/b',
24
+ ],
25
+ ];
26
+ $expected = [
27
+ [
28
+ 'blockName' => 'custom/a',
29
+ ],
30
+ [
31
+ 'blockName' => 'custom/b',
32
+ ],
33
+ ];
34
+ $this->assertEquals(
35
+ $expected,
36
+ EditorBlocksProcessor::processsIgnoredBlocks($input, NULL),
37
+ );
38
+ }
39
+
40
+ public function testNoTransientBlocks() {
41
+ $input = [
42
+ [
43
+ 'blockName' => 'custom/a',
44
+ ],
45
+ [
46
+ 'blockName' => 'custom/b',
47
+ ],
48
+ ];
49
+ $expected = [
50
+ [
51
+ 'blockName' => 'custom/a',
52
+ ],
53
+ [
54
+ 'blockName' => 'custom/b',
55
+ ],
56
+ ];
57
+ $this->assertEquals(
58
+ $expected,
59
+ EditorBlocksProcessor::processsIgnoredBlocks($input, ['custom/c']),
60
+ );
61
+ }
62
+
63
+ public function testTransientBlocks() {
64
+ $input = [
65
+ [
66
+ 'blockName' => 'custom/a',
67
+ ],
68
+ [
69
+ 'blockName' => 'custom/c',
70
+ 'innerBlocks' => [
71
+ [
72
+ 'blockName' => 'custom/d',
73
+ ],
74
+ [
75
+ 'blockName' => 'custom/e',
76
+ ],
77
+ ],
78
+ ],
79
+ [
80
+ 'blockName' => 'custom/b',
81
+ ],
82
+ ];
83
+
84
+ $expected = [
85
+ [
86
+ 'blockName' => 'custom/a',
87
+ ],
88
+ [
89
+ 'blockName' => 'custom/d',
90
+ ],
91
+ [
92
+ 'blockName' => 'custom/e',
93
+ ],
94
+ [
95
+ 'blockName' => 'custom/b',
96
+ ],
97
+ ];
98
+ $this->assertEquals(
99
+ $expected,
100
+ EditorBlocksProcessor::processsIgnoredBlocks($input, ['custom/c']),
101
+ );
102
+ }
103
+
104
+ public function testTextAggregation() {
105
+ $input = [
106
+ [
107
+ 'blockName' => 'core/paragraph',
108
+ 'innerHTML' => '<p>A</p>',
109
+ ],
110
+ [
111
+ 'blockName' => 'core/paragraph',
112
+ 'innerHTML' => '<p>B</p>',
113
+ ],
114
+ [
115
+ 'blockName' => 'custom/a',
116
+ 'innerBlocks' => [
117
+
118
+ [
119
+ 'blockName' => 'core/paragraph',
120
+ 'innerHTML' => '<p>C</p>',
121
+ ],
122
+ [
123
+ 'blockName' => 'core/list',
124
+ 'innerHTML' => '<p>D</p>',
125
+ ],
126
+ ]
127
+ ],
128
+ [
129
+ 'blockName' => 'core/paragraph',
130
+ 'innerHTML' => '<p>E</p>',
131
+ ],
132
+ ];
133
+
134
+ $expected = [
135
+ [
136
+ 'blockName' => 'core/paragraph',
137
+ 'innerHTML' => '<p>A</p><p>B</p>',
138
+ ],
139
+ [
140
+ 'blockName' => 'custom/a',
141
+ 'innerBlocks' => [
142
+ [
143
+ 'blockName' => 'core/paragraph',
144
+ 'innerHTML' => '<p>C</p><p>D</p>',
145
+ ],
146
+ ]
147
+ ],
148
+ [
149
+ 'blockName' => 'core/paragraph',
150
+ 'innerHTML' => '<p>E</p>',
151
+ ],
152
+ ];
153
+ $this->assertEquals(
154
+ $expected,
155
+ EditorBlocksProcessor::aggregateParagraphs($input, ['core/paragraph', 'core/list']),
156
+ );
157
+ }
158
+
159
+ }
@@ -0,0 +1,65 @@
1
+ <?php
2
+
3
+ namespace Drupal\Tests\silverback_gutenberg\Unit;
4
+
5
+ use Drupal\silverback_gutenberg\LinkedContentExtractor;
6
+ use Drupal\Tests\UnitTestCase;
7
+
8
+ class LinkedContentExtractorTest extends UnitTestCase {
9
+
10
+ /**
11
+ * @covers \Drupal\silverback_gutenberg\LinkedContentExtractor::getTargetEntities
12
+ * @dataProvider targetEntitiesExtractionProvider
13
+ */
14
+ public function testTargetEntitiesExtraction($sourceText, $expected) {
15
+ $extractor = new LinkedContentExtractor();
16
+ $this->assertEquals($expected, $extractor->getTargetEntities($sourceText));
17
+ }
18
+
19
+ /**
20
+ * Data provider for testTargetEntitiesExtraction().
21
+ *
22
+ * @return array
23
+ */
24
+ public function targetEntitiesExtractionProvider() {
25
+ return [
26
+ [
27
+ 'sourceText' => '<div>This is a text with <span>no internally referenced</span> <a href="https://www.example.com">content</a>.</div>',
28
+ 'expected' => [],
29
+ ],
30
+ [
31
+ 'sourceText' => '<div>This is a simple <a href="/" data-id="111" data-entity-type="node">link</a></div>',
32
+ 'expected' => [
33
+ 'node' => [
34
+ '111' => '111'
35
+ ]
36
+ ]
37
+ ],
38
+ [
39
+ 'sourceText' => '<div>This is a <p>node <a href="/" data-id="111" data-entity-type="node">reference</a>, another node <a href="/" data-id="112" data-entity-type="node">reference</a></p>,<p>then another duplicated node <a href="/" data-id="111" data-entity-type="node">reference</a></p> and one custom entity <a href="/" data-id="222" data-entity-type="custom_entity">reference</a></div>',
40
+ 'expected' => [
41
+ 'node' => [
42
+ '111' => '111',
43
+ '112' => '112',
44
+ ],
45
+ 'custom_entity' => [
46
+ '222' => '222'
47
+ ]
48
+ ]
49
+ ],
50
+ [
51
+ 'sourceText' => '<div>This is a node <a href="/" data-id="111">reference</a> without the data-entity-type attribute</div>',
52
+ 'expected' => [
53
+ 'node' => [
54
+ '111' => '111'
55
+ ]
56
+ ]
57
+ ],
58
+ [
59
+ 'sourceText' => '<div>This is a node <a href="/" data-entity-type="node">reference</a> without the data-id attribute</div>',
60
+ 'expected' => []
61
+ ],
62
+ ];
63
+ }
64
+
65
+ }
@@ -0,0 +1,248 @@
1
+ <?php
2
+
3
+ namespace Drupal\Tests\silverback_gutenberg\Unit;
4
+
5
+ use Drupal\silverback_gutenberg\ReferencedContentExtractor;
6
+ use Drupal\Tests\UnitTestCase;
7
+
8
+ class ReferencedContentExtractorTest extends UnitTestCase {
9
+
10
+ /**
11
+ * @covers \Drupal\silverback_gutenberg\ReferencedContentExtractor::getTargetEntities
12
+ * @dataProvider targetEntitiesExtractionProvider
13
+ */
14
+ public function testTargetEntitiesExtraction($gutenbergBlocks, $entityTypeAttr, $uuidAttr, $expected) {
15
+ $extractor = new ReferencedContentExtractor();
16
+ $this->assertEquals($expected, $extractor->getTargetEntities($gutenbergBlocks, $entityTypeAttr, $uuidAttr));
17
+ }
18
+
19
+ /**
20
+ * Data provider for testTargetEntitiesExtraction().
21
+ *
22
+ * @return array
23
+ */
24
+ public function targetEntitiesExtractionProvider() {
25
+ return [
26
+ // Empty blocks.
27
+ [
28
+ 'gutenbergBlocks' => [],
29
+ 'entityTypeAttr' => 'entityType',
30
+ 'uuidAttr' => 'uuid',
31
+ 'expected' => [],
32
+ ],
33
+
34
+ // One single root block, with a node reference.
35
+ [
36
+ 'gutenbergBlocks' => [
37
+ [
38
+ 'attrs' => [
39
+ 'entityType' => 'node',
40
+ 'uuid' => '111'
41
+ ]
42
+ ]
43
+ ],
44
+ 'entityTypeAttr' => 'entityType',
45
+ 'uuidAttr' => 'uuid',
46
+ 'expected' => [
47
+ 'node' => [
48
+ '111' => '111'
49
+ ]
50
+ ],
51
+ ],
52
+
53
+ // One single root block, with an array of uuids.
54
+ [
55
+ 'gutenbergBlocks' => [
56
+ [
57
+ 'attrs' => [
58
+ 'entityType' => 'node',
59
+ 'uuid' => ['111', '112']
60
+ ]
61
+ ]
62
+ ],
63
+ 'entityTypeAttr' => 'entityType',
64
+ 'uuidAttr' => 'uuid',
65
+ 'expected' => [
66
+ 'node' => [
67
+ '111' => '111',
68
+ '112' => '112'
69
+ ]
70
+ ],
71
+ ],
72
+
73
+ // More root blocks with references to the same entity type.
74
+ [
75
+ 'gutenbergBlocks' => [
76
+ [
77
+ 'attrs' => [
78
+ 'entityType' => 'node',
79
+ 'uuid' => '111'
80
+ ],
81
+ ],
82
+ [
83
+ 'attrs' => [
84
+ 'entityType' => 'node',
85
+ 'uuid' => '112'
86
+ ],
87
+ ]
88
+ ],
89
+ 'entityTypeAttr' => 'entityType',
90
+ 'uuidAttr' => 'uuid',
91
+ 'expected' => [
92
+ 'node' => [
93
+ '111' => '111',
94
+ '112' => '112'
95
+ ]
96
+ ],
97
+ ],
98
+
99
+ // Multiple root block with inner blocks, referencing one entity type.
100
+ [
101
+ 'gutenbergBlocks' => [
102
+ [
103
+ 'attrs' => [
104
+ 'entityType' => 'node',
105
+ 'uuid' => '111'
106
+ ],
107
+ 'innerBlocks' => [
108
+ [
109
+ 'attrs' => [
110
+ 'entityType' => 'node',
111
+ 'uuid' => '112'
112
+ ],
113
+ ],
114
+ [
115
+ 'attrs' => [
116
+ 'entityType' => 'node',
117
+ 'uuid' => '111'
118
+ ],
119
+ ]
120
+ ],
121
+ ],
122
+ [
123
+ 'attrs' => [
124
+ 'entityType' => 'node',
125
+ 'uuid' => '113'
126
+ ],
127
+ ]
128
+ ],
129
+ 'entityTypeAttr' => 'entityType',
130
+ 'uuidAttr' => 'uuid',
131
+ 'expected' => [
132
+ 'node' => [
133
+ '111' => '111',
134
+ '112' => '112',
135
+ '113' => '113'
136
+ ]
137
+ ],
138
+ ],
139
+
140
+ // Multiple blocks referencing different entity types.
141
+ [
142
+ 'gutenbergBlocks' => [
143
+ [
144
+ 'attrs' => [
145
+ 'entityType' => 'user',
146
+ 'uuid' => '111'
147
+ ],
148
+ 'innerBlocks' => [
149
+ [
150
+ 'attrs' => [
151
+ 'entityType' => 'node',
152
+ 'uuid' => '112'
153
+ ],
154
+ ],
155
+ [
156
+ 'attrs' => [
157
+ 'entityType' => 'node',
158
+ 'uuid' => '113'
159
+ ],
160
+ ]
161
+ ],
162
+ ],
163
+ ],
164
+ 'entityTypeAttr' => 'entityType',
165
+ 'uuidAttr' => 'uuid',
166
+ 'expected' => [
167
+ 'user' => [
168
+ '111' => '111',
169
+ ],
170
+ 'node' => [
171
+ '112' => '112',
172
+ '113' => '113'
173
+ ]
174
+ ],
175
+ ],
176
+
177
+ // Multiple blocks, one of them not having the entityType attribute set.
178
+ [
179
+ 'gutenbergBlocks' => [
180
+ [
181
+ 'attrs' => [
182
+ 'uuid' => '111'
183
+ ],
184
+ 'innerBlocks' => [
185
+ [
186
+ 'attrs' => [
187
+ 'entityType' => 'node',
188
+ 'uuid' => '112'
189
+ ],
190
+ ],
191
+ [
192
+ 'attrs' => [
193
+ 'entityType' => 'node',
194
+ 'uuid' => '113'
195
+ ],
196
+ ]
197
+ ],
198
+ ],
199
+ ],
200
+ 'entityTypeAttr' => 'entityType',
201
+ 'uuidAttr' => 'uuid',
202
+ 'expected' => [
203
+ 'node' => [
204
+ '111' => '111',
205
+ '112' => '112',
206
+ '113' => '113',
207
+ ]
208
+ ],
209
+ ],
210
+
211
+ // Multiple blocks, one of them not having the uuid attribute set.
212
+ [
213
+ 'gutenbergBlocks' => [
214
+ [
215
+ 'attrs' => [
216
+ 'entityType' => 'node',
217
+ ],
218
+ 'innerBlocks' => [
219
+ [
220
+ 'attrs' => [
221
+ 'entityType' => 'user',
222
+ 'uuid' => '112'
223
+ ],
224
+ ],
225
+ [
226
+ 'attrs' => [
227
+ 'entityType' => 'node',
228
+ 'uuid' => '113'
229
+ ],
230
+ ]
231
+ ],
232
+ ],
233
+ ],
234
+ 'entityTypeAttr' => 'entityType',
235
+ 'uuidAttr' => 'uuid',
236
+ 'expected' => [
237
+ 'user' => [
238
+ '112' => '112',
239
+ ],
240
+ 'node' => [
241
+ '113' => '113',
242
+ ]
243
+ ],
244
+ ],
245
+ ];
246
+ }
247
+
248
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "1": "abc",
3
+ "2": "def"
4
+ }
@@ -0,0 +1,71 @@
1
+ <!-- wp:custom/root -->
2
+ <main class="wp-block-custom-root">
3
+ <!-- wp:paragraph -->
4
+ <p>A paragraph.</p>
5
+ <!-- /wp:paragraph -->
6
+
7
+ <!-- wp:list -->
8
+ <ul>
9
+ <li>unordered</li>
10
+ <li>list</li>
11
+ </ul>
12
+ <!-- /wp:list -->
13
+
14
+ <!-- wp:list {"ordered":true} -->
15
+ <ol>
16
+ <li>ordered</li>
17
+ <li>list</li>
18
+ </ol>
19
+ <!-- /wp:list -->
20
+
21
+ <!-- wp:quote -->
22
+ <blockquote class="wp-block-quote">
23
+ <p>A quote</p>
24
+ <cite>With a citation.</cite>
25
+ </blockquote>
26
+ <!-- /wp:quote -->
27
+
28
+ <!-- wp:group -->
29
+ <div class="wp-block-group">
30
+ <div class="wp-block-group__inner-container">
31
+ <!-- wp:paragraph -->
32
+ <p>Grouped paragraph 1.</p>
33
+ <!-- /wp:paragraph -->
34
+
35
+ <!-- wp:paragraph -->
36
+ <p>Grouped paragraph 2.</p>
37
+ <!-- /wp:paragraph -->
38
+ </div>
39
+ </div>
40
+ <!-- /wp:group -->
41
+
42
+ <!-- wp:custom/two-columns -->
43
+ <!-- wp:columns -->
44
+ <div class="wp-block-columns">
45
+ <!-- wp:column -->
46
+ <div class="wp-block-column">
47
+ <!-- wp:custom/teaser {"title":"Teaser","subtitle":"on left","url":"/en/article/with-everything","mediaEntityIds":["2"]} -->
48
+ <div class="wp-block-custom-teaser">
49
+ <a href="/en/article/with-everything">
50
+ <h2>Teaser</h2>
51
+ <h4>on left</h4>
52
+ </a>
53
+ </div>
54
+ <!-- /wp:custom/teaser -->
55
+ </div>
56
+ <!-- /wp:column -->
57
+
58
+ <!-- wp:column -->
59
+ <div class="wp-block-column">
60
+ <!-- wp:drupalmedia/drupal-media-entity {"mediaEntityIds":["1"],"caption":"Just media on right"} /-->
61
+
62
+ <!-- wp:paragraph -->
63
+ <p></p>
64
+ <!-- /wp:paragraph -->
65
+ </div>
66
+ <!-- /wp:column -->
67
+ </div>
68
+ <!-- /wp:columns -->
69
+ <!-- /wp:custom/two-columns -->
70
+ </main>
71
+ <!-- /wp:custom/root -->
@@ -0,0 +1,71 @@
1
+ <!-- wp:custom/root -->
2
+ <main class="wp-block-custom-root">
3
+ <!-- wp:paragraph -->
4
+ <p>A paragraph.</p>
5
+ <!-- /wp:paragraph -->
6
+
7
+ <!-- wp:list -->
8
+ <ul>
9
+ <li>unordered</li>
10
+ <li>list</li>
11
+ </ul>
12
+ <!-- /wp:list -->
13
+
14
+ <!-- wp:list {"ordered":true} -->
15
+ <ol>
16
+ <li>ordered</li>
17
+ <li>list</li>
18
+ </ol>
19
+ <!-- /wp:list -->
20
+
21
+ <!-- wp:quote -->
22
+ <blockquote class="wp-block-quote">
23
+ <p>A quote</p>
24
+ <cite>With a citation.</cite>
25
+ </blockquote>
26
+ <!-- /wp:quote -->
27
+
28
+ <!-- wp:group -->
29
+ <div class="wp-block-group">
30
+ <div class="wp-block-group__inner-container">
31
+ <!-- wp:paragraph -->
32
+ <p>Grouped paragraph 1.</p>
33
+ <!-- /wp:paragraph -->
34
+
35
+ <!-- wp:paragraph -->
36
+ <p>Grouped paragraph 2.</p>
37
+ <!-- /wp:paragraph -->
38
+ </div>
39
+ </div>
40
+ <!-- /wp:group -->
41
+
42
+ <!-- wp:custom/two-columns -->
43
+ <!-- wp:columns -->
44
+ <div class="wp-block-columns">
45
+ <!-- wp:column -->
46
+ <div class="wp-block-column">
47
+ <!-- wp:custom/teaser {"title":"Teaser","subtitle":"on left","url":"/en/article/with-everything","mediaEntityIds":["def"]} -->
48
+ <div class="wp-block-custom-teaser">
49
+ <a href="/en/article/with-everything">
50
+ <h2>Teaser</h2>
51
+ <h4>on left</h4>
52
+ </a>
53
+ </div>
54
+ <!-- /wp:custom/teaser -->
55
+ </div>
56
+ <!-- /wp:column -->
57
+
58
+ <!-- wp:column -->
59
+ <div class="wp-block-column">
60
+ <!-- wp:drupalmedia/drupal-media-entity {"mediaEntityIds":["abc"],"caption":"Just media on right"} /-->
61
+
62
+ <!-- wp:paragraph -->
63
+ <p></p>
64
+ <!-- /wp:paragraph -->
65
+ </div>
66
+ <!-- /wp:column -->
67
+ </div>
68
+ <!-- /wp:columns -->
69
+ <!-- /wp:custom/two-columns -->
70
+ </main>
71
+ <!-- /wp:custom/root -->
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@amazeelabs/silverback-gutenberg",
3
+ "version": "2.6.2",
4
+ "scripts": {
5
+ "precommit": "pnpm precommit:fix && pnpm precommit:check && pnpm test:unit",
6
+ "precommit:fix": "pnpm --filter @custom/cms precommit:fix packages/@amazeelabs/silverback-gutenberg/drupal",
7
+ "precommit:check": "pnpm --filter @custom/cms precommit:check packages/@amazeelabs/silverback-gutenberg/drupal",
8
+ "test:static": "exit 0; pnpm --filter @custom/cms cms:test:static packages/@amazeelabs/silverback-gutenberg/drupal",
9
+ "test:unit": "pnpm --filter @custom/cms cms:test:unit --filter=silverback_gutenberg",
10
+ "test:integration": "pnpm --filter @custom/cms cms:test:integration --filter=silverback_gutenberg"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "gitHead": "774575487f7cdc3af29146a56d3773db153b0c69"
16
+ }
package/turbo.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://turborepo.org/schema.json",
3
+ "extends": ["//"],
4
+ "tasks": {
5
+ "test:static": {
6
+ "dependsOn": ["drupal:test:static"]
7
+ },
8
+ "test:unit": {
9
+ "dependsOn": ["drupal:test:unit"]
10
+ },
11
+ "test:integration": {
12
+ "dependsOn": ["drupal:test:integration"]
13
+ }
14
+ }
15
+ }