Add unsend campaign feature (#45)
* Add unsend email editor Add email editor Add more email editor Add renderer partial Add more marketing email features * Add more campaign feature * Add variables * Getting there * campaign is there mfs * Add migration
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import { mergeAttributes, Node } from "@tiptap/core";
|
||||
import { ReactNodeViewRenderer } from "@tiptap/react";
|
||||
|
||||
import { UnsubscribeFooterComponent } from "../nodes/unsubscribe-footer";
|
||||
|
||||
declare module "@tiptap/core" {
|
||||
interface Commands<ReturnType> {
|
||||
unsubscribeFooter: {
|
||||
setUnsubscribeFooter: () => ReturnType;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export const UnsubscribeFooterExtension = Node.create({
|
||||
name: "unsubscribeFooter",
|
||||
group: "block",
|
||||
content: "inline*",
|
||||
|
||||
addAttributes() {
|
||||
return {
|
||||
component: {
|
||||
default: "unsubscribeFooter",
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
parseHTML() {
|
||||
return [
|
||||
{
|
||||
tag: `unsub`,
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
renderHTML({ HTMLAttributes }) {
|
||||
return [
|
||||
"unsub",
|
||||
mergeAttributes(
|
||||
{
|
||||
"data-unsend-component": this.name,
|
||||
class: "footer",
|
||||
contenteditable: "true",
|
||||
},
|
||||
HTMLAttributes
|
||||
),
|
||||
0,
|
||||
];
|
||||
},
|
||||
|
||||
addNodeView() {
|
||||
return ReactNodeViewRenderer(UnsubscribeFooterComponent);
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user