@maily-to/core 0.0.22 → 0.0.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maily-to/core",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "Powerful editor for creating beautiful, pre-designed, mobile-ready emails.",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
@@ -20,6 +20,11 @@
20
20
  "browser": "./dist/blocks/index.mjs",
21
21
  "import": "./dist/blocks/index.mjs",
22
22
  "require": "./dist/blocks/index.js"
23
+ },
24
+ "./extensions": {
25
+ "browser": "./dist/extensions/index.mjs",
26
+ "import": "./dist/extensions/index.mjs",
27
+ "require": "./dist/extensions/index.js"
23
28
  }
24
29
  },
25
30
  "typesVersions": {
@@ -29,6 +34,9 @@
29
34
  ],
30
35
  "blocks": [
31
36
  "dist/blocks/index.d.ts"
37
+ ],
38
+ "extensions": [
39
+ "dist/extensions/index.d.ts"
32
40
  ]
33
41
  }
34
42
  },
@@ -80,14 +88,14 @@
80
88
  "@tiptap/starter-kit": "^2.9.1",
81
89
  "@tiptap/suggestion": "^2.9.1",
82
90
  "clsx": "^2.1.1",
83
- "echo-drag-handle-plugin": "^0.0.2",
84
91
  "fast-deep-equal": "^3.1.3",
85
92
  "lucide-react": "^0.453.0",
86
93
  "react-colorful": "^5.6.1",
87
94
  "tailwind-merge": "^2.5.4",
88
95
  "tailwindcss": "^3.4.14",
89
96
  "tippy.js": "^6.3.7",
90
- "uuid": "^10.0.0"
97
+ "uuid": "^10.0.0",
98
+ "y-prosemirror": "^1.2.15"
91
99
  },
92
100
  "devDependencies": {
93
101
  "@types/react": "^18.3.12",
package/readme.md CHANGED
@@ -116,6 +116,56 @@ You can pass variables to the editor in two ways:
116
116
 
117
117
  See the [@maily-to/render](../render) package for more information on how to render the editor content to HTML.
118
118
 
119
+ ### Extensions
120
+
121
+ Extensions are a way to extend the editor's functionality. You can add custom blocks, marks, or extend the editor's functionality using extensions.
122
+
123
+ ```tsx
124
+ // (Omitted repeated imports)
125
+ import { MailyKit, VariableExtension, getVariableSuggestions } from '@maily-to/core/extensions';
126
+
127
+ <Editor
128
+ extensions={[
129
+ MailyKit.configure({
130
+ // do disable the link card node
131
+ linkCard: false,
132
+ }),
133
+ // it will extend the variable extension
134
+ // and provide suggestions for variables
135
+ VariableExtension.extend({
136
+ addNodeView() {
137
+ // now you can replace the default
138
+ // VariableView with your custom view
139
+ return ReactNodeViewRenderer(VariableView, {
140
+ className: 'mly-relative mly-inline-block',
141
+ as: 'div',
142
+ });
143
+ },
144
+ }).configure({
145
+ suggestions: getVariableSuggestions(
146
+ variables,
147
+ variableTriggerCharacter
148
+ ),
149
+ }),
150
+ ]}
151
+ />
152
+ ```
153
+
154
+ Or, you can add your own custom extensions, like shown below:
155
+
156
+ ```tsx
157
+ // (Omitted repeated imports)
158
+ import { CustomExtension } from './extensions/custom-extension';
159
+
160
+ <Editor
161
+ extensions={[
162
+ CustomExtension.configure({
163
+ // your configuration
164
+ }),
165
+ ]}
166
+ />
167
+ ```
168
+
119
169
  ## License
120
170
 
121
171
  MIT &copy; [Arik Chakma](https://twitter.com/imarikchakma)