@wordpress/block-editor
Version:
98 lines (94 loc) • 3.5 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _components = require("@wordpress/components");
var _data = require("@wordpress/data");
var _compose = require("@wordpress/compose");
var _blocks = require("@wordpress/blocks");
var _blockEditor = require("@wordpress/block-editor");
var _reactNative = require("react-native");
var _blockTitle = _interopRequireDefault(require("../block-title"));
var _useBlockDisplayInformation = _interopRequireDefault(require("../use-block-display-information"));
var _subdirectoryIcon = _interopRequireDefault(require("./subdirectory-icon"));
var _store = require("../../store");
var _blockSelectionButton = _interopRequireDefault(require("./block-selection-button.scss"));
var _jsxRuntime = require("react/jsx-runtime");
/**
* WordPress dependencies
*/
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const BlockSelectionButton = ({
clientId,
rootClientId,
rootBlockIcon,
isRTL
}) => {
const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
style: [_blockSelectionButton.default.selectionButtonContainer, rootClientId && _blockSelectionButton.default.densedPaddingLeft],
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
style: _blockSelectionButton.default.button,
onPress: () => {
/* Open BottomSheet with markup. */
},
disabled: true /* Disable temporarily since onPress function is empty. */,
children: [rootClientId && rootBlockIcon && [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
size: 24,
icon: rootBlockIcon.src,
fill: _blockSelectionButton.default.icon.color
}, "parent-icon"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
style: _blockSelectionButton.default.arrow,
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_subdirectoryIcon.default, {
fill: _blockSelectionButton.default.arrow.color,
isRTL: isRTL
})
}, "subdirectory-icon")], blockInformation?.icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockIcon, {
size: 24,
icon: blockInformation.icon,
fill: _blockSelectionButton.default.icon.color
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
maxFontSizeMultiplier: 1.25,
ellipsizeMode: "tail",
numberOfLines: 1,
style: _blockSelectionButton.default.selectionButtonTitle,
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockTitle.default, {
clientId: clientId,
maximumLength: 35
})
})]
})
});
};
var _default = exports.default = (0, _compose.compose)([(0, _data.withSelect)((select, {
clientId
}) => {
const {
getBlockRootClientId,
getBlockName,
getSettings
} = select(_store.store);
const rootClientId = getBlockRootClientId(clientId);
if (!rootClientId) {
return {
clientId
};
}
const rootBlockName = getBlockName(rootClientId);
const rootBlockType = (0, _blocks.getBlockType)(rootBlockName);
const rootBlockIcon = rootBlockType ? rootBlockType.icon : {};
return {
clientId,
rootClientId,
rootBlockIcon,
isRTL: getSettings().isRTL
};
})])(BlockSelectionButton);
//# sourceMappingURL=block-selection-button.native.js.map
;