@leochen0204/grapesjs-mjml 1.0.7-fork-rc.0
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/LICENSE +25 -0
- package/README.md +13 -0
- package/dist/index.d.ts +141 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/locale/ca.js +51 -0
- package/locale/de.js +52 -0
- package/locale/en.js +52 -0
- package/locale/es.js +51 -0
- package/locale/fr.js +52 -0
- package/locale/he.js +52 -0
- package/locale/index.js +69 -0
- package/locale/nl.js +52 -0
- package/locale/pl.js +52 -0
- package/locale/pt.js +52 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Copyright (c) 2017-current, Artur Arseniev
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
5
|
+
are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
- Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
- Redistributions in binary form must reproduce the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
11
|
+
other materials provided with the distribution.
|
|
12
|
+
- Neither the name "GrapesJS" nor the names of its contributors may be
|
|
13
|
+
used to endorse or promote products derived from this software without
|
|
14
|
+
specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
17
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
20
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
21
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
22
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
23
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
24
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Editor, Plugin } from 'grapesjs';
|
|
2
|
+
import mjml from 'mjml-core';
|
|
3
|
+
import { MJMLParsingOptions } from 'mjml-core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MJML Parser.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://github.com/mjmlio/mjml/tree/master/packages/mjml-core}
|
|
9
|
+
*/
|
|
10
|
+
export type MjmlParser = typeof mjml;
|
|
11
|
+
declare const componentsToQuery: (cmps: string | string[]) => string;
|
|
12
|
+
export type ComponentPluginOptions = {
|
|
13
|
+
/**
|
|
14
|
+
* Core model, which can be extended
|
|
15
|
+
*/
|
|
16
|
+
coreMjmlModel: any;
|
|
17
|
+
/**
|
|
18
|
+
* Core view, which can be extended
|
|
19
|
+
*/
|
|
20
|
+
coreMjmlView: any;
|
|
21
|
+
opt: Required<PluginOptions>;
|
|
22
|
+
sandboxEl: HTMLDivElement;
|
|
23
|
+
componentsToQuery: typeof componentsToQuery;
|
|
24
|
+
};
|
|
25
|
+
export interface CommandOptionsMjmlToHtml extends MJMLParsingOptions {
|
|
26
|
+
mjml?: string;
|
|
27
|
+
}
|
|
28
|
+
export type PluginOptions = {
|
|
29
|
+
/**
|
|
30
|
+
* Which blocks to add.
|
|
31
|
+
* @default (all)
|
|
32
|
+
*/
|
|
33
|
+
blocks?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Add custom block options, based on block id.
|
|
36
|
+
* @default (blockId) => ({})
|
|
37
|
+
* @example (blockId) => (blockId === 'mj-hero' ? { attributes: {...} } : {})
|
|
38
|
+
*/
|
|
39
|
+
block?: (blockId: string) => {};
|
|
40
|
+
/**
|
|
41
|
+
* Code viewer theme.
|
|
42
|
+
* @default 'hopscotch'
|
|
43
|
+
*/
|
|
44
|
+
codeViewerTheme?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Add custom MJML components
|
|
47
|
+
*
|
|
48
|
+
* @default []
|
|
49
|
+
*/
|
|
50
|
+
customComponents?: ((editor: Editor, componentOptions: ComponentPluginOptions) => void)[];
|
|
51
|
+
/**
|
|
52
|
+
* Placeholder MJML template for the import modal
|
|
53
|
+
* @default ''
|
|
54
|
+
*/
|
|
55
|
+
importPlaceholder?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Image placeholder source for mj-image block
|
|
58
|
+
* @default ''
|
|
59
|
+
*/
|
|
60
|
+
imagePlaceholderSrc?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Custom MJML parser.
|
|
63
|
+
* @default mjml-browser instance
|
|
64
|
+
*/
|
|
65
|
+
mjmlParser?: MjmlParser;
|
|
66
|
+
/**
|
|
67
|
+
* Overwrite default export command
|
|
68
|
+
* @default true
|
|
69
|
+
*/
|
|
70
|
+
overwriteExport?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* String before the MJML in export code
|
|
73
|
+
* @default ''
|
|
74
|
+
*/
|
|
75
|
+
preMjml?: string;
|
|
76
|
+
/**
|
|
77
|
+
* String after the MJML in export code
|
|
78
|
+
* @default ''
|
|
79
|
+
*/
|
|
80
|
+
postMjml?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Clean all previous blocks if true
|
|
83
|
+
* @default true
|
|
84
|
+
*/
|
|
85
|
+
resetBlocks?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Reset the Style Manager and add new properties for MJML
|
|
88
|
+
* @default true
|
|
89
|
+
*/
|
|
90
|
+
resetStyleManager?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Clean all previous devices and set a new one for mobile
|
|
93
|
+
* @default true
|
|
94
|
+
*/
|
|
95
|
+
resetDevices?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Hide the default selector manager
|
|
98
|
+
* @default true
|
|
99
|
+
*/
|
|
100
|
+
hideSelector?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Experimental: use XML parser instead of HTML.
|
|
103
|
+
* This should allow importing void MJML elements (without closing tags) like <mj-image/>.
|
|
104
|
+
* @default false
|
|
105
|
+
* @experimental
|
|
106
|
+
*/
|
|
107
|
+
useXmlParser?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Column padding (this way it's easier to select columns)
|
|
110
|
+
* @default '10px 0'
|
|
111
|
+
*/
|
|
112
|
+
columnsPadding?: string;
|
|
113
|
+
/**
|
|
114
|
+
* I18n object containing languages, [more info](https://grapesjs.com/docs/modules/I18n.html#configuration).
|
|
115
|
+
* @default {}
|
|
116
|
+
*/
|
|
117
|
+
i18n?: Record<string, any>;
|
|
118
|
+
/**
|
|
119
|
+
* Custom fonts on exported HTML header, [more info](https://github.com/mjmlio/mjml#inside-nodejs).
|
|
120
|
+
* @default {}
|
|
121
|
+
* @example
|
|
122
|
+
* {
|
|
123
|
+
* Montserrat: 'https://fonts.googleapis.com/css?family=Montserrat',
|
|
124
|
+
* 'Open Sans': 'https://fonts.googleapis.com/css?family=Open+Sans'
|
|
125
|
+
* }
|
|
126
|
+
*/
|
|
127
|
+
fonts?: Record<string, any>;
|
|
128
|
+
/**
|
|
129
|
+
* Load custom preset theme.
|
|
130
|
+
* @default true
|
|
131
|
+
*/
|
|
132
|
+
useCustomTheme?: boolean;
|
|
133
|
+
};
|
|
134
|
+
export type RequiredPluginOptions = Required<PluginOptions>;
|
|
135
|
+
declare const plugin: Plugin<PluginOptions>;
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
plugin as default,
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export {};
|