@wordpress/block-library
Version:
Block library for the WordPress editor.
44 lines (43 loc) • 1.29 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import clsx from "clsx";
import { getColorClassName, useBlockProps } from "@wordpress/block-editor";
const v1 = {
attributes: {
color: {
type: "string"
},
customColor: {
type: "string"
}
},
save({ attributes }) {
const { color, customColor } = attributes;
const backgroundClass = getColorClassName("background-color", color);
const colorClass = getColorClassName("color", color);
const className = clsx({
"has-text-color has-background": color || customColor,
[backgroundClass]: backgroundClass,
[colorClass]: colorClass
});
const style = {
backgroundColor: backgroundClass ? void 0 : customColor,
color: colorClass ? void 0 : customColor
};
return /* @__PURE__ */ jsx("hr", { ...useBlockProps.save({ className, style }) });
},
migrate(attributes) {
const { color, customColor, ...restAttributes } = attributes;
return {
...restAttributes,
backgroundColor: color ? color : void 0,
opacity: "css",
style: customColor ? { color: { background: customColor } } : void 0,
tagName: "hr"
};
}
};
var deprecated_default = [v1];
export {
deprecated_default as default
};
//# sourceMappingURL=deprecated.js.map