@wordpress/editor 12.5.7 → 12.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/post-featured-image/index.js +84 -41
  3. package/build/components/post-featured-image/index.js.map +1 -1
  4. package/build/components/post-text-editor/index.js +6 -6
  5. package/build/components/post-text-editor/index.js.map +1 -1
  6. package/build/components/post-title/index.js +13 -2
  7. package/build/components/post-title/index.js.map +1 -1
  8. package/build/components/post-visibility/index.js +132 -167
  9. package/build/components/post-visibility/index.js.map +1 -1
  10. package/build/components/post-visibility/label.js +5 -22
  11. package/build/components/post-visibility/label.js.map +1 -1
  12. package/build/components/post-visibility/utils.js +14 -13
  13. package/build/components/post-visibility/utils.js.map +1 -1
  14. package/build/components/provider/index.native.js +3 -1
  15. package/build/components/provider/index.native.js.map +1 -1
  16. package/build-module/components/post-featured-image/index.js +86 -42
  17. package/build-module/components/post-featured-image/index.js.map +1 -1
  18. package/build-module/components/post-text-editor/index.js +6 -6
  19. package/build-module/components/post-text-editor/index.js.map +1 -1
  20. package/build-module/components/post-title/index.js +12 -2
  21. package/build-module/components/post-title/index.js.map +1 -1
  22. package/build-module/components/post-visibility/index.js +132 -166
  23. package/build-module/components/post-visibility/index.js.map +1 -1
  24. package/build-module/components/post-visibility/label.js +5 -20
  25. package/build-module/components/post-visibility/label.js.map +1 -1
  26. package/build-module/components/post-visibility/utils.js +14 -13
  27. package/build-module/components/post-visibility/utils.js.map +1 -1
  28. package/build-module/components/provider/index.native.js +2 -1
  29. package/build-module/components/provider/index.native.js.map +1 -1
  30. package/build-style/style-rtl.css +51 -52
  31. package/build-style/style.css +51 -52
  32. package/package.json +28 -27
  33. package/src/components/autosave-monitor/test/index.js +3 -0
  34. package/src/components/editor-help/test/index.native.js +1 -1
  35. package/src/components/post-featured-image/index.js +102 -69
  36. package/src/components/post-saved-state/style.scss +9 -0
  37. package/src/components/post-slug/test/index.js +4 -4
  38. package/src/components/post-text-editor/index.js +5 -6
  39. package/src/components/post-title/index.js +16 -2
  40. package/src/components/post-visibility/index.js +130 -150
  41. package/src/components/post-visibility/label.js +6 -15
  42. package/src/components/post-visibility/style.scss +25 -20
  43. package/src/components/post-visibility/utils.js +7 -12
  44. package/src/components/provider/index.native.js +2 -1
  45. package/src/components/table-of-contents/style.scss +1 -3
  46. package/src/store/test/selectors.js +2 -2
@@ -5,11 +5,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = exports.PostVisibility = void 0;
8
+ exports.default = PostVisibility;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
14
  var _i18n = require("@wordpress/i18n");
15
15
 
@@ -19,6 +19,8 @@ var _compose = require("@wordpress/compose");
19
19
 
20
20
  var _data = require("@wordpress/data");
21
21
 
22
+ var _icons = require("@wordpress/icons");
23
+
22
24
  var _utils = require("./utils");
23
25
 
24
26
  var _store = require("../../store");
@@ -30,178 +32,141 @@ var _store = require("../../store");
30
32
  /**
31
33
  * Internal dependencies
32
34
  */
