@wordpress/editor 14.32.1-next.ff1cebbba.0 → 14.33.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 +2 -0
- package/build/bindings/api.js +2 -2
- package/build/bindings/api.js.map +3 -3
- package/build/bindings/post-data.js +50 -13
- package/build/bindings/post-data.js.map +3 -3
- package/build/bindings/term-data.js +165 -0
- package/build/bindings/term-data.js.map +7 -0
- package/build/components/collab-sidebar/add-comment.js +11 -15
- package/build/components/collab-sidebar/add-comment.js.map +2 -2
- package/build/components/collab-sidebar/comment-menu-item.js +1 -1
- package/build/components/collab-sidebar/comment-menu-item.js.map +2 -2
- package/build/components/collab-sidebar/comments.js +89 -67
- package/build/components/collab-sidebar/comments.js.map +2 -2
- package/build/components/collab-sidebar/constants.js +3 -0
- package/build/components/collab-sidebar/constants.js.map +2 -2
- package/build/components/collab-sidebar/hooks.js +13 -6
- package/build/components/collab-sidebar/hooks.js.map +2 -2
- package/build/components/collab-sidebar/index.js +28 -15
- package/build/components/collab-sidebar/index.js.map +3 -3
- package/build/components/post-fields/index.js +3 -25
- package/build/components/post-fields/index.js.map +2 -2
- package/build/components/post-template/create-new-template-modal.js +2 -1
- package/build/components/post-template/create-new-template-modal.js.map +2 -2
- package/build/components/provider/index.js +3 -2
- package/build/components/provider/index.js.map +2 -2
- package/build/components/provider/use-hide-blocks-from-inserter.js +4 -26
- package/build/components/provider/use-hide-blocks-from-inserter.js.map +3 -3
- package/build/store/actions.js +12 -11
- package/build/store/actions.js.map +2 -2
- package/build-module/bindings/api.js +2 -2
- package/build-module/bindings/api.js.map +2 -2
- package/build-module/bindings/post-data.js +50 -13
- package/build-module/bindings/post-data.js.map +2 -2
- package/build-module/bindings/term-data.js +145 -0
- package/build-module/bindings/term-data.js.map +7 -0
- package/build-module/components/collab-sidebar/add-comment.js +12 -16
- package/build-module/components/collab-sidebar/add-comment.js.map +2 -2
- package/build-module/components/collab-sidebar/comment-menu-item.js +1 -1
- package/build-module/components/collab-sidebar/comment-menu-item.js.map +2 -2
- package/build-module/components/collab-sidebar/comments.js +89 -67
- package/build-module/components/collab-sidebar/comments.js.map +2 -2
- package/build-module/components/collab-sidebar/constants.js +2 -0
- package/build-module/components/collab-sidebar/constants.js.map +2 -2
- package/build-module/components/collab-sidebar/hooks.js +13 -6
- package/build-module/components/collab-sidebar/hooks.js.map +2 -2
- package/build-module/components/collab-sidebar/index.js +33 -16
- package/build-module/components/collab-sidebar/index.js.map +2 -2
- package/build-module/components/post-fields/index.js +4 -26
- package/build-module/components/post-fields/index.js.map +2 -2
- package/build-module/components/post-template/create-new-template-modal.js +2 -1
- package/build-module/components/post-template/create-new-template-modal.js.map +2 -2
- package/build-module/components/provider/index.js +3 -2
- package/build-module/components/provider/index.js.map +2 -2
- package/build-module/components/provider/use-hide-blocks-from-inserter.js +4 -26
- package/build-module/components/provider/use-hide-blocks-from-inserter.js.map +2 -2
- package/build-module/store/actions.js +12 -11
- package/build-module/store/actions.js.map +2 -2
- package/build-style/style-rtl.css +1 -0
- package/build-style/style.css +1 -0
- package/build-types/bindings/post-data.d.ts +7 -4
- package/build-types/bindings/term-data.d.ts +42 -0
- package/build-types/bindings/term-data.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/constants.d.ts +1 -0
- package/build-types/components/collab-sidebar/constants.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/post-fields/index.d.ts +1 -5
- package/build-types/components/post-fields/index.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-hide-blocks-from-inserter.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/package.json +38 -38
- package/src/bindings/api.js +2 -2
- package/src/bindings/post-data.js +80 -17
- package/src/bindings/term-data.js +224 -0
- package/src/components/collab-sidebar/add-comment.js +12 -23
- package/src/components/collab-sidebar/comment-menu-item.js +1 -1
- package/src/components/collab-sidebar/comments.js +111 -63
- package/src/components/collab-sidebar/constants.js +1 -0
- package/src/components/collab-sidebar/hooks.js +16 -9
- package/src/components/collab-sidebar/index.js +66 -49
- package/src/components/collab-sidebar/style.scss +1 -0
- package/src/components/post-fields/index.ts +5 -42
- package/src/components/post-template/create-new-template-modal.js +1 -0
- package/src/components/provider/index.js +5 -2
- package/src/components/provider/use-hide-blocks-from-inserter.js +6 -37
- package/src/store/actions.js +15 -17
- package/tsconfig.tsbuildinfo +1 -1
- package/build/bindings/entity.js +0 -78
- package/build/bindings/entity.js.map +0 -7
- package/build-module/bindings/entity.js +0 -58
- package/build-module/bindings/entity.js.map +0 -7
- package/build-types/bindings/entity.d.ts +0 -16
- package/build-types/bindings/entity.d.ts.map +0 -1
- package/src/bindings/entity.js +0 -89
package/build/bindings/entity.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var entity_exports = {};
|
|
20
|
-
__export(entity_exports, {
|
|
21
|
-
default: () => entity_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(entity_exports);
|
|
24
|
-
var import_i18n = require("@wordpress/i18n");
|
|
25
|
-
var import_core_data = require("@wordpress/core-data");
|
|
26
|
-
var entity_default = {
|
|
27
|
-
name: "core/entity",
|
|
28
|
-
label: (0, import_i18n.__)("Entity"),
|
|
29
|
-
getValues({ select, clientId, bindings }) {
|
|
30
|
-
const { getBlockAttributes } = select("core/block-editor");
|
|
31
|
-
const blockAttributes = getBlockAttributes(clientId);
|
|
32
|
-
const entityId = blockAttributes?.id;
|
|
33
|
-
if (!entityId) {
|
|
34
|
-
return {};
|
|
35
|
-
}
|
|
36
|
-
const urlBinding = bindings.url;
|
|
37
|
-
if (!urlBinding?.args?.key) {
|
|
38
|
-
return {};
|
|
39
|
-
}
|
|
40
|
-
const key = urlBinding.args.key;
|
|
41
|
-
if (key !== "url") {
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
const { type, kind } = blockAttributes || {};
|
|
45
|
-
if (!type || !kind) {
|
|
46
|
-
return {};
|
|
47
|
-
}
|
|
48
|
-
if (kind !== "post-type" && kind !== "taxonomy") {
|
|
49
|
-
return {};
|
|
50
|
-
}
|
|
51
|
-
const { getEntityRecord } = select(import_core_data.store);
|
|
52
|
-
let value = "";
|
|
53
|
-
if (kind === "post-type") {
|
|
54
|
-
const post = getEntityRecord("postType", type, entityId);
|
|
55
|
-
if (!post) {
|
|
56
|
-
return {};
|
|
57
|
-
}
|
|
58
|
-
value = post.link || "";
|
|
59
|
-
} else if (kind === "taxonomy") {
|
|
60
|
-
const taxonomySlug = type === "tag" ? "post_tag" : type;
|
|
61
|
-
const term = getEntityRecord("taxonomy", taxonomySlug, entityId);
|
|
62
|
-
if (!term) {
|
|
63
|
-
return {};
|
|
64
|
-
}
|
|
65
|
-
value = term.link || "";
|
|
66
|
-
}
|
|
67
|
-
if (!value) {
|
|
68
|
-
return {};
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
url: value
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
canUserEditValue() {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
//# sourceMappingURL=entity.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/bindings/entity.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\nexport default {\n\tname: 'core/entity',\n\tlabel: __( 'Entity' ),\n\tgetValues( { select, clientId, bindings } ) {\n\t\tconst { getBlockAttributes } = select( 'core/block-editor' );\n\n\t\t// Get the nav link's id attribute\n\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\tconst entityId = blockAttributes?.id;\n\n\t\tif ( ! entityId ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Get the key from binding args - no key means invalid binding\n\t\tconst urlBinding = bindings.url;\n\t\tif ( ! urlBinding?.args?.key ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst key = urlBinding.args.key;\n\n\t\t// For now, only support 'url' key\n\t\tif ( key !== 'url' ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Get the entity type and kind from block attributes\n\t\tconst { type, kind } = blockAttributes || {};\n\n\t\t// Validate required attributes exist\n\t\tif ( ! type || ! kind ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Validate entity kind is supported\n\t\tif ( kind !== 'post-type' && kind !== 'taxonomy' ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\tlet value = '';\n\n\t\t// Handle post types\n\t\tif ( kind === 'post-type' ) {\n\t\t\tconst post = getEntityRecord( 'postType', type, entityId );\n\n\t\t\tif ( ! post ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tvalue = post.link || '';\n\t\t}\n\t\t// Handle taxonomies\n\t\telse if ( kind === 'taxonomy' ) {\n\t\t\t// Convert 'tag' back to 'post_tag' for API calls\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/71979.\n\t\t\tconst taxonomySlug = type === 'tag' ? 'post_tag' : type;\n\t\t\tconst term = getEntityRecord( 'taxonomy', taxonomySlug, entityId );\n\n\t\t\tif ( ! term ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tvalue = term.link || '';\n\t\t}\n\n\t\t// If we couldn't get a valid URL, return empty object\n\t\tif ( ! value ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\turl: value,\n\t\t};\n\t},\n\tcanUserEditValue() {\n\t\t// This binding source provides read-only URLs derived from entity data\n\t\t// Users cannot manually edit these values as they are automatically\n\t\t// generated from the linked post/term's permalink\n\t\treturn false;\n\t},\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,uBAAuC;AAEvC,IAAO,iBAAQ;AAAA,EACd,MAAM;AAAA,EACN,WAAO,gBAAI,QAAS;AAAA,EACpB,UAAW,EAAE,QAAQ,UAAU,SAAS,GAAI;AAC3C,UAAM,EAAE,mBAAmB,IAAI,OAAQ,mBAAoB;AAG3D,UAAM,kBAAkB,mBAAoB,QAAS;AACrD,UAAM,WAAW,iBAAiB;AAElC,QAAK,CAAE,UAAW;AACjB,aAAO,CAAC;AAAA,IACT;AAGA,UAAM,aAAa,SAAS;AAC5B,QAAK,CAAE,YAAY,MAAM,KAAM;AAC9B,aAAO,CAAC;AAAA,IACT;AAEA,UAAM,MAAM,WAAW,KAAK;AAG5B,QAAK,QAAQ,OAAQ;AACpB,aAAO,CAAC;AAAA,IACT;AAGA,UAAM,EAAE,MAAM,KAAK,IAAI,mBAAmB,CAAC;AAG3C,QAAK,CAAE,QAAQ,CAAE,MAAO;AACvB,aAAO,CAAC;AAAA,IACT;AAGA,QAAK,SAAS,eAAe,SAAS,YAAa;AAClD,aAAO,CAAC;AAAA,IACT;AAEA,UAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAAA,KAAc;AAClD,QAAI,QAAQ;AAGZ,QAAK,SAAS,aAAc;AAC3B,YAAM,OAAO,gBAAiB,YAAY,MAAM,QAAS;AAEzD,UAAK,CAAE,MAAO;AACb,eAAO,CAAC;AAAA,MACT;AAEA,cAAQ,KAAK,QAAQ;AAAA,IACtB,WAEU,SAAS,YAAa;AAG/B,YAAM,eAAe,SAAS,QAAQ,aAAa;AACnD,YAAM,OAAO,gBAAiB,YAAY,cAAc,QAAS;AAEjE,UAAK,CAAE,MAAO;AACb,eAAO,CAAC;AAAA,MACT;AAEA,cAAQ,KAAK,QAAQ;AAAA,IACtB;AAGA,QAAK,CAAE,OAAQ;AACd,aAAO,CAAC;AAAA,IACT;AAEA,WAAO;AAAA,MACN,KAAK;AAAA,IACN;AAAA,EACD;AAAA,EACA,mBAAmB;AAIlB,WAAO;AAAA,EACR;AACD;",
|
|
6
|
-
"names": ["coreDataStore"]
|
|
7
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { __ } from "@wordpress/i18n";
|
|
2
|
-
import { store as coreDataStore } from "@wordpress/core-data";
|
|
3
|
-
var entity_default = {
|
|
4
|
-
name: "core/entity",
|
|
5
|
-
label: __("Entity"),
|
|
6
|
-
getValues({ select, clientId, bindings }) {
|
|
7
|
-
const { getBlockAttributes } = select("core/block-editor");
|
|
8
|
-
const blockAttributes = getBlockAttributes(clientId);
|
|
9
|
-
const entityId = blockAttributes?.id;
|
|
10
|
-
if (!entityId) {
|
|
11
|
-
return {};
|
|
12
|
-
}
|
|
13
|
-
const urlBinding = bindings.url;
|
|
14
|
-
if (!urlBinding?.args?.key) {
|
|
15
|
-
return {};
|
|
16
|
-
}
|
|
17
|
-
const key = urlBinding.args.key;
|
|
18
|
-
if (key !== "url") {
|
|
19
|
-
return {};
|
|
20
|
-
}
|
|
21
|
-
const { type, kind } = blockAttributes || {};
|
|
22
|
-
if (!type || !kind) {
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
if (kind !== "post-type" && kind !== "taxonomy") {
|
|
26
|
-
return {};
|
|
27
|
-
}
|
|
28
|
-
const { getEntityRecord } = select(coreDataStore);
|
|
29
|
-
let value = "";
|
|
30
|
-
if (kind === "post-type") {
|
|
31
|
-
const post = getEntityRecord("postType", type, entityId);
|
|
32
|
-
if (!post) {
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
value = post.link || "";
|
|
36
|
-
} else if (kind === "taxonomy") {
|
|
37
|
-
const taxonomySlug = type === "tag" ? "post_tag" : type;
|
|
38
|
-
const term = getEntityRecord("taxonomy", taxonomySlug, entityId);
|
|
39
|
-
if (!term) {
|
|
40
|
-
return {};
|
|
41
|
-
}
|
|
42
|
-
value = term.link || "";
|
|
43
|
-
}
|
|
44
|
-
if (!value) {
|
|
45
|
-
return {};
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
url: value
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
canUserEditValue() {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
export {
|
|
56
|
-
entity_default as default
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=entity.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/bindings/entity.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\nexport default {\n\tname: 'core/entity',\n\tlabel: __( 'Entity' ),\n\tgetValues( { select, clientId, bindings } ) {\n\t\tconst { getBlockAttributes } = select( 'core/block-editor' );\n\n\t\t// Get the nav link's id attribute\n\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\tconst entityId = blockAttributes?.id;\n\n\t\tif ( ! entityId ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Get the key from binding args - no key means invalid binding\n\t\tconst urlBinding = bindings.url;\n\t\tif ( ! urlBinding?.args?.key ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst key = urlBinding.args.key;\n\n\t\t// For now, only support 'url' key\n\t\tif ( key !== 'url' ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Get the entity type and kind from block attributes\n\t\tconst { type, kind } = blockAttributes || {};\n\n\t\t// Validate required attributes exist\n\t\tif ( ! type || ! kind ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Validate entity kind is supported\n\t\tif ( kind !== 'post-type' && kind !== 'taxonomy' ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\tlet value = '';\n\n\t\t// Handle post types\n\t\tif ( kind === 'post-type' ) {\n\t\t\tconst post = getEntityRecord( 'postType', type, entityId );\n\n\t\t\tif ( ! post ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tvalue = post.link || '';\n\t\t}\n\t\t// Handle taxonomies\n\t\telse if ( kind === 'taxonomy' ) {\n\t\t\t// Convert 'tag' back to 'post_tag' for API calls\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/71979.\n\t\t\tconst taxonomySlug = type === 'tag' ? 'post_tag' : type;\n\t\t\tconst term = getEntityRecord( 'taxonomy', taxonomySlug, entityId );\n\n\t\t\tif ( ! term ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tvalue = term.link || '';\n\t\t}\n\n\t\t// If we couldn't get a valid URL, return empty object\n\t\tif ( ! value ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\turl: value,\n\t\t};\n\t},\n\tcanUserEditValue() {\n\t\t// This binding source provides read-only URLs derived from entity data\n\t\t// Users cannot manually edit these values as they are automatically\n\t\t// generated from the linked post/term's permalink\n\t\treturn false;\n\t},\n};\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,qBAAqB;AAEvC,IAAO,iBAAQ;AAAA,EACd,MAAM;AAAA,EACN,OAAO,GAAI,QAAS;AAAA,EACpB,UAAW,EAAE,QAAQ,UAAU,SAAS,GAAI;AAC3C,UAAM,EAAE,mBAAmB,IAAI,OAAQ,mBAAoB;AAG3D,UAAM,kBAAkB,mBAAoB,QAAS;AACrD,UAAM,WAAW,iBAAiB;AAElC,QAAK,CAAE,UAAW;AACjB,aAAO,CAAC;AAAA,IACT;AAGA,UAAM,aAAa,SAAS;AAC5B,QAAK,CAAE,YAAY,MAAM,KAAM;AAC9B,aAAO,CAAC;AAAA,IACT;AAEA,UAAM,MAAM,WAAW,KAAK;AAG5B,QAAK,QAAQ,OAAQ;AACpB,aAAO,CAAC;AAAA,IACT;AAGA,UAAM,EAAE,MAAM,KAAK,IAAI,mBAAmB,CAAC;AAG3C,QAAK,CAAE,QAAQ,CAAE,MAAO;AACvB,aAAO,CAAC;AAAA,IACT;AAGA,QAAK,SAAS,eAAe,SAAS,YAAa;AAClD,aAAO,CAAC;AAAA,IACT;AAEA,UAAM,EAAE,gBAAgB,IAAI,OAAQ,aAAc;AAClD,QAAI,QAAQ;AAGZ,QAAK,SAAS,aAAc;AAC3B,YAAM,OAAO,gBAAiB,YAAY,MAAM,QAAS;AAEzD,UAAK,CAAE,MAAO;AACb,eAAO,CAAC;AAAA,MACT;AAEA,cAAQ,KAAK,QAAQ;AAAA,IACtB,WAEU,SAAS,YAAa;AAG/B,YAAM,eAAe,SAAS,QAAQ,aAAa;AACnD,YAAM,OAAO,gBAAiB,YAAY,cAAc,QAAS;AAEjE,UAAK,CAAE,MAAO;AACb,eAAO,CAAC;AAAA,MACT;AAEA,cAAQ,KAAK,QAAQ;AAAA,IACtB;AAGA,QAAK,CAAE,OAAQ;AACd,aAAO,CAAC;AAAA,IACT;AAEA,WAAO;AAAA,MACN,KAAK;AAAA,IACN;AAAA,EACD;AAAA,EACA,mBAAmB;AAIlB,WAAO;AAAA,EACR;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
let name: string;
|
|
3
|
-
let label: import("@wordpress/i18n").TranslatableText<"Entity">;
|
|
4
|
-
function getValues({ select, clientId, bindings }: {
|
|
5
|
-
select: any;
|
|
6
|
-
clientId: any;
|
|
7
|
-
bindings: any;
|
|
8
|
-
}): {
|
|
9
|
-
url?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
url: string;
|
|
12
|
-
};
|
|
13
|
-
function canUserEditValue(): boolean;
|
|
14
|
-
}
|
|
15
|
-
export default _default;
|
|
16
|
-
//# sourceMappingURL=entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../src/bindings/entity.js"],"names":[],"mappings":";;;IASC;;;;;;;;MAwEC;IACD,qCAKC"}
|
package/src/bindings/entity.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { store as coreDataStore } from '@wordpress/core-data';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
name: 'core/entity',
|
|
9
|
-
label: __( 'Entity' ),
|
|
10
|
-
getValues( { select, clientId, bindings } ) {
|
|
11
|
-
const { getBlockAttributes } = select( 'core/block-editor' );
|
|
12
|
-
|
|
13
|
-
// Get the nav link's id attribute
|
|
14
|
-
const blockAttributes = getBlockAttributes( clientId );
|
|
15
|
-
const entityId = blockAttributes?.id;
|
|
16
|
-
|
|
17
|
-
if ( ! entityId ) {
|
|
18
|
-
return {};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Get the key from binding args - no key means invalid binding
|
|
22
|
-
const urlBinding = bindings.url;
|
|
23
|
-
if ( ! urlBinding?.args?.key ) {
|
|
24
|
-
return {};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const key = urlBinding.args.key;
|
|
28
|
-
|
|
29
|
-
// For now, only support 'url' key
|
|
30
|
-
if ( key !== 'url' ) {
|
|
31
|
-
return {};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Get the entity type and kind from block attributes
|
|
35
|
-
const { type, kind } = blockAttributes || {};
|
|
36
|
-
|
|
37
|
-
// Validate required attributes exist
|
|
38
|
-
if ( ! type || ! kind ) {
|
|
39
|
-
return {};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Validate entity kind is supported
|
|
43
|
-
if ( kind !== 'post-type' && kind !== 'taxonomy' ) {
|
|
44
|
-
return {};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const { getEntityRecord } = select( coreDataStore );
|
|
48
|
-
let value = '';
|
|
49
|
-
|
|
50
|
-
// Handle post types
|
|
51
|
-
if ( kind === 'post-type' ) {
|
|
52
|
-
const post = getEntityRecord( 'postType', type, entityId );
|
|
53
|
-
|
|
54
|
-
if ( ! post ) {
|
|
55
|
-
return {};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
value = post.link || '';
|
|
59
|
-
}
|
|
60
|
-
// Handle taxonomies
|
|
61
|
-
else if ( kind === 'taxonomy' ) {
|
|
62
|
-
// Convert 'tag' back to 'post_tag' for API calls
|
|
63
|
-
// See https://github.com/WordPress/gutenberg/issues/71979.
|
|
64
|
-
const taxonomySlug = type === 'tag' ? 'post_tag' : type;
|
|
65
|
-
const term = getEntityRecord( 'taxonomy', taxonomySlug, entityId );
|
|
66
|
-
|
|
67
|
-
if ( ! term ) {
|
|
68
|
-
return {};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
value = term.link || '';
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// If we couldn't get a valid URL, return empty object
|
|
75
|
-
if ( ! value ) {
|
|
76
|
-
return {};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
url: value,
|
|
81
|
-
};
|
|
82
|
-
},
|
|
83
|
-
canUserEditValue() {
|
|
84
|
-
// This binding source provides read-only URLs derived from entity data
|
|
85
|
-
// Users cannot manually edit these values as they are automatically
|
|
86
|
-
// generated from the linked post/term's permalink
|
|
87
|
-
return false;
|
|
88
|
-
},
|
|
89
|
-
};
|