@wordpress/block-library
Version:
Block library for the WordPress editor.
40 lines (39 loc) • 1.2 kB
JavaScript
import clsx from "clsx";
import { getColorClassName, useBlockProps } from "@wordpress/block-editor";
import { jsx } from "react/jsx-runtime";
var deprecated_default = [{
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"
};
}
}];
export { deprecated_default as default };
//# sourceMappingURL=deprecated.mjs.map