33
- class PostVisibility extends _element.Component {
34
- constructor(props) {
35
- super(...arguments);
36
- (0, _defineProperty2.default)(this, "confirmPrivate", () => {
37
- const {
38
- onUpdateVisibility,
39
- onSave
40
- } = this.props;
41
- onUpdateVisibility('private');
42
- this.setState({
43
- hasPassword: false,
44
- showPrivateConfirmDialog: false
45
- });
46
- onSave();
47
- });
48
- (0, _defineProperty2.default)(this, "handleDialogCancel", () => {
49
- this.setState({
50
- showPrivateConfirmDialog: false
51
- });
52
- });
53
- this.setPublic = this.setPublic.bind(this);
54
- this.setPrivate = this.setPrivate.bind(this);
55
- this.setPasswordProtected = this.setPasswordProtected.bind(this);
56
- this.updatePassword = this.updatePassword.bind(this);
57
- this.state = {
58
- hasPassword: !!props.password,
59
- showPrivateConfirmDialog: false
60
- };
61
- }
62
-
63
- setPublic() {
64
- const {
65
- visibility,
66
- onUpdateVisibility,
67
- status
68
- } = this.props;
69
- onUpdateVisibility(visibility === 'private' ? 'draft' : status);
70
- this.setState({
71
- hasPassword: false
35
+ function PostVisibility(_ref) {
36
+ let {
37
+ onClose
38
+ } = _ref;
39
+ const instanceId = (0, _compose.useInstanceId)(PostVisibility);
40
+ const {
41
+ status,
42
+ visibility,
43
+ password
44
+ } = (0, _data.useSelect)(select => ({
45
+ status: select(_store.store).getEditedPostAttribute('status'),
46
+ visibility: select(_store.store).getEditedPostVisibility(),
47
+ password: select(_store.store).getEditedPostAttribute('password')
48
+ }));
49
+ const {
50
+ editPost,
51
+ savePost
52
+ } = (0, _data.useDispatch)(_store.store);
53
+ const [hasPassword, setHasPassword] = (0, _element.useState)(!!password);
54
+ const [showPrivateConfirmDialog, setShowPrivateConfirmDialog] = (0, _element.useState)(false);
55
+
56
+ const setPublic = () => {
57
+ editPost({
58
+ status: visibility === 'private' ? 'draft' : status,
59
+ password: ''
72
60
  });
73
- }
61
+ setHasPassword(false);
62
+ };
74
63
 
75
- setPrivate() {
76
- this.setState({
77
- showPrivateConfirmDialog: true
78
- });
79
- }
80
-
81
- setPasswordProtected() {
82
- const {
83
- visibility,
84
- onUpdateVisibility,
85
- status,
86
- password
87
- } = this.props;
88
- onUpdateVisibility(visibility === 'private' ? 'draft' : status, password || '');
89
- this.setState({
90
- hasPassword: true
91
- });
92
- }
93
-
94
- updatePassword(event) {
95
- const {
96
- status,
97
- onUpdateVisibility
98
- } = this.props;
99
- onUpdateVisibility(status, event.target.value);
100
- }
101
-
102
- render() {
103
- const {
104
- visibility,
105
- password,
106
- instanceId
107
- } = this.props;
108
- const visibilityHandlers = {
109
- public: {
110
- onSelect: this.setPublic,
111
- checked: visibility === 'public' && !this.state.hasPassword
112
- },
113
- private: {
114
- onSelect: this.setPrivate,
115
- checked: visibility === 'private'
116
- },
117
- password: {
118
- onSelect: this.setPasswordProtected,
119
- checked: this.state.hasPassword
120
- }
121
- };
122
- return [(0, _element.createElement)("fieldset", {
123
- key: "visibility-selector",
124
- className: "editor-post-visibility__dialog-fieldset"
125
- }, (0, _element.createElement)("legend", {
126
- className: "editor-post-visibility__dialog-legend"
127
- }, (0, _i18n.__)('Post Visibility')), _utils.visibilityOptions.map(_ref => {
128
- let {
129
- value,
130
- label,
131
- info
132
- } = _ref;
133
- return (0, _element.createElement)("div", {
134
- key: value,
135
- className: "editor-post-visibility__choice"
136
- }, (0, _element.createElement)("input", {
137
- type: "radio",
138
- name: `editor-post-visibility__setting-${instanceId}`,
139
- value: value,
140
- onChange: visibilityHandlers[value].onSelect,
141
- checked: visibilityHandlers[value].checked,
142
- id: `editor-post-${value}-${instanceId}`,
143
- "aria-describedby": `editor-post-${value}-${instanceId}-description`,
144
- className: "editor-post-visibility__dialog-radio"
145
- }), (0, _element.createElement)("label", {
146
- htmlFor: `editor-post-${value}-${instanceId}`,
147
- className: "editor-post-visibility__dialog-label"
148
- }, label), (0, _element.createElement)("p", {
149
- id: `editor-post-${value}-${instanceId}-description`,
150
- className: "editor-post-visibility__dialog-info"
151
- }, info));
152
- })), this.state.hasPassword && (0, _element.createElement)("div", {
153
- className: "editor-post-visibility__dialog-password",
154
- key: "password-selector"
155
- }, (0, _element.createElement)(_components.VisuallyHidden, {
156
- as: "label",
157
- htmlFor: `editor-post-visibility__dialog-password-input-${instanceId}`
158
- }, (0, _i18n.__)('Create password')), (0, _element.createElement)("input", {
159
- className: "editor-post-visibility__dialog-password-input",
160
- id: `editor-post-visibility__dialog-password-input-${instanceId}`,
161
- type: "text",
162
- onChange: this.updatePassword,
163
- value: password,
164
- placeholder: (0, _i18n.__)('Use a secure password')
165
- })), (0, _element.createElement)(_components.__experimentalConfirmDialog, {
166
- key: "private-publish-confirmation",
167
- isOpen: this.state.showPrivateConfirmDialog,
168
- onConfirm: this.confirmPrivate,
169
- onCancel: this.handleDialogCancel
170
- }, (0, _i18n.__)('Would you like to privately publish this post now?'))];
171
- }
64
+ const setPrivate = () => {
65
+ setShowPrivateConfirmDialog(true);
66
+ };
172
67
 
173
- }
68
+ const confirmPrivate = () => {
69
+ editPost({
70
+ status: 'private',
71
+ password: ''
72
+ });
73
+ setHasPassword(false);
74
+ setShowPrivateConfirmDialog(false);
75
+ savePost();
76
+ };
174
77
 
175
- exports.PostVisibility = PostVisibility;
78
+ const handleDialogCancel = () => {
79
+ setShowPrivateConfirmDialog(false);
80
+ };
176
81
 
177
- var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
178
- const {
179
- getEditedPostAttribute,
180
- getEditedPostVisibility
181
- } = select(_store.store);
182
- return {
183
- status: getEditedPostAttribute('status'),
184
- visibility: getEditedPostVisibility(),
185
- password: getEditedPostAttribute('password')
82
+ const setPasswordProtected = () => {
83
+ editPost({
84
+ status: visibility === 'private' ? 'draft' : status,
85
+ password: password || ''
86
+ });
87
+ setHasPassword(true);
186
88
  };
187
- }), (0, _data.withDispatch)(dispatch => {
188
- const {
189
- savePost,
190
- editPost
191
- } = dispatch(_store.store);
192
- return {
193
- onSave: savePost,
194
-
195
- onUpdateVisibility(status) {
196
- let password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
197
- editPost({
198
- status,
199
- password
200
- });
201
- }
202
89
 
90
+ const updatePassword = event => {
91
+ editPost({
92
+ password: event.target.value
93
+ });
203
94
  };
204
- }), _compose.withInstanceId])(PostVisibility);
205
95
 
206
- exports.default = _default;
96
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.Button, {
97
+ className: "editor-post-visibility__close",
98
+ isSmall: true,
99
+ icon: _icons.close,
100
+ onClick: onClose
101
+ }), (0, _element.createElement)("fieldset", {
102
+ className: "editor-post-visibility__fieldset"
103
+ }, (0, _element.createElement)("legend", {
104
+ className: "editor-post-visibility__legend"
105
+ }, (0, _i18n.__)('Visibility')), (0, _element.createElement)("p", {
106
+ className: "editor-post-visibility__description"
107
+ }, (0, _i18n.__)('Control how this post is viewed.')), (0, _element.createElement)(PostVisibilityChoice, {
108
+ instanceId: instanceId,
109
+ value: "public",
110
+ label: _utils.visibilityOptions.public.label,
111
+ info: _utils.visibilityOptions.public.info,
112
+ checked: visibility === 'public' && !hasPassword,
113
+ onChange: setPublic
114
+ }), (0, _element.createElement)(PostVisibilityChoice, {
115
+ instanceId: instanceId,
116
+ value: "private",
117
+ label: _utils.visibilityOptions.private.label,
118
+ info: _utils.visibilityOptions.private.info,
119
+ checked: visibility === 'private',
120
+ onChange: setPrivate
121
+ }), (0, _element.createElement)(PostVisibilityChoice, {
122
+ instanceId: instanceId,
123
+ value: "password",
124
+ label: _utils.visibilityOptions.password.label,
125
+ info: _utils.visibilityOptions.password.info,
126
+ checked: hasPassword,
127
+ onChange: setPasswordProtected
128
+ }), hasPassword && (0, _element.createElement)("div", {
129
+ className: "editor-post-visibility__password"
130
+ }, (0, _element.createElement)(_components.VisuallyHidden, {
131
+ as: "label",
132
+ htmlFor: `editor-post-visibility__password-input-${instanceId}`
133
+ }, (0, _i18n.__)('Create password')), (0, _element.createElement)("input", {
134
+ className: "editor-post-visibility__password-input",
135
+ id: `editor-post-visibility__password-input-${instanceId}`,
136
+ type: "text",
137
+ onChange: updatePassword,
138
+ value: password,
139
+ placeholder: (0, _i18n.__)('Use a secure password')
140
+ }))), (0, _element.createElement)(_components.__experimentalConfirmDialog, {
141
+ isOpen: showPrivateConfirmDialog,
142
+ onConfirm: confirmPrivate,
143
+ onCancel: handleDialogCancel
144
+ }, (0, _i18n.__)('Would you like to privately publish this post now?')));
145
+ }
146
+
147
+ function PostVisibilityChoice(_ref2) {
148
+ let {
149
+ instanceId,
150
+ value,
151
+ label,
152
+ info,
153
+ ...props
154
+ } = _ref2;
155
+ return (0, _element.createElement)("div", {
156
+ className: "editor-post-visibility__choice"
157
+ }, (0, _element.createElement)("input", (0, _extends2.default)({
158
+ type: "radio",
159
+ name: `editor-post-visibility__setting-${instanceId}`,
160
+ value: value,
161
+ id: `editor-post-${value}-${instanceId}`,
162
+ "aria-describedby": `editor-post-${value}-${instanceId}-description`,
163
+ className: "editor-post-visibility__radio"
164
+ }, props)), (0, _element.createElement)("label", {
165
+ htmlFor: `editor-post-${value}-${instanceId}`,
166
+ className: "editor-post-visibility__label"
167
+ }, label), (0, _element.createElement)("p", {
168
+ id: `editor-post-${value}-${instanceId}-description`,
169
+ className: "editor-post-visibility__info"
170
+ }, info));
171
+ }
207
172
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-visibility/index.js"],"names":["PostVisibility","Component","constructor","props","arguments","onUpdateVisibility","onSave","setState","hasPassword","showPrivateConfirmDialog","setPublic","bind","setPrivate","setPasswordProtected","updatePassword","state","password","visibility","status","event","target","value","render","instanceId","visibilityHandlers","public","onSelect","checked","private","visibilityOptions","map","label","info","confirmPrivate","handleDialogCancel","select","getEditedPostAttribute","getEditedPostVisibility","editorStore","dispatch","savePost","editPost","withInstanceId"],"mappings":";;;;;;;;;AAIA;;;;AADA;;AAEA;;AAIA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIO,MAAMA,cAAN,SAA6BC,kBAA7B,CAAuC;AAC7CC,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAO,GAAGC,SAAV;AADoB,0DAyBJ,MAAM;AACtB,YAAM;AAAEC,QAAAA,kBAAF;AAAsBC,QAAAA;AAAtB,UAAiC,KAAKH,KAA5C;AAEAE,MAAAA,kBAAkB,CAAE,SAAF,CAAlB;AACA,WAAKE,QAAL,CAAe;AACdC,QAAAA,WAAW,EAAE,KADC;AAEdC,QAAAA,wBAAwB,EAAE;AAFZ,OAAf;AAIAH,MAAAA,MAAM;AACN,KAlCoB;AAAA,8DAoCA,MAAM;AAC1B,WAAKC,QAAL,CAAe;AAAEE,QAAAA,wBAA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IAAAA,sBAAF;AAA0BC,IAAAA;AAA1B,MAAsDF,MAAM,CACjEG,YADiE,CAAlE;AAGA,SAAO;AACNpB,IAAAA,MAAM,EAAEkB,sBAAsB,CAAE,QAAF,CADxB;AAENnB,IAAAA,UAAU,EAAEoB,uBAAuB,EAF7B;AAGNrB,IAAAA,QAAQ,EAAEoB,sBAAsB,CAAE,UAAF;AAH1B,GAAP;AAKA,CATD,CADuB,EAWvB,wBAAgBG,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAED,YAAF,CAAvC;AACA,SAAO;AACNhC,IAAAA,MAAM,EAAEkC,QADF;;AAENnC,IAAAA,kBAAkB,CAAEa,MAAF,EAA0B;AAAA,UAAhBF,QAAgB,uEAAL,EAAK;AAC3CyB,MAAAA,QAAQ,CAAE;AAAEvB,QAAAA,MAAF;AAAUF,QAAAA;AAAV,OAAF,CAAR;AACA;;AAJK,GAAP;AAMA,CARD,CAXuB,EAoBvB0B,uBApBuB,CAAT,EAqBV1C,cArBU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component } from '@wordpress/element';\nimport {\n\tVisuallyHidden,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { visibilityOptions } from './utils';\nimport { store as editorStore } from '../../store';\n\nexport class PostVisibility extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.setPublic = this.setPublic.bind( this );\n\t\tthis.setPrivate = this.setPrivate.bind( this );\n\t\tthis.setPasswordProtected = this.setPasswordProtected.bind( this );\n\t\tthis.updatePassword = this.updatePassword.bind( this );\n\n\t\tthis.state = {\n\t\t\thasPassword: !! props.password,\n\t\t\tshowPrivateConfirmDialog: false,\n\t\t};\n\t}\n\n\tsetPublic() {\n\t\tconst { visibility, onUpdateVisibility, status } = this.props;\n\n\t\tonUpdateVisibility( visibility === 'private' ? 'draft' : status );\n\t\tthis.setState( { hasPassword: false } );\n\t}\n\n\tsetPrivate() {\n\t\tthis.setState( { showPrivateConfirmDialog: true } );\n\t}\n\n\tconfirmPrivate = () => {\n\t\tconst { onUpdateVisibility, onSave } = this.props;\n\n\t\tonUpdateVisibility( 'private' );\n\t\tthis.setState( {\n\t\t\thasPassword: false,\n\t\t\tshowPrivateConfirmDialog: false,\n\t\t} );\n\t\tonSave();\n\t};\n\n\thandleDialogCancel = () => {\n\t\tthis.setState( { showPrivateConfirmDialog: false } );\n\t};\n\n\tsetPasswordProtected() {\n\t\tconst { visibility, onUpdateVisibility, status, password } = this.props;\n\n\t\tonUpdateVisibility(\n\t\t\tvisibility === 'private' ? 'draft' : status,\n\t\t\tpassword || ''\n\t\t);\n\t\tthis.setState( { hasPassword: true } );\n\t}\n\n\tupdatePassword( event ) {\n\t\tconst { status, onUpdateVisibility } = this.props;\n\t\tonUpdateVisibility( status, event.target.value );\n\t}\n\n\trender() {\n\t\tconst { visibility, password, instanceId } = this.props;\n\n\t\tconst visibilityHandlers = {\n\t\t\tpublic: {\n\t\t\t\tonSelect: this.setPublic,\n\t\t\t\tchecked: visibility === 'public' && ! this.state.hasPassword,\n\t\t\t},\n\t\t\tprivate: {\n\t\t\t\tonSelect: this.setPrivate,\n\t\t\t\tchecked: visibility === 'private',\n\t\t\t},\n\t\t\tpassword: {\n\t\t\t\tonSelect: this.setPasswordProtected,\n\t\t\t\tchecked: this.state.hasPassword,\n\t\t\t},\n\t\t};\n\n\t\treturn [\n\t\t\t<fieldset\n\t\t\t\tkey=\"visibility-selector\"\n\t\t\t\tclassName=\"editor-post-visibility__dialog-fieldset\"\n\t\t\t>\n\t\t\t\t<legend className=\"editor-post-visibility__dialog-legend\">\n\t\t\t\t\t{ __( 'Post Visibility' ) }\n\t\t\t\t</legend>\n\t\t\t\t{ visibilityOptions.map( ( { value, label, info } ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\tclassName=\"editor-post-visibility__choice\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\tname={ `editor-post-visibility__setting-${ instanceId }` }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tonChange={ visibilityHandlers[ value ].onSelect }\n\t\t\t\t\t\t\tchecked={ visibilityHandlers[ value ].checked }\n\t\t\t\t\t\t\tid={ `editor-post-${ value }-${ instanceId }` }\n\t\t\t\t\t\t\taria-describedby={ `editor-post-${ value }-${ instanceId }-description` }\n\t\t\t\t\t\t\tclassName=\"editor-post-visibility__dialog-radio\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<label\n\t\t\t\t\t\t\thtmlFor={ `editor-post-${ value }-${ instanceId }` }\n\t\t\t\t\t\t\tclassName=\"editor-post-visibility__dialog-label\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tid={ `editor-post-${ value }-${ instanceId }-description` }\n\t\t\t\t\t\t\t\tclassName=\"editor-post-visibility__dialog-info\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ info }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t}\n\t\t\t\t\t</div>\n\t\t\t\t) ) }\n\t\t\t</fieldset>,\n\t\t\tthis.state.hasPassword && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"editor-post-visibility__dialog-password\"\n\t\t\t\t\tkey=\"password-selector\"\n\t\t\t\t>\n\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\tas=\"label\"\n\t\t\t\t\t\thtmlFor={ `editor-post-visibility__dialog-password-input-${ instanceId }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Create password' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t<input\n\t\t\t\t\t\tclassName=\"editor-post-visibility__dialog-password-input\"\n\t\t\t\t\t\tid={ `editor-post-visibility__dialog-password-input-${ instanceId }` }\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tonChange={ this.updatePassword }\n\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\tplaceholder={ __( 'Use a secure password' ) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t),\n\t\t\t<ConfirmDialog\n\t\t\t\tkey=\"private-publish-confirmation\"\n\t\t\t\tisOpen={ this.state.showPrivateConfirmDialog }\n\t\t\t\tonConfirm={ this.confirmPrivate }\n\t\t\t\tonCancel={ this.handleDialogCancel }\n\t\t\t>\n\t\t\t\t{ __( 'Would you like to privately publish this post now?' ) }\n\t\t\t</ConfirmDialog>,\n\t\t];\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getEditedPostVisibility } = select(\n\t\t\teditorStore\n\t\t);\n\t\treturn {\n\t\t\tstatus: getEditedPostAttribute( 'status' ),\n\t\t\tvisibility: getEditedPostVisibility(),\n\t\t\tpassword: getEditedPostAttribute( 'password' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { savePost, editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonSave: savePost,\n\t\t\tonUpdateVisibility( status, password = '' ) {\n\t\t\t\teditPost( { status, password } );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n] )( PostVisibility );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-visibility/index.js"],"names":["PostVisibility","onClose","instanceId","status","visibility","password","select","editorStore","getEditedPostAttribute","getEditedPostVisibility","editPost","savePost","hasPassword","setHasPassword","showPrivateConfirmDialog","setShowPrivateConfirmDialog","setPublic","setPrivate","confirmPrivate","handleDialogCancel","setPasswordProtected","updatePassword","event","target","value","close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SAASY,oBAAT,QAA8E;AAAA,MAA/C;AAAE7B,IAAAA,UAAF;AAAcsB,IAAAA,KAAd;AAAqBI,IAAAA,KAArB;AAA4BC,IAAAA,IAA5B;AAAkC,OAAGG;AAArC,GAA+C;AAC7E,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AACC,IAAA,IAAI,EAAC,OADN;AAEC,IAAA,IAAI,EAAI,mCAAmC9B,UAAY,EAFxD;AAGC,IAAA,KAAK,EAAGsB,KAHT;AAIC,IAAA,EAAE,EAAI,eAAeA,KAAO,IAAItB,UAAY,EAJ7C;AAKC,wBAAoB,eAAesB,KAAO,IAAItB,UAAY,cAL3D;AAMC,IAAA,SAAS,EAAC;AANX,KAOM8B,KAPN,EADD,EAUC;AACC,IAAA,OAAO,EAAI,eAAeR,KAAO,IAAItB,UAAY,EADlD;AAEC,IAAA,SAAS,EAAC;AAFX,KAIG0B,KAJH,CAVD,EAgBC;AACC,IAAA,EAAE,EAAI,eAAeJ,KAAO,IAAItB,UAAY,cAD7C;AAEC,IAAA,SAAS,EAAC;AAFX,KAIG2B,IAJH,CAhBD,CADD;AAyBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport {\n\tVisuallyHidden,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tButton,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { close as closeIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { visibilityOptions } from './utils';\nimport { store as editorStore } from '../../store';\n\nexport default function PostVisibility( { onClose } ) {\n\tconst instanceId = useInstanceId( PostVisibility );\n\n\tconst { status, visibility, password } = useSelect( ( select ) => ( {\n\t\tstatus: select( editorStore ).getEditedPostAttribute( 'status' ),\n\t\tvisibility: select( editorStore ).getEditedPostVisibility(),\n\t\tpassword: select( editorStore ).getEditedPostAttribute( 'password' ),\n\t} ) );\n\n\tconst { editPost, savePost } = useDispatch( editorStore );\n\n\tconst [ hasPassword, setHasPassword ] = useState( !! password );\n\tconst [ showPrivateConfirmDialog, setShowPrivateConfirmDialog ] = useState(\n\t\tfalse\n\t);\n\n\tconst setPublic = () => {\n\t\teditPost( {\n\t\t\tstatus: visibility === 'private' ? 'draft' : status,\n\t\t\tpassword: '',\n\t\t} );\n\t\tsetHasPassword( false );\n\t};\n\n\tconst setPrivate = () => {\n\t\tsetShowPrivateConfirmDialog( true );\n\t};\n\n\tconst confirmPrivate = () => {\n\t\teditPost( { status: 'private', password: '' } );\n\t\tsetHasPassword( false );\n\t\tsetShowPrivateConfirmDialog( false );\n\t\tsavePost();\n\t};\n\n\tconst handleDialogCancel = () => {\n\t\tsetShowPrivateConfirmDialog( false );\n\t};\n\n\tconst setPasswordProtected = () => {\n\t\teditPost( {\n\t\t\tstatus: visibility === 'private' ? 'draft' : status,\n\t\t\tpassword: password || '',\n\t\t} );\n\t\tsetHasPassword( true );\n\t};\n\n\tconst updatePassword = ( event ) => {\n\t\teditPost( { password: event.target.value } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-visibility__close\"\n\t\t\t\tisSmall\n\t\t\t\ticon={ closeIcon }\n\t\t\t\tonClick={ onClose }\n\t\t\t/>\n\t\t\t<fieldset className=\"editor-post-visibility__fieldset\">\n\t\t\t\t<legend className=\"editor-post-visibility__legend\">\n\t\t\t\t\t{ __( 'Visibility' ) }\n\t\t\t\t</legend>\n\t\t\t\t<p className=\"editor-post-visibility__description\">\n\t\t\t\t\t{ __( 'Control how this post is viewed.' ) }\n\t\t\t\t</p>\n\t\t\t\t<PostVisibilityChoice\n\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\tvalue=\"public\"\n\t\t\t\t\tlabel={ visibilityOptions.public.label }\n\t\t\t\t\tinfo={ visibilityOptions.public.info }\n\t\t\t\t\tchecked={ visibility === 'public' && ! hasPassword }\n\t\t\t\t\tonChange={ setPublic }\n\t\t\t\t/>\n\t\t\t\t<PostVisibilityChoice\n\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\tvalue=\"private\"\n\t\t\t\t\tlabel={ visibilityOptions.private.label }\n\t\t\t\t\tinfo={ visibilityOptions.private.info }\n\t\t\t\t\tchecked={ visibility === 'private' }\n\t\t\t\t\tonChange={ setPrivate }\n\t\t\t\t/>\n\t\t\t\t<PostVisibilityChoice\n\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\tvalue=\"password\"\n\t\t\t\t\tlabel={ visibilityOptions.password.label }\n\t\t\t\t\tinfo={ visibilityOptions.password.info }\n\t\t\t\t\tchecked={ hasPassword }\n\t\t\t\t\tonChange={ setPasswordProtected }\n\t\t\t\t/>\n\t\t\t\t{ hasPassword && (\n\t\t\t\t\t<div className=\"editor-post-visibility__password\">\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"label\"\n\t\t\t\t\t\t\thtmlFor={ `editor-post-visibility__password-input-${ instanceId }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create password' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tclassName=\"editor-post-visibility__password-input\"\n\t\t\t\t\t\t\tid={ `editor-post-visibility__password-input-${ instanceId }` }\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tonChange={ updatePassword }\n\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\tplaceholder={ __( 'Use a secure password' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</fieldset>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showPrivateConfirmDialog }\n\t\t\t\tonConfirm={ confirmPrivate }\n\t\t\t\tonCancel={ handleDialogCancel }\n\t\t\t>\n\t\t\t\t{ __( 'Would you like to privately publish this post now?' ) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nfunction PostVisibilityChoice( { instanceId, value, label, info, ...props } ) {\n\treturn (\n\t\t<div className=\"editor-post-visibility__choice\">\n\t\t\t<input\n\t\t\t\ttype=\"radio\"\n\t\t\t\tname={ `editor-post-visibility__setting-${ instanceId }` }\n\t\t\t\tvalue={ value }\n\t\t\t\tid={ `editor-post-${ value }-${ instanceId }` }\n\t\t\t\taria-describedby={ `editor-post-${ value }-${ instanceId }-description` }\n\t\t\t\tclassName=\"editor-post-visibility__radio\"\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t\t<label\n\t\t\t\thtmlFor={ `editor-post-${ value }-${ instanceId }` }\n\t\t\t\tclassName=\"editor-post-visibility__label\"\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</label>\n\t\t\t<p\n\t\t\t\tid={ `editor-post-${ value }-${ instanceId }-description` }\n\t\t\t\tclassName=\"editor-post-visibility__info\"\n\t\t\t>\n\t\t\t\t{ info }\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"]}
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
7
-
8
- var _lodash = require("lodash");
6
+ exports.default = PostVisibilityLabel;
9
7
 
10
8
  var _data = require("@wordpress/data");
11
9
 
@@ -13,10 +11,6 @@ var _utils = require("./utils");
13
11
 
14
12
  var _store = require("../../store");
15
13
 
16
- /**
17
- * External dependencies
18
- */
19
-
20
14
  /**
21
15
  * WordPress dependencies
22
16
  */
@@ -24,21 +18,10 @@ var _store = require("../../store");
24
18
  /**
25
19
  * Internal dependencies
26
20
  */
27
- function PostVisibilityLabel(_ref) {
28
- let {
29
- visibility
30
- } = _ref;
21
+ function PostVisibilityLabel() {
22
+ var _visibilityOptions$vi;
31
23
 
32
- const getVisibilityLabel = () => (0, _lodash.find)(_utils.visibilityOptions, {
33
- value: visibility
34
- }).label;
35
-
36
- return getVisibilityLabel(visibility);
24
+ const visibility = (0, _data.useSelect)(select => select(_store.store).getEditedPostVisibility());
25
+ return (_visibilityOptions$vi = _utils.visibilityOptions[visibility]) === null || _visibilityOptions$vi === void 0 ? void 0 : _visibilityOptions$vi.label;
37
26
  }
38
-
39
- var _default = (0, _data.withSelect)(select => ({
40
- visibility: select(_store.store).getEditedPostVisibility()
41
- }))(PostVisibilityLabel);
42
-
43
- exports.default = _default;
44
27
  //# sourceMappingURL=label.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-visibility/label.js"],"names":["PostVisibilityLabel","visibility","getVisibilityLabel","visibilityOptions","value","label","select","editorStore","getEditedPostVisibility"],"mappings":";;;;;;;AAGA;;AAKA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,mBAAT,OAA+C;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;;AAC9C,QAAMC,kBAAkB,GAAG,MAC1B,kBAAMC,wBAAN,EAAyB;AAAEC,IAAAA,KAAK,EAAEH;AAAT,GAAzB,EAAiDI,KADlD;;AAGA,SAAOH,kBAAkB,CAAED,UAAF,CAAzB;AACA;;eAEc,sBAAcK,MAAF,KAAgB;AAC1CL,EAAAA,UAAU,EAAEK,MAAM,CAAEC,YAAF,CAAN,CAAsBC,uBAAtB;AAD8B,CAAhB,CAAZ,EAERR,mBAFQ,C","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { visibilityOptions } from './utils';\nimport { store as editorStore } from '../../store';\n\nfunction PostVisibilityLabel( { visibility } ) {\n\tconst getVisibilityLabel = () =>\n\t\tfind( visibilityOptions, { value: visibility } ).label;\n\n\treturn getVisibilityLabel( visibility );\n}\n\nexport default withSelect( ( select ) => ( {\n\tvisibility: select( editorStore ).getEditedPostVisibility(),\n} ) )( PostVisibilityLabel );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-visibility/label.js"],"names":["PostVisibilityLabel","visibility","select","editorStore","getEditedPostVisibility","visibilityOptions","label"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,mBAAT,GAA+B;AAAA;;AAC7C,QAAMC,UAAU,GAAG,qBAAaC,MAAF,IAC7BA,MAAM,CAAEC,YAAF,CAAN,CAAsBC,uBAAtB,EADkB,CAAnB;AAGA,kCAAOC,yBAAmBJ,UAAnB,CAAP,0DAAO,sBAAiCK,KAAxC;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { visibilityOptions } from './utils';\nimport { store as editorStore } from '../../store';\n\nexport default function PostVisibilityLabel() {\n\tconst visibility = useSelect( ( select ) =>\n\t\tselect( editorStore ).getEditedPostVisibility()\n\t);\n\treturn visibilityOptions[ visibility ]?.label;\n}\n"]}
@@ -10,18 +10,19 @@ var _i18n = require("@wordpress/i18n");
10
10
  /**
11
11
  * WordPress dependencies
12
12
  */
13
- const visibilityOptions = [{
14
- value: 'public',
15
- label: (0, _i18n.__)('Public'),
16
- info: (0, _i18n.__)('Visible to everyone.')
17
- }, {
18
- value: 'private',
19
- label: (0, _i18n.__)('Private'),
20
- info: (0, _i18n.__)('Only visible to site admins and editors.')
21
- }, {
22
- value: 'password',
23
- label: (0, _i18n.__)('Password Protected'),
24
- info: (0, _i18n.__)('Protected with a password you choose. Only those with the password can view this post.')
25
- }];
13
+ const visibilityOptions = {
14
+ public: {
15
+ label: (0, _i18n.__)('Public'),
16
+ info: (0, _i18n.__)('Visible to everyone.')
17
+ },
18
+ private: {
19
+ label: (0, _i18n.__)('Private'),
20
+ info: (0, _i18n.__)('Only visible to site admins and editors.')
21
+ },
22
+ password: {
23
+ label: (0, _i18n.__)('Password protected'),
24
+ info: (0, _i18n.__)('Only those with the password can view this post.')
25
+ }
26
+ };
26
27
  exports.visibilityOptions = visibilityOptions;
27
28
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-visibility/utils.js"],"names":["visibilityOptions","value","label","info"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,iBAAiB,GAAG,CAChC;AACCC,EAAAA,KAAK,EAAE,QADR;AAECC,EAAAA,KAAK,EAAE,cAAI,QAAJ,CAFR;AAGCC,EAAAA,IAAI,EAAE,cAAI,sBAAJ;AAHP,CADgC,EAMhC;AACCF,EAAAA,KAAK,EAAE,SADR;AAECC,EAAAA,KAAK,EAAE,cAAI,SAAJ,CAFR;AAGCC,EAAAA,IAAI,EAAE,cAAI,0CAAJ;AAHP,CANgC,EAWhC;AACCF,EAAAA,KAAK,EAAE,UADR;AAECC,EAAAA,KAAK,EAAE,cAAI,oBAAJ,CAFR;AAGCC,EAAAA,IAAI,EAAE,cACL,wFADK;AAHP,CAXgC,CAA1B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const visibilityOptions = [\n\t{\n\t\tvalue: 'public',\n\t\tlabel: __( 'Public' ),\n\t\tinfo: __( 'Visible to everyone.' ),\n\t},\n\t{\n\t\tvalue: 'private',\n\t\tlabel: __( 'Private' ),\n\t\tinfo: __( 'Only visible to site admins and editors.' ),\n\t},\n\t{\n\t\tvalue: 'password',\n\t\tlabel: __( 'Password Protected' ),\n\t\tinfo: __(\n\t\t\t'Protected with a password you choose. Only those with the password can view this post.'\n\t\t),\n\t},\n];\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-visibility/utils.js"],"names":["visibilityOptions","public","label","info","private","password"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,iBAAiB,GAAG;AAChCC,EAAAA,MAAM,EAAE;AACPC,IAAAA,KAAK,EAAE,cAAI,QAAJ,CADA;AAEPC,IAAAA,IAAI,EAAE,cAAI,sBAAJ;AAFC,GADwB;AAKhCC,EAAAA,OAAO,EAAE;AACRF,IAAAA,KAAK,EAAE,cAAI,SAAJ,CADC;AAERC,IAAAA,IAAI,EAAE,cAAI,0CAAJ;AAFE,GALuB;AAShCE,EAAAA,QAAQ,EAAE;AACTH,IAAAA,KAAK,EAAE,cAAI,oBAAJ,CADE;AAETC,IAAAA,IAAI,EAAE,cAAI,kDAAJ;AAFG;AATsB,CAA1B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const visibilityOptions = {\n\tpublic: {\n\t\tlabel: __( 'Public' ),\n\t\tinfo: __( 'Visible to everyone.' ),\n\t},\n\tprivate: {\n\t\tlabel: __( 'Private' ),\n\t\tinfo: __( 'Only visible to site admins and editors.' ),\n\t},\n\tpassword: {\n\t\tlabel: __( 'Password protected' ),\n\t\tinfo: __( 'Only those with the password can view this post.' ),\n\t},\n};\n"]}
@@ -13,6 +13,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
13
13
 
14
14
  var _memize = _interopRequireDefault(require("memize"));
15
15
 
16
+ var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
17
+
16
18
  var _reactNativeBridge = _interopRequireWildcard(require("@wordpress/react-native-bridge"));
17
19
 
18
20
  var _wordcount = require("@wordpress/wordcount");
@@ -315,7 +317,7 @@ class NativeEditorProvider extends _element.Component {
315
317
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_index.default, (0, _extends2.default)({
316
318
  post: this.post,
317
319
  settings: editorSettings
318
- }, props), children), (0, _element.createElement)(_editor.EditorHelpTopics, {
320
+ }, props), (0, _element.createElement)(_reactNativeSafeAreaContext.SafeAreaProvider, null, children)), (0, _element.createElement)(_editor.EditorHelpTopics, {
319
321
  isVisible: this.state.isHelpVisible,
320
322
  onClose: () => this.setState({
321
323
  isHelpVisible: false
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/provider/index.native.js"],"names":["postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","rawAttributes","NativeEditorProvider","Component","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","locale","updateSettings","getThemeColors","subscriptionParentGetHtml","serializeToNativeAction","subscriptionParentToggleHTMLMode","toggleMode","subscriptionParentSetTitle","payload","editTitle","title","subscriptionParentUpdateHtml","updateHtmlAction","html","subscriptionParentReplaceBlock","replaceBlockAction","clientId","subscriptionParentMediaAppend","blockName","mediaType","newBlock","id","mediaId","mediaUrl","indexAfterSelected","selectedBlockIndex","insertionIndex","blockCount","insertBlock","subscriptionParentUpdateEditorSettings","galleryWithImageBlocks","editorSettings","window","wp","galleryBlockV2Enabled","subscriptionParentUpdateCapabilities","updateCapabilitiesAction","subscriptionParentShowNotice","createSuccessNotice","message","subscriptionParentShowEditorHelp","setState","storedImpressions","impressions","NEW_BLOCK_TYPES","storedImpressionKeys","Object","keys","storedImpressionsCurrent","every","newKey","includes","componentWillUnmount","remove","rawStyles","rawFeatures","defaultEditorColors","defaultEditorGradients","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","unsupportedBlockNames","filter","block","attributes","originalName","RNReactNativeGutenbergBridge","editorDidMount","mode","hasChanges","raw","content","contentInfo","characterCount","wordCount","paragraphCount","provideToNative_Html","parsed","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","clearSelectedBlock","render","children","select","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","editorStore","getEditorMode","editPostStore","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","getSettings","getBlockEditorSettings","blockEditorStore","colors","gradients","selectedBlockClientId","dispatch","editPost","resetEditorBlocks","switchEditorMode","coreStore","noticesStore","__unstableShouldCreateUndoLevel"],"mappings":";;;;;;;;;AAsBA;;;;AAnBA;;AAKA;;AAeA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;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A,+BAA+B,EAAE;AADP,OAAV,CAAjB;AAGA,KAdK;;AAeN5B,IAAAA,UAAU,CAAEb,IAAF,EAAS;AAClBsC,MAAAA,gBAAgB,CAAEtC,IAAF,CAAhB;AACA,KAjBK;;AAkBNY,IAAAA;AAlBM,GAAP;AAoBA,CAhCD,CAnCuB,CAAT,EAoEVjG,oBApEU,C","sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport RNReactNativeGutenbergBridge, {\n\trequestBlockTypeImpressions,\n\tsetBlockTypeImpressions,\n\tsubscribeParentGetHtml,\n\tsubscribeParentToggleHTMLMode,\n\tsubscribeUpdateHtml,\n\tsubscribeSetTitle,\n\tsubscribeMediaAppend,\n\tsubscribeReplaceBlock,\n\tsubscribeUpdateEditorSettings,\n\tsubscribeUpdateCapabilities,\n\tsubscribeShowNotice,\n\tsubscribeShowEditorHelp,\n} from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport {\n\tparse,\n\tserialize,\n\tgetUnregisteredTypeHandlerName,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getGlobalStyles, getColorsAndGradients } from '@wordpress/components';\nimport { NEW_BLOCK_TYPES } from '@wordpress/block-library';\n\nconst postTypeEntities = [\n\t{ name: 'post', baseURL: '/wp/v2/posts' },\n\t{ name: 'page', baseURL: '/wp/v2/pages' },\n\t{ name: 'attachment', baseURL: '/wp/v2/media' },\n\t{ name: 'wp_block', baseURL: '/wp/v2/blocks' },\n].map( ( postTypeEntity ) => ( {\n\tkind: 'postType',\n\t...postTypeEntity,\n\ttransientEdits: {\n\t\tblocks: true,\n\t\tselection: true,\n\t},\n\tmergedEdits: {\n\t\tmeta: true,\n\t},\n\trawAttributes: [ 'title', 'excerpt', 'content' ],\n} ) );\nimport { EditorHelpTopics, store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport EditorProvider from './index.js';\n\nclass NativeEditorProvider extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\t// Keep a local reference to `post` to detect changes.\n\t\tthis.post = this.props.post;\n\t\tthis.props.addEntities( postTypeEntities );\n\t\tthis.props.receiveEntityRecords(\n\t\t\t'postType',\n\t\t\tthis.post.type,\n\t\t\tthis.post\n\t\t);\n\n\t\tthis.getEditorSettings = memize(\n\t\t\t( settings, capabilities ) => ( {\n\t\t\t\t...settings,\n\t\t\t\tcapabilities,\n\t\t\t} ),\n\t\t\t{\n\t\t\t\tmaxSize: 1,\n\t\t\t}\n\t\t);\n\t\tthis.state = {\n\t\t\tisHelpVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { capabilities, locale, updateSettings } = this.props;\n\n\t\tupdateSettings( {\n\t\t\t...capabilities,\n\t\t\t...this.getThemeColors( this.props ),\n\t\t\tlocale,\n\t\t} );\n\n\t\tthis.subscriptionParentGetHtml = subscribeParentGetHtml( () => {\n\t\t\tthis.serializeToNativeAction();\n\t\t} );\n\n\t\tthis.subscriptionParentToggleHTMLMode = subscribeParentToggleHTMLMode(\n\t\t\t() => {\n\t\t\t\tthis.toggleMode();\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentSetTitle = subscribeSetTitle( ( payload ) => {\n\t\t\tthis.props.editTitle( payload.title );\n\t\t} );\n\n\t\tthis.subscriptionParentUpdateHtml = subscribeUpdateHtml(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateHtmlAction( payload.html );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentReplaceBlock = subscribeReplaceBlock(\n\t\t\t( payload ) => {\n\t\t\t\tthis.replaceBlockAction( payload.html, payload.clientId );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentMediaAppend = subscribeMediaAppend(\n\t\t\t( payload ) => {\n\t\t\t\tconst blockName = 'core/' + payload.mediaType;\n\t\t\t\tconst newBlock = createBlock( blockName, {\n\t\t\t\t\tid: payload.mediaId,\n\t\t\t\t\t[ payload.mediaType === 'image'\n\t\t\t\t\t\t? 'url'\n\t\t\t\t\t\t: 'src' ]: payload.mediaUrl,\n\t\t\t\t} );\n\n\t\t\t\tconst indexAfterSelected = this.props.selectedBlockIndex + 1;\n\t\t\t\tconst insertionIndex =\n\t\t\t\t\tindexAfterSelected || this.props.blockCount;\n\n\t\t\t\tthis.props.insertBlock( newBlock, insertionIndex );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateEditorSettings = subscribeUpdateEditorSettings(\n\t\t\t( { galleryWithImageBlocks, ...editorSettings } ) => {\n\t\t\t\tif ( typeof galleryWithImageBlocks === 'boolean' ) {\n\t\t\t\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\t\t\t\t}\n\t\t\t\tupdateSettings( this.getThemeColors( editorSettings ) );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateCapabilitiesAction( payload );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowNotice = subscribeShowNotice(\n\t\t\t( payload ) => {\n\t\t\t\tthis.props.createSuccessNotice( payload.message );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowEditorHelp = subscribeShowEditorHelp( () => {\n\t\t\tthis.setState( { isHelpVisible: true } );\n\t\t} );\n\n\t\t// Request current block impressions from native app.\n\t\trequestBlockTypeImpressions( ( storedImpressions ) => {\n\t\t\tconst impressions = { ...NEW_BLOCK_TYPES, ...storedImpressions };\n\n\t\t\t// Persist impressions to JavaScript store.\n\t\t\tupdateSettings( { impressions } );\n\n\t\t\t// Persist impressions to native store if they do not include latest\n\t\t\t// `NEW_BLOCK_TYPES` configuration.\n\t\t\tconst storedImpressionKeys = Object.keys( storedImpressions );\n\t\t\tconst storedImpressionsCurrent = Object.keys(\n\t\t\t\tNEW_BLOCK_TYPES\n\t\t\t).every( ( newKey ) => storedImpressionKeys.includes( newKey ) );\n\t\t\tif ( ! storedImpressionsCurrent ) {\n\t\t\t\tsetBlockTypeImpressions( impressions );\n\t\t\t}\n\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentGetHtml ) {\n\t\t\tthis.subscriptionParentGetHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentToggleHTMLMode ) {\n\t\t\tthis.subscriptionParentToggleHTMLMode.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentSetTitle ) {\n\t\t\tthis.subscriptionParentSetTitle.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateHtml ) {\n\t\t\tthis.subscriptionParentUpdateHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentReplaceBlock ) {\n\t\t\tthis.subscriptionParentReplaceBlock.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentMediaAppend ) {\n\t\t\tthis.subscriptionParentMediaAppend.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateEditorSettings ) {\n\t\t\tthis.subscriptionParentUpdateEditorSettings.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateCapabilities ) {\n\t\t\tthis.subscriptionParentUpdateCapabilities.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowNotice ) {\n\t\t\tthis.subscriptionParentShowNotice.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowEditorHelp ) {\n\t\t\tthis.subscriptionParentShowEditorHelp.remove();\n\t\t}\n\t}\n\n\tgetThemeColors( { rawStyles, rawFeatures } ) {\n\t\tconst { defaultEditorColors, defaultEditorGradients } = this.props;\n\n\t\tif ( rawStyles && rawFeatures ) {\n\t\t\treturn getGlobalStyles( rawStyles, rawFeatures );\n\t\t}\n\n\t\treturn getColorsAndGradients(\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\trawFeatures\n\t\t);\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( ! prevProps.isReady && this.props.isReady ) {\n\t\t\tconst blocks = this.props.blocks;\n\t\t\tconst isUnsupportedBlock = ( { name } ) =>\n\t\t\t\tname === getUnregisteredTypeHandlerName();\n\t\t\tconst unsupportedBlockNames = blocks\n\t\t\t\t.filter( isUnsupportedBlock )\n\t\t\t\t.map( ( block ) => block.attributes.originalName );\n\t\t\tRNReactNativeGutenbergBridge.editorDidMount(\n\t\t\t\tunsupportedBlockNames\n\t\t\t);\n\t\t}\n\t}\n\n\tserializeToNativeAction() {\n\t\tconst title = this.props.title;\n\t\tlet html;\n\n\t\tif ( this.props.mode === 'text' ) {\n\t\t\t// The HTMLTextInput component does not update the store when user is doing changes\n\t\t\t// Let's request the HTML from the component's state directly.\n\t\t\thtml = applyFilters( 'native.persist-html' );\n\t\t} else {\n\t\t\thtml = serialize( this.props.blocks );\n\t\t}\n\n\t\tconst hasChanges =\n\t\t\ttitle !== this.post.title.raw || html !== this.post.content.raw;\n\n\t\t// Variable to store the content structure metrics.\n\t\tconst contentInfo = {};\n\t\tcontentInfo.characterCount = wordCount(\n\t\t\thtml,\n\t\t\t'characters_including_spaces'\n\t\t);\n\t\tcontentInfo.wordCount = wordCount( html, 'words' );\n\t\tcontentInfo.paragraphCount = this.props.paragraphCount;\n\t\tcontentInfo.blockCount = this.props.blockCount;\n\t\tRNReactNativeGutenbergBridge.provideToNative_Html(\n\t\t\thtml,\n\t\t\ttitle,\n\t\t\thasChanges,\n\t\t\tcontentInfo\n\t\t);\n\n\t\tif ( hasChanges ) {\n\t\t\tthis.post.title.raw = title;\n\t\t\tthis.post.content.raw = html;\n\t\t}\n\t}\n\n\tupdateHtmlAction( html ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.resetEditorBlocksWithoutUndoLevel( parsed );\n\t}\n\n\treplaceBlockAction( html, blockClientId ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.replaceBlock( blockClientId, parsed );\n\t}\n\n\ttoggleMode() {\n\t\tconst { mode, switchMode } = this.props;\n\t\t// Refresh html content first.\n\t\tthis.serializeToNativeAction();\n\t\t// Make sure to blur the selected block and dismiss the keyboard.\n\t\tthis.props.clearSelectedBlock();\n\t\tswitchMode( mode === 'visual' ? 'text' : 'visual' );\n\t}\n\n\tupdateCapabilitiesAction( capabilities ) {\n\t\tthis.props.updateSettings( capabilities );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\tpost, // eslint-disable-line no-unused-vars\n\t\t\tcapabilities,\n\t\t\tsettings,\n\t\t\t...props\n\t\t} = this.props;\n\t\tconst editorSettings = this.getEditorSettings( settings, capabilities );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ this.post }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</EditorProvider>\n\t\t\t\t<EditorHelpTopics\n\t\t\t\t\tisVisible={ this.state.isHelpVisible }\n\t\t\t\t\tonClose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t\tclose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\t__unstableIsEditorReady: isEditorReady,\n\t\t\tgetEditorBlocks,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostContent,\n\t\t} = select( editorStore );\n\t\tconst { getEditorMode } = select( editPostStore );\n\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetGlobalBlockCount,\n\t\t\tgetSettings: getBlockEditorSettings,\n\t\t} = select( blockEditorStore );\n\n\t\tconst settings = getBlockEditorSettings();\n\t\tconst defaultEditorColors = settings?.colors ?? [];\n\t\tconst defaultEditorGradients = settings?.gradients ?? [];\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\tisReady: isEditorReady(),\n\t\t\tblocks: getEditorBlocks(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tgetEditedPostContent,\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\tselectedBlockIndex: getBlockIndex( selectedBlockClientId ),\n\t\t\tblockCount: getGlobalBlockCount(),\n\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, resetEditorBlocks } = dispatch( editorStore );\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\treplaceBlock,\n\t\t} = dispatch( blockEditorStore );\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { addEntities, receiveEntityRecords } = dispatch( coreStore );\n\t\tconst { createSuccessNotice } = dispatch( noticesStore );\n\n\t\treturn {\n\t\t\tupdateSettings,\n\t\t\taddEntities,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\tcreateSuccessNotice,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\treceiveEntityRecords,\n\t\t\tresetEditorBlocksWithoutUndoLevel( blocks ) {\n\t\t\t\tresetEditorBlocks( blocks, {\n\t\t\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tswitchMode( mode ) {\n\t\t\t\tswitchEditorMode( mode );\n\t\t\t},\n\t\t\treplaceBlock,\n\t\t};\n\t} ),\n] )( NativeEditorProvider );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/provider/index.native.js"],"names":["postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","rawAttributes","NativeEditorProvider","Component","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","locale","updateSettings","getThemeColors","subscriptionParentGetHtml","serializeToNativeAction","subscriptionParentToggleHTMLMode","toggleMode","subscriptionParentSetTitle","payload","editTitle","title","subscriptionParentUpdateHtml","updateHtmlAction","html","subscriptionParentReplaceBlock","replaceBlockAction","clientId","subscriptionParentMediaAppend","blockName","mediaType","newBlock","id","mediaId","mediaUrl","indexAfterSelected","selectedBlockIndex","insertionIndex","blockCount","insertBlock","subscriptionParentUpdateEditorSettings","galleryWithImageBlocks","editorSettings","window","wp","galleryBlockV2Enabled","subscriptionParentUpdateCapabilities","updateCapabilitiesAction","subscriptionParentShowNotice","createSuccessNotice","message","subscriptionParentShowEditorHelp","setState","storedImpressions","impressions","NEW_BLOCK_TYPES","storedImpressionKeys","Object","keys","storedImpressionsCurrent","every","newKey","includes","componentWillUnmount","remove","rawStyles","rawFeatures","defaultEditorColors","defaultEditorGradients","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","unsupportedBlockNames","filter","block","attributes","originalName","RNReactNativeGutenbergBridge","editorDidMount","mode","hasChanges","raw","content","contentInfo","characterCount","wordCount","paragraphCount","provideToNative_Html","parsed","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","clearSelectedBlock","render","children","select","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","editorStore","getEditorMode","editPostStore","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","getSettings","getBlockEditorSettings","blockEditorStore","colors","gradients","selectedBlockClientId","dispatch","editPost","resetEditorBlocks","switchEditorMode","coreStore","noticesStore","__unstableShouldCreateUndoLevel"],"mappings":";;;;;;;;;AAuBA;;;;AApBA;;AACA;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AAiC,CAAEpG,MAAF,EAAW;AAC3C+H,MAAAA,iBAAiB,CAAE/H,MAAF,EAAU;AAC1BmI,QAAAA,+BAA+B,EAAE;AADP,OAAV,CAAjB;AAGA,KAdK;;AAeN5B,IAAAA,UAAU,CAAEb,IAAF,EAAS;AAClBsC,MAAAA,gBAAgB,CAAEtC,IAAF,CAAhB;AACA,KAjBK;;AAkBNY,IAAAA;AAlBM,GAAP;AAoBA,CAhCD,CAnCuB,CAAT,EAoEVjG,oBApEU,C","sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\n/**\n * WordPress dependencies\n */\nimport RNReactNativeGutenbergBridge, {\n\trequestBlockTypeImpressions,\n\tsetBlockTypeImpressions,\n\tsubscribeParentGetHtml,\n\tsubscribeParentToggleHTMLMode,\n\tsubscribeUpdateHtml,\n\tsubscribeSetTitle,\n\tsubscribeMediaAppend,\n\tsubscribeReplaceBlock,\n\tsubscribeUpdateEditorSettings,\n\tsubscribeUpdateCapabilities,\n\tsubscribeShowNotice,\n\tsubscribeShowEditorHelp,\n} from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport {\n\tparse,\n\tserialize,\n\tgetUnregisteredTypeHandlerName,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getGlobalStyles, getColorsAndGradients } from '@wordpress/components';\nimport { NEW_BLOCK_TYPES } from '@wordpress/block-library';\n\nconst postTypeEntities = [\n\t{ name: 'post', baseURL: '/wp/v2/posts' },\n\t{ name: 'page', baseURL: '/wp/v2/pages' },\n\t{ name: 'attachment', baseURL: '/wp/v2/media' },\n\t{ name: 'wp_block', baseURL: '/wp/v2/blocks' },\n].map( ( postTypeEntity ) => ( {\n\tkind: 'postType',\n\t...postTypeEntity,\n\ttransientEdits: {\n\t\tblocks: true,\n\t\tselection: true,\n\t},\n\tmergedEdits: {\n\t\tmeta: true,\n\t},\n\trawAttributes: [ 'title', 'excerpt', 'content' ],\n} ) );\nimport { EditorHelpTopics, store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport EditorProvider from './index.js';\n\nclass NativeEditorProvider extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\t// Keep a local reference to `post` to detect changes.\n\t\tthis.post = this.props.post;\n\t\tthis.props.addEntities( postTypeEntities );\n\t\tthis.props.receiveEntityRecords(\n\t\t\t'postType',\n\t\t\tthis.post.type,\n\t\t\tthis.post\n\t\t);\n\n\t\tthis.getEditorSettings = memize(\n\t\t\t( settings, capabilities ) => ( {\n\t\t\t\t...settings,\n\t\t\t\tcapabilities,\n\t\t\t} ),\n\t\t\t{\n\t\t\t\tmaxSize: 1,\n\t\t\t}\n\t\t);\n\t\tthis.state = {\n\t\t\tisHelpVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { capabilities, locale, updateSettings } = this.props;\n\n\t\tupdateSettings( {\n\t\t\t...capabilities,\n\t\t\t...this.getThemeColors( this.props ),\n\t\t\tlocale,\n\t\t} );\n\n\t\tthis.subscriptionParentGetHtml = subscribeParentGetHtml( () => {\n\t\t\tthis.serializeToNativeAction();\n\t\t} );\n\n\t\tthis.subscriptionParentToggleHTMLMode = subscribeParentToggleHTMLMode(\n\t\t\t() => {\n\t\t\t\tthis.toggleMode();\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentSetTitle = subscribeSetTitle( ( payload ) => {\n\t\t\tthis.props.editTitle( payload.title );\n\t\t} );\n\n\t\tthis.subscriptionParentUpdateHtml = subscribeUpdateHtml(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateHtmlAction( payload.html );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentReplaceBlock = subscribeReplaceBlock(\n\t\t\t( payload ) => {\n\t\t\t\tthis.replaceBlockAction( payload.html, payload.clientId );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentMediaAppend = subscribeMediaAppend(\n\t\t\t( payload ) => {\n\t\t\t\tconst blockName = 'core/' + payload.mediaType;\n\t\t\t\tconst newBlock = createBlock( blockName, {\n\t\t\t\t\tid: payload.mediaId,\n\t\t\t\t\t[ payload.mediaType === 'image'\n\t\t\t\t\t\t? 'url'\n\t\t\t\t\t\t: 'src' ]: payload.mediaUrl,\n\t\t\t\t} );\n\n\t\t\t\tconst indexAfterSelected = this.props.selectedBlockIndex + 1;\n\t\t\t\tconst insertionIndex =\n\t\t\t\t\tindexAfterSelected || this.props.blockCount;\n\n\t\t\t\tthis.props.insertBlock( newBlock, insertionIndex );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateEditorSettings = subscribeUpdateEditorSettings(\n\t\t\t( { galleryWithImageBlocks, ...editorSettings } ) => {\n\t\t\t\tif ( typeof galleryWithImageBlocks === 'boolean' ) {\n\t\t\t\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\t\t\t\t}\n\t\t\t\tupdateSettings( this.getThemeColors( editorSettings ) );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateCapabilitiesAction( payload );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowNotice = subscribeShowNotice(\n\t\t\t( payload ) => {\n\t\t\t\tthis.props.createSuccessNotice( payload.message );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowEditorHelp = subscribeShowEditorHelp( () => {\n\t\t\tthis.setState( { isHelpVisible: true } );\n\t\t} );\n\n\t\t// Request current block impressions from native app.\n\t\trequestBlockTypeImpressions( ( storedImpressions ) => {\n\t\t\tconst impressions = { ...NEW_BLOCK_TYPES, ...storedImpressions };\n\n\t\t\t// Persist impressions to JavaScript store.\n\t\t\tupdateSettings( { impressions } );\n\n\t\t\t// Persist impressions to native store if they do not include latest\n\t\t\t// `NEW_BLOCK_TYPES` configuration.\n\t\t\tconst storedImpressionKeys = Object.keys( storedImpressions );\n\t\t\tconst storedImpressionsCurrent = Object.keys(\n\t\t\t\tNEW_BLOCK_TYPES\n\t\t\t).every( ( newKey ) => storedImpressionKeys.includes( newKey ) );\n\t\t\tif ( ! storedImpressionsCurrent ) {\n\t\t\t\tsetBlockTypeImpressions( impressions );\n\t\t\t}\n\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentGetHtml ) {\n\t\t\tthis.subscriptionParentGetHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentToggleHTMLMode ) {\n\t\t\tthis.subscriptionParentToggleHTMLMode.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentSetTitle ) {\n\t\t\tthis.subscriptionParentSetTitle.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateHtml ) {\n\t\t\tthis.subscriptionParentUpdateHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentReplaceBlock ) {\n\t\t\tthis.subscriptionParentReplaceBlock.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentMediaAppend ) {\n\t\t\tthis.subscriptionParentMediaAppend.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateEditorSettings ) {\n\t\t\tthis.subscriptionParentUpdateEditorSettings.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateCapabilities ) {\n\t\t\tthis.subscriptionParentUpdateCapabilities.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowNotice ) {\n\t\t\tthis.subscriptionParentShowNotice.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowEditorHelp ) {\n\t\t\tthis.subscriptionParentShowEditorHelp.remove();\n\t\t}\n\t}\n\n\tgetThemeColors( { rawStyles, rawFeatures } ) {\n\t\tconst { defaultEditorColors, defaultEditorGradients } = this.props;\n\n\t\tif ( rawStyles && rawFeatures ) {\n\t\t\treturn getGlobalStyles( rawStyles, rawFeatures );\n\t\t}\n\n\t\treturn getColorsAndGradients(\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\trawFeatures\n\t\t);\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( ! prevProps.isReady && this.props.isReady ) {\n\t\t\tconst blocks = this.props.blocks;\n\t\t\tconst isUnsupportedBlock = ( { name } ) =>\n\t\t\t\tname === getUnregisteredTypeHandlerName();\n\t\t\tconst unsupportedBlockNames = blocks\n\t\t\t\t.filter( isUnsupportedBlock )\n\t\t\t\t.map( ( block ) => block.attributes.originalName );\n\t\t\tRNReactNativeGutenbergBridge.editorDidMount(\n\t\t\t\tunsupportedBlockNames\n\t\t\t);\n\t\t}\n\t}\n\n\tserializeToNativeAction() {\n\t\tconst title = this.props.title;\n\t\tlet html;\n\n\t\tif ( this.props.mode === 'text' ) {\n\t\t\t// The HTMLTextInput component does not update the store when user is doing changes\n\t\t\t// Let's request the HTML from the component's state directly.\n\t\t\thtml = applyFilters( 'native.persist-html' );\n\t\t} else {\n\t\t\thtml = serialize( this.props.blocks );\n\t\t}\n\n\t\tconst hasChanges =\n\t\t\ttitle !== this.post.title.raw || html !== this.post.content.raw;\n\n\t\t// Variable to store the content structure metrics.\n\t\tconst contentInfo = {};\n\t\tcontentInfo.characterCount = wordCount(\n\t\t\thtml,\n\t\t\t'characters_including_spaces'\n\t\t);\n\t\tcontentInfo.wordCount = wordCount( html, 'words' );\n\t\tcontentInfo.paragraphCount = this.props.paragraphCount;\n\t\tcontentInfo.blockCount = this.props.blockCount;\n\t\tRNReactNativeGutenbergBridge.provideToNative_Html(\n\t\t\thtml,\n\t\t\ttitle,\n\t\t\thasChanges,\n\t\t\tcontentInfo\n\t\t);\n\n\t\tif ( hasChanges ) {\n\t\t\tthis.post.title.raw = title;\n\t\t\tthis.post.content.raw = html;\n\t\t}\n\t}\n\n\tupdateHtmlAction( html ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.resetEditorBlocksWithoutUndoLevel( parsed );\n\t}\n\n\treplaceBlockAction( html, blockClientId ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.replaceBlock( blockClientId, parsed );\n\t}\n\n\ttoggleMode() {\n\t\tconst { mode, switchMode } = this.props;\n\t\t// Refresh html content first.\n\t\tthis.serializeToNativeAction();\n\t\t// Make sure to blur the selected block and dismiss the keyboard.\n\t\tthis.props.clearSelectedBlock();\n\t\tswitchMode( mode === 'visual' ? 'text' : 'visual' );\n\t}\n\n\tupdateCapabilitiesAction( capabilities ) {\n\t\tthis.props.updateSettings( capabilities );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\tpost, // eslint-disable-line no-unused-vars\n\t\t\tcapabilities,\n\t\t\tsettings,\n\t\t\t...props\n\t\t} = this.props;\n\t\tconst editorSettings = this.getEditorSettings( settings, capabilities );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ this.post }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<SafeAreaProvider>{ children }</SafeAreaProvider>\n\t\t\t\t</EditorProvider>\n\t\t\t\t<EditorHelpTopics\n\t\t\t\t\tisVisible={ this.state.isHelpVisible }\n\t\t\t\t\tonClose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t\tclose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\t__unstableIsEditorReady: isEditorReady,\n\t\t\tgetEditorBlocks,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostContent,\n\t\t} = select( editorStore );\n\t\tconst { getEditorMode } = select( editPostStore );\n\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetGlobalBlockCount,\n\t\t\tgetSettings: getBlockEditorSettings,\n\t\t} = select( blockEditorStore );\n\n\t\tconst settings = getBlockEditorSettings();\n\t\tconst defaultEditorColors = settings?.colors ?? [];\n\t\tconst defaultEditorGradients = settings?.gradients ?? [];\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\tisReady: isEditorReady(),\n\t\t\tblocks: getEditorBlocks(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tgetEditedPostContent,\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\tselectedBlockIndex: getBlockIndex( selectedBlockClientId ),\n\t\t\tblockCount: getGlobalBlockCount(),\n\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, resetEditorBlocks } = dispatch( editorStore );\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\treplaceBlock,\n\t\t} = dispatch( blockEditorStore );\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { addEntities, receiveEntityRecords } = dispatch( coreStore );\n\t\tconst { createSuccessNotice } = dispatch( noticesStore );\n\n\t\treturn {\n\t\t\tupdateSettings,\n\t\t\taddEntities,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\tcreateSuccessNotice,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\treceiveEntityRecords,\n\t\t\tresetEditorBlocksWithoutUndoLevel( blocks ) {\n\t\t\t\tresetEditorBlocks( blocks, {\n\t\t\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tswitchMode( mode ) {\n\t\t\t\tswitchEditorMode( mode );\n\t\t\t},\n\t\t\treplaceBlock,\n\t\t};\n\t} ),\n] )( NativeEditorProvider );\n"]}