@daisychainapp/maily-to-core 0.1.2 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/index.cjs +305 -0
- package/dist/blocks/index.cjs.map +1 -0
- package/dist/blocks/index.d.cts +59 -0
- package/dist/blocks/index.d.ts +3 -1
- package/dist/blocks/index.mjs +40 -26
- package/dist/blocks/index.mjs.map +1 -1
- package/dist/extensions/index.cjs +6079 -0
- package/dist/extensions/index.cjs.map +1 -0
- package/dist/extensions/index.d.cts +425 -0
- package/dist/extensions/index.d.ts +237 -144
- package/dist/extensions/index.js +304 -155
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/index.mjs +3938 -2982
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +9057 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +2358 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +61 -0
- package/dist/index.d.ts +1 -22
- package/dist/index.js +63 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5631 -4880
- package/dist/index.mjs.map +1 -1
- package/package.json +128 -50
- package/readme.md +91 -33
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/blocks.ts
|
|
21
|
+
var blocks_exports = {};
|
|
22
|
+
__export(blocks_exports, {
|
|
23
|
+
blockquote: () => blockquote,
|
|
24
|
+
bulletList: () => bulletList,
|
|
25
|
+
button: () => button,
|
|
26
|
+
clearLine: () => clearLine,
|
|
27
|
+
columns: () => columns,
|
|
28
|
+
divider: () => divider,
|
|
29
|
+
footer: () => footer,
|
|
30
|
+
hardBreak: () => hardBreak,
|
|
31
|
+
heading1: () => heading1,
|
|
32
|
+
heading2: () => heading2,
|
|
33
|
+
heading3: () => heading3,
|
|
34
|
+
htmlCodeBlock: () => htmlCodeBlock,
|
|
35
|
+
image: () => image,
|
|
36
|
+
inlineImage: () => inlineImage,
|
|
37
|
+
linkCard: () => linkCard,
|
|
38
|
+
logo: () => logo,
|
|
39
|
+
orderedList: () => orderedList,
|
|
40
|
+
repeat: () => repeat,
|
|
41
|
+
section: () => section,
|
|
42
|
+
spacer: () => spacer,
|
|
43
|
+
text: () => text
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(blocks_exports);
|
|
46
|
+
|
|
47
|
+
// src/blocks/button.tsx
|
|
48
|
+
var import_lucide_react = require("lucide-react");
|
|
49
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
|
+
var button = {
|
|
51
|
+
title: "Button",
|
|
52
|
+
description: "Add a call to action button to email.",
|
|
53
|
+
searchTerms: ["link", "button", "cta"],
|
|
54
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.MousePointer, { className: "mly-h-4 mly-w-4" }),
|
|
55
|
+
command: ({ editor, range }) => {
|
|
56
|
+
editor.chain().focus().deleteRange(range).setButton().run();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var linkCard = {
|
|
60
|
+
title: "Link Card",
|
|
61
|
+
description: "Add a link card to email.",
|
|
62
|
+
searchTerms: ["link", "button", "image"],
|
|
63
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ArrowUpRightSquare, { className: "mly-h-4 mly-w-4" }),
|
|
64
|
+
command: ({ editor, range }) => {
|
|
65
|
+
editor.chain().focus().deleteRange(range).setLinkCard().run();
|
|
66
|
+
},
|
|
67
|
+
render: (editor) => {
|
|
68
|
+
return editor.extensionManager.extensions.findIndex(
|
|
69
|
+
(ext) => ext.name === "linkCard"
|
|
70
|
+
) === -1 ? null : true;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// src/blocks/code.tsx
|
|
75
|
+
var import_lucide_react2 = require("lucide-react");
|
|
76
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
77
|
+
var htmlCodeBlock = {
|
|
78
|
+
title: "Custom HTML",
|
|
79
|
+
description: "Insert a custom HTML block",
|
|
80
|
+
searchTerms: ["html", "code", "custom"],
|
|
81
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.CodeXmlIcon, { className: "mly-h-4 mly-w-4" }),
|
|
82
|
+
command: ({ editor, range }) => {
|
|
83
|
+
editor.chain().focus().deleteRange(range).setHtmlCodeBlock({ language: "html" }).run();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// src/blocks/image.tsx
|
|
88
|
+
var import_state = require("@tiptap/pm/state");
|
|
89
|
+
var import_lucide_react3 = require("lucide-react");
|
|
90
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
91
|
+
var image = {
|
|
92
|
+
title: "Image",
|
|
93
|
+
description: "Full width image",
|
|
94
|
+
searchTerms: ["image"],
|
|
95
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react3.ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
96
|
+
command: ({ editor, range }) => {
|
|
97
|
+
editor.chain().focus().deleteRange(range).setImage({ src: "" }).run();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var logo = {
|
|
101
|
+
title: "Logo",
|
|
102
|
+
description: "Add your brand logo",
|
|
103
|
+
searchTerms: ["image", "logo"],
|
|
104
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react3.ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
105
|
+
command: ({ editor, range }) => {
|
|
106
|
+
editor.chain().focus().deleteRange(range).setLogoImage({ src: "" }).run();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var inlineImage = {
|
|
110
|
+
title: "Inline Image",
|
|
111
|
+
description: "Inline image",
|
|
112
|
+
searchTerms: ["image", "inline"],
|
|
113
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react3.ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
114
|
+
command: ({ editor, range }) => {
|
|
115
|
+
editor.chain().focus().deleteRange(range).setInlineImage({
|
|
116
|
+
src: "https://maily.to/brand/logo.png"
|
|
117
|
+
}).command((props) => {
|
|
118
|
+
const { tr, state, view, editor: editor2 } = props;
|
|
119
|
+
const { from } = range;
|
|
120
|
+
const node = state.doc.nodeAt(from);
|
|
121
|
+
if (!node) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
const selection = import_state.TextSelection.create(
|
|
125
|
+
tr.doc,
|
|
126
|
+
from,
|
|
127
|
+
from + node.nodeSize
|
|
128
|
+
);
|
|
129
|
+
tr.setSelection(selection);
|
|
130
|
+
return true;
|
|
131
|
+
}).run();
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// src/blocks/layout.tsx
|
|
136
|
+
var import_lucide_react4 = require("lucide-react");
|
|
137
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
138
|
+
var columns = {
|
|
139
|
+
title: "Columns",
|
|
140
|
+
description: "Add columns to email.",
|
|
141
|
+
searchTerms: ["layout", "columns"],
|
|
142
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.ColumnsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
143
|
+
command: ({ editor, range }) => {
|
|
144
|
+
editor.chain().focus().deleteRange(range).setColumns().focus(editor.state.selection.head - 2).run();
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
var section = {
|
|
148
|
+
title: "Section",
|
|
149
|
+
description: "Add a section to email.",
|
|
150
|
+
searchTerms: ["layout", "section"],
|
|
151
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.RectangleHorizontal, { className: "mly-h-4 mly-w-4" }),
|
|
152
|
+
command: ({ editor, range }) => {
|
|
153
|
+
editor.chain().focus().deleteRange(range).setSection().run();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
var repeat = {
|
|
157
|
+
title: "Repeat",
|
|
158
|
+
description: "Loop over an array of items.",
|
|
159
|
+
searchTerms: ["repeat", "for", "loop"],
|
|
160
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.Repeat2, { className: "mly-h-4 mly-w-4" }),
|
|
161
|
+
command: ({ editor, range }) => {
|
|
162
|
+
editor.chain().focus().deleteRange(range).setRepeat().run();
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
var spacer = {
|
|
166
|
+
title: "Spacer",
|
|
167
|
+
description: "Add space between blocks.",
|
|
168
|
+
searchTerms: ["space", "gap", "divider"],
|
|
169
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.MoveVertical, { className: "mly-h-4 mly-w-4" }),
|
|
170
|
+
command: ({ editor, range }) => {
|
|
171
|
+
editor.chain().focus().deleteRange(range).setSpacer({ height: "sm" }).run();
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
var divider = {
|
|
175
|
+
title: "Divider",
|
|
176
|
+
description: "Add a horizontal divider.",
|
|
177
|
+
searchTerms: ["divider", "line"],
|
|
178
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.Minus, { className: "mly-h-4 mly-w-4" }),
|
|
179
|
+
command: ({ editor, range }) => {
|
|
180
|
+
editor.chain().focus().deleteRange(range).setHorizontalRule().run();
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// src/blocks/list.tsx
|
|
185
|
+
var import_lucide_react5 = require("lucide-react");
|
|
186
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
187
|
+
var bulletList = {
|
|
188
|
+
title: "Bullet List",
|
|
189
|
+
description: "Create a simple bullet list.",
|
|
190
|
+
searchTerms: ["unordered", "point"],
|
|
191
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react5.List, { className: "mly-h-4 mly-w-4" }),
|
|
192
|
+
command: ({ editor, range }) => {
|
|
193
|
+
editor.chain().focus().deleteRange(range).toggleBulletList().run();
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
var orderedList = {
|
|
197
|
+
title: "Numbered List",
|
|
198
|
+
description: "Create a list with numbering.",
|
|
199
|
+
searchTerms: ["ordered"],
|
|
200
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react5.ListOrdered, { className: "mly-h-4 mly-w-4" }),
|
|
201
|
+
command: ({ editor, range }) => {
|
|
202
|
+
editor.chain().focus().deleteRange(range).toggleOrderedList().run();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// src/blocks/typography.tsx
|
|
207
|
+
var import_lucide_react6 = require("lucide-react");
|
|
208
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
209
|
+
var text = {
|
|
210
|
+
title: "Text",
|
|
211
|
+
description: "Just start typing with plain text.",
|
|
212
|
+
searchTerms: ["p", "paragraph"],
|
|
213
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react6.Text, { className: "mly-h-4 mly-w-4" }),
|
|
214
|
+
command: ({ editor, range }) => {
|
|
215
|
+
editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").run();
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
var heading1 = {
|
|
219
|
+
title: "Heading 1",
|
|
220
|
+
description: "Big heading.",
|
|
221
|
+
searchTerms: ["h1", "title", "big", "large"],
|
|
222
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react6.Heading1, { className: "mly-h-4 mly-w-4" }),
|
|
223
|
+
command: ({ editor, range }) => {
|
|
224
|
+
editor.chain().focus().deleteRange(range).setNode("heading", { level: 1 }).run();
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
var heading2 = {
|
|
228
|
+
title: "Heading 2",
|
|
229
|
+
description: "Medium heading.",
|
|
230
|
+
searchTerms: ["h2", "subtitle", "medium"],
|
|
231
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react6.Heading2, { className: "mly-h-4 mly-w-4" }),
|
|
232
|
+
command: ({ editor, range }) => {
|
|
233
|
+
editor.chain().focus().deleteRange(range).setNode("heading", { level: 2 }).run();
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
var heading3 = {
|
|
237
|
+
title: "Heading 3",
|
|
238
|
+
description: "Small heading.",
|
|
239
|
+
searchTerms: ["h3", "subtitle", "small"],
|
|
240
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react6.Heading3, { className: "mly-h-4 mly-w-4" }),
|
|
241
|
+
command: ({ editor, range }) => {
|
|
242
|
+
editor.chain().focus().deleteRange(range).setNode("heading", { level: 3 }).run();
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
var hardBreak = {
|
|
246
|
+
title: "Hard Break",
|
|
247
|
+
description: "Add a break between lines.",
|
|
248
|
+
searchTerms: ["break", "line"],
|
|
249
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react6.DivideIcon, { className: "mly-h-4 mly-w-4" }),
|
|
250
|
+
command: ({ editor, range }) => {
|
|
251
|
+
editor.chain().focus().deleteRange(range).setHardBreak().run();
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var blockquote = {
|
|
255
|
+
title: "Blockquote",
|
|
256
|
+
description: "Add blockquote.",
|
|
257
|
+
searchTerms: ["quote", "blockquote"],
|
|
258
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react6.TextQuote, { className: "mly-h-4 mly-w-4" }),
|
|
259
|
+
command: ({ editor, range }) => {
|
|
260
|
+
editor.chain().focus().deleteRange(range).toggleBlockquote().run();
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
var footer = {
|
|
264
|
+
title: "Footer",
|
|
265
|
+
description: "Add a footer text to email.",
|
|
266
|
+
searchTerms: ["footer", "text"],
|
|
267
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react6.FootprintsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
268
|
+
command: ({ editor, range }) => {
|
|
269
|
+
editor.chain().focus().deleteRange(range).setFooter().run();
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
var clearLine = {
|
|
273
|
+
title: "Clear Line",
|
|
274
|
+
description: "Clear the current line.",
|
|
275
|
+
searchTerms: ["clear", "line"],
|
|
276
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react6.EraserIcon, { className: "mly-h-4 mly-w-4" }),
|
|
277
|
+
command: ({ editor, range }) => {
|
|
278
|
+
editor.chain().focus().selectParentNode().deleteSelection().run();
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
282
|
+
0 && (module.exports = {
|
|
283
|
+
blockquote,
|
|
284
|
+
bulletList,
|
|
285
|
+
button,
|
|
286
|
+
clearLine,
|
|
287
|
+
columns,
|
|
288
|
+
divider,
|
|
289
|
+
footer,
|
|
290
|
+
hardBreak,
|
|
291
|
+
heading1,
|
|
292
|
+
heading2,
|
|
293
|
+
heading3,
|
|
294
|
+
htmlCodeBlock,
|
|
295
|
+
image,
|
|
296
|
+
inlineImage,
|
|
297
|
+
linkCard,
|
|
298
|
+
logo,
|
|
299
|
+
orderedList,
|
|
300
|
+
repeat,
|
|
301
|
+
section,
|
|
302
|
+
spacer,
|
|
303
|
+
text
|
|
304
|
+
});
|
|
305
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/blocks.ts","../../src/blocks/button.tsx","../../src/blocks/code.tsx","../../src/blocks/image.tsx","../../src/blocks/layout.tsx","../../src/blocks/list.tsx","../../src/blocks/typography.tsx"],"sourcesContent":["export * from './blocks/button';\nexport * from './blocks/code';\nexport * from './blocks/image';\nexport * from './blocks/layout';\nexport * from './blocks/list';\nexport * from './blocks/types';\nexport * from './blocks/typography';\n","import type { BlockItem } from './types';\nimport { MousePointer, ArrowUpRightSquare } from 'lucide-react';\n\nexport const button: BlockItem = {\n title: 'Button',\n description: 'Add a call to action button to email.',\n searchTerms: ['link', 'button', 'cta'],\n icon: <MousePointer className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).setButton().run();\n },\n};\n\nexport const linkCard: BlockItem = {\n title: 'Link Card',\n description: 'Add a link card to email.',\n searchTerms: ['link', 'button', 'image'],\n icon: <ArrowUpRightSquare className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).setLinkCard().run();\n },\n render: (editor) => {\n return editor.extensionManager.extensions.findIndex(\n (ext) => ext.name === 'linkCard'\n ) === -1\n ? null\n : true;\n },\n};\n","import { CodeXmlIcon } from 'lucide-react';\nimport { BlockItem } from './types';\n\nexport const htmlCodeBlock: BlockItem = {\n title: 'Custom HTML',\n description: 'Insert a custom HTML block',\n searchTerms: ['html', 'code', 'custom'],\n icon: <CodeXmlIcon className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor\n .chain()\n .focus()\n .deleteRange(range)\n // @ts-ignore\n .setHtmlCodeBlock({ language: 'html' })\n .run();\n },\n};\n","import { NodeSelection, Selection, TextSelection } from '@tiptap/pm/state';\nimport type { BlockItem } from './types';\nimport { ImageIcon } from 'lucide-react';\n\nexport const image: BlockItem = {\n title: 'Image',\n description: 'Full width image',\n searchTerms: ['image'],\n icon: <ImageIcon className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).setImage({ src: '' }).run();\n },\n};\n\nexport const logo: BlockItem = {\n title: 'Logo',\n description: 'Add your brand logo',\n searchTerms: ['image', 'logo'],\n icon: <ImageIcon className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).setLogoImage({ src: '' }).run();\n },\n};\n\nexport const inlineImage: BlockItem = {\n title: 'Inline Image',\n description: 'Inline image',\n searchTerms: ['image', 'inline'],\n icon: <ImageIcon className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor\n .chain()\n .focus()\n .deleteRange(range)\n // @ts-ignore\n .setInlineImage({\n src: 'https://maily.to/brand/logo.png',\n })\n // @ts-ignore\n .command((props) => {\n const { tr, state, view, editor } = props;\n const { from } = range;\n\n const node = state.doc.nodeAt(from);\n if (!node) {\n return false;\n }\n\n const selection = TextSelection.create(\n tr.doc,\n from,\n from + node.nodeSize\n );\n tr.setSelection(selection);\n return true;\n })\n .run();\n },\n};\n","import type { BlockItem } from './types';\nimport {\n ColumnsIcon,\n Repeat2,\n MoveVertical,\n RectangleHorizontal,\n Minus,\n} from 'lucide-react';\n\nexport const columns: BlockItem = {\n title: 'Columns',\n description: 'Add columns to email.',\n searchTerms: ['layout', 'columns'],\n icon: <ColumnsIcon className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor\n .chain()\n .focus()\n .deleteRange(range)\n // @ts-ignore\n .setColumns()\n .focus(editor.state.selection.head - 2)\n .run();\n },\n};\n\nexport const section: BlockItem = {\n title: 'Section',\n description: 'Add a section to email.',\n searchTerms: ['layout', 'section'],\n icon: <RectangleHorizontal className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).setSection().run();\n },\n};\n\nexport const repeat: BlockItem = {\n title: 'Repeat',\n description: 'Loop over an array of items.',\n searchTerms: ['repeat', 'for', 'loop'],\n icon: <Repeat2 className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).setRepeat().run();\n },\n};\n\nexport const spacer: BlockItem = {\n title: 'Spacer',\n description: 'Add space between blocks.',\n searchTerms: ['space', 'gap', 'divider'],\n icon: <MoveVertical className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).setSpacer({ height: 'sm' }).run();\n },\n};\n\nexport const divider: BlockItem = {\n title: 'Divider',\n description: 'Add a horizontal divider.',\n searchTerms: ['divider', 'line'],\n icon: <Minus className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).setHorizontalRule().run();\n },\n};\n","import type { BlockItem } from './types';\nimport { List, ListOrdered } from 'lucide-react';\n\nexport const bulletList: BlockItem = {\n title: 'Bullet List',\n description: 'Create a simple bullet list.',\n searchTerms: ['unordered', 'point'],\n icon: <List className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).toggleBulletList().run();\n },\n};\n\nexport const orderedList: BlockItem = {\n title: 'Numbered List',\n description: 'Create a list with numbering.',\n searchTerms: ['ordered'],\n icon: <ListOrdered className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).toggleOrderedList().run();\n },\n};\n","import type { BlockItem } from './types';\nimport {\n Text,\n Heading1,\n Heading2,\n Heading3,\n DivideIcon,\n TextQuote,\n FootprintsIcon,\n EraserIcon,\n} from 'lucide-react';\n\nexport const text: BlockItem = {\n title: 'Text',\n description: 'Just start typing with plain text.',\n searchTerms: ['p', 'paragraph'],\n icon: <Text className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n editor\n .chain()\n .focus()\n .deleteRange(range)\n .toggleNode('paragraph', 'paragraph')\n .run();\n },\n};\n\nexport const heading1: BlockItem = {\n title: 'Heading 1',\n description: 'Big heading.',\n searchTerms: ['h1', 'title', 'big', 'large'],\n icon: <Heading1 className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n editor\n .chain()\n .focus()\n .deleteRange(range)\n .setNode('heading', { level: 1 })\n .run();\n },\n};\n\nexport const heading2: BlockItem = {\n title: 'Heading 2',\n description: 'Medium heading.',\n searchTerms: ['h2', 'subtitle', 'medium'],\n icon: <Heading2 className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n editor\n .chain()\n .focus()\n .deleteRange(range)\n .setNode('heading', { level: 2 })\n .run();\n },\n};\n\nexport const heading3: BlockItem = {\n title: 'Heading 3',\n description: 'Small heading.',\n searchTerms: ['h3', 'subtitle', 'small'],\n icon: <Heading3 className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n editor\n .chain()\n .focus()\n .deleteRange(range)\n .setNode('heading', { level: 3 })\n .run();\n },\n};\n\nexport const hardBreak: BlockItem = {\n title: 'Hard Break',\n description: 'Add a break between lines.',\n searchTerms: ['break', 'line'],\n icon: <DivideIcon className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).setHardBreak().run();\n },\n};\n\nexport const blockquote: BlockItem = {\n title: 'Blockquote',\n description: 'Add blockquote.',\n searchTerms: ['quote', 'blockquote'],\n icon: <TextQuote className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).toggleBlockquote().run();\n },\n};\n\nexport const footer: BlockItem = {\n title: 'Footer',\n description: 'Add a footer text to email.',\n searchTerms: ['footer', 'text'],\n icon: <FootprintsIcon className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().deleteRange(range).setFooter().run();\n },\n};\n\nexport const clearLine: BlockItem = {\n title: 'Clear Line',\n description: 'Clear the current line.',\n searchTerms: ['clear', 'line'],\n icon: <EraserIcon className=\"mly-h-4 mly-w-4\" />,\n command: ({ editor, range }) => {\n // @ts-ignore\n editor.chain().focus().selectParentNode().deleteSelection().run();\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,0BAAiD;AAMzC;AAJD,IAAM,SAAoB;AAAA,EAC/B,OAAO;AAAA,EACP,aAAa;AAAA,EACb,aAAa,CAAC,QAAQ,UAAU,KAAK;AAAA,EACrC,MAAM,4CAAC,oCAAa,WAAU,mBAAkB;AAAA,EAChD,SAAS,CAAC,EAAE,QAAQ,MAAM,MAAM;AAE9B,WAAO,MAAM,EAAE,MAAM,EAAE,YAAY,KAAK,EAAE,UAAU,EAAE,IAAI;AAAA,EAC5D;AACF;AAEO,IAAM,WAAsB;AAAA,EACjC,OAAO;AAAA,EACP,aAAa;AAAA,EACb,aAAa,CAAC,QAAQ,UAAU,OAAO;AAAA,EACvC,MAAM,4CAAC,0CAAmB,W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,EAC5D;AACF;AAEO,IAAM,YAAuB;AAAA,EAClC,OAAO;AAAA,EACP,aAAa;AAAA,EACb,aAAa,CAAC,SAAS,MAAM;AAAA,EAC7B,MAAM,6CAAC,mCAAW,WAAU,mBAAkB;AAAA,EAC9C,SAAS,CAAC,EAAE,QAAQ,MAAM,MAAM;AAE9B,WAAO,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,IAAI;AAAA,EAClE;AACF;","names":["import_lucide_react","import_jsx_runtime","import_lucide_react","import_jsx_runtime","editor","import_lucide_react","import_jsx_runtime","import_lucide_react","import_jsx_runtime","import_lucide_react","import_jsx_runtime"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Editor, Range } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
interface CommandProps {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
range: Range;
|
|
6
|
+
}
|
|
7
|
+
type BlockItem = {
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
searchTerms: string[];
|
|
11
|
+
icon?: JSX.Element;
|
|
12
|
+
render?: (editor: Editor) => JSX.Element | null | true;
|
|
13
|
+
preview?: string | ((editor: Editor) => JSX.Element | null);
|
|
14
|
+
} & ({
|
|
15
|
+
command: (options: CommandProps) => void;
|
|
16
|
+
id?: never;
|
|
17
|
+
commands?: never;
|
|
18
|
+
} | {
|
|
19
|
+
/**
|
|
20
|
+
* id to be used for the slash command query
|
|
21
|
+
* `headers.` will go inside the header subcommand
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
command?: never;
|
|
25
|
+
commands: BlockItem[];
|
|
26
|
+
});
|
|
27
|
+
type BlockGroupItem = {
|
|
28
|
+
title: string;
|
|
29
|
+
commands: BlockItem[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
declare const button: BlockItem;
|
|
33
|
+
declare const linkCard: BlockItem;
|
|
34
|
+
|
|
35
|
+
declare const htmlCodeBlock: BlockItem;
|
|
36
|
+
|
|
37
|
+
declare const image: BlockItem;
|
|
38
|
+
declare const logo: BlockItem;
|
|
39
|
+
declare const inlineImage: BlockItem;
|
|
40
|
+
|
|
41
|
+
declare const columns: BlockItem;
|
|
42
|
+
declare const section: BlockItem;
|
|
43
|
+
declare const repeat: BlockItem;
|
|
44
|
+
declare const spacer: BlockItem;
|
|
45
|
+
declare const divider: BlockItem;
|
|
46
|
+
|
|
47
|
+
declare const bulletList: BlockItem;
|
|
48
|
+
declare const orderedList: BlockItem;
|
|
49
|
+
|
|
50
|
+
declare const text: BlockItem;
|
|
51
|
+
declare const heading1: BlockItem;
|
|
52
|
+
declare const heading2: BlockItem;
|
|
53
|
+
declare const heading3: BlockItem;
|
|
54
|
+
declare const hardBreak: BlockItem;
|
|
55
|
+
declare const blockquote: BlockItem;
|
|
56
|
+
declare const footer: BlockItem;
|
|
57
|
+
declare const clearLine: BlockItem;
|
|
58
|
+
|
|
59
|
+
export { type BlockGroupItem, type BlockItem, type CommandProps, blockquote, bulletList, button, clearLine, columns, divider, footer, hardBreak, heading1, heading2, heading3, htmlCodeBlock, image, inlineImage, linkCard, logo, orderedList, repeat, section, spacer, text };
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ type BlockGroupItem = {
|
|
|
32
32
|
declare const button: BlockItem;
|
|
33
33
|
declare const linkCard: BlockItem;
|
|
34
34
|
|
|
35
|
+
declare const htmlCodeBlock: BlockItem;
|
|
36
|
+
|
|
35
37
|
declare const image: BlockItem;
|
|
36
38
|
declare const logo: BlockItem;
|
|
37
39
|
declare const inlineImage: BlockItem;
|
|
@@ -54,4 +56,4 @@ declare const blockquote: BlockItem;
|
|
|
54
56
|
declare const footer: BlockItem;
|
|
55
57
|
declare const clearLine: BlockItem;
|
|
56
58
|
|
|
57
|
-
export { type BlockGroupItem, type BlockItem, blockquote, bulletList, button, clearLine, columns, divider, footer, hardBreak, heading1, heading2, heading3, image, inlineImage, linkCard, logo, orderedList, repeat, section, spacer, text };
|
|
59
|
+
export { type BlockGroupItem, type BlockItem, type CommandProps, blockquote, bulletList, button, clearLine, columns, divider, footer, hardBreak, heading1, heading2, heading3, htmlCodeBlock, image, inlineImage, linkCard, logo, orderedList, repeat, section, spacer, text };
|
package/dist/blocks/index.mjs
CHANGED
|
@@ -25,15 +25,28 @@ var linkCard = {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
// src/blocks/code.tsx
|
|
29
|
+
import { CodeXmlIcon } from "lucide-react";
|
|
30
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
31
|
+
var htmlCodeBlock = {
|
|
32
|
+
title: "Custom HTML",
|
|
33
|
+
description: "Insert a custom HTML block",
|
|
34
|
+
searchTerms: ["html", "code", "custom"],
|
|
35
|
+
icon: /* @__PURE__ */ jsx2(CodeXmlIcon, { className: "mly-h-4 mly-w-4" }),
|
|
36
|
+
command: ({ editor, range }) => {
|
|
37
|
+
editor.chain().focus().deleteRange(range).setHtmlCodeBlock({ language: "html" }).run();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
28
41
|
// src/blocks/image.tsx
|
|
29
42
|
import { TextSelection } from "@tiptap/pm/state";
|
|
30
43
|
import { ImageIcon } from "lucide-react";
|
|
31
|
-
import { jsx as
|
|
44
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
32
45
|
var image = {
|
|
33
46
|
title: "Image",
|
|
34
47
|
description: "Full width image",
|
|
35
48
|
searchTerms: ["image"],
|
|
36
|
-
icon: /* @__PURE__ */
|
|
49
|
+
icon: /* @__PURE__ */ jsx3(ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
37
50
|
command: ({ editor, range }) => {
|
|
38
51
|
editor.chain().focus().deleteRange(range).setImage({ src: "" }).run();
|
|
39
52
|
}
|
|
@@ -42,7 +55,7 @@ var logo = {
|
|
|
42
55
|
title: "Logo",
|
|
43
56
|
description: "Add your brand logo",
|
|
44
57
|
searchTerms: ["image", "logo"],
|
|
45
|
-
icon: /* @__PURE__ */
|
|
58
|
+
icon: /* @__PURE__ */ jsx3(ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
46
59
|
command: ({ editor, range }) => {
|
|
47
60
|
editor.chain().focus().deleteRange(range).setLogoImage({ src: "" }).run();
|
|
48
61
|
}
|
|
@@ -51,10 +64,10 @@ var inlineImage = {
|
|
|
51
64
|
title: "Inline Image",
|
|
52
65
|
description: "Inline image",
|
|
53
66
|
searchTerms: ["image", "inline"],
|
|
54
|
-
icon: /* @__PURE__ */
|
|
67
|
+
icon: /* @__PURE__ */ jsx3(ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
55
68
|
command: ({ editor, range }) => {
|
|
56
69
|
editor.chain().focus().deleteRange(range).setInlineImage({
|
|
57
|
-
src: ""
|
|
70
|
+
src: "https://maily.to/brand/logo.png"
|
|
58
71
|
}).command((props) => {
|
|
59
72
|
const { tr, state, view, editor: editor2 } = props;
|
|
60
73
|
const { from } = range;
|
|
@@ -81,12 +94,12 @@ import {
|
|
|
81
94
|
RectangleHorizontal,
|
|
82
95
|
Minus
|
|
83
96
|
} from "lucide-react";
|
|
84
|
-
import { jsx as
|
|
97
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
85
98
|
var columns = {
|
|
86
99
|
title: "Columns",
|
|
87
100
|
description: "Add columns to email.",
|
|
88
101
|
searchTerms: ["layout", "columns"],
|
|
89
|
-
icon: /* @__PURE__ */
|
|
102
|
+
icon: /* @__PURE__ */ jsx4(ColumnsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
90
103
|
command: ({ editor, range }) => {
|
|
91
104
|
editor.chain().focus().deleteRange(range).setColumns().focus(editor.state.selection.head - 2).run();
|
|
92
105
|
}
|
|
@@ -95,7 +108,7 @@ var section = {
|
|
|
95
108
|
title: "Section",
|
|
96
109
|
description: "Add a section to email.",
|
|
97
110
|
searchTerms: ["layout", "section"],
|
|
98
|
-
icon: /* @__PURE__ */
|
|
111
|
+
icon: /* @__PURE__ */ jsx4(RectangleHorizontal, { className: "mly-h-4 mly-w-4" }),
|
|
99
112
|
command: ({ editor, range }) => {
|
|
100
113
|
editor.chain().focus().deleteRange(range).setSection().run();
|
|
101
114
|
}
|
|
@@ -104,7 +117,7 @@ var repeat = {
|
|
|
104
117
|
title: "Repeat",
|
|
105
118
|
description: "Loop over an array of items.",
|
|
106
119
|
searchTerms: ["repeat", "for", "loop"],
|
|
107
|
-
icon: /* @__PURE__ */
|
|
120
|
+
icon: /* @__PURE__ */ jsx4(Repeat2, { className: "mly-h-4 mly-w-4" }),
|
|
108
121
|
command: ({ editor, range }) => {
|
|
109
122
|
editor.chain().focus().deleteRange(range).setRepeat().run();
|
|
110
123
|
}
|
|
@@ -113,7 +126,7 @@ var spacer = {
|
|
|
113
126
|
title: "Spacer",
|
|
114
127
|
description: "Add space between blocks.",
|
|
115
128
|
searchTerms: ["space", "gap", "divider"],
|
|
116
|
-
icon: /* @__PURE__ */
|
|
129
|
+
icon: /* @__PURE__ */ jsx4(MoveVertical, { className: "mly-h-4 mly-w-4" }),
|
|
117
130
|
command: ({ editor, range }) => {
|
|
118
131
|
editor.chain().focus().deleteRange(range).setSpacer({ height: "sm" }).run();
|
|
119
132
|
}
|
|
@@ -122,7 +135,7 @@ var divider = {
|
|
|
122
135
|
title: "Divider",
|
|
123
136
|
description: "Add a horizontal divider.",
|
|
124
137
|
searchTerms: ["divider", "line"],
|
|
125
|
-
icon: /* @__PURE__ */
|
|
138
|
+
icon: /* @__PURE__ */ jsx4(Minus, { className: "mly-h-4 mly-w-4" }),
|
|
126
139
|
command: ({ editor, range }) => {
|
|
127
140
|
editor.chain().focus().deleteRange(range).setHorizontalRule().run();
|
|
128
141
|
}
|
|
@@ -130,12 +143,12 @@ var divider = {
|
|
|
130
143
|
|
|
131
144
|
// src/blocks/list.tsx
|
|
132
145
|
import { List, ListOrdered } from "lucide-react";
|
|
133
|
-
import { jsx as
|
|
146
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
134
147
|
var bulletList = {
|
|
135
148
|
title: "Bullet List",
|
|
136
149
|
description: "Create a simple bullet list.",
|
|
137
150
|
searchTerms: ["unordered", "point"],
|
|
138
|
-
icon: /* @__PURE__ */
|
|
151
|
+
icon: /* @__PURE__ */ jsx5(List, { className: "mly-h-4 mly-w-4" }),
|
|
139
152
|
command: ({ editor, range }) => {
|
|
140
153
|
editor.chain().focus().deleteRange(range).toggleBulletList().run();
|
|
141
154
|
}
|
|
@@ -144,7 +157,7 @@ var orderedList = {
|
|
|
144
157
|
title: "Numbered List",
|
|
145
158
|
description: "Create a list with numbering.",
|
|
146
159
|
searchTerms: ["ordered"],
|
|
147
|
-
icon: /* @__PURE__ */
|
|
160
|
+
icon: /* @__PURE__ */ jsx5(ListOrdered, { className: "mly-h-4 mly-w-4" }),
|
|
148
161
|
command: ({ editor, range }) => {
|
|
149
162
|
editor.chain().focus().deleteRange(range).toggleOrderedList().run();
|
|
150
163
|
}
|
|
@@ -161,12 +174,12 @@ import {
|
|
|
161
174
|
FootprintsIcon,
|
|
162
175
|
EraserIcon
|
|
163
176
|
} from "lucide-react";
|
|
164
|
-
import { jsx as
|
|
177
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
165
178
|
var text = {
|
|
166
179
|
title: "Text",
|
|
167
180
|
description: "Just start typing with plain text.",
|
|
168
181
|
searchTerms: ["p", "paragraph"],
|
|
169
|
-
icon: /* @__PURE__ */
|
|
182
|
+
icon: /* @__PURE__ */ jsx6(Text, { className: "mly-h-4 mly-w-4" }),
|
|
170
183
|
command: ({ editor, range }) => {
|
|
171
184
|
editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").run();
|
|
172
185
|
}
|
|
@@ -174,8 +187,8 @@ var text = {
|
|
|
174
187
|
var heading1 = {
|
|
175
188
|
title: "Heading 1",
|
|
176
189
|
description: "Big heading.",
|
|
177
|
-
searchTerms: ["title", "big", "large"],
|
|
178
|
-
icon: /* @__PURE__ */
|
|
190
|
+
searchTerms: ["h1", "title", "big", "large"],
|
|
191
|
+
icon: /* @__PURE__ */ jsx6(Heading1, { className: "mly-h-4 mly-w-4" }),
|
|
179
192
|
command: ({ editor, range }) => {
|
|
180
193
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 1 }).run();
|
|
181
194
|
}
|
|
@@ -183,8 +196,8 @@ var heading1 = {
|
|
|
183
196
|
var heading2 = {
|
|
184
197
|
title: "Heading 2",
|
|
185
198
|
description: "Medium heading.",
|
|
186
|
-
searchTerms: ["subtitle", "medium"],
|
|
187
|
-
icon: /* @__PURE__ */
|
|
199
|
+
searchTerms: ["h2", "subtitle", "medium"],
|
|
200
|
+
icon: /* @__PURE__ */ jsx6(Heading2, { className: "mly-h-4 mly-w-4" }),
|
|
188
201
|
command: ({ editor, range }) => {
|
|
189
202
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 2 }).run();
|
|
190
203
|
}
|
|
@@ -192,8 +205,8 @@ var heading2 = {
|
|
|
192
205
|
var heading3 = {
|
|
193
206
|
title: "Heading 3",
|
|
194
207
|
description: "Small heading.",
|
|
195
|
-
searchTerms: ["subtitle", "small"],
|
|
196
|
-
icon: /* @__PURE__ */
|
|
208
|
+
searchTerms: ["h3", "subtitle", "small"],
|
|
209
|
+
icon: /* @__PURE__ */ jsx6(Heading3, { className: "mly-h-4 mly-w-4" }),
|
|
197
210
|
command: ({ editor, range }) => {
|
|
198
211
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 3 }).run();
|
|
199
212
|
}
|
|
@@ -202,7 +215,7 @@ var hardBreak = {
|
|
|
202
215
|
title: "Hard Break",
|
|
203
216
|
description: "Add a break between lines.",
|
|
204
217
|
searchTerms: ["break", "line"],
|
|
205
|
-
icon: /* @__PURE__ */
|
|
218
|
+
icon: /* @__PURE__ */ jsx6(DivideIcon, { className: "mly-h-4 mly-w-4" }),
|
|
206
219
|
command: ({ editor, range }) => {
|
|
207
220
|
editor.chain().focus().deleteRange(range).setHardBreak().run();
|
|
208
221
|
}
|
|
@@ -211,7 +224,7 @@ var blockquote = {
|
|
|
211
224
|
title: "Blockquote",
|
|
212
225
|
description: "Add blockquote.",
|
|
213
226
|
searchTerms: ["quote", "blockquote"],
|
|
214
|
-
icon: /* @__PURE__ */
|
|
227
|
+
icon: /* @__PURE__ */ jsx6(TextQuote, { className: "mly-h-4 mly-w-4" }),
|
|
215
228
|
command: ({ editor, range }) => {
|
|
216
229
|
editor.chain().focus().deleteRange(range).toggleBlockquote().run();
|
|
217
230
|
}
|
|
@@ -220,7 +233,7 @@ var footer = {
|
|
|
220
233
|
title: "Footer",
|
|
221
234
|
description: "Add a footer text to email.",
|
|
222
235
|
searchTerms: ["footer", "text"],
|
|
223
|
-
icon: /* @__PURE__ */
|
|
236
|
+
icon: /* @__PURE__ */ jsx6(FootprintsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
224
237
|
command: ({ editor, range }) => {
|
|
225
238
|
editor.chain().focus().deleteRange(range).setFooter().run();
|
|
226
239
|
}
|
|
@@ -229,7 +242,7 @@ var clearLine = {
|
|
|
229
242
|
title: "Clear Line",
|
|
230
243
|
description: "Clear the current line.",
|
|
231
244
|
searchTerms: ["clear", "line"],
|
|
232
|
-
icon: /* @__PURE__ */
|
|
245
|
+
icon: /* @__PURE__ */ jsx6(EraserIcon, { className: "mly-h-4 mly-w-4" }),
|
|
233
246
|
command: ({ editor, range }) => {
|
|
234
247
|
editor.chain().focus().selectParentNode().deleteSelection().run();
|
|
235
248
|
}
|
|
@@ -246,6 +259,7 @@ export {
|
|
|
246
259
|
heading1,
|
|
247
260
|
heading2,
|
|
248
261
|
heading3,
|
|
262
|
+
htmlCodeBlock,
|
|
249
263
|
image,
|
|
250
264
|
inlineImage,
|
|
251
265
|
linkCard,
|