colonel-kurtz
Advanced tools
Comparing version 2.18.0-alpha to 2.18.0-beta
@@ -21,2 +21,4 @@ # Block Types | ||
component | A React component used to edit a block of a given type | ||
types | An array of other BlockType ids that may be created as children | ||
root | Configures the BlockType to display in the menu unless specifically asked for using `types`. Defaults to true. | ||
@@ -23,0 +25,0 @@ ## Creating Block Types |
{ | ||
"name": "colonel-kurtz", | ||
"version": "2.18.0-alpha", | ||
"version": "2.18.0-beta", | ||
"description": "A block editor", | ||
@@ -5,0 +5,0 @@ "main": "src/Colonel.js", |
@@ -0,1 +1,3 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
@@ -5,12 +7,17 @@ | ||
var defaults = { root: true }; | ||
var BlockType = (function () { | ||
function BlockType(_ref) { | ||
var component = _ref.component; | ||
var menuItems = _ref.menuItems; | ||
var label = _ref.label; | ||
var types = _ref.types; | ||
var id = _ref.id; | ||
function BlockType(config) { | ||
_classCallCheck(this, BlockType); | ||
var _extends2 = _extends({}, defaults, config); | ||
var component = _extends2.component; | ||
var menuItems = _extends2.menuItems; | ||
var label = _extends2.label; | ||
var types = _extends2.types; | ||
var id = _extends2.id; | ||
var root = _extends2.root; | ||
if (typeof component === 'object') { | ||
@@ -25,2 +32,3 @@ component = React.createClass(component); | ||
this.menuItems = menuItems; | ||
this.root = root; | ||
} | ||
@@ -36,2 +44,2 @@ | ||
module.exports = BlockType; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9tb2RlbHMvQmxvY2tUeXBlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsSUFBSSxLQUFLLEdBQUcsT0FBTyxDQUFDL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wZXMgICAgID0gdHlwZXMgfHwgW11cbiAgICB0aGlzLmNvbXBvbmVudCA9IGNvbXBvbmVudFxuICAgIHRoaXMubWVudUl0ZW1zID0gbWVudUl0ZW1zXG4gICAgdGhpcy5yb290ICAgICAgPSByb290XG4gIH1cblxuICB2YWx1ZU9mKCkge1xuICAgIHJldHVybiB0aGlzLmlkXG4gIH1cblxufVxuXG5tb2R1bGUuZXhwb3J0cyA9IEJsb2NrVHlwZVxuIl19 |
@@ -21,5 +21,7 @@ /** | ||
} else { | ||
return blockTypes; | ||
return blockTypes.filter(function (type) { | ||
return type.root; | ||
}); | ||
} | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy91dGlscy90eXBlc0ZvckJsb2NrLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBS0EsTUFBTSxDQUFDLE9BQU8sR0FBRyxVQUFVLFVBQVUsRUFBRSxLQUFLLEVBQUU7QUFDNUMsTUFBSSxLQUFLLEVBQUU7O0FBQ1QsVUFBSSxLQUFLLEdBQUcsVUFBVSxDQUFDLE1BQU0sQ0FBQyxVQUFBLENBQUM7ZUFBSSxDQUFDLENBQUMsRUFBRSxLQUFLLEtBQUssQ0FBQyxJQUFJO09BQUEsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQTtBQUNoRTtXQUFPLFVBQVUsQ0FBQyxNQUFNLENBQUMsVUFBQSxDQUFDO2lCQUFJLEtBQUssQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsQ0FBQztTQUFBLENBQUM7UUFBQTs7OztHQUN4RCxNQUFNO0FBQ0wsV0FBTyxVQUFVLENBQUE7R0FDbEI7Q0FDRixDQUFBIiwiZmlsZSI6InR5cGVzRm9yQmxvY2suanMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAq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