@wordpress/block-library 9.36.1-next.738bb1424.0 → 9.36.2-next.8fd3f8831.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/accordion-heading/deprecated.cjs +120 -1
- package/build/accordion-heading/deprecated.cjs.map +2 -2
- package/build/accordion-heading/edit.cjs +9 -1
- package/build/accordion-heading/edit.cjs.map +3 -3
- package/build/accordion-heading/save.cjs +1 -0
- package/build/accordion-heading/save.cjs.map +2 -2
- package/build/accordion-item/block.json +3 -0
- package/build/accordion-item/edit.cjs +3 -37
- package/build/accordion-item/edit.cjs.map +2 -2
- package/build/accordion-panel/block.json +1 -4
- package/build/accordion-panel/edit.cjs +3 -2
- package/build/accordion-panel/edit.cjs.map +2 -2
- package/build/breadcrumbs/block.json +1 -2
- package/build/breadcrumbs/edit.cjs +2 -1
- package/build/breadcrumbs/edit.cjs.map +2 -2
- package/build/button/index.cjs +9 -1
- package/build/button/index.cjs.map +2 -2
- package/build/buttons/block.json +1 -0
- package/build/comment-author-name/block.json +1 -3
- package/build/comment-author-name/deprecated.cjs +57 -1
- package/build/comment-author-name/deprecated.cjs.map +3 -3
- package/build/comment-author-name/edit.cjs +9 -19
- package/build/comment-author-name/edit.cjs.map +3 -3
- package/build/freeform/edit.cjs +48 -174
- package/build/freeform/edit.cjs.map +2 -2
- package/build/freeform/modal.cjs +51 -67
- package/build/freeform/modal.cjs.map +2 -2
- package/build/index.cjs +2 -2
- package/build/index.cjs.map +2 -2
- package/build/list/block.json +2 -1
- package/build/query/edit/query-content.cjs +4 -3
- package/build/query/edit/query-content.cjs.map +2 -2
- package/build/query/edit/query-placeholder.cjs +4 -3
- package/build/query/edit/query-placeholder.cjs.map +2 -2
- package/build/query/edit/query-toolbar.cjs +19 -7
- package/build/query/edit/query-toolbar.cjs.map +3 -3
- package/build/social-links/block.json +2 -1
- package/build-module/accordion-heading/deprecated.js +122 -2
- package/build-module/accordion-heading/deprecated.js.map +2 -2
- package/build-module/accordion-heading/edit.js +11 -2
- package/build-module/accordion-heading/edit.js.map +2 -2
- package/build-module/accordion-heading/save.js +1 -0
- package/build-module/accordion-heading/save.js.map +2 -2
- package/build-module/accordion-item/block.json +3 -0
- package/build-module/accordion-item/edit.js +3 -37
- package/build-module/accordion-item/edit.js.map +2 -2
- package/build-module/accordion-panel/block.json +1 -4
- package/build-module/accordion-panel/edit.js +3 -2
- package/build-module/accordion-panel/edit.js.map +2 -2
- package/build-module/breadcrumbs/block.json +1 -2
- package/build-module/breadcrumbs/edit.js +2 -1
- package/build-module/breadcrumbs/edit.js.map +2 -2
- package/build-module/button/index.js +9 -1
- package/build-module/button/index.js.map +2 -2
- package/build-module/buttons/block.json +1 -0
- package/build-module/comment-author-name/block.json +1 -3
- package/build-module/comment-author-name/deprecated.js +57 -1
- package/build-module/comment-author-name/deprecated.js.map +2 -2
- package/build-module/comment-author-name/edit.js +10 -25
- package/build-module/comment-author-name/edit.js.map +2 -2
- package/build-module/freeform/edit.js +56 -176
- package/build-module/freeform/edit.js.map +2 -2
- package/build-module/freeform/modal.js +55 -78
- package/build-module/freeform/modal.js.map +2 -2
- package/build-module/index.js +2 -2
- package/build-module/index.js.map +2 -2
- package/build-module/list/block.json +2 -1
- package/build-module/query/edit/query-content.js +5 -5
- package/build-module/query/edit/query-content.js.map +2 -2
- package/build-module/query/edit/query-placeholder.js +4 -4
- package/build-module/query/edit/query-placeholder.js.map +2 -2
- package/build-module/query/edit/query-toolbar.js +22 -7
- package/build-module/query/edit/query-toolbar.js.map +2 -2
- package/build-module/social-links/block.json +2 -1
- package/build-style/audio/style-rtl.css +4 -0
- package/build-style/audio/style.css +4 -0
- package/build-style/audio/theme-rtl.css +4 -0
- package/build-style/audio/theme.css +4 -0
- package/build-style/columns/style-rtl.css +4 -0
- package/build-style/columns/style.css +4 -0
- package/build-style/common-rtl.css +4 -0
- package/build-style/common.css +4 -0
- package/build-style/editor-rtl.css +9 -324
- package/build-style/editor.css +9 -328
- package/build-style/embed/style-rtl.css +4 -0
- package/build-style/embed/style.css +4 -0
- package/build-style/embed/theme-rtl.css +4 -0
- package/build-style/embed/theme.css +4 -0
- package/build-style/freeform/editor-rtl.css +10 -330
- package/build-style/freeform/editor.css +10 -334
- package/build-style/gallery/editor-rtl.css +4 -0
- package/build-style/gallery/editor.css +4 -0
- package/build-style/gallery/style-rtl.css +4 -0
- package/build-style/gallery/style.css +4 -0
- package/build-style/gallery/theme-rtl.css +4 -0
- package/build-style/gallery/theme.css +4 -0
- package/build-style/html/editor-rtl.css +4 -0
- package/build-style/html/editor.css +4 -0
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/image/style-rtl.css +4 -0
- package/build-style/image/style.css +4 -0
- package/build-style/image/theme-rtl.css +4 -0
- package/build-style/image/theme.css +4 -0
- package/build-style/latest-posts/style-rtl.css +4 -0
- package/build-style/latest-posts/style.css +4 -0
- package/build-style/navigation/editor-rtl.css +4 -0
- package/build-style/navigation/editor.css +4 -0
- package/build-style/navigation/style-rtl.css +4 -0
- package/build-style/navigation/style.css +4 -0
- package/build-style/navigation-submenu/editor-rtl.css +4 -0
- package/build-style/navigation-submenu/editor.css +4 -0
- package/build-style/page-list/editor-rtl.css +4 -0
- package/build-style/page-list/editor.css +4 -0
- package/build-style/paragraph/editor-rtl.css +5 -0
- package/build-style/paragraph/editor.css +5 -0
- package/build-style/post-template/style-rtl.css +4 -0
- package/build-style/post-template/style.css +4 -0
- package/build-style/query/editor-rtl.css +4 -0
- package/build-style/query/editor.css +4 -0
- package/build-style/rss/style-rtl.css +4 -0
- package/build-style/rss/style.css +4 -0
- package/build-style/shortcode/editor-rtl.css +4 -0
- package/build-style/shortcode/editor.css +4 -0
- package/build-style/style-rtl.css +4 -0
- package/build-style/style.css +4 -0
- package/build-style/table/editor-rtl.css +4 -0
- package/build-style/table/editor.css +4 -0
- package/build-style/table/theme-rtl.css +4 -0
- package/build-style/table/theme.css +4 -0
- package/build-style/template-part/editor-rtl.css +4 -0
- package/build-style/template-part/editor.css +4 -0
- package/build-style/theme-rtl.css +4 -0
- package/build-style/theme.css +4 -0
- package/build-style/video/style-rtl.css +4 -0
- package/build-style/video/style.css +4 -0
- package/build-style/video/theme-rtl.css +4 -0
- package/build-style/video/theme.css +4 -0
- package/package.json +37 -37
- package/src/accordion-heading/deprecated.js +122 -1
- package/src/accordion-heading/edit.js +11 -1
- package/src/accordion-heading/save.js +1 -0
- package/src/accordion-item/block.json +3 -0
- package/src/accordion-item/edit.js +4 -38
- package/src/accordion-panel/block.json +1 -4
- package/src/accordion-panel/edit.js +3 -4
- package/src/breadcrumbs/block.json +1 -2
- package/src/breadcrumbs/edit.js +2 -1
- package/src/breadcrumbs/index.php +23 -1
- package/src/button/index.js +12 -0
- package/src/button/test/get-experimental-label.js +50 -0
- package/src/buttons/block.json +1 -0
- package/src/comment-author-name/block.json +1 -3
- package/src/comment-author-name/deprecated.js +61 -1
- package/src/comment-author-name/edit.js +10 -34
- package/src/freeform/edit.js +60 -245
- package/src/freeform/editor.scss +1 -382
- package/src/freeform/modal.js +47 -80
- package/src/index.js +1 -1
- package/src/list/block.json +2 -1
- package/src/paragraph/editor.scss +8 -0
- package/src/post-date/index.php +4 -7
- package/src/query/edit/query-content.js +3 -3
- package/src/query/edit/query-placeholder.js +3 -3
- package/src/query/edit/query-toolbar.js +47 -31
- package/src/social-links/block.json +2 -1
- package/src/term-template/index.php +1 -1
|
@@ -34,6 +34,62 @@ __export(deprecated_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(deprecated_exports);
|
|
36
36
|
var import_migrate_font_family = __toESM(require("../utils/migrate-font-family.cjs"), 1);
|
|
37
|
+
var import_migrate_text_align = __toESM(require("../utils/migrate-text-align.cjs"), 1);
|
|
38
|
+
var v2 = {
|
|
39
|
+
attributes: {
|
|
40
|
+
isLink: {
|
|
41
|
+
type: "boolean",
|
|
42
|
+
default: true
|
|
43
|
+
},
|
|
44
|
+
linkTarget: {
|
|
45
|
+
type: "string",
|
|
46
|
+
default: "_self"
|
|
47
|
+
},
|
|
48
|
+
textAlign: {
|
|
49
|
+
type: "string"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
usesContext: ["commentId"],
|
|
53
|
+
supports: {
|
|
54
|
+
html: false,
|
|
55
|
+
spacing: {
|
|
56
|
+
margin: true,
|
|
57
|
+
padding: true
|
|
58
|
+
},
|
|
59
|
+
color: {
|
|
60
|
+
gradients: true,
|
|
61
|
+
link: true
|
|
62
|
+
},
|
|
63
|
+
typography: {
|
|
64
|
+
fontSize: true,
|
|
65
|
+
lineHeight: true,
|
|
66
|
+
__experimentalFontFamily: true,
|
|
67
|
+
__experimentalFontWeight: true,
|
|
68
|
+
__experimentalFontStyle: true,
|
|
69
|
+
__experimentalTextTransform: true,
|
|
70
|
+
__experimentalTextDecoration: true,
|
|
71
|
+
__experimentalLetterSpacing: true
|
|
72
|
+
},
|
|
73
|
+
interactivity: {
|
|
74
|
+
clientNavigation: true
|
|
75
|
+
},
|
|
76
|
+
__experimentalBorder: {
|
|
77
|
+
radius: true,
|
|
78
|
+
color: true,
|
|
79
|
+
width: true,
|
|
80
|
+
style: true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
save() {
|
|
84
|
+
return null;
|
|
85
|
+
},
|
|
86
|
+
migrate: import_migrate_text_align.default,
|
|
87
|
+
isEligible(attributes) {
|
|
88
|
+
return !!attributes.textAlign || !!attributes.className?.match(
|
|
89
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
37
93
|
var v1 = {
|
|
38
94
|
attributes: {
|
|
39
95
|
isLink: {
|
|
@@ -69,5 +125,5 @@ var v1 = {
|
|
|
69
125
|
return style?.typography?.fontFamily;
|
|
70
126
|
}
|
|
71
127
|
};
|
|
72
|
-
var deprecated_default = [v1];
|
|
128
|
+
var deprecated_default = [v2, v1];
|
|
73
129
|
//# sourceMappingURL=deprecated.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/comment-author-name/deprecated.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\n\nconst v1 = {\n\tattributes: {\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\tlinkTarget: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '_self',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateFontFamily,\n\tisEligible( { style } ) {\n\t\treturn style?.typography?.fontFamily;\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v1 ];\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iCAA8B;
|
|
6
|
-
"names": ["migrateFontFamily"]
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\nimport migrateTextAlign from '../utils/migrate-text-align';\n\nconst v2 = {\n\tattributes: {\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tlinkTarget: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '_self',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tusesContext: [ 'commentId' ],\n\tsupports: {\n\t\thtml: false,\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t\tpadding: true,\n\t\t},\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateTextAlign,\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\t!! attributes.textAlign ||\n\t\t\t!! attributes.className?.match(\n\t\t\t\t/\\bhas-text-align-(left|center|right)\\b/\n\t\t\t)\n\t\t);\n\t},\n};\n\nconst v1 = {\n\tattributes: {\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\tlinkTarget: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '_self',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateFontFamily,\n\tisEligible( { style } ) {\n\t\treturn style?.typography?.fontFamily;\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v2, v1 ];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iCAA8B;AAC9B,gCAA6B;AAE7B,IAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,YAAY;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA,aAAa,CAAE,WAAY;AAAA,EAC3B,UAAU;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,MACR,QAAQ;AAAA,MACR,SAAS;AAAA,IACV;AAAA,IACA,OAAO;AAAA,MACN,WAAW;AAAA,MACX,MAAM;AAAA,IACP;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,0BAA0B;AAAA,MAC1B,0BAA0B;AAAA,MAC1B,yBAAyB;AAAA,MACzB,6BAA6B;AAAA,MAC7B,8BAA8B;AAAA,MAC9B,6BAA6B;AAAA,IAC9B;AAAA,IACA,eAAe;AAAA,MACd,kBAAkB;AAAA,IACnB;AAAA,IACA,sBAAsB;AAAA,MACrB,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,IACR;AAAA,EACD;AAAA,EACA,OAAO;AACN,WAAO;AAAA,EACR;AAAA,EACA,SAAS,0BAAAA;AAAA,EACT,WAAY,YAAa;AACxB,WACC,CAAC,CAAE,WAAW,aACd,CAAC,CAAE,WAAW,WAAW;AAAA,MACxB;AAAA,IACD;AAAA,EAEF;AACD;AAEA,IAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,YAAY;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,EACD;AAAA,EACA,UAAU;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,MACN,WAAW;AAAA,MACX,MAAM;AAAA,IACP;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,0BAA0B;AAAA,MAC1B,0BAA0B;AAAA,MAC1B,yBAAyB;AAAA,MACzB,6BAA6B;AAAA,MAC7B,6BAA6B;AAAA,IAC9B;AAAA,EACD;AAAA,EACA,OAAO;AACN,WAAO;AAAA,EACR;AAAA,EACA,SAAS,2BAAAC;AAAA,EACT,WAAY,EAAE,MAAM,GAAI;AACvB,WAAO,OAAO,YAAY;AAAA,EAC3B;AACD;AAUA,IAAO,qBAAQ,CAAE,IAAI,EAAG;",
|
|
6
|
+
"names": ["migrateTextAlign", "migrateFontFamily"]
|
|
7
7
|
}
|
|
@@ -33,25 +33,23 @@ __export(edit_exports, {
|
|
|
33
33
|
default: () => Edit
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(edit_exports);
|
|
36
|
-
var import_clsx = __toESM(require("clsx"), 1);
|
|
37
36
|
var import_i18n = require("@wordpress/i18n");
|
|
38
37
|
var import_data = require("@wordpress/data");
|
|
39
38
|
var import_block_editor = require("@wordpress/block-editor");
|
|
40
39
|
var import_core_data = require("@wordpress/core-data");
|
|
41
40
|
var import_components = require("@wordpress/components");
|
|
42
41
|
var import_hooks = require("../utils/hooks.cjs");
|
|
42
|
+
var import_deprecated_text_align_attributes = __toESM(require("../utils/deprecated-text-align-attributes.cjs"), 1);
|
|
43
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
-
function Edit({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
function Edit(props) {
|
|
45
|
+
const {
|
|
46
|
+
attributes: { isLink, linkTarget },
|
|
47
|
+
context: { commentId },
|
|
48
|
+
setAttributes
|
|
49
|
+
} = props;
|
|
50
|
+
(0, import_deprecated_text_align_attributes.default)(props);
|
|
49
51
|
const dropdownMenuProps = (0, import_hooks.useToolsPanelDropdownMenuProps)();
|
|
50
|
-
const blockProps = (0, import_block_editor.useBlockProps)(
|
|
51
|
-
className: (0, import_clsx.default)({
|
|
52
|
-
[`has-text-align-${textAlign}`]: textAlign
|
|
53
|
-
})
|
|
54
|
-
});
|
|
52
|
+
const blockProps = (0, import_block_editor.useBlockProps)();
|
|
55
53
|
let displayName = (0, import_data.useSelect)(
|
|
56
54
|
(select) => {
|
|
57
55
|
const { getEntityRecord } = select(import_core_data.store);
|
|
@@ -65,13 +63,6 @@ function Edit({
|
|
|
65
63
|
},
|
|
66
64
|
[commentId]
|
|
67
65
|
);
|
|
68
|
-
const blockControls = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { group: "block", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
-
import_block_editor.AlignmentControl,
|
|
70
|
-
{
|
|
71
|
-
value: textAlign,
|
|
72
|
-
onChange: (newAlign) => setAttributes({ textAlign: newAlign })
|
|
73
|
-
}
|
|
74
|
-
) });
|
|
75
66
|
const inspectorControls = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
76
67
|
import_components.__experimentalToolsPanel,
|
|
77
68
|
{
|
|
@@ -140,7 +131,6 @@ function Edit({
|
|
|
140
131
|
) : displayName;
|
|
141
132
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
142
133
|
inspectorControls,
|
|
143
|
-
blockControls,
|
|
144
134
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...blockProps, children: displayAuthor })
|
|
145
135
|
] });
|
|
146
136
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/comment-author-name/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\n/**\n * Renders the `core/comment-author-name` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {string} props.attributes.linkTarget Target of the link.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {JSX.Element} React element.\n */\nexport default function Edit( props ) {\n\tconst {\n\t\tattributes: { isLink, linkTarget },\n\t\tcontext: { commentId },\n\t\tsetAttributes,\n\t} = props;\n\tuseDeprecatedTextAlign( props );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst blockProps = useBlockProps();\n\tlet displayName = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\t\tconst comment = getEntityRecord( 'root', 'comment', commentId );\n\t\t\tconst authorName = comment?.author_name;\n\n\t\t\tif ( comment && ! authorName ) {\n\t\t\t\tconst user = getEntityRecord( 'root', 'user', comment.author );\n\t\t\t\treturn user?.name ?? __( 'Anonymous' );\n\t\t\t}\n\t\t\treturn authorName ?? '';\n\t\t},\n\t\t[ commentId ]\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tisLink: true,\n\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Link to authors URL' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => ! isLink }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tisLink: true,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link to authors URL' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t{ isLink && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => linkTarget !== '_self' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tlinkTarget: '_self',\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\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! displayName ) {\n\t\tdisplayName = _x( 'Comment Author', 'block title' );\n\t}\n\n\tconst displayAuthor = isLink ? (\n\t\t<a\n\t\t\thref=\"#comment-author-pseudo-link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t>\n\t\t\t{ displayName }\n\t\t</a>\n\t) : (\n\t\tdisplayName\n\t);\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...blockProps }>{ displayAuthor }</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuB;AACvB,kBAA0B;AAC1B,0BAAiD;AACjD,uBAAmC;AACnC,wBAIO;AAKP,mBAA+C;AAC/C,8CAAmC;AA0ChC;AA3BY,SAAR,KAAuB,OAAQ;AACrC,QAAM;AAAA,IACL,YAAY,EAAE,QAAQ,WAAW;AAAA,IACjC,SAAS,EAAE,UAAU;AAAA,IACrB;AAAA,EACD,IAAI;AACJ,8CAAAA,SAAwB,KAAM;AAC9B,QAAM,wBAAoB,6CAA+B;AACzD,QAAM,iBAAa,mCAAc;AACjC,MAAI,kBAAc;AAAA,IACjB,CAAE,WAAY;AACb,YAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAAC,KAAU;AAE9C,YAAM,UAAU,gBAAiB,QAAQ,WAAW,SAAU;AAC9D,YAAM,aAAa,SAAS;AAE5B,UAAK,WAAW,CAAE,YAAa;AAC9B,cAAM,OAAO,gBAAiB,QAAQ,QAAQ,QAAQ,MAAO;AAC7D,eAAO,MAAM,YAAQ,gBAAI,WAAY;AAAA,MACtC;AACA,aAAO,cAAc;AAAA,IACtB;AAAA,IACA,CAAE,SAAU;AAAA,EACb;AAEA,QAAM,oBACL,4CAAC,yCACA;AAAA,IAAC,kBAAAC;AAAA,IAAA;AAAA,MACA,WAAQ,gBAAI,UAAW;AAAA,MACvB,UAAW,MAAM;AAChB,sBAAe;AAAA,UACd,QAAQ;AAAA,UACR,YAAY;AAAA,QACb,CAAE;AAAA,MACH;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,qBAAsB;AAAA,YAClC,kBAAgB;AAAA,YAChB,UAAW,MAAM,CAAE;AAAA,YACnB,YAAa,MACZ,cAAe;AAAA,cACd,QAAQ;AAAA,YACT,CAAE;AAAA,YAGH;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,qBAAsB;AAAA,gBAClC,UAAW,MAAM,cAAe,EAAE,QAAQ,CAAE,OAAO,CAAE;AAAA,gBACrD,SAAU;AAAA;AAAA,YACX;AAAA;AAAA,QACD;AAAA,QACE,UACD;AAAA,UAAC,kBAAAA;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,iBAAkB;AAAA,YAC9B,kBAAgB;AAAA,YAChB,UAAW,MAAM,eAAe;AAAA,YAChC,YAAa,MACZ,cAAe;AAAA,cACd,YAAY;AAAA,YACb,CAAE;AAAA,YAGH;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,iBAAkB;AAAA,gBAC9B,UAAW,CAAE,UACZ,cAAe;AAAA,kBACd,YAAY,QAAQ,WAAW;AAAA,gBAChC,CAAE;AAAA,gBAEH,SAAU,eAAe;AAAA;AAAA,YAC1B;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF,GACD;AAGD,MAAK,CAAE,aAAa,CAAE,aAAc;AACnC,sBAAc,gBAAI,kBAAkB,aAAc;AAAA,EACnD;AAEA,QAAM,gBAAgB,SACrB;AAAA,IAAC;AAAA;AAAA,MACA,MAAK;AAAA,MACL,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,MAE1C;AAAA;AAAA,EACH,IAEA;AAED,SACC,4EACG;AAAA;AAAA,IACF,4CAAC,SAAM,GAAG,YAAe,yBAAe;AAAA,KACzC;AAEF;",
|
|
6
|
+
"names": ["useDeprecatedTextAlign", "coreStore", "ToolsPanel", "ToolsPanelItem"]
|
|
7
7
|
}
|
package/build/freeform/edit.cjs
CHANGED
|
@@ -34,197 +34,71 @@ __export(edit_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(edit_exports);
|
|
36
36
|
var import_block_editor = require("@wordpress/block-editor");
|
|
37
|
-
var import_compose = require("@wordpress/compose");
|
|
38
37
|
var import_data = require("@wordpress/data");
|
|
39
38
|
var import_components = require("@wordpress/components");
|
|
40
39
|
var import_element = require("@wordpress/element");
|
|
41
40
|
var import_i18n = require("@wordpress/i18n");
|
|
42
|
-
var
|
|
41
|
+
var import_icons = require("@wordpress/icons");
|
|
43
42
|
var import_convert_to_blocks_button = __toESM(require("./convert-to-blocks-button.cjs"), 1);
|
|
44
43
|
var import_modal = __toESM(require("./modal.cjs"), 1);
|
|
45
44
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (body.childNodes[0].childNodes.length > 1) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
return /^\n?$/.test(body.innerText || body.textContent);
|
|
58
|
-
}
|
|
59
|
-
function FreeformEdit(props) {
|
|
60
|
-
const { clientId } = props;
|
|
45
|
+
function FreeformEdit({
|
|
46
|
+
attributes,
|
|
47
|
+
setAttributes,
|
|
48
|
+
clientId
|
|
49
|
+
}) {
|
|
50
|
+
const { content } = attributes;
|
|
51
|
+
const [isOpen, setOpen] = (0, import_element.useState)(false);
|
|
52
|
+
const editButtonRef = (0, import_element.useRef)(null);
|
|
61
53
|
const canRemove = (0, import_data.useSelect)(
|
|
62
54
|
(select) => select(import_block_editor.store).canRemoveBlock(clientId),
|
|
63
55
|
[clientId]
|
|
64
56
|
);
|
|
65
|
-
const [isIframed, setIsIframed] = (0, import_element.useState)(false);
|
|
66
|
-
const ref = (0, import_compose.useRefEffect)((element) => {
|
|
67
|
-
setIsIframed(element.ownerDocument !== document);
|
|
68
|
-
}, []);
|
|
69
57
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
70
58
|
canRemove && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_convert_to_blocks_button.default, { clientId }) }) }),
|
|
71
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
setAttributes,
|
|
78
|
-
onReplace
|
|
79
|
-
}) {
|
|
80
|
-
const { getMultiSelectedBlockClientIds } = (0, import_data.useSelect)(import_block_editor.store);
|
|
81
|
-
const didMountRef = (0, import_element.useRef)(false);
|
|
82
|
-
(0, import_element.useEffect)(() => {
|
|
83
|
-
if (!didMountRef.current) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const editor = window.tinymce.get(`editor-${clientId}`);
|
|
87
|
-
if (!editor) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const currentContent = editor.getContent();
|
|
91
|
-
if (currentContent !== content) {
|
|
92
|
-
editor.setContent(content || "");
|
|
93
|
-
}
|
|
94
|
-
}, [clientId, content]);
|
|
95
|
-
(0, import_element.useEffect)(() => {
|
|
96
|
-
const { baseURL, suffix } = window.wpEditorL10n.tinymce;
|
|
97
|
-
didMountRef.current = true;
|
|
98
|
-
window.tinymce.EditorManager.overrideDefaults({
|
|
99
|
-
base_url: baseURL,
|
|
100
|
-
suffix
|
|
101
|
-
});
|
|
102
|
-
function onSetup(editor) {
|
|
103
|
-
let bookmark;
|
|
104
|
-
if (content) {
|
|
105
|
-
editor.on("loadContent", () => editor.setContent(content));
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
import_components.ToolbarButton,
|
|
61
|
+
{
|
|
62
|
+
ref: editButtonRef,
|
|
63
|
+
onClick: () => setOpen(true),
|
|
64
|
+
children: (0, import_i18n.__)("Edit")
|
|
106
65
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
66
|
+
) }) }),
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...(0, import_block_editor.useBlockProps)(), children: [
|
|
68
|
+
content ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.RawHTML, { children: content }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
import_components.Placeholder,
|
|
70
|
+
{
|
|
71
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockIcon, { icon: import_icons.classic }),
|
|
72
|
+
label: (0, import_i18n.__)("Classic"),
|
|
73
|
+
instructions: (0, import_i18n.__)(
|
|
74
|
+
"Use the classic editor to add content."
|
|
75
|
+
),
|
|
76
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
77
|
+
import_components.Button,
|
|
78
|
+
{
|
|
79
|
+
__next40pxDefaultSize: true,
|
|
80
|
+
variant: "primary",
|
|
81
|
+
onClick: () => setOpen(true),
|
|
82
|
+
children: (0, import_i18n.__)("Edit contents")
|
|
123
83
|
}
|
|
124
|
-
|
|
125
|
-
});
|
|
126
|
-
return false;
|
|
127
|
-
});
|
|
128
|
-
editor.on("mousedown touchstart", () => {
|
|
129
|
-
bookmark = null;
|
|
130
|
-
});
|
|
131
|
-
const debouncedOnChange = (0, import_compose.debounce)(() => {
|
|
132
|
-
const value = editor.getContent();
|
|
133
|
-
if (value !== editor._lastChange) {
|
|
134
|
-
editor._lastChange = value;
|
|
135
|
-
setAttributes({
|
|
136
|
-
content: value
|
|
137
|
-
});
|
|
84
|
+
)
|
|
138
85
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (altKey && event.keyCode === import_keycodes.F10) {
|
|
153
|
-
event.stopPropagation();
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
editor.on("paste", (event) => {
|
|
157
|
-
event.stopPropagation();
|
|
158
|
-
});
|
|
159
|
-
editor.on("init", () => {
|
|
160
|
-
const rootNode = editor.getBody();
|
|
161
|
-
if (rootNode.ownerDocument.activeElement === rootNode) {
|
|
162
|
-
rootNode.blur();
|
|
163
|
-
editor.focus();
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
function initialize() {
|
|
168
|
-
const { settings } = window.wpEditorL10n.tinymce;
|
|
169
|
-
wp.oldEditor.initialize(`editor-${clientId}`, {
|
|
170
|
-
tinymce: {
|
|
171
|
-
...settings,
|
|
172
|
-
inline: true,
|
|
173
|
-
content_css: false,
|
|
174
|
-
fixed_toolbar_container: `#toolbar-${clientId}`,
|
|
175
|
-
setup: onSetup
|
|
86
|
+
),
|
|
87
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
|
+
import_modal.default,
|
|
89
|
+
{
|
|
90
|
+
clientId,
|
|
91
|
+
content,
|
|
92
|
+
onClose: () => {
|
|
93
|
+
setOpen(false);
|
|
94
|
+
if (editButtonRef.current) {
|
|
95
|
+
editButtonRef.current.focus();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
onChange: (newContent) => setAttributes({ content: newContent })
|
|
176
99
|
}
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
function onReadyStateChange() {
|
|
180
|
-
if (document.readyState === "complete") {
|
|
181
|
-
initialize();
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
if (document.readyState === "complete") {
|
|
185
|
-
initialize();
|
|
186
|
-
} else {
|
|
187
|
-
document.addEventListener("readystatechange", onReadyStateChange);
|
|
188
|
-
}
|
|
189
|
-
return () => {
|
|
190
|
-
document.removeEventListener(
|
|
191
|
-
"readystatechange",
|
|
192
|
-
onReadyStateChange
|
|
193
|
-
);
|
|
194
|
-
wp.oldEditor.remove(`editor-${clientId}`);
|
|
195
|
-
didMountRef.current = false;
|
|
196
|
-
};
|
|
197
|
-
}, []);
|
|
198
|
-
function focus() {
|
|
199
|
-
const editor = window.tinymce.get(`editor-${clientId}`);
|
|
200
|
-
if (editor) {
|
|
201
|
-
editor.focus();
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
function onToolbarKeyDown(event) {
|
|
205
|
-
event.stopPropagation();
|
|
206
|
-
event.nativeEvent.stopImmediatePropagation();
|
|
207
|
-
}
|
|
208
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
209
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
210
|
-
"div",
|
|
211
|
-
{
|
|
212
|
-
id: `toolbar-${clientId}`,
|
|
213
|
-
className: "block-library-classic__toolbar",
|
|
214
|
-
onClick: focus,
|
|
215
|
-
"data-placeholder": (0, import_i18n.__)("Classic"),
|
|
216
|
-
onKeyDown: onToolbarKeyDown
|
|
217
|
-
},
|
|
218
|
-
"toolbar"
|
|
219
|
-
),
|
|
220
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
221
|
-
"div",
|
|
222
|
-
{
|
|
223
|
-
id: `editor-${clientId}`,
|
|
224
|
-
className: "wp-block-freeform block-library-rich-text__tinymce"
|
|
225
|
-
},
|
|
226
|
-
"editor"
|
|
227
|
-
)
|
|
100
|
+
)
|
|
101
|
+
] })
|
|
228
102
|
] });
|
|
229
103
|
}
|
|
230
104
|
//# sourceMappingURL=edit.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/freeform/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tPlaceholder,\n\tToolbarGroup,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { useState, useRef, RawHTML } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { classic } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ConvertToBlocksButton from './convert-to-blocks-button';\nimport ModalEdit from './modal';\n\nexport default function FreeformEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { content } = attributes;\n\tconst [ isOpen, setOpen ] = useState( false );\n\tconst editButtonRef = useRef( null );\n\n\tconst canRemove = useSelect(\n\t\t( select ) => select( blockEditorStore ).canRemoveBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ canRemove && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ConvertToBlocksButton clientId={ clientId } />\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tref={ editButtonRef }\n\t\t\t\t\t\tonClick={ () => setOpen( true ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t{ content ? (\n\t\t\t\t\t<RawHTML>{ content }</RawHTML>\n\t\t\t\t) : (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ classic } /> }\n\t\t\t\t\t\tlabel={ __( 'Classic' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Use the classic editor to add content.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tonClick={ () => setOpen( true ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Edit contents' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</Placeholder>\n\t\t\t\t) }\n\t\t\t\t{ isOpen && (\n\t\t\t\t\t<ModalEdit\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tcontent={ content }\n\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\tsetOpen( false );\n\t\t\t\t\t\t\tif ( editButtonRef.current ) {\n\t\t\t\t\t\t\t\teditButtonRef.current.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( newContent ) =>\n\t\t\t\t\t\t\tsetAttributes( { content: newContent } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAKO;AACP,kBAA0B;AAC1B,wBAKO;AACP,qBAA0C;AAC1C,kBAAmB;AACnB,mBAAwB;AAKxB,sCAAkC;AAClC,mBAAsB;AAiBpB;AAfa,SAAR,aAA+B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,CAAE,QAAQ,OAAQ,QAAI,yBAAU,KAAM;AAC5C,QAAM,oBAAgB,uBAAQ,IAAK;AAEnC,QAAM,gBAAY;AAAA,IACjB,CAAE,WAAY,OAAQ,oBAAAA,KAAiB,EAAE,eAAgB,QAAS;AAAA,IAClE,CAAE,QAAS;AAAA,EACZ;AAEA,SACC,4EACG;AAAA,iBACD,4CAAC,qCACA,sDAAC,kCACA,sDAAC,gCAAAC,SAAA,EAAsB,UAAsB,GAC9C,GACD;AAAA,IAED,4CAAC,qCACA,sDAAC,kCACA;AAAA,MAAC;AAAA;AAAA,QACA,KAAM;AAAA,QACN,SAAU,MAAM,QAAS,IAAK;AAAA,QAE5B,8BAAI,MAAO;AAAA;AAAA,IACd,GACD,GACD;AAAA,IACA,6CAAC,SAAM,OAAG,mCAAc,GACrB;AAAA,gBACD,4CAAC,0BAAU,mBAAS,IAEpB;AAAA,QAAC;AAAA;AAAA,UACA,MAAO,4CAAC,iCAAU,MAAO,sBAAU;AAAA,UACnC,WAAQ,gBAAI,SAAU;AAAA,UACtB,kBAAe;AAAA,YACd;AAAA,UACD;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,SAAQ;AAAA,cACR,SAAU,MAAM,QAAS,IAAK;AAAA,cAE5B,8BAAI,eAAgB;AAAA;AAAA,UACvB;AAAA;AAAA,MACD;AAAA,MAEC,UACD;AAAA,QAAC,aAAAC;AAAA,QAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA,SAAU,MAAM;AACf,oBAAS,KAAM;AACf,gBAAK,cAAc,SAAU;AAC5B,4BAAc,QAAQ,MAAM;AAAA,YAC7B;AAAA,UACD;AAAA,UACA,UAAW,CAAE,eACZ,cAAe,EAAE,SAAS,WAAW,CAAE;AAAA;AAAA,MAEzC;AAAA,OAEF;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore", "ConvertToBlocksButton", "ModalEdit"]
|
|
7
7
|
}
|
package/build/freeform/modal.cjs
CHANGED
|
@@ -78,76 +78,60 @@ function ClassicEdit(props) {
|
|
|
78
78
|
}, []);
|
|
79
79
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { ...props });
|
|
80
80
|
}
|
|
81
|
-
function ModalEdit(
|
|
82
|
-
const {
|
|
83
|
-
clientId,
|
|
84
|
-
attributes: { content },
|
|
85
|
-
setAttributes,
|
|
86
|
-
onReplace
|
|
87
|
-
} = props;
|
|
88
|
-
const [isOpen, setOpen] = (0, import_element.useState)(false);
|
|
81
|
+
function ModalEdit({ clientId, content, onClose, onChange }) {
|
|
89
82
|
const [isModalFullScreen, setIsModalFullScreen] = (0, import_element.useState)(false);
|
|
90
83
|
const id = `editor-${clientId}`;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
84
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
85
|
+
import_components.Modal,
|
|
86
|
+
{
|
|
87
|
+
title: (0, import_i18n.__)("Classic Editor"),
|
|
88
|
+
onRequestClose: onClose,
|
|
89
|
+
shouldCloseOnClickOutside: false,
|
|
90
|
+
overlayClassName: "block-editor-freeform-modal",
|
|
91
|
+
isFullScreen: isModalFullScreen,
|
|
92
|
+
className: "block-editor-freeform-modal__content",
|
|
93
|
+
headerActions: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
+
ModalAuxiliaryActions,
|
|
95
|
+
{
|
|
96
|
+
onClick: () => setIsModalFullScreen(!isModalFullScreen),
|
|
97
|
+
isModalFullScreen
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClassicEdit, { id, defaultValue: content }),
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
103
|
+
import_components.Flex,
|
|
106
104
|
{
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
className: "block-editor-freeform-modal__actions",
|
|
106
|
+
justify: "flex-end",
|
|
107
|
+
expanded: false,
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
110
|
+
import_components.Button,
|
|
111
|
+
{
|
|
112
|
+
__next40pxDefaultSize: true,
|
|
113
|
+
variant: "tertiary",
|
|
114
|
+
onClick: onClose,
|
|
115
|
+
children: (0, import_i18n.__)("Cancel")
|
|
116
|
+
}
|
|
117
|
+
) }),
|
|
118
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
119
|
+
import_components.Button,
|
|
120
|
+
{
|
|
121
|
+
__next40pxDefaultSize: true,
|
|
122
|
+
variant: "primary",
|
|
123
|
+
onClick: () => {
|
|
124
|
+
onChange(window.wp.oldEditor.getContent(id));
|
|
125
|
+
onClose();
|
|
126
|
+
},
|
|
127
|
+
children: (0, import_i18n.__)("Save")
|
|
128
|
+
}
|
|
129
|
+
) })
|
|
130
|
+
]
|
|
109
131
|
}
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
import_components.Flex,
|
|
115
|
-
{
|
|
116
|
-
className: "block-editor-freeform-modal__actions",
|
|
117
|
-
justify: "flex-end",
|
|
118
|
-
expanded: false,
|
|
119
|
-
children: [
|
|
120
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
121
|
-
import_components.Button,
|
|
122
|
-
{
|
|
123
|
-
__next40pxDefaultSize: true,
|
|
124
|
-
variant: "tertiary",
|
|
125
|
-
onClick: onClose,
|
|
126
|
-
children: (0, import_i18n.__)("Cancel")
|
|
127
|
-
}
|
|
128
|
-
) }),
|
|
129
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
|
-
import_components.Button,
|
|
131
|
-
{
|
|
132
|
-
__next40pxDefaultSize: true,
|
|
133
|
-
variant: "primary",
|
|
134
|
-
onClick: () => {
|
|
135
|
-
setAttributes({
|
|
136
|
-
content: window.wp.oldEditor.getContent(
|
|
137
|
-
id
|
|
138
|
-
)
|
|
139
|
-
});
|
|
140
|
-
setOpen(false);
|
|
141
|
-
},
|
|
142
|
-
children: (0, import_i18n.__)("Save")
|
|
143
|
-
}
|
|
144
|
-
) })
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
)
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
)
|
|
151
|
-
] });
|
|
132
|
+
)
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
);
|
|
152
136
|
}
|
|
153
137
|
//# sourceMappingURL=modal.cjs.map
|