@convertkit/editor-core
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -0,1 +1,3 @@ | ||
function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
import React from "react"; | ||
@@ -7,2 +9,4 @@ export default (function (options) { | ||
var classNames = _extends({}, options.classNames); | ||
var defaultBlock = options.defaultBlock || "paragraph"; | ||
@@ -19,21 +23,34 @@ return { | ||
node = props.node; | ||
var className = classNames[node.type]; | ||
switch (node.type) { | ||
case "heading-one": | ||
return React.createElement("h1", attributes, children); | ||
return React.createElement("h1", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
case "heading-two": | ||
return React.createElement("h2", attributes, children); | ||
return React.createElement("h2", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
case "heading-three": | ||
return React.createElement("h3", attributes, children); | ||
return React.createElement("h3", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
case "heading-four": | ||
return React.createElement("h4", attributes, children); | ||
return React.createElement("h4", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
case "heading-five": | ||
return React.createElement("h5", attributes, children); | ||
return React.createElement("h5", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
case "heading-six": | ||
return React.createElement("h6", attributes, children); | ||
return React.createElement("h6", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
@@ -40,0 +57,0 @@ case "paragraph": |
29
index.js
@@ -12,2 +12,4 @@ "use strict"; | ||
function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
var _default = function _default(options) { | ||
@@ -18,2 +20,4 @@ if (options === void 0) { | ||
var classNames = _extends({}, options.classNames); | ||
var defaultBlock = options.defaultBlock || "paragraph"; | ||
@@ -30,21 +34,34 @@ return { | ||
node = props.node; | ||
var className = classNames[node.type]; | ||
switch (node.type) { | ||
case "heading-one": | ||
return _react.default.createElement("h1", attributes, children); | ||
return _react.default.createElement("h1", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
case "heading-two": | ||
return _react.default.createElement("h2", attributes, children); | ||
return _react.default.createElement("h2", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
case "heading-three": | ||
return _react.default.createElement("h3", attributes, children); | ||
return _react.default.createElement("h3", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
case "heading-four": | ||
return _react.default.createElement("h4", attributes, children); | ||
return _react.default.createElement("h4", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
case "heading-five": | ||
return _react.default.createElement("h5", attributes, children); | ||
return _react.default.createElement("h5", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
case "heading-six": | ||
return _react.default.createElement("h6", attributes, children); | ||
return _react.default.createElement("h6", _extends({}, attributes, { | ||
className: className | ||
}), children); | ||
@@ -51,0 +68,0 @@ case "paragraph": |
{ | ||
"name": "@convertkit/editor-core", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Core plugin for ConvertKit Editor", | ||
"main": "src/index.js", | ||
"main": "index.js", | ||
"module": "es/index.js", | ||
@@ -7,0 +7,0 @@ "scripts": { |
import React from "react"; | ||
export default (options = {}) => { | ||
const classNames = { | ||
...options.classNames | ||
}; | ||
const defaultBlock = options.defaultBlock || "paragraph"; | ||
@@ -14,15 +18,41 @@ | ||
const { attributes, children, node } = props; | ||
const className = classNames[node.type]; | ||
switch (node.type) { | ||
case "heading-one": | ||
return <h1 {...attributes}>{children}</h1>; | ||
return ( | ||
<h1 {...attributes} className={className}> | ||
{children} | ||
</h1> | ||
); | ||
case "heading-two": | ||
return <h2 {...attributes}>{children}</h2>; | ||
return ( | ||
<h2 {...attributes} className={className}> | ||
{children} | ||
</h2> | ||
); | ||
case "heading-three": | ||
return <h3 {...attributes}>{children}</h3>; | ||
return ( | ||
<h3 {...attributes} className={className}> | ||
{children} | ||
</h3> | ||
); | ||
case "heading-four": | ||
return <h4 {...attributes}>{children}</h4>; | ||
return ( | ||
<h4 {...attributes} className={className}> | ||
{children} | ||
</h4> | ||
); | ||
case "heading-five": | ||
return <h5 {...attributes}>{children}</h5>; | ||
return ( | ||
<h5 {...attributes} className={className}> | ||
{children} | ||
</h5> | ||
); | ||
case "heading-six": | ||
return <h6 {...attributes}>{children}</h6>; | ||
return ( | ||
<h6 {...attributes} className={className}> | ||
{children} | ||
</h6> | ||
); | ||
case "paragraph": | ||
@@ -29,0 +59,0 @@ return <p {...attributes}>{children}</p>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8156
217