@gechiui/block-editor
Version:
56 lines (46 loc) • 1.62 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require("lodash");
var _hooks = require("@gechiui/hooks");
var _blocks = require("@gechiui/blocks");
var _components = require("@gechiui/components");
var _align = require("./align.js");
Object.keys(_align).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _align[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _align[key];
}
});
});
/**
* External dependencies
*/
/**
* GeChiUI dependencies
*/
const ALIGNMENTS = ['left', 'center', 'right'];
// Used to filter out blocks that don't support wide/full alignment on mobile
(0, _hooks.addFilter)('blocks.registerBlockType', 'core/react-native-editor/align', (settings, name) => {
if (_components.WIDE_ALIGNMENTS.excludeBlocks.includes(name) && (0, _blocks.hasBlockSupport)(settings, 'align')) {
const blockAlign = settings.supports.align;
settings.supports = { ...settings.supports,
align: Array.isArray(blockAlign) ? (0, _lodash.without)(blockAlign, ...Object.values(_components.WIDE_ALIGNMENTS.alignments)) : blockAlign,
alignWide: false
};
settings.attributes = { ...settings.attributes,
align: {
type: 'string',
// Allow for '' since it is used by updateAlignment function
// in withToolbarControls for special cases with defined default values.
enum: [...ALIGNMENTS, '']
}
};
}
return settings;
});
//# sourceMappingURL=align.native.js.map