@wordpress/block-serialization-default-parser 4.2.0 → 4.2.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.
- package/README.md +67 -60
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Install the module
|
|
|
10
10
|
npm install @wordpress/block-serialization-default-parser --save
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
_This package assumes that your code will run in an **ES2015+** environment. If you're using an environment that has limited or no support for
|
|
13
|
+
_This package assumes that your code will run in an **ES2015+** environment. If you're using an environment that has limited or no support for such language features and APIs, you should include [the polyfill shipped in `@wordpress/babel-preset-default`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/babel-preset-default#polyfill) in your code._
|
|
14
14
|
|
|
15
15
|
## API
|
|
16
16
|
|
|
@@ -26,21 +26,27 @@ Input post:
|
|
|
26
26
|
|
|
27
27
|
```html
|
|
28
28
|
<!-- wp:columns {"columns":3} -->
|
|
29
|
-
<div class="wp-block-columns has-3-columns"
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
<!--
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<!--
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
<div class="wp-block-columns has-3-columns">
|
|
30
|
+
<!-- wp:column -->
|
|
31
|
+
<div class="wp-block-column">
|
|
32
|
+
<!-- wp:paragraph -->
|
|
33
|
+
<p>Left</p>
|
|
34
|
+
<!-- /wp:paragraph -->
|
|
35
|
+
</div>
|
|
36
|
+
<!-- /wp:column -->
|
|
37
|
+
|
|
38
|
+
<!-- wp:column -->
|
|
39
|
+
<div class="wp-block-column">
|
|
40
|
+
<!-- wp:paragraph -->
|
|
41
|
+
<p><strong>Middle</strong></p>
|
|
42
|
+
<!-- /wp:paragraph -->
|
|
43
|
+
</div>
|
|
44
|
+
<!-- /wp:column -->
|
|
45
|
+
|
|
46
|
+
<!-- wp:column -->
|
|
47
|
+
<div class="wp-block-column"></div>
|
|
48
|
+
<!-- /wp:column -->
|
|
49
|
+
</div>
|
|
44
50
|
<!-- /wp:columns -->
|
|
45
51
|
```
|
|
46
52
|
|
|
@@ -49,49 +55,51 @@ Parsing code:
|
|
|
49
55
|
```js
|
|
50
56
|
import { parse } from '@wordpress/block-serialization-default-parser';
|
|
51
57
|
|
|
52
|
-
parse( post ) ===
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
58
|
+
parse( post ) ===
|
|
59
|
+
[
|
|
60
|
+
{
|
|
61
|
+
blockName: 'core/columns',
|
|
62
|
+
attrs: {
|
|
63
|
+
columns: 3,
|
|
64
|
+
},
|
|
65
|
+
innerBlocks: [
|
|
66
|
+
{
|
|
67
|
+
blockName: 'core/column',
|
|
68
|
+
attrs: null,
|
|
69
|
+
innerBlocks: [
|
|
70
|
+
{
|
|
71
|
+
blockName: 'core/paragraph',
|
|
72
|
+
attrs: null,
|
|
73
|
+
innerBlocks: [],
|
|
74
|
+
innerHTML: '\n<p>Left</p>\n',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
innerHTML: '\n<div class="wp-block-column"></div>\n',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
blockName: 'core/column',
|
|
81
|
+
attrs: null,
|
|
82
|
+
innerBlocks: [
|
|
83
|
+
{
|
|
84
|
+
blockName: 'core/paragraph',
|
|
85
|
+
attrs: null,
|
|
86
|
+
innerBlocks: [],
|
|
87
|
+
innerHTML: '\n<p><strong>Middle</strong></p>\n',
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
innerHTML: '\n<div class="wp-block-column"></div>\n',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
blockName: 'core/column',
|
|
94
|
+
attrs: null,
|
|
95
|
+
innerBlocks: [],
|
|
96
|
+
innerHTML: '\n<div class="wp-block-column"></div>\n',
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
innerHTML:
|
|
100
|
+
'\n<div class="wp-block-columns has-3-columns">\n\n\n\n</div>\n',
|
|
101
|
+
},
|
|
102
|
+
];
|
|
95
103
|
```
|
|
96
104
|
|
|
97
105
|
_Parameters_
|
|
@@ -102,7 +110,6 @@ _Returns_
|
|
|
102
110
|
|
|
103
111
|
- `Array`: A block-based representation of the input HTML.
|
|
104
112
|
|
|
105
|
-
|
|
106
113
|
<!-- END TOKEN(Autogenerated API docs) -->
|
|
107
114
|
|
|
108
115
|
## Theory
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-serialization-default-parser",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.2",
|
|
4
4
|
"description": "Block serialization specification parser for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "8f7f052bc04e3f4eb50f479ced14be1489b9fa79"
|
|
36
36
|
}
|