@wordpress/editor 13.6.0 → 13.8.0
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/CHANGELOG.md +4 -0
- package/build/components/post-excerpt/index.js +1 -1
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +7 -5
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +5 -0
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +13 -7
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/index.js +1 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +18 -10
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/utils/terms.js +21 -10
- package/build/utils/terms.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +1 -1
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +8 -6
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +5 -0
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +15 -9
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/index.js +1 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +19 -11
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/utils/terms.js +20 -8
- package/build-module/utils/terms.js.map +1 -1
- package/build-style/style-rtl.css +4 -23
- package/build-style/style.css +4 -23
- package/package.json +30 -30
- package/src/components/post-excerpt/index.js +1 -1
- package/src/components/post-locked-modal/index.js +56 -60
- package/src/components/post-locked-modal/style.scss +1 -5
- package/src/components/post-publish-panel/postpublish.js +5 -0
- package/src/components/post-taxonomies/hierarchical-term-selector.js +26 -21
- package/src/components/post-taxonomies/style.scss +5 -20
- package/src/components/post-type-support-check/index.js +1 -1
- package/src/components/post-url/index.js +1 -1
- package/src/components/theme-support-check/index.js +1 -1
- package/src/hooks/custom-sources-backwards-compatibility.js +12 -11
- package/src/utils/terms.js +17 -7
|
@@ -4,7 +4,7 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
/**
|
|
5
5
|
* External dependencies
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { isEmpty } from 'lodash';
|
|
8
8
|
/**
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
@@ -53,18 +53,21 @@ const createWithMetaAttributeSource = metaAttributes => createHigherOrderCompone
|
|
|
53
53
|
const postType = useSelect(select => select(editorStore).getCurrentPostType(), []);
|
|
54
54
|
const [meta, setMeta] = useEntityProp('postType', postType, 'meta');
|
|
55
55
|
const mergedAttributes = useMemo(() => ({ ...attributes,
|
|
56
|
-
...
|
|
56
|
+
...Object.fromEntries(Object.entries(metaAttributes).map(_ref2 => {
|
|
57
|
+
let [attributeKey, metaKey] = _ref2;
|
|
58
|
+
return [attributeKey, meta[metaKey]];
|
|
59
|
+
}))
|
|
57
60
|
}), [attributes, meta]);
|
|
58
61
|
return createElement(BlockEdit, _extends({
|
|
59
62
|
attributes: mergedAttributes,
|
|
60
63
|
setAttributes: nextAttributes => {
|
|
61
64
|
const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter( // Filter to intersection of keys between the updated
|
|
62
65
|
// attributes and those with an associated meta key.
|
|
63
|
-
|
|
64
|
-
let [key] =
|
|
66
|
+
_ref3 => {
|
|
67
|
+
let [key] = _ref3;
|
|
65
68
|
return key in metaAttributes;
|
|
66
|
-
}).map(
|
|
67
|
-
let [attributeKey, value] =
|
|
69
|
+
}).map(_ref4 => {
|
|
70
|
+
let [attributeKey, value] = _ref4;
|
|
68
71
|
return [// Rename the keys to the expected meta key name.
|
|
69
72
|
metaAttributes[attributeKey], value];
|
|
70
73
|
}));
|
|
@@ -91,12 +94,17 @@ function shimAttributeSource(settings) {
|
|
|
91
94
|
var _settings$attributes;
|
|
92
95
|
|
|
93
96
|
/** @type {WPMetaAttributeMapping} */
|
|
94
|
-
const metaAttributes =
|
|
97
|
+
const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(_ref5 => {
|
|
95
98
|
let [, {
|
|
96
99
|
source
|
|
97
|
-
}] =
|
|
100
|
+
}] = _ref5;
|
|
98
101
|
return source === 'meta';
|
|
99
|
-
})
|
|
102
|
+
}).map(_ref6 => {
|
|
103
|
+
let [attributeKey, {
|
|
104
|
+
meta
|
|
105
|
+
}] = _ref6;
|
|
106
|
+
return [attributeKey, meta];
|
|
107
|
+
}));
|
|
100
108
|
|
|
101
109
|
if (!isEmpty(metaAttributes)) {
|
|
102
110
|
settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
|
|
@@ -124,10 +132,10 @@ addFilter('blocks.registerBlockType', 'core/editor/custom-sources-backwards-comp
|
|
|
124
132
|
// In the future, we could support updating block settings, at which point this
|
|
125
133
|
// implementation could use that mechanism instead.
|
|
126
134
|
|
|
127
|
-
globalSelect(blocksStore).getBlockTypes().map(
|
|
135
|
+
globalSelect(blocksStore).getBlockTypes().map(_ref7 => {
|
|
128
136
|
let {
|
|
129
137
|
name
|
|
130
|
-
} =
|
|
138
|
+
} = _ref7;
|
|
131
139
|
return globalSelect(blocksStore).getBlockType(name);
|
|
132
140
|
}).forEach(shimAttributeSource);
|
|
133
141
|
//# sourceMappingURL=custom-sources-backwards-compatibility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["isEmpty","store","blocksStore","select","globalSelect","useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","editorStore","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","getCurrentPostType","meta","setMeta","mergedAttributes","Object","fromEntries","entries","map","attributeKey","metaKey","nextAttributes","nextMeta","filter","key","value","shimAttributeSource","settings","source","edit","getBlockTypes","name","getBlockType","forEach"],"mappings":"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","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( metaAttributes ).map(\n\t\t\t\t\t\t\t\t( [ attributeKey, metaKey ] ) => [\n\t\t\t\t\t\t\t\t\tattributeKey,\n\t\t\t\t\t\t\t\t\tmeta[ metaKey ],\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( ! isEmpty( nextMeta ) ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = Object.fromEntries(\n\t\tObject.entries( settings.attributes ?? {} )\n\t\t\t.filter( ( [ , { source } ] ) => source === 'meta' )\n\t\t\t.map( ( [ attributeKey, { meta } ] ) => [ attributeKey, meta ] )\n\t);\n\tif ( ! isEmpty( metaAttributes ) ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { groupBy } from 'lodash';
|
|
5
1
|
/**
|
|
6
2
|
* WordPress dependencies
|
|
7
3
|
*/
|
|
8
|
-
|
|
9
4
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
10
5
|
/**
|
|
11
6
|
* Returns terms in a tree form.
|
|
@@ -22,13 +17,30 @@ export function buildTermsTree(flatTerms) {
|
|
|
22
17
|
parent: null,
|
|
23
18
|
...term
|
|
24
19
|
};
|
|
25
|
-
});
|
|
26
|
-
const termsByParent = groupBy(flatTermsWithParentAndChildren, 'parent');
|
|
20
|
+
}); // All terms should have a `parent` because we're about to index them by it.
|
|
27
21
|
|
|
28
|
-
if (
|
|
22
|
+
if (flatTermsWithParentAndChildren.some(_ref => {
|
|
23
|
+
let {
|
|
24
|
+
parent
|
|
25
|
+
} = _ref;
|
|
26
|
+
return parent === null;
|
|
27
|
+
})) {
|
|
29
28
|
return flatTermsWithParentAndChildren;
|
|
30
29
|
}
|
|
31
30
|
|
|
31
|
+
const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => {
|
|
32
|
+
const {
|
|
33
|
+
parent
|
|
34
|
+
} = term;
|
|
35
|
+
|
|
36
|
+
if (!acc[parent]) {
|
|
37
|
+
acc[parent] = [];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
acc[parent].push(term);
|
|
41
|
+
return acc;
|
|
42
|
+
}, {});
|
|
43
|
+
|
|
32
44
|
const fillWithChildren = terms => {
|
|
33
45
|
return terms.map(term => {
|
|
34
46
|
const children = termsByParent[term.id];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/utils/terms.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/utils/terms.js"],"names":["decodeEntities","buildTermsTree","flatTerms","flatTermsWithParentAndChildren","map","term","children","parent","some","termsByParent","reduce","acc","push","fillWithChildren","terms","id","length","unescapeString","arg","unescapeTerm","name","unescapeTerms"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,SAAzB,EAAqC;AAC3C,QAAMC,8BAA8B,GAAGD,SAAS,CAACE,GAAV,CAAiBC,IAAF,IAAY;AACjE,WAAO;AACNC,MAAAA,QAAQ,EAAE,EADJ;AAENC,MAAAA,MAAM,EAAE,IAFF;AAGN,SAAGF;AAHG,KAAP;AAKA,GANsC,CAAvC,CAD2C,CAS3C;;AACA,MACCF,8BAA8B,CAACK,IAA/B,CAAqC;AAAA,QAAE;AAAED,MAAAA;AAAF,KAAF;AAAA,WAAkBA,MAAM,KAAK,IAA7B;AAAA,GAArC,CADD,EAEE;AACD,WAAOJ,8BAAP;AACA;;AAED,QAAMM,aAAa,GAAGN,8BAA8B,CAACO,MAA/B,CACrB,CAAEC,GAAF,EAAON,IAAP,KAAiB;AAChB,UAAM;AAAEE,MAAAA;AAAF,QAAaF,IAAnB;;AACA,QAAK,CAAEM,GAAG,CAAEJ,MAAF,CAAV,EAAuB;AACtBI,MAAAA,GAAG,CAAEJ,MAAF,CAAH,GAAgB,EAAhB;AACA;;AACDI,IAAAA,GAAG,CAAEJ,MAAF,CAAH,CAAcK,IAAd,CAAoBP,IAApB;AACA,WAAOM,GAAP;AACA,GARoB,EASrB,EATqB,CAAtB;;AAYA,QAAME,gBAAgB,GAAKC,KAAF,IAAa;AACrC,WAAOA,KAAK,CAACV,GAAN,CAAaC,IAAF,IAAY;AAC7B,YAAMC,QAAQ,GAAGG,aAAa,CAAEJ,IAAI,CAACU,EAAP,CAA9B;AACA,aAAO,EACN,GAAGV,IADG;AAENC,QAAAA,QAAQ,EACPA,QAAQ,IAAIA,QAAQ,CAACU,MAArB,GACGH,gBAAgB,CAAEP,QAAF,CADnB,GAEG;AALE,OAAP;AAOA,KATM,CAAP;AAUA,GAXD;;AAaA,SAAOO,gBAAgB,CAAEJ,aAAa,CAAE,GAAF,CAAb,IAAwB,EAA1B,CAAvB;AACA;AAED,OAAO,MAAMQ,cAAc,GAAKC,GAAF,IAAW;AACxC,SAAOlB,cAAc,CAAEkB,GAAF,CAArB;AACA,CAFM;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,YAAY,GAAKd,IAAF,IAAY;AACvC,SAAO,EACN,GAAGA,IADG;AAENe,IAAAA,IAAI,EAAEH,cAAc,CAAEZ,IAAI,CAACe,IAAP;AAFd,GAAP;AAIA,CALM;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAKP,KAAF,IAAa;AACzC,SAAO,CAAEA,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAW,EAAX,EAAgBV,GAAhB,CAAqBe,YAArB,CAAP;AACA,CAFM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Returns terms in a tree form.\n *\n * @param {Array} flatTerms Array of terms in flat format.\n *\n * @return {Array} Array of terms in tree format.\n */\nexport function buildTermsTree( flatTerms ) {\n\tconst flatTermsWithParentAndChildren = flatTerms.map( ( term ) => {\n\t\treturn {\n\t\t\tchildren: [],\n\t\t\tparent: null,\n\t\t\t...term,\n\t\t};\n\t} );\n\n\t// All terms should have a `parent` because we're about to index them by it.\n\tif (\n\t\tflatTermsWithParentAndChildren.some( ( { parent } ) => parent === null )\n\t) {\n\t\treturn flatTermsWithParentAndChildren;\n\t}\n\n\tconst termsByParent = flatTermsWithParentAndChildren.reduce(\n\t\t( acc, term ) => {\n\t\t\tconst { parent } = term;\n\t\t\tif ( ! acc[ parent ] ) {\n\t\t\t\tacc[ parent ] = [];\n\t\t\t}\n\t\t\tacc[ parent ].push( term );\n\t\t\treturn acc;\n\t\t},\n\t\t{}\n\t);\n\n\tconst fillWithChildren = ( terms ) => {\n\t\treturn terms.map( ( term ) => {\n\t\t\tconst children = termsByParent[ term.id ];\n\t\t\treturn {\n\t\t\t\t...term,\n\t\t\t\tchildren:\n\t\t\t\t\tchildren && children.length\n\t\t\t\t\t\t? fillWithChildren( children )\n\t\t\t\t\t\t: [],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn fillWithChildren( termsByParent[ '0' ] || [] );\n}\n\nexport const unescapeString = ( arg ) => {\n\treturn decodeEntities( arg );\n};\n\n/**\n * Returns a term object with name unescaped.\n *\n * @param {Object} term The term object to unescape.\n *\n * @return {Object} Term object with name property unescaped.\n */\nexport const unescapeTerm = ( term ) => {\n\treturn {\n\t\t...term,\n\t\tname: unescapeString( term.name ),\n\t};\n};\n\n/**\n * Returns an array of term objects with names unescaped.\n * The unescape of each term is performed using the unescapeTerm function.\n *\n * @param {Object[]} terms Array of term objects to unescape.\n *\n * @return {Object[]} Array of term objects unescaped.\n */\nexport const unescapeTerms = ( terms ) => {\n\treturn ( terms ?? [] ).map( unescapeTerm );\n};\n"]}
|
|
@@ -367,9 +367,6 @@
|
|
|
367
367
|
max-width: 480px;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
.editor-post-locked-modal .components-modal__content {
|
|
371
|
-
display: flex;
|
|
372
|
-
}
|
|
373
370
|
|
|
374
371
|
.editor-post-locked-modal__buttons {
|
|
375
372
|
margin-top: 24px;
|
|
@@ -378,7 +375,7 @@
|
|
|
378
375
|
.editor-post-locked-modal__avatar {
|
|
379
376
|
border-radius: 2px;
|
|
380
377
|
margin-top: 16px;
|
|
381
|
-
|
|
378
|
+
min-width: initial !important;
|
|
382
379
|
}
|
|
383
380
|
|
|
384
381
|
.editor-post-publish-button__button.has-changes-dot::before {
|
|
@@ -618,31 +615,15 @@
|
|
|
618
615
|
.editor-post-taxonomies__hierarchical-terms-choice {
|
|
619
616
|
margin-bottom: 8px;
|
|
620
617
|
}
|
|
618
|
+
.editor-post-taxonomies__hierarchical-terms-choice:last-child {
|
|
619
|
+
margin-bottom: 4px;
|
|
620
|
+
}
|
|
621
621
|
|
|
622
622
|
.editor-post-taxonomies__hierarchical-terms-subchoices {
|
|
623
623
|
margin-top: 8px;
|
|
624
624
|
margin-right: 16px;
|
|
625
625
|
}
|
|
626
626
|
|
|
627
|
-
.components-button.editor-post-taxonomies__hierarchical-terms-submit,
|
|
628
|
-
.components-button.editor-post-taxonomies__hierarchical-terms-add {
|
|
629
|
-
margin-top: 12px;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
.editor-post-taxonomies__hierarchical-terms-label {
|
|
633
|
-
display: inline-block;
|
|
634
|
-
margin-top: 12px;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
.editor-post-taxonomies__hierarchical-terms-input {
|
|
638
|
-
margin-top: 8px;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
.editor-post-taxonomies__hierarchical-terms-filter {
|
|
642
|
-
margin-bottom: 8px;
|
|
643
|
-
width: 100%;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
627
|
.editor-post-taxonomies__flat-term-most-used .editor-post-taxonomies__flat-term-most-used-label {
|
|
647
628
|
margin-bottom: 4px;
|
|
648
629
|
}
|
package/build-style/style.css
CHANGED
|
@@ -367,9 +367,6 @@
|
|
|
367
367
|
max-width: 480px;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
.editor-post-locked-modal .components-modal__content {
|
|
371
|
-
display: flex;
|
|
372
|
-
}
|
|
373
370
|
|
|
374
371
|
.editor-post-locked-modal__buttons {
|
|
375
372
|
margin-top: 24px;
|
|
@@ -378,7 +375,7 @@
|
|
|
378
375
|
.editor-post-locked-modal__avatar {
|
|
379
376
|
border-radius: 2px;
|
|
380
377
|
margin-top: 16px;
|
|
381
|
-
|
|
378
|
+
min-width: initial !important;
|
|
382
379
|
}
|
|
383
380
|
|
|
384
381
|
.editor-post-publish-button__button.has-changes-dot::before {
|
|
@@ -618,31 +615,15 @@
|
|
|
618
615
|
.editor-post-taxonomies__hierarchical-terms-choice {
|
|
619
616
|
margin-bottom: 8px;
|
|
620
617
|
}
|
|
618
|
+
.editor-post-taxonomies__hierarchical-terms-choice:last-child {
|
|
619
|
+
margin-bottom: 4px;
|
|
620
|
+
}
|
|
621
621
|
|
|
622
622
|
.editor-post-taxonomies__hierarchical-terms-subchoices {
|
|
623
623
|
margin-top: 8px;
|
|
624
624
|
margin-left: 16px;
|
|
625
625
|
}
|
|
626
626
|
|
|
627
|
-
.components-button.editor-post-taxonomies__hierarchical-terms-submit,
|
|
628
|
-
.components-button.editor-post-taxonomies__hierarchical-terms-add {
|
|
629
|
-
margin-top: 12px;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
.editor-post-taxonomies__hierarchical-terms-label {
|
|
633
|
-
display: inline-block;
|
|
634
|
-
margin-top: 12px;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
.editor-post-taxonomies__hierarchical-terms-input {
|
|
638
|
-
margin-top: 8px;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
.editor-post-taxonomies__hierarchical-terms-filter {
|
|
642
|
-
margin-bottom: 8px;
|
|
643
|
-
width: 100%;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
627
|
.editor-post-taxonomies__flat-term-most-used .editor-post-taxonomies__flat-term-most-used-label {
|
|
647
628
|
margin-bottom: 4px;
|
|
648
629
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.8.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,34 +31,34 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.
|
|
35
|
-
"@wordpress/api-fetch": "^6.
|
|
36
|
-
"@wordpress/blob": "^3.
|
|
37
|
-
"@wordpress/block-editor": "^11.
|
|
38
|
-
"@wordpress/blocks": "^12.
|
|
39
|
-
"@wordpress/components": "^23.
|
|
40
|
-
"@wordpress/compose": "^6.
|
|
41
|
-
"@wordpress/core-data": "^6.
|
|
42
|
-
"@wordpress/data": "^
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^5.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/media-utils": "^4.
|
|
54
|
-
"@wordpress/notices": "^3.
|
|
55
|
-
"@wordpress/preferences": "^3.
|
|
56
|
-
"@wordpress/private-apis": "^0.
|
|
57
|
-
"@wordpress/reusable-blocks": "^4.
|
|
58
|
-
"@wordpress/rich-text": "^6.
|
|
59
|
-
"@wordpress/server-side-render": "^4.
|
|
60
|
-
"@wordpress/url": "^3.
|
|
61
|
-
"@wordpress/wordcount": "^3.
|
|
34
|
+
"@wordpress/a11y": "^3.31.0",
|
|
35
|
+
"@wordpress/api-fetch": "^6.28.0",
|
|
36
|
+
"@wordpress/blob": "^3.31.0",
|
|
37
|
+
"@wordpress/block-editor": "^11.8.0",
|
|
38
|
+
"@wordpress/blocks": "^12.8.0",
|
|
39
|
+
"@wordpress/components": "^23.8.0",
|
|
40
|
+
"@wordpress/compose": "^6.8.0",
|
|
41
|
+
"@wordpress/core-data": "^6.8.0",
|
|
42
|
+
"@wordpress/data": "^9.1.0",
|
|
43
|
+
"@wordpress/date": "^4.31.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.31.0",
|
|
45
|
+
"@wordpress/dom": "^3.31.0",
|
|
46
|
+
"@wordpress/element": "^5.8.0",
|
|
47
|
+
"@wordpress/hooks": "^3.31.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.31.0",
|
|
49
|
+
"@wordpress/i18n": "^4.31.0",
|
|
50
|
+
"@wordpress/icons": "^9.22.0",
|
|
51
|
+
"@wordpress/keyboard-shortcuts": "^4.8.0",
|
|
52
|
+
"@wordpress/keycodes": "^3.31.0",
|
|
53
|
+
"@wordpress/media-utils": "^4.22.0",
|
|
54
|
+
"@wordpress/notices": "^3.31.0",
|
|
55
|
+
"@wordpress/preferences": "^3.8.0",
|
|
56
|
+
"@wordpress/private-apis": "^0.13.0",
|
|
57
|
+
"@wordpress/reusable-blocks": "^4.8.0",
|
|
58
|
+
"@wordpress/rich-text": "^6.8.0",
|
|
59
|
+
"@wordpress/server-side-render": "^4.8.0",
|
|
60
|
+
"@wordpress/url": "^3.32.0",
|
|
61
|
+
"@wordpress/wordcount": "^3.31.0",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
63
63
|
"date-fns": "^2.28.0",
|
|
64
64
|
"escape-html": "^1.0.3",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "d61700b9f1c72ba0b030fc815ef1685b4f4031ec"
|
|
79
79
|
}
|
|
@@ -23,7 +23,7 @@ function PostExcerpt( { excerpt, onUpdateExcerpt } ) {
|
|
|
23
23
|
/>
|
|
24
24
|
<ExternalLink
|
|
25
25
|
href={ __(
|
|
26
|
-
'https://wordpress.org/
|
|
26
|
+
'https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'
|
|
27
27
|
) }
|
|
28
28
|
>
|
|
29
29
|
{ __( 'Learn more about manual excerpts' ) }
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
Modal,
|
|
7
7
|
Button,
|
|
8
8
|
ExternalLink,
|
|
9
|
-
|
|
10
|
-
FlexItem,
|
|
9
|
+
__experimentalHStack as HStack,
|
|
11
10
|
} from '@wordpress/components';
|
|
12
11
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
12
|
import { addQueryArgs } from '@wordpress/url';
|
|
@@ -175,55 +174,30 @@ export default function PostLockedModal() {
|
|
|
175
174
|
isDismissible={ false }
|
|
176
175
|
className="editor-post-locked-modal"
|
|
177
176
|
>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
<div>
|
|
188
|
-
{ !! isTakeover && (
|
|
189
|
-
<p>
|
|
190
|
-
{ createInterpolateElement(
|
|
191
|
-
userDisplayName
|
|
192
|
-
? sprintf(
|
|
193
|
-
/* translators: %s: user's display name */
|
|
194
|
-
__(
|
|
195
|
-
'<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
|
|
196
|
-
),
|
|
197
|
-
userDisplayName
|
|
198
|
-
)
|
|
199
|
-
: __(
|
|
200
|
-
'Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
|
|
201
|
-
),
|
|
202
|
-
{
|
|
203
|
-
strong: <strong />,
|
|
204
|
-
PreviewLink: (
|
|
205
|
-
<ExternalLink href={ previewLink }>
|
|
206
|
-
{ __( 'preview' ) }
|
|
207
|
-
</ExternalLink>
|
|
208
|
-
),
|
|
209
|
-
}
|
|
210
|
-
) }
|
|
211
|
-
</p>
|
|
177
|
+
<HStack alignment="top" spacing={ 6 }>
|
|
178
|
+
{ !! userAvatar && (
|
|
179
|
+
<img
|
|
180
|
+
src={ userAvatar }
|
|
181
|
+
alt={ __( 'Avatar' ) }
|
|
182
|
+
className="editor-post-locked-modal__avatar"
|
|
183
|
+
width={ 64 }
|
|
184
|
+
height={ 64 }
|
|
185
|
+
/>
|
|
212
186
|
) }
|
|
213
|
-
|
|
214
|
-
|
|
187
|
+
<div>
|
|
188
|
+
{ !! isTakeover && (
|
|
215
189
|
<p>
|
|
216
190
|
{ createInterpolateElement(
|
|
217
191
|
userDisplayName
|
|
218
192
|
? sprintf(
|
|
219
193
|
/* translators: %s: user's display name */
|
|
220
194
|
__(
|
|
221
|
-
'<strong>%s</strong>
|
|
195
|
+
'<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
|
|
222
196
|
),
|
|
223
197
|
userDisplayName
|
|
224
198
|
)
|
|
225
199
|
: __(
|
|
226
|
-
'Another user
|
|
200
|
+
'Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
|
|
227
201
|
),
|
|
228
202
|
{
|
|
229
203
|
strong: <strong />,
|
|
@@ -235,33 +209,55 @@ export default function PostLockedModal() {
|
|
|
235
209
|
}
|
|
236
210
|
) }
|
|
237
211
|
</p>
|
|
238
|
-
|
|
239
|
-
{ __(
|
|
240
|
-
'If you take over, the other user will lose editing control to the post, but their changes will be saved.'
|
|
241
|
-
) }
|
|
242
|
-
</p>
|
|
243
|
-
</>
|
|
244
|
-
) }
|
|
245
|
-
|
|
246
|
-
<Flex
|
|
247
|
-
className="editor-post-locked-modal__buttons"
|
|
248
|
-
justify="flex-end"
|
|
249
|
-
expanded={ false }
|
|
250
|
-
>
|
|
212
|
+
) }
|
|
251
213
|
{ ! isTakeover && (
|
|
252
|
-
|
|
214
|
+
<>
|
|
215
|
+
<p>
|
|
216
|
+
{ createInterpolateElement(
|
|
217
|
+
userDisplayName
|
|
218
|
+
? sprintf(
|
|
219
|
+
/* translators: %s: user's display name */
|
|
220
|
+
__(
|
|
221
|
+
'<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'
|
|
222
|
+
),
|
|
223
|
+
userDisplayName
|
|
224
|
+
)
|
|
225
|
+
: __(
|
|
226
|
+
'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'
|
|
227
|
+
),
|
|
228
|
+
{
|
|
229
|
+
strong: <strong />,
|
|
230
|
+
PreviewLink: (
|
|
231
|
+
<ExternalLink href={ previewLink }>
|
|
232
|
+
{ __( 'preview' ) }
|
|
233
|
+
</ExternalLink>
|
|
234
|
+
),
|
|
235
|
+
}
|
|
236
|
+
) }
|
|
237
|
+
</p>
|
|
238
|
+
<p>
|
|
239
|
+
{ __(
|
|
240
|
+
'If you take over, the other user will lose editing control to the post, but their changes will be saved.'
|
|
241
|
+
) }
|
|
242
|
+
</p>
|
|
243
|
+
</>
|
|
244
|
+
) }
|
|
245
|
+
|
|
246
|
+
<HStack
|
|
247
|
+
className="editor-post-locked-modal__buttons"
|
|
248
|
+
justify="flex-end"
|
|
249
|
+
>
|
|
250
|
+
{ ! isTakeover && (
|
|
253
251
|
<Button variant="tertiary" href={ unlockUrl }>
|
|
254
252
|
{ __( 'Take over' ) }
|
|
255
253
|
</Button>
|
|
256
|
-
|
|
257
|
-
) }
|
|
258
|
-
<FlexItem>
|
|
254
|
+
) }
|
|
259
255
|
<Button variant="primary" href={ allPostsUrl }>
|
|
260
256
|
{ allPostsLabel }
|
|
261
257
|
</Button>
|
|
262
|
-
</
|
|
263
|
-
</
|
|
264
|
-
</
|
|
258
|
+
</HStack>
|
|
259
|
+
</div>
|
|
260
|
+
</HStack>
|
|
265
261
|
</Modal>
|
|
266
262
|
);
|
|
267
263
|
}
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
@include break-small() {
|
|
3
3
|
max-width: $break-mobile;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
.components-modal__content {
|
|
7
|
-
display: flex;
|
|
8
|
-
}
|
|
9
5
|
}
|
|
10
6
|
|
|
11
7
|
.editor-post-locked-modal__buttons {
|
|
@@ -15,5 +11,5 @@
|
|
|
15
11
|
.editor-post-locked-modal__avatar {
|
|
16
12
|
border-radius: $radius-block-ui;
|
|
17
13
|
margin-top: $grid-unit-20;
|
|
18
|
-
|
|
14
|
+
min-width: initial !important;
|
|
19
15
|
}
|
|
@@ -17,6 +17,7 @@ import PostScheduleLabel from '../post-schedule/label';
|
|
|
17
17
|
import { store as editorStore } from '../../store';
|
|
18
18
|
|
|
19
19
|
const POSTNAME = '%postname%';
|
|
20
|
+
const PAGENAME = '%pagename%';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Returns URL for a future post.
|
|
@@ -33,6 +34,10 @@ const getFuturePostUrl = ( post ) => {
|
|
|
33
34
|
return post.permalink_template.replace( POSTNAME, slug );
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
if ( post.permalink_template.includes( PAGENAME ) ) {
|
|
38
|
+
return post.permalink_template.replace( PAGENAME, slug );
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
return post.permalink_template;
|
|
37
42
|
};
|
|
38
43
|
|