@wordpress/edit-post 8.32.0 → 8.32.1-next.ff1cebbba.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/build/commands/use-commands.js +54 -47
- package/build/commands/use-commands.js.map +7 -1
- package/build/components/back-button/fullscreen-mode-close.js +127 -118
- package/build/components/back-button/fullscreen-mode-close.js.map +7 -1
- package/build/components/back-button/index.js +56 -54
- package/build/components/back-button/index.js.map +7 -1
- package/build/components/browser-url/index.js +45 -44
- package/build/components/browser-url/index.js.map +7 -1
- package/build/components/editor-initialization/index.js +24 -18
- package/build/components/editor-initialization/index.js.map +7 -1
- package/build/components/editor-initialization/listener-hooks.js +42 -43
- package/build/components/editor-initialization/listener-hooks.js.map +7 -1
- package/build/components/init-pattern-modal/index.js +100 -79
- package/build/components/init-pattern-modal/index.js.map +7 -1
- package/build/components/keyboard-shortcuts/index.js +37 -33
- package/build/components/keyboard-shortcuts/index.js.map +7 -1
- package/build/components/layout/index.js +447 -467
- package/build/components/layout/index.js.map +7 -1
- package/build/components/layout/use-padding-appender.js +66 -59
- package/build/components/layout/use-padding-appender.js.map +7 -1
- package/build/components/layout/use-should-iframe.js +36 -30
- package/build/components/layout/use-should-iframe.js.map +7 -1
- package/build/components/meta-boxes/index.js +46 -33
- package/build/components/meta-boxes/index.js.map +7 -1
- package/build/components/meta-boxes/meta-box-visibility.js +37 -22
- package/build/components/meta-boxes/meta-box-visibility.js.map +7 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +62 -53
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +7 -1
- package/build/components/meta-boxes/use-meta-box-initialization.js +37 -32
- package/build/components/meta-boxes/use-meta-box-initialization.js.map +7 -1
- package/build/components/more-menu/index.js +64 -44
- package/build/components/more-menu/index.js.map +7 -1
- package/build/components/more-menu/manage-patterns-menu-item.js +39 -37
- package/build/components/more-menu/manage-patterns-menu-item.js.map +7 -1
- package/build/components/more-menu/welcome-guide-menu-item.js +39 -21
- package/build/components/more-menu/welcome-guide-menu-item.js.map +7 -1
- package/build/components/preferences-modal/enable-custom-fields.js +76 -66
- package/build/components/preferences-modal/enable-custom-fields.js.map +7 -1
- package/build/components/preferences-modal/enable-panel.js +47 -43
- package/build/components/preferences-modal/enable-panel.js.map +7 -1
- package/build/components/preferences-modal/index.js +51 -39
- package/build/components/preferences-modal/index.js.map +7 -1
- package/build/components/preferences-modal/meta-boxes-section.js +65 -52
- package/build/components/preferences-modal/meta-boxes-section.js.map +7 -1
- package/build/components/welcome-guide/default.js +134 -97
- package/build/components/welcome-guide/default.js.map +7 -1
- package/build/components/welcome-guide/image.js +34 -23
- package/build/components/welcome-guide/image.js.map +7 -1
- package/build/components/welcome-guide/index.js +51 -38
- package/build/components/welcome-guide/index.js.map +7 -1
- package/build/components/welcome-guide/template.js +65 -45
- package/build/components/welcome-guide/template.js.map +7 -1
- package/build/deprecated.js +84 -110
- package/build/deprecated.js.map +7 -1
- package/build/hooks/use-navigate-to-entity-record.js +60 -78
- package/build/hooks/use-navigate-to-entity-record.js.map +7 -1
- package/build/index.js +101 -136
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -15
- package/build/lock-unlock.js.map +7 -1
- package/build/store/actions.js +239 -431
- package/build/store/actions.js.map +7 -1
- package/build/store/constants.js +33 -26
- package/build/store/constants.js.map +7 -1
- package/build/store/index.js +44 -32
- package/build/store/index.js.map +7 -1
- package/build/store/reducer.js +50 -57
- package/build/store/reducer.js.map +7 -1
- package/build/store/selectors.js +288 -459
- package/build/store/selectors.js.map +7 -1
- package/build/utils/meta-boxes.js +31 -19
- package/build/utils/meta-boxes.js.map +7 -1
- package/build-module/commands/use-commands.js +35 -40
- package/build-module/commands/use-commands.js.map +7 -1
- package/build-module/components/back-button/fullscreen-mode-close.js +102 -110
- package/build-module/components/back-button/fullscreen-mode-close.js.map +7 -1
- package/build-module/components/back-button/index.js +28 -47
- package/build-module/components/back-button/index.js.map +7 -1
- package/build-module/components/browser-url/index.js +23 -38
- package/build-module/components/browser-url/index.js.map +7 -1
- package/build-module/components/editor-initialization/index.js +6 -13
- package/build-module/components/editor-initialization/index.js.map +7 -1
- package/build-module/components/editor-initialization/listener-hooks.js +20 -34
- package/build-module/components/editor-initialization/listener-hooks.js.map +7 -1
- package/build-module/components/init-pattern-modal/index.js +90 -74
- package/build-module/components/init-pattern-modal/index.js.map +7 -1
- package/build-module/components/keyboard-shortcuts/index.js +21 -26
- package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
- package/build-module/components/layout/index.js +439 -448
- package/build-module/components/layout/index.js.map +7 -1
- package/build-module/components/layout/use-padding-appender.js +44 -54
- package/build-module/components/layout/use-padding-appender.js.map +7 -1
- package/build-module/components/layout/use-should-iframe.js +15 -25
- package/build-module/components/layout/use-should-iframe.js.map +7 -1
- package/build-module/components/meta-boxes/index.js +18 -26
- package/build-module/components/meta-boxes/index.js.map +7 -1
- package/build-module/components/meta-boxes/meta-box-visibility.js +18 -15
- package/build-module/components/meta-boxes/meta-box-visibility.js.map +7 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js +30 -44
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +7 -1
- package/build-module/components/meta-boxes/use-meta-box-initialization.js +14 -25
- package/build-module/components/meta-boxes/use-meta-box-initialization.js.map +7 -1
- package/build-module/components/more-menu/index.js +36 -37
- package/build-module/components/more-menu/index.js.map +7 -1
- package/build-module/components/more-menu/manage-patterns-menu-item.js +21 -31
- package/build-module/components/more-menu/manage-patterns-menu-item.js.map +7 -1
- package/build-module/components/more-menu/welcome-guide-menu-item.js +22 -16
- package/build-module/components/more-menu/welcome-guide-menu-item.js.map +7 -1
- package/build-module/components/preferences-modal/enable-custom-fields.js +51 -56
- package/build-module/components/preferences-modal/enable-custom-fields.js.map +7 -1
- package/build-module/components/preferences-modal/enable-panel.js +30 -38
- package/build-module/components/preferences-modal/enable-panel.js.map +7 -1
- package/build-module/components/preferences-modal/index.js +24 -34
- package/build-module/components/preferences-modal/index.js.map +7 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +34 -45
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +7 -1
- package/build-module/components/welcome-guide/default.js +107 -91
- package/build-module/components/welcome-guide/default.js.map +7 -1
- package/build-module/components/welcome-guide/image.js +16 -18
- package/build-module/components/welcome-guide/image.js.map +7 -1
- package/build-module/components/welcome-guide/index.js +23 -31
- package/build-module/components/welcome-guide/index.js.map +7 -1
- package/build-module/components/welcome-guide/template.js +38 -39
- package/build-module/components/welcome-guide/template.js.map +7 -1
- package/build-module/deprecated.js +62 -103
- package/build-module/deprecated.js.map +7 -1
- package/build-module/hooks/use-navigate-to-entity-record.js +42 -73
- package/build-module/hooks/use-navigate-to-entity-record.js.map +7 -1
- package/build-module/index.js +70 -95
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/store/actions.js +158 -368
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/constants.js +9 -21
- package/build-module/store/constants.js.map +7 -1
- package/build-module/store/index.js +10 -22
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/reducer.js +28 -51
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/selectors.js +232 -442
- package/build-module/store/selectors.js.map +7 -1
- package/build-module/utils/meta-boxes.js +9 -13
- package/build-module/utils/meta-boxes.js.map +7 -1
- package/build-style/classic-rtl.css +0 -154
- package/build-style/classic.css +0 -154
- package/build-style/style-rtl.css +135 -110
- package/build-style/style.css +135 -110
- package/package.json +39 -31
- package/src/classic.scss +3 -0
- package/src/components/back-button/style.scss +3 -0
- package/src/components/layout/index.js +3 -2
- package/src/components/layout/style.scss +4 -0
- package/src/components/meta-boxes/meta-boxes-area/style.scss +3 -0
- package/src/components/welcome-guide/style.scss +3 -0
- package/src/style.scss +8 -4
- package/build/components/header/header-toolbar/index.native.js +0 -204
- package/build/components/header/header-toolbar/index.native.js.map +0 -1
- package/build/components/header/index.native.js +0 -59
- package/build/components/header/index.native.js.map +0 -1
- package/build/components/layout/index.native.js +0 -166
- package/build/components/layout/index.native.js.map +0 -1
- package/build/components/visual-editor/header.native.js +0 -63
- package/build/components/visual-editor/header.native.js.map +0 -1
- package/build/components/visual-editor/index.native.js +0 -44
- package/build/components/visual-editor/index.native.js.map +0 -1
- package/build/editor.native.js +0 -157
- package/build/editor.native.js.map +0 -1
- package/build/index.native.js +0 -58
- package/build/index.native.js.map +0 -1
- package/build-module/components/header/header-toolbar/index.native.js +0 -196
- package/build-module/components/header/header-toolbar/index.native.js.map +0 -1
- package/build-module/components/header/index.native.js +0 -50
- package/build-module/components/header/index.native.js.map +0 -1
- package/build-module/components/layout/index.native.js +0 -158
- package/build-module/components/layout/index.native.js.map +0 -1
- package/build-module/components/visual-editor/header.native.js +0 -56
- package/build-module/components/visual-editor/header.native.js.map +0 -1
- package/build-module/components/visual-editor/index.native.js +0 -35
- package/build-module/components/visual-editor/index.native.js.map +0 -1
- package/build-module/editor.native.js +0 -149
- package/build-module/editor.native.js.map +0 -1
- package/build-module/index.native.js +0 -45
- package/build-module/index.native.js.map +0 -1
package/build/editor.native.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _memize = _interopRequireDefault(require("memize"));
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
11
|
-
var _element = require("@wordpress/element");
|
|
12
|
-
var _editor = require("@wordpress/editor");
|
|
13
|
-
var _blocks = require("@wordpress/blocks");
|
|
14
|
-
var _data = require("@wordpress/data");
|
|
15
|
-
var _compose = require("@wordpress/compose");
|
|
16
|
-
var _reactNativeBridge = require("@wordpress/react-native-bridge");
|
|
17
|
-
var _components = require("@wordpress/components");
|
|
18
|
-
var _coreData = require("@wordpress/core-data");
|
|
19
|
-
var _layout = _interopRequireDefault(require("./components/layout"));
|
|
20
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
/**
|
|
22
|
-
* External dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* WordPress dependencies
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Internal dependencies
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
class Editor extends _element.Component {
|
|
34
|
-
constructor(props) {
|
|
35
|
-
super(...arguments);
|
|
36
|
-
if (props.initialHtmlModeEnabled && props.mode === 'visual') {
|
|
37
|
-
// Enable html mode if the initial mode the parent wants it but we're not already in it.
|
|
38
|
-
this.props.switchEditorMode('text');
|
|
39
|
-
}
|
|
40
|
-
this.getEditorSettings = (0, _memize.default)(this.getEditorSettings, {
|
|
41
|
-
maxSize: 1
|
|
42
|
-
});
|
|
43
|
-
this.setTitleRef = this.setTitleRef.bind(this);
|
|
44
|
-
}
|
|
45
|
-
getEditorSettings(settings) {
|
|
46
|
-
settings = {
|
|
47
|
-
...settings,
|
|
48
|
-
isRTL: _reactNative.I18nManager.isRTL
|
|
49
|
-
};
|
|
50
|
-
return settings;
|
|
51
|
-
}
|
|
52
|
-
componentDidMount() {
|
|
53
|
-
const {
|
|
54
|
-
editEntityRecord,
|
|
55
|
-
postType,
|
|
56
|
-
postId
|
|
57
|
-
} = this.props;
|
|
58
|
-
this.subscriptionParentSetFocusOnTitle = (0, _reactNativeBridge.subscribeSetFocusOnTitle)(() => {
|
|
59
|
-
if (this.postTitleRef) {
|
|
60
|
-
this.postTitleRef.focus();
|
|
61
|
-
} else {
|
|
62
|
-
// If the post title ref is not available, we postpone setting focus to when it's available.
|
|
63
|
-
this.focusTitleWhenAvailable = true;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
this.subscriptionParentFeaturedImageIdNativeUpdated = (0, _reactNativeBridge.subscribeFeaturedImageIdNativeUpdated)(payload => {
|
|
67
|
-
editEntityRecord('postType', postType, postId, {
|
|
68
|
-
featured_media: payload.featuredImageId
|
|
69
|
-
}, {
|
|
70
|
-
undoIgnore: true
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
componentWillUnmount() {
|
|
75
|
-
if (this.subscriptionParentSetFocusOnTitle) {
|
|
76
|
-
this.subscriptionParentSetFocusOnTitle.remove();
|
|
77
|
-
}
|
|
78
|
-
if (this.subscribeFeaturedImageIdNativeUpdated) {
|
|
79
|
-
this.subscribeFeaturedImageIdNativeUpdated.remove();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
setTitleRef(titleRef) {
|
|
83
|
-
if (this.focusTitleWhenAvailable && !this.postTitleRef) {
|
|
84
|
-
this.focusTitleWhenAvailable = false;
|
|
85
|
-
titleRef.focus();
|
|
86
|
-
}
|
|
87
|
-
this.postTitleRef = titleRef;
|
|
88
|
-
}
|
|
89
|
-
render() {
|
|
90
|
-
const {
|
|
91
|
-
settings,
|
|
92
|
-
initialEdits,
|
|
93
|
-
post,
|
|
94
|
-
postId,
|
|
95
|
-
postType,
|
|
96
|
-
featuredImageId,
|
|
97
|
-
initialHtml,
|
|
98
|
-
...props
|
|
99
|
-
} = this.props;
|
|
100
|
-
const editorSettings = this.getEditorSettings(settings);
|
|
101
|
-
const normalizedPost = post || {
|
|
102
|
-
id: postId,
|
|
103
|
-
title: {
|
|
104
|
-
raw: props.initialTitle || ''
|
|
105
|
-
},
|
|
106
|
-
featured_media: featuredImageId,
|
|
107
|
-
content: {
|
|
108
|
-
// Make sure the post content is in sync with gutenberg store
|
|
109
|
-
// to avoid marking the post as modified when simply loaded
|
|
110
|
-
// For now, let's assume: serialize( parse( html ) ) !== html.
|
|
111
|
-
raw: (0, _blocks.serialize)((0, _blocks.parse)(initialHtml || ''))
|
|
112
|
-
},
|
|
113
|
-
type: postType,
|
|
114
|
-
status: 'draft',
|
|
115
|
-
meta: []
|
|
116
|
-
};
|
|
117
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView, {
|
|
118
|
-
style: {
|
|
119
|
-
flex: 1
|
|
120
|
-
},
|
|
121
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SlotFillProvider, {
|
|
122
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.EditorProvider, {
|
|
123
|
-
settings: editorSettings,
|
|
124
|
-
post: normalizedPost,
|
|
125
|
-
initialEdits: initialEdits,
|
|
126
|
-
useSubRegistry: false,
|
|
127
|
-
...props,
|
|
128
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.ErrorBoundary, {
|
|
129
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_layout.default, {
|
|
130
|
-
setTitleRef: this.setTitleRef
|
|
131
|
-
})
|
|
132
|
-
})
|
|
133
|
-
})
|
|
134
|
-
})
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
var _default = exports.default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
139
|
-
const {
|
|
140
|
-
getEditorMode
|
|
141
|
-
} = select(_editor.store);
|
|
142
|
-
return {
|
|
143
|
-
mode: getEditorMode()
|
|
144
|
-
};
|
|
145
|
-
}), (0, _data.withDispatch)(dispatch => {
|
|
146
|
-
const {
|
|
147
|
-
switchEditorMode
|
|
148
|
-
} = dispatch(_editor.store);
|
|
149
|
-
const {
|
|
150
|
-
editEntityRecord
|
|
151
|
-
} = dispatch(_coreData.store);
|
|
152
|
-
return {
|
|
153
|
-
switchEditorMode,
|
|
154
|
-
editEntityRecord
|
|
155
|
-
};
|
|
156
|
-
})])(Editor);
|
|
157
|
-
//# sourceMappingURL=editor.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_memize","_interopRequireDefault","require","_reactNative","_reactNativeGestureHandler","_element","_editor","_blocks","_data","_compose","_reactNativeBridge","_components","_coreData","_layout","_jsxRuntime","Editor","Component","constructor","props","arguments","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","memize","maxSize","setTitleRef","bind","settings","isRTL","I18nManager","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","subscribeSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","subscribeFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","serialize","parse","type","status","meta","jsx","GestureHandlerRootView","style","flex","children","SlotFillProvider","EditorProvider","useSubRegistry","ErrorBoundary","default","_default","exports","compose","withSelect","select","getEditorMode","editorStore","withDispatch","dispatch","coreStore"],"sources":["@wordpress/edit-post/src/editor.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { I18nManager } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport {\n\tEditorProvider,\n\tErrorBoundary,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { parse, serialize } from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport {\n\tsubscribeSetFocusOnTitle,\n\tsubscribeFeaturedImageIdNativeUpdated,\n} from '@wordpress/react-native-bridge';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\n\nclass Editor extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\n\t\tif ( props.initialHtmlModeEnabled && props.mode === 'visual' ) {\n\t\t\t// Enable html mode if the initial mode the parent wants it but we're not already in it.\n\t\t\tthis.props.switchEditorMode( 'text' );\n\t\t}\n\n\t\tthis.getEditorSettings = memize( this.getEditorSettings, {\n\t\t\tmaxSize: 1,\n\t\t} );\n\n\t\tthis.setTitleRef = this.setTitleRef.bind( this );\n\t}\n\n\tgetEditorSettings( settings ) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\n\t\t};\n\n\t\treturn settings;\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { editEntityRecord, postType, postId } = this.props;\n\n\t\tthis.subscriptionParentSetFocusOnTitle = subscribeSetFocusOnTitle(\n\t\t\t() => {\n\t\t\t\tif ( this.postTitleRef ) {\n\t\t\t\t\tthis.postTitleRef.focus();\n\t\t\t\t} else {\n\t\t\t\t\t// If the post title ref is not available, we postpone setting focus to when it's available.\n\t\t\t\t\tthis.focusTitleWhenAvailable = true;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentFeaturedImageIdNativeUpdated =\n\t\t\tsubscribeFeaturedImageIdNativeUpdated( ( payload ) => {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t\t{ featured_media: payload.featuredImageId },\n\t\t\t\t\t{\n\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentSetFocusOnTitle ) {\n\t\t\tthis.subscriptionParentSetFocusOnTitle.remove();\n\t\t}\n\n\t\tif ( this.subscribeFeaturedImageIdNativeUpdated ) {\n\t\t\tthis.subscribeFeaturedImageIdNativeUpdated.remove();\n\t\t}\n\t}\n\n\tsetTitleRef( titleRef ) {\n\t\tif ( this.focusTitleWhenAvailable && ! this.postTitleRef ) {\n\t\t\tthis.focusTitleWhenAvailable = false;\n\t\t\ttitleRef.focus();\n\t\t}\n\n\t\tthis.postTitleRef = titleRef;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tsettings,\n\t\t\tinitialEdits,\n\t\t\tpost,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tfeaturedImageId,\n\t\t\tinitialHtml,\n\t\t\t...props\n\t\t} = this.props;\n\n\t\tconst editorSettings = this.getEditorSettings( settings );\n\n\t\tconst normalizedPost = post || {\n\t\t\tid: postId,\n\t\t\ttitle: {\n\t\t\t\traw: props.initialTitle || '',\n\t\t\t},\n\t\t\tfeatured_media: featuredImageId,\n\t\t\tcontent: {\n\t\t\t\t// Make sure the post content is in sync with gutenberg store\n\t\t\t\t// to avoid marking the post as modified when simply loaded\n\t\t\t\t// For now, let's assume: serialize( parse( html ) ) !== html.\n\t\t\t\traw: serialize( parse( initialHtml || '' ) ),\n\t\t\t},\n\t\t\ttype: postType,\n\t\t\tstatus: 'draft',\n\t\t\tmeta: [],\n\t\t};\n\n\t\treturn (\n\t\t\t<GestureHandlerRootView style={ { flex: 1 } }>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ normalizedPost }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t<Layout setTitleRef={ this.setTitleRef } />\n\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</GestureHandlerRootView>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { switchEditorMode } = dispatch( editorStore );\n\t\tconst { editEntityRecord } = dispatch( coreStore );\n\t\treturn {\n\t\t\tsw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C;EAE/C,OAAO;IACN5D,IAAI,EAAE2D,aAAa,CAAC;EACrB,CAAC;AACF,CAAE,CAAC,EACH,IAAAE,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAE7D;EAAiB,CAAC,GAAG6D,QAAQ,CAAEF,aAAY,CAAC;EACpD,MAAM;IAAEjD;EAAiB,CAAC,GAAGmD,QAAQ,CAAEC,eAAU,CAAC;EAClD,OAAO;IACN9D,gBAAgB;IAChBU;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEjB,MAAO,CAAC","ignoreList":[]}
|
package/build/index.native.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.initializeEditor = initializeEditor;
|
|
8
|
-
Object.defineProperty(exports, "store", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () {
|
|
11
|
-
return _store.store;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
require("@wordpress/core-data");
|
|
15
|
-
require("@wordpress/format-library");
|
|
16
|
-
var _data = require("@wordpress/data");
|
|
17
|
-
var _preferences = require("@wordpress/preferences");
|
|
18
|
-
var _store = require("./store");
|
|
19
|
-
var _editor = _interopRequireDefault(require("./editor"));
|
|
20
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
/**
|
|
22
|
-
* WordPress dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Initializes the Editor and returns a componentProvider
|
|
31
|
-
* that can be registered with `AppRegistry.registerComponent`
|
|
32
|
-
*
|
|
33
|
-
* @param {string} id Unique identifier for editor instance.
|
|
34
|
-
* @param {Object} postType Post type of the post to edit.
|
|
35
|
-
* @param {Object} postId ID of the post to edit (unused right now)
|
|
36
|
-
*/
|
|
37
|
-
function initializeEditor(id, postType, postId) {
|
|
38
|
-
(0, _data.dispatch)(_preferences.store).setDefaults('core/edit-post', {
|
|
39
|
-
editorMode: 'visual',
|
|
40
|
-
fullscreenMode: true,
|
|
41
|
-
inactivePanels: [],
|
|
42
|
-
openPanels: ['post-status'],
|
|
43
|
-
welcomeGuide: true
|
|
44
|
-
});
|
|
45
|
-
(0, _data.dispatch)(_preferences.store).setDefaults('core', {
|
|
46
|
-
editorTool: 'edit',
|
|
47
|
-
hiddenBlockTypes: [],
|
|
48
|
-
inactivePanels: [],
|
|
49
|
-
openPanels: ['post-status'],
|
|
50
|
-
isPublishSidebarEnabled: true,
|
|
51
|
-
fixedToolbar: false
|
|
52
|
-
});
|
|
53
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {
|
|
54
|
-
postId: postId,
|
|
55
|
-
postType: postType
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["require","_data","_preferences","_store","_editor","_interopRequireDefault","_jsxRuntime","initializeEditor","id","postType","postId","dispatch","preferencesStore","setDefaults","editorMode","fullscreenMode","inactivePanels","openPanels","welcomeGuide","editorTool","hiddenBlockTypes","isPublishSidebarEnabled","fixedToolbar","jsx","default"],"sources":["@wordpress/edit-post/src/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/core-data';\nimport '@wordpress/format-library';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nexport { store } from './store';\nimport Editor from './editor';\n\n/**\n * Initializes the Editor and returns a componentProvider\n * that can be registered with `AppRegistry.registerComponent`\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit (unused right now)\n */\nexport function initializeEditor( id, postType, postId ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfullscreenMode: true,\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\twelcomeGuide: true,\n\t} );\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\teditorTool: 'edit',\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tisPublishSidebarEnabled: true,\n\t\tfixedToolbar: false,\n\t} );\n\n\treturn <Editor postId={ postId } postType={ postType } />;\n}\n"],"mappings":";;;;;;;;;;;;;AAGAA,OAAA;AACAA,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AAA8B,IAAAM,WAAA,GAAAN,OAAA;AAZ9B;AACA;AACA;;AAMA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,gBAAgBA,CAAEC,EAAE,EAAEC,QAAQ,EAAEC,MAAM,EAAG;EACxD,IAAAC,cAAQ,EAAEC,kBAAiB,CAAC,CAACC,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,IAAI;IACpBC,cAAc,EAAE,EAAE;IAClBC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC,YAAY,EAAE;EACf,CAAE,CAAC;EACH,IAAAP,cAAQ,EAAEC,kBAAiB,CAAC,CAACC,WAAW,CAAE,MAAM,EAAE;IACjDM,UAAU,EAAE,MAAM;IAClBC,gBAAgB,EAAE,EAAE;IACpBJ,cAAc,EAAE,EAAE;IAClBC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BI,uBAAuB,EAAE,IAAI;IAC7BC,YAAY,EAAE;EACf,CAAE,CAAC;EAEH,oBAAO,IAAAhB,WAAA,CAAAiB,GAAA,EAACnB,OAAA,CAAAoB,OAAM;IAACd,MAAM,EAAGA,MAAQ;IAACD,QAAQ,EAAGA;EAAU,CAAE,CAAC;AAC1D","ignoreList":[]}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { ScrollView, StyleSheet, View } from 'react-native';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useCallback, useRef, useEffect, Platform } from '@wordpress/element';
|
|
10
|
-
import { compose, usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
11
|
-
import { withSelect, withDispatch } from '@wordpress/data';
|
|
12
|
-
import { withViewportMatch } from '@wordpress/viewport';
|
|
13
|
-
import { __ } from '@wordpress/i18n';
|
|
14
|
-
import { Inserter, BlockToolbar, store as blockEditorStore } from '@wordpress/block-editor';
|
|
15
|
-
import { ToolbarGroup, ToolbarButton } from '@wordpress/components';
|
|
16
|
-
import { keyboardClose, audio as audioIcon, media as imageIcon, video as videoIcon, gallery as galleryIcon } from '@wordpress/icons';
|
|
17
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
18
|
-
import { createBlock } from '@wordpress/blocks';
|
|
19
|
-
import { toggleUndoButton, toggleRedoButton, subscribeOnUndoPressed, subscribeOnRedoPressed } from '@wordpress/react-native-bridge';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Internal dependencies
|
|
23
|
-
*/
|
|
24
|
-
import styles from './style.scss';
|
|
25
|
-
import { store as editPostStore } from '../../../store';
|
|
26
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
-
const shadowStyle = {
|
|
28
|
-
shadowOffset: {
|
|
29
|
-
width: 2,
|
|
30
|
-
height: 2
|
|
31
|
-
},
|
|
32
|
-
shadowOpacity: 1,
|
|
33
|
-
shadowRadius: 6,
|
|
34
|
-
elevation: 18
|
|
35
|
-
};
|
|
36
|
-
function HeaderToolbar({
|
|
37
|
-
hasRedo,
|
|
38
|
-
hasUndo,
|
|
39
|
-
redo,
|
|
40
|
-
undo,
|
|
41
|
-
showInserter,
|
|
42
|
-
showKeyboardHideButton,
|
|
43
|
-
insertBlock,
|
|
44
|
-
onHideKeyboard,
|
|
45
|
-
isRTL,
|
|
46
|
-
noContentSelected
|
|
47
|
-
}) {
|
|
48
|
-
const anchorNodeRef = useRef();
|
|
49
|
-
const containerStyle = [usePreferredColorSchemeStyle(styles['header-toolbar__container'], styles['header-toolbar__container--dark']), {
|
|
50
|
-
borderTopWidth: StyleSheet.hairlineWidth
|
|
51
|
-
}];
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
const onUndoSubscription = subscribeOnUndoPressed(undo);
|
|
54
|
-
const onRedoSubscription = subscribeOnRedoPressed(redo);
|
|
55
|
-
return () => {
|
|
56
|
-
onUndoSubscription?.remove();
|
|
57
|
-
onRedoSubscription?.remove();
|
|
58
|
-
};
|
|
59
|
-
}, [undo, redo]);
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
toggleUndoButton(!hasUndo);
|
|
62
|
-
}, [hasUndo]);
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
toggleRedoButton(!hasRedo);
|
|
65
|
-
}, [hasRedo]);
|
|
66
|
-
const scrollViewRef = useRef(null);
|
|
67
|
-
const scrollToStart = () => {
|
|
68
|
-
// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android
|
|
69
|
-
if (Platform.isAndroid && isRTL) {
|
|
70
|
-
scrollViewRef.current.scrollToEnd();
|
|
71
|
-
} else {
|
|
72
|
-
scrollViewRef.current.scrollTo({
|
|
73
|
-
x: 0
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const onInsertBlock = useCallback(blockType => () => {
|
|
78
|
-
insertBlock(createBlock(blockType), undefined, undefined, true, {
|
|
79
|
-
source: 'inserter_menu',
|
|
80
|
-
inserterMethod: 'quick-inserter'
|
|
81
|
-
});
|
|
82
|
-
}, [insertBlock]);
|
|
83
|
-
const renderMediaButtons = /*#__PURE__*/_jsxs(ToolbarGroup, {
|
|
84
|
-
children: [/*#__PURE__*/_jsx(ToolbarButton, {
|
|
85
|
-
title: __('Image'),
|
|
86
|
-
icon: imageIcon,
|
|
87
|
-
onClick: onInsertBlock('core/image'),
|
|
88
|
-
testID: "insert-image-button",
|
|
89
|
-
extraProps: {
|
|
90
|
-
hint: __('Insert Image Block')
|
|
91
|
-
}
|
|
92
|
-
}, "imageButton"), /*#__PURE__*/_jsx(ToolbarButton, {
|
|
93
|
-
title: __('Video'),
|
|
94
|
-
icon: videoIcon,
|
|
95
|
-
onClick: onInsertBlock('core/video'),
|
|
96
|
-
testID: "insert-video-button",
|
|
97
|
-
extraProps: {
|
|
98
|
-
hint: __('Insert Video Block')
|
|
99
|
-
}
|
|
100
|
-
}, "videoButton"), /*#__PURE__*/_jsx(ToolbarButton, {
|
|
101
|
-
title: __('Gallery'),
|
|
102
|
-
icon: galleryIcon,
|
|
103
|
-
onClick: onInsertBlock('core/gallery'),
|
|
104
|
-
testID: "insert-gallery-button",
|
|
105
|
-
extraProps: {
|
|
106
|
-
hint: __('Insert Gallery Block')
|
|
107
|
-
}
|
|
108
|
-
}, "galleryButton"), /*#__PURE__*/_jsx(ToolbarButton, {
|
|
109
|
-
title: __('Audio'),
|
|
110
|
-
icon: audioIcon,
|
|
111
|
-
onClick: onInsertBlock('core/audio'),
|
|
112
|
-
testID: "insert-audio-button",
|
|
113
|
-
extraProps: {
|
|
114
|
-
hint: __('Insert Audio Block')
|
|
115
|
-
}
|
|
116
|
-
}, "audioButton")]
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
/* translators: accessibility text for the editor toolbar */
|
|
120
|
-
const toolbarAriaLabel = __('Document tools');
|
|
121
|
-
const shadowColor = usePreferredColorSchemeStyle(styles['header-toolbar__keyboard-hide-shadow--light'], styles['header-toolbar__keyboard-hide-shadow--dark']);
|
|
122
|
-
const showKeyboardButtonStyles = [usePreferredColorSchemeStyle(styles['header-toolbar__keyboard-hide-container'], styles['header-toolbar__keyboard-hide-container--dark']), shadowStyle, {
|
|
123
|
-
shadowColor: Platform.isAndroid ? styles['header-toolbar__keyboard-hide-shadow--solid'].color : shadowColor.color
|
|
124
|
-
}];
|
|
125
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
126
|
-
ref: anchorNodeRef,
|
|
127
|
-
testID: toolbarAriaLabel,
|
|
128
|
-
accessibilityLabel: toolbarAriaLabel,
|
|
129
|
-
style: containerStyle,
|
|
130
|
-
children: [/*#__PURE__*/_jsxs(ScrollView, {
|
|
131
|
-
ref: scrollViewRef,
|
|
132
|
-
onContentSizeChange: scrollToStart,
|
|
133
|
-
horizontal: true,
|
|
134
|
-
showsHorizontalScrollIndicator: false,
|
|
135
|
-
keyboardShouldPersistTaps: "always",
|
|
136
|
-
alwaysBounceHorizontal: false,
|
|
137
|
-
contentContainerStyle: styles['header-toolbar__scrollable-content'],
|
|
138
|
-
children: [/*#__PURE__*/_jsx(Inserter, {
|
|
139
|
-
disabled: !showInserter
|
|
140
|
-
}), noContentSelected && renderMediaButtons, /*#__PURE__*/_jsx(BlockToolbar, {
|
|
141
|
-
anchorNodeRef: anchorNodeRef.current
|
|
142
|
-
})]
|
|
143
|
-
}), showKeyboardHideButton && /*#__PURE__*/_jsx(ToolbarGroup, {
|
|
144
|
-
passedStyle: showKeyboardButtonStyles,
|
|
145
|
-
children: /*#__PURE__*/_jsx(ToolbarButton, {
|
|
146
|
-
title: __('Hide keyboard'),
|
|
147
|
-
icon: keyboardClose,
|
|
148
|
-
onClick: onHideKeyboard,
|
|
149
|
-
extraProps: {
|
|
150
|
-
hint: __('Tap to hide the keyboard')
|
|
151
|
-
}
|
|
152
|
-
})
|
|
153
|
-
})]
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
export default compose([withSelect(select => {
|
|
157
|
-
const {
|
|
158
|
-
getBlockRootClientId,
|
|
159
|
-
getBlockSelectionEnd,
|
|
160
|
-
hasInserterItems,
|
|
161
|
-
hasSelectedBlock
|
|
162
|
-
} = select(blockEditorStore);
|
|
163
|
-
const {
|
|
164
|
-
getEditorSettings
|
|
165
|
-
} = select(editorStore);
|
|
166
|
-
const isAnyBlockSelected = hasSelectedBlock();
|
|
167
|
-
return {
|
|
168
|
-
hasRedo: select(editorStore).hasEditorRedo(),
|
|
169
|
-
hasUndo: select(editorStore).hasEditorUndo(),
|
|
170
|
-
// This setting (richEditingEnabled) should not live in the block editor's setting.
|
|
171
|
-
showInserter: select(editPostStore).getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled && hasInserterItems(getBlockRootClientId(getBlockSelectionEnd())),
|
|
172
|
-
isTextModeEnabled: select(editPostStore).getEditorMode() === 'text',
|
|
173
|
-
isRTL: select(blockEditorStore).getSettings().isRTL,
|
|
174
|
-
noContentSelected: !isAnyBlockSelected
|
|
175
|
-
};
|
|
176
|
-
}), withDispatch(dispatch => {
|
|
177
|
-
const {
|
|
178
|
-
clearSelectedBlock,
|
|
179
|
-
insertBlock
|
|
180
|
-
} = dispatch(blockEditorStore);
|
|
181
|
-
const {
|
|
182
|
-
togglePostTitleSelection
|
|
183
|
-
} = dispatch(editorStore);
|
|
184
|
-
return {
|
|
185
|
-
redo: dispatch(editorStore).redo,
|
|
186
|
-
undo: dispatch(editorStore).undo,
|
|
187
|
-
onHideKeyboard() {
|
|
188
|
-
clearSelectedBlock();
|
|
189
|
-
togglePostTitleSelection(false);
|
|
190
|
-
},
|
|
191
|
-
insertBlock
|
|
192
|
-
};
|
|
193
|
-
}), withViewportMatch({
|
|
194
|
-
isLargeViewport: 'medium'
|
|
195
|
-
})])(HeaderToolbar);
|
|
196
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ScrollView","StyleSheet","View","useCallback","useRef","useEffect","Platform","compose","usePreferredColorSchemeStyle","withSelect","withDispatch","withViewportMatch","__","Inserter","BlockToolbar","store","blockEditorStore","ToolbarGroup","ToolbarButton","keyboardClose","audio","audioIcon","media","imageIcon","video","videoIcon","gallery","galleryIcon","editorStore","createBlock","toggleUndoButton","toggleRedoButton","subscribeOnUndoPressed","subscribeOnRedoPressed","styles","editPostStore","jsx","_jsx","jsxs","_jsxs","shadowStyle","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","HeaderToolbar","hasRedo","hasUndo","redo","undo","showInserter","showKeyboardHideButton","insertBlock","onHideKeyboard","isRTL","noContentSelected","anchorNodeRef","containerStyle","borderTopWidth","hairlineWidth","onUndoSubscription","onRedoSubscription","remove","scrollViewRef","scrollToStart","isAndroid","current","scrollToEnd","scrollTo","x","onInsertBlock","blockType","undefined","source","inserterMethod","renderMediaButtons","children","title","icon","onClick","testID","extraProps","hint","toolbarAriaLabel","shadowColor","showKeyboardButtonStyles","color","ref","accessibilityLabel","style","onContentSizeChange","horizontal","showsHorizontalScrollIndicator","keyboardShouldPersistTaps","alwaysBounceHorizontal","contentContainerStyle","disabled","passedStyle","select","getBlockRootClientId","getBlockSelectionEnd","hasInserterItems","hasSelectedBlock","getEditorSettings","isAnyBlockSelected","hasEditorRedo","hasEditorUndo","getEditorMode","richEditingEnabled","isTextModeEnabled","getSettings","dispatch","clearSelectedBlock","togglePostTitleSelection","isLargeViewport"],"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { ScrollView, StyleSheet, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useEffect, Platform } from '@wordpress/element';\nimport { compose, usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { withViewportMatch } from '@wordpress/viewport';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInserter,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport {\n\tkeyboardClose,\n\taudio as audioIcon,\n\tmedia as imageIcon,\n\tvideo as videoIcon,\n\tgallery as galleryIcon,\n} from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\ttoggleUndoButton,\n\ttoggleRedoButton,\n\tsubscribeOnUndoPressed,\n\tsubscribeOnRedoPressed,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { store as editPostStore } from '../../../store';\n\nconst shadowStyle = {\n\tshadowOffset: { width: 2, height: 2 },\n\tshadowOpacity: 1,\n\tshadowRadius: 6,\n\televation: 18,\n};\n\nfunction HeaderToolbar( {\n\thasRedo,\n\thasUndo,\n\tredo,\n\tundo,\n\tshowInserter,\n\tshowKeyboardHideButton,\n\tinsertBlock,\n\tonHideKeyboard,\n\tisRTL,\n\tnoContentSelected,\n} ) {\n\tconst anchorNodeRef = useRef();\n\n\tconst containerStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__container' ],\n\t\t\tstyles[ 'header-toolbar__container--dark' ]\n\t\t),\n\t\t{ borderTopWidth: StyleSheet.hairlineWidth },\n\t];\n\n\tuseEffect( () => {\n\t\tconst onUndoSubscription = subscribeOnUndoPressed( undo );\n\t\tconst onRedoSubscription = subscribeOnRedoPressed( redo );\n\n\t\treturn () => {\n\t\t\tonUndoSubscription?.remove();\n\t\t\tonRedoSubscription?.remove();\n\t\t};\n\t}, [ undo, redo ] );\n\n\tuseEffect( () => {\n\t\ttoggleUndoButton( ! hasUndo );\n\t}, [ hasUndo ] );\n\n\tuseEffect( () => {\n\t\ttoggleRedoButton( ! hasRedo );\n\t}, [ hasRedo ] );\n\n\tconst scrollViewRef = useRef( null );\n\tconst scrollToStart = () => {\n\t\t// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android\n\t\tif ( Platform.isAndroid && isRTL ) {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t} else {\n\t\t\tscrollViewRef.current.scrollTo( { x: 0 } );\n\t\t}\n\t};\n\n\tconst onInsertBlock = useCallback(\n\t\t( blockType ) => () => {\n\t\t\tinsertBlock( createBlock( blockType ), undefined, undefined, true, {\n\t\t\t\tsource: 'inserter_menu',\n\t\t\t\tinserterMethod: 'quick-inserter',\n\t\t\t} );\n\t\t},\n\t\t[ insertBlock ]\n\t);\n\n\tconst renderMediaButtons = (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"imageButton\"\n\t\t\t\ttitle={ __( 'Image' ) }\n\t\t\t\ticon={ imageIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/image' ) }\n\t\t\t\ttestID=\"insert-image-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Image Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"videoButton\"\n\t\t\t\ttitle={ __( 'Video' ) }\n\t\t\t\ticon={ videoIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/video' ) }\n\t\t\t\ttestID=\"insert-video-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Video Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"galleryButton\"\n\t\t\t\ttitle={ __( 'Gallery' ) }\n\t\t\t\ticon={ galleryIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/gallery' ) }\n\t\t\t\ttestID=\"insert-gallery-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Gallery Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"audioButton\"\n\t\t\t\ttitle={ __( 'Audio' ) }\n\t\t\t\ticon={ audioIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/audio' ) }\n\t\t\t\ttestID=\"insert-audio-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Audio Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst shadowColor = usePreferredColorSchemeStyle(\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--light' ],\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--dark' ]\n\t);\n\tconst showKeyboardButtonStyles = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container' ],\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container--dark' ]\n\t\t),\n\t\tshadowStyle,\n\t\t{\n\t\t\tshadowColor: Platform.isAndroid\n\t\t\t\t? styles[ 'header-toolbar__keyboard-hide-shadow--solid' ].color\n\t\t\t\t: shadowColor.color,\n\t\t},\n\t];\n\n\treturn (\n\t\t<View\n\t\t\tref={ anchorNodeRef }\n\t\t\ttestID={ toolbarAriaLabel }\n\t\t\taccessibilityLabel={ toolbarAriaLabel }\n\t\t\tstyle={ containerStyle }\n\t\t>\n\t\t\t<ScrollView\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\tonContentSizeChange={ scrollToStart }\n\t\t\t\thorizontal\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\talwaysBounceHorizontal={ false }\n\t\t\t\tcontentContainerStyle={\n\t\t\t\t\tstyles[ 'header-toolbar__scrollable-content' ]\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<Inserter disabled={ ! showInserter } />\n\n\t\t\t\t{ noContentSelected && renderMediaButtons }\n\t\t\t\t<BlockToolbar anchorNodeRef={ anchorNodeRef.current } />\n\t\t\t</ScrollView>\n\t\t\t{ showKeyboardHideButton && (\n\t\t\t\t<ToolbarGroup passedStyle={ showKeyboardButtonStyles }>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Hide keyboard' ) }\n\t\t\t\t\t\ticon={ keyboardClose }\n\t\t\t\t\t\tonClick={ onHideKeyboard }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\thint: __( 'Tap to hide the keyboard' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockSelectionEnd,\n\t\t\thasInserterItems,\n\t\t\thasSelectedBlock,\n\t\t} = select( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst isAnyBlockSelected = hasSelectedBlock();\n\t\treturn {\n\t\t\thasRedo: select( editorStore ).hasEditorRedo(),\n\t\t\thasUndo: select( editorStore ).hasEditorUndo(),\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tshowInserter:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisTextModeEnabled:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'text',\n\t\t\tisRTL: select( blockEditorStore ).getSettings().isRTL,\n\t\t\tnoContentSelected: ! isAnyBlockSelected,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { clearSelectedBlock, insertBlock } =\n\t\t\tdispatch( blockEditorStore );\n\t\tconst { togglePostTitleSelection } = dispatch( editorStore );\n\n\t\treturn {\n\t\t\tredo: dispatch( editorStore ).redo,\n\t\t\tundo: dispatch( editorStore ).undo,\n\t\t\tonHideKeyboard() {\n\t\t\t\tclearSelectedBlock();\n\t\t\t\ttogglePostT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B,CAAC;AACF,CAAE,CAAC,EACHhG,YAAY,CAAIuG,QAAQ,IAAM;EAC7B,MAAM;IAAEC,kBAAkB;IAAE5D;EAAY,CAAC,GACxC2D,QAAQ,CAAEjG,gBAAiB,CAAC;EAC7B,MAAM;IAAEmG;EAAyB,CAAC,GAAGF,QAAQ,CAAErF,WAAY,CAAC;EAE5D,OAAO;IACNsB,IAAI,EAAE+D,QAAQ,CAAErF,WAAY,CAAC,CAACsB,IAAI;IAClCC,IAAI,EAAE8D,QAAQ,CAAErF,WAAY,CAAC,CAACuB,IAAI;IAClCI,cAAcA,CAAA,EAAG;MAChB2D,kBAAkB,CAAC,CAAC;MACpBC,wBAAwB,CAAE,KAAM,CAAC;IAClC,CAAC;IACD7D;EACD,CAAC;AACF,CAAE,CAAC,EACH3C,iBAAiB,CAAE;EAAEyG,eAAe,EAAE;AAAS,CAAE,CAAC,CACjD,CAAC,CAAErE,aAAc,CAAC","ignoreList":[]}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Keyboard } from 'react-native';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { Component } from '@wordpress/element';
|
|
10
|
-
import '@wordpress/editor';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import HeaderToolbar from './header-toolbar';
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
export default class Header extends Component {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.keyboardDidShow = this.keyboardDidShow.bind(this);
|
|
21
|
-
this.keyboardDidHide = this.keyboardDidHide.bind(this);
|
|
22
|
-
this.state = {
|
|
23
|
-
isKeyboardVisible: false
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
componentDidMount() {
|
|
27
|
-
this.keyboardShowSubscription = Keyboard.addListener('keyboardDidShow', this.keyboardDidShow);
|
|
28
|
-
this.keyboardHideSubscription = Keyboard.addListener('keyboardDidHide', this.keyboardDidHide);
|
|
29
|
-
}
|
|
30
|
-
componentWillUnmount() {
|
|
31
|
-
this.keyboardShowSubscription.remove();
|
|
32
|
-
this.keyboardHideSubscription.remove();
|
|
33
|
-
}
|
|
34
|
-
keyboardDidShow() {
|
|
35
|
-
this.setState({
|
|
36
|
-
isKeyboardVisible: true
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
keyboardDidHide() {
|
|
40
|
-
this.setState({
|
|
41
|
-
isKeyboardVisible: false
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
render() {
|
|
45
|
-
return /*#__PURE__*/_jsx(HeaderToolbar, {
|
|
46
|
-
showKeyboardHideButton: this.state.isKeyboardVisible
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Keyboard","Component","HeaderToolbar","jsx","_jsx","Header","constructor","arguments","keyboardDidShow","bind","keyboardDidHide","state","isKeyboardVisible","componentDidMount","keyboardShowSubscription","addListener","keyboardHideSubscription","componentWillUnmount","remove","setState","render","showKeyboardHideButton"],"sources":["@wordpress/edit-post/src/components/header/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Keyboard } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport HeaderToolbar from './header-toolbar';\n\nexport default class Header extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.keyboardDidShow = this.keyboardDidShow.bind( this );\n\t\tthis.keyboardDidHide = this.keyboardDidHide.bind( this );\n\n\t\tthis.state = {\n\t\t\tisKeyboardVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.keyboardShowSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidShow',\n\t\t\tthis.keyboardDidShow\n\t\t);\n\t\tthis.keyboardHideSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidHide',\n\t\t\tthis.keyboardDidHide\n\t\t);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.keyboardShowSubscription.remove();\n\t\tthis.keyboardHideSubscription.remove();\n\t}\n\n\tkeyboardDidShow() {\n\t\tthis.setState( { isKeyboardVisible: true } );\n\t}\n\n\tkeyboardDidHide() {\n\t\tthis.setState( { isKeyboardVisible: false } );\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<HeaderToolbar\n\t\t\t\tshowKeyboardHideButton={ this.state.isKeyboardVisible }\n\t\t\t/>\n\t\t);\n\t}\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,cAAc;;AAEvC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,OAAO,mBAAmB;;AAE1B;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE7C,eAAe,MAAMC,MAAM,SAASJ,SAAS,CAAC;EAC7CK,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,eAAe,GAAG,IAAI,CAACA,eAAe,CAACC,IAAI,CAAE,IAAK,CAAC;IACxD,IAAI,CAACC,eAAe,GAAG,IAAI,CAACA,eAAe,CAACD,IAAI,CAAE,IAAK,CAAC;IAExD,IAAI,CAACE,KAAK,GAAG;MACZC,iBAAiB,EAAE;IACpB,CAAC;EACF;EAEAC,iBAAiBA,CAAA,EAAG;IACnB,IAAI,CAACC,wBAAwB,GAAGd,QAAQ,CAACe,WAAW,CACnD,iBAAiB,EACjB,IAAI,CAACP,eACN,CAAC;IACD,IAAI,CAACQ,wBAAwB,GAAGhB,QAAQ,CAACe,WAAW,CACnD,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