UNPKG

tandem-front-end

Version:

Visual editor for web components

135 lines 2.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var recompose_1 = require("recompose"); var paperclip_1 = require("paperclip"); var actions_1 = require("actions"); var InputProperties = require("./input.pc").InputProperties; var TYPE_MENU_OPTIONS = [ "a", "abbr", "acronym", "address", "b", "base", "blockquote", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strike", "strong", "style", "sub", "summary", "sup", "svg", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr" ].map(function (value) { return ({ label: value, value: value }); }); exports.default = recompose_1.compose(recompose_1.pure, recompose_1.withHandlers({ onTypeChange: function (_a) { var dispatch = _a.dispatch; return function (value) { dispatch(actions_1.elementTypeChanged(value)); }; } }), function (Base) { return function (_a) { var onTypeChange = _a.onTypeChange, selectedNodes = _a.selectedNodes, onTextValueKeyDown = _a.onTextValueKeyDown, dispatch = _a.dispatch; var element = selectedNodes.find(function (node) { return node.name !== paperclip_1.PCSourceTagNames.TEXT; }); var fieldChild; if (element.name === "input") { fieldChild = (React.createElement(InputProperties, { dispatch: dispatch, selectedNodes: selectedNodes })); } return (React.createElement(Base, { fieldsProps: { children: fieldChild || [] }, typeInputProps: { value: element.name, options: TYPE_MENU_OPTIONS, onChange: onTypeChange } })); }; }); //# sourceMappingURL=element-controller.js.map