@studiocms/wysiwyg 0.1.0-experimental.5 → 0.1.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 +1 -1
- package/README.md +7 -28
- package/dist/common/gjs-blocks.d.ts +4 -0
- package/dist/common/gjs-blocks.js +27 -0
- package/dist/common/gjs-componentRegistry.d.ts +31 -0
- package/dist/common/gjs-componentRegistry.js +59 -0
- package/dist/common/gjs-editor-settings.d.ts +23 -0
- package/dist/common/gjs-editor-settings.js +357 -0
- package/dist/common/gjs-editor-utils.d.ts +165 -0
- package/dist/common/gjs-editor-utils.js +217 -0
- package/dist/common/grapesBlocks/blocks/basics.d.ts +4 -0
- package/dist/common/grapesBlocks/blocks/basics.js +279 -0
- package/dist/common/grapesBlocks/blocks/extras.d.ts +4 -0
- package/dist/common/grapesBlocks/blocks/extras.js +63 -0
- package/dist/common/grapesBlocks/blocks/forms.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins/forms/blocks.js → common/grapesBlocks/blocks/forms.js} +15 -14
- package/dist/common/grapesBlocks/blocks/index.d.ts +5 -0
- package/dist/common/grapesBlocks/blocks/index.js +23 -0
- package/dist/common/grapesBlocks/blocks/tabs.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins/tabs/blocks.js → common/grapesBlocks/blocks/tabs.js} +9 -8
- package/dist/common/grapesBlocks/commands/clear.d.ts +4 -0
- package/dist/common/grapesBlocks/commands/clear.js +21 -0
- package/dist/common/grapesBlocks/commands/customCodeCommands.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins/code/commands.js → common/grapesBlocks/commands/customCodeCommands.js} +11 -9
- package/dist/common/grapesBlocks/commands/deviceCommands.js +23 -0
- package/dist/common/grapesBlocks/commands/index.d.ts +5 -0
- package/dist/common/grapesBlocks/commands/index.js +40 -0
- package/dist/common/grapesBlocks/commands/openImport.d.ts +4 -0
- package/dist/common/grapesBlocks/commands/openImport.js +71 -0
- package/dist/common/grapesBlocks/components/countdown.d.ts +12 -0
- package/dist/common/grapesBlocks/components/countdown.js +147 -0
- package/dist/common/grapesBlocks/components/customCode.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins/code/components.js → common/grapesBlocks/components/customCode.js} +16 -15
- package/dist/common/grapesBlocks/components/forms.d.ts +3 -0
- package/dist/{wysiwyg/editorPlugins/forms/components.js → common/grapesBlocks/components/forms.js} +30 -36
- package/dist/common/grapesBlocks/components/index.d.ts +5 -0
- package/dist/common/grapesBlocks/components/index.js +23 -0
- package/dist/common/grapesBlocks/components/tabLoader.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins/tabs/components/index.js → common/grapesBlocks/components/tabLoader.js} +7 -7
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tab.d.ts +1 -1
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tab.js +2 -2
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContainer.d.ts +1 -1
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContent.d.ts +1 -1
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContents.d.ts +1 -1
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tabs.d.ts +1 -1
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tabs.js +8 -8
- package/dist/common/grapesBlocks/components/tooltip.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins → common/grapesBlocks/components}/tooltip.js +15 -87
- package/dist/common/grapesBlocks/components/typed.d.ts +9 -0
- package/dist/{wysiwyg/editorPlugins/typed/components.js → common/grapesBlocks/components/typed.js} +7 -7
- package/dist/common/grapesBlocks/consts.d.ts +25 -0
- package/dist/common/grapesBlocks/consts.js +245 -0
- package/dist/common/grapesBlocks/i18n/index.d.ts +3 -0
- package/dist/common/grapesBlocks/i18n/index.js +19 -0
- package/dist/common/grapesBlocks/panels/index.d.ts +4 -0
- package/dist/common/grapesBlocks/panels/index.js +171 -0
- package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/colorPicker.d.ts +9 -0
- package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/colorPicker.js +16 -2
- package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/index.d.ts +3 -3
- package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/index.js +18 -12
- package/dist/common/grapesBlocks/selectors/index.d.ts +4 -0
- package/dist/common/grapesBlocks/selectors/index.js +9 -0
- package/dist/common/grapesBlocks/selectors/tooltip.d.ts +4 -0
- package/dist/common/grapesBlocks/selectors/tooltip.js +15 -0
- package/dist/common/grapesBlocks/traits/formTraits.d.ts +3 -0
- package/dist/{wysiwyg/editorPlugins/forms/traits.js → common/grapesBlocks/traits/formTraits.js} +12 -8
- package/dist/common/grapesBlocks/traits/index.d.ts +4 -0
- package/dist/common/grapesBlocks/traits/index.js +15 -0
- package/dist/common/grapesBlocks/traits/typedTraits.d.ts +3 -0
- package/dist/common/grapesBlocks/traits/typedTraits.js +24 -0
- package/dist/{wysiwyg/editorPlugins/tuiImageEditor.d.ts → common/grapesBlocks/tuiImageEditor/index.d.ts} +2 -2
- package/dist/{wysiwyg/editorPlugins/tuiImageEditor.js → common/grapesBlocks/tuiImageEditor/index.js} +6 -7
- package/dist/common/grapesBlocks/types.d.ts +446 -0
- package/dist/components/Editor.astro +153 -0
- package/dist/components/render.d.ts +15 -0
- package/dist/components/render.js +11 -0
- package/dist/consts.d.ts +31 -0
- package/dist/consts.js +15 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +71 -0
- package/dist/lib/db.d.ts +83 -0
- package/dist/lib/db.js +50 -0
- package/dist/lib/prerender.d.ts +10 -0
- package/dist/lib/prerender.js +22 -0
- package/dist/{wysiwyg → lib}/shared.d.ts +3 -6
- package/dist/lib/shared.js +6 -0
- package/dist/{utils.d.ts → lib/utils.d.ts} +1 -1
- package/dist/lib/utils.js +10 -0
- package/dist/routes/grapes.css.d.ts +7 -0
- package/dist/routes/grapes.css.js +13 -0
- package/dist/routes/partial.astro +44 -0
- package/dist/routes/store.d.ts +1 -0
- package/dist/routes/store.js +121 -0
- package/dist/schema.d.ts +60 -0
- package/dist/schema.js +24 -0
- package/dist/styles/editor.css +150 -0
- package/dist/styles/grapes.css +71 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.js +9 -0
- package/package.json +30 -28
- package/dist/common/prepareRender.d.ts +0 -11
- package/dist/common/prepareRender.js +0 -24
- package/dist/studio/components/Render.astro +0 -11
- package/dist/studio/components/StudioSDKEditor.astro +0 -334
- package/dist/studio/index.d.ts +0 -38
- package/dist/studio/index.js +0 -58
- package/dist/studio/routes/partial.astro +0 -27
- package/dist/studio/shared.d.ts +0 -17
- package/dist/studio/shared.js +0 -7
- package/dist/studio/utils.d.ts +0 -105
- package/dist/studio/utils.js +0 -244
- package/dist/studio/virtual.d.ts +0 -114
- package/dist/utils.js +0 -15
- package/dist/wysiwyg/components/Editor.astro +0 -765
- package/dist/wysiwyg/components/Render.astro +0 -11
- package/dist/wysiwyg/editorPlugins/blocks/blocks.d.ts +0 -3
- package/dist/wysiwyg/editorPlugins/blocks/blocks.js +0 -239
- package/dist/wysiwyg/editorPlugins/blocks/index.d.ts +0 -80
- package/dist/wysiwyg/editorPlugins/blocks/index.js +0 -26
- package/dist/wysiwyg/editorPlugins/code/blocks.d.ts +0 -4
- package/dist/wysiwyg/editorPlugins/code/blocks.js +0 -20
- package/dist/wysiwyg/editorPlugins/code/commands.d.ts +0 -4
- package/dist/wysiwyg/editorPlugins/code/components.d.ts +0 -4
- package/dist/wysiwyg/editorPlugins/code/index.d.ts +0 -47
- package/dist/wysiwyg/editorPlugins/code/index.js +0 -28
- package/dist/wysiwyg/editorPlugins/code/utils.d.ts +0 -3
- package/dist/wysiwyg/editorPlugins/code/utils.js +0 -8
- package/dist/wysiwyg/editorPlugins/countdown.d.ts +0 -86
- package/dist/wysiwyg/editorPlugins/countdown.js +0 -163
- package/dist/wysiwyg/editorPlugins/forms/blocks.d.ts +0 -3
- package/dist/wysiwyg/editorPlugins/forms/components.d.ts +0 -11
- package/dist/wysiwyg/editorPlugins/forms/index.d.ts +0 -21
- package/dist/wysiwyg/editorPlugins/forms/index.js +0 -18
- package/dist/wysiwyg/editorPlugins/forms/traits.d.ts +0 -2
- package/dist/wysiwyg/editorPlugins/index.d.ts +0 -9
- package/dist/wysiwyg/editorPlugins/index.js +0 -20
- package/dist/wysiwyg/editorPlugins/rte/styles.css +0 -63
- package/dist/wysiwyg/editorPlugins/tabs/blocks.d.ts +0 -3
- package/dist/wysiwyg/editorPlugins/tabs/components/index.d.ts +0 -4
- package/dist/wysiwyg/editorPlugins/tabs/index.d.ts +0 -5
- package/dist/wysiwyg/editorPlugins/tabs/index.js +0 -15
- package/dist/wysiwyg/editorPlugins/tabs/options.d.ts +0 -5
- package/dist/wysiwyg/editorPlugins/tabs/options.js +0 -80
- package/dist/wysiwyg/editorPlugins/tabs/types.d.ts +0 -81
- package/dist/wysiwyg/editorPlugins/tooltip.d.ts +0 -68
- package/dist/wysiwyg/editorPlugins/typed/blocks.d.ts +0 -4
- package/dist/wysiwyg/editorPlugins/typed/blocks.js +0 -15
- package/dist/wysiwyg/editorPlugins/typed/components.d.ts +0 -9
- package/dist/wysiwyg/editorPlugins/typed/index.d.ts +0 -35
- package/dist/wysiwyg/editorPlugins/typed/index.js +0 -18
- package/dist/wysiwyg/editorPlugins/typed/traits.js +0 -18
- package/dist/wysiwyg/editorPlugins/typed/utils.d.ts +0 -2
- package/dist/wysiwyg/editorPlugins/typed/utils.js +0 -6
- package/dist/wysiwyg/index.d.ts +0 -20
- package/dist/wysiwyg/index.js +0 -47
- package/dist/wysiwyg/routes/partial.astro +0 -27
- package/dist/wysiwyg/shared.js +0 -7
- package/dist/wysiwyg/styles/main.css +0 -52
- package/dist/wysiwyg/virtual.d.ts +0 -3
- /package/dist/{wysiwyg/editorPlugins/typed/traits.d.ts → common/grapesBlocks/commands/deviceCommands.d.ts} +0 -0
- /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContainer.js +0 -0
- /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContent.js +0 -0
- /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContents.js +0 -0
- /package/dist/{wysiwyg/editorPlugins/tabs → common/grapesBlocks}/types.js +0 -0
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
const plugin = (editor, opts = {}) => {
|
|
2
|
-
const options = {
|
|
3
|
-
id: "countdown",
|
|
4
|
-
label: "Countdown",
|
|
5
|
-
block: {},
|
|
6
|
-
props: {},
|
|
7
|
-
style: "",
|
|
8
|
-
styleAdditional: "",
|
|
9
|
-
startTime: "",
|
|
10
|
-
endText: "EXPIRED",
|
|
11
|
-
dateInputType: "date",
|
|
12
|
-
labelDays: "days",
|
|
13
|
-
labelHours: "hours",
|
|
14
|
-
labelMinutes: "minutes",
|
|
15
|
-
labelSeconds: "seconds",
|
|
16
|
-
classPrefix: "countdown",
|
|
17
|
-
...opts
|
|
18
|
-
};
|
|
19
|
-
const { block, props, style } = options;
|
|
20
|
-
const id = options.id;
|
|
21
|
-
const label = options.label;
|
|
22
|
-
const pfx = options.classPrefix;
|
|
23
|
-
if (block) {
|
|
24
|
-
editor.Blocks.add(id, {
|
|
25
|
-
media: `<svg viewBox="0 0 24 24">
|
|
26
|
-
<path fill="currentColor" d="M12 20C16.4 20 20 16.4 20 12S16.4 4 12 4 4 7.6 4 12 7.6 20 12 20M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22C6.5 22 2 17.5 2 12C2 6.5 6.5 2 12 2M17 11.5V13H11V7H12.5V11.5H17Z" />
|
|
27
|
-
</svg>`,
|
|
28
|
-
label,
|
|
29
|
-
category: "Extra",
|
|
30
|
-
select: true,
|
|
31
|
-
content: { type: id },
|
|
32
|
-
...block
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
const countdownScript = function(props2) {
|
|
36
|
-
const startfrom = props2.startfrom;
|
|
37
|
-
const endTxt = props2.endText;
|
|
38
|
-
const el = this;
|
|
39
|
-
const countDownDate = new Date(startfrom).getTime();
|
|
40
|
-
const countdownEl = el.querySelector("[data-js=countdown]");
|
|
41
|
-
const endTextEl = el.querySelector("[data-js=countdown-endtext]");
|
|
42
|
-
const dayEl = el.querySelector("[data-js=countdown-day]");
|
|
43
|
-
const hourEl = el.querySelector("[data-js=countdown-hour]");
|
|
44
|
-
const minuteEl = el.querySelector("[data-js=countdown-minute]");
|
|
45
|
-
const secondEl = el.querySelector("[data-js=countdown-second]");
|
|
46
|
-
const oldInterval = el.__gjsCountdownInterval;
|
|
47
|
-
oldInterval && clearInterval(oldInterval);
|
|
48
|
-
const connected = window.__gjsCountdownIntervals || [];
|
|
49
|
-
const toClean = [];
|
|
50
|
-
connected.forEach((item) => {
|
|
51
|
-
if (!item.isConnected) {
|
|
52
|
-
clearInterval(item.__gjsCountdownInterval);
|
|
53
|
-
toClean.push(item);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
connected.indexOf(el) < 0 && connected.push(el);
|
|
57
|
-
window.__gjsCountdownIntervals = connected.filter((item) => toClean.indexOf(item) < 0);
|
|
58
|
-
const setTimer = (days, hours, minutes, seconds) => {
|
|
59
|
-
dayEl.innerHTML = `${days < 10 ? `0${days}` : days}`;
|
|
60
|
-
hourEl.innerHTML = `${hours < 10 ? `0${hours}` : hours}`;
|
|
61
|
-
minuteEl.innerHTML = `${minutes < 10 ? `0${minutes}` : minutes}`;
|
|
62
|
-
secondEl.innerHTML = `${seconds < 10 ? `0${seconds}` : seconds}`;
|
|
63
|
-
};
|
|
64
|
-
const moveTimer = () => {
|
|
65
|
-
const now = (/* @__PURE__ */ new Date()).getTime();
|
|
66
|
-
const distance = countDownDate - now;
|
|
67
|
-
const days = Math.floor(distance / 864e5);
|
|
68
|
-
const hours = Math.floor(distance % 864e5 / 36e5);
|
|
69
|
-
const minutes = Math.floor(distance % 36e5 / 6e4);
|
|
70
|
-
const seconds = Math.floor(distance % 6e4 / 1e3);
|
|
71
|
-
setTimer(days, hours, minutes, seconds);
|
|
72
|
-
if (distance < 0) {
|
|
73
|
-
clearInterval(el.__gjsCountdownInterval);
|
|
74
|
-
endTextEl.innerHTML = endTxt;
|
|
75
|
-
countdownEl.style.display = "none";
|
|
76
|
-
endTextEl.style.display = "";
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
if (countDownDate) {
|
|
80
|
-
el.__gjsCountdownInterval = setInterval(moveTimer, 1e3);
|
|
81
|
-
endTextEl.style.display = "none";
|
|
82
|
-
countdownEl.style.display = "";
|
|
83
|
-
moveTimer();
|
|
84
|
-
} else {
|
|
85
|
-
setTimer(0, 0, 0, 0);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
editor.Components.addType(id, {
|
|
89
|
-
model: {
|
|
90
|
-
defaults: {
|
|
91
|
-
startfrom: options.startTime,
|
|
92
|
-
classes: [pfx],
|
|
93
|
-
endText: options.endText,
|
|
94
|
-
droppable: false,
|
|
95
|
-
script: countdownScript,
|
|
96
|
-
"script-props": ["startfrom", "endText"],
|
|
97
|
-
traits: [
|
|
98
|
-
{
|
|
99
|
-
label: "Start",
|
|
100
|
-
name: "startfrom",
|
|
101
|
-
changeProp: true,
|
|
102
|
-
type: options.dateInputType
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
label: "End text",
|
|
106
|
-
name: "endText",
|
|
107
|
-
changeProp: true
|
|
108
|
-
}
|
|
109
|
-
],
|
|
110
|
-
// @ts-ignore
|
|
111
|
-
components: `
|
|
112
|
-
<span data-js="countdown" class="${pfx}-cont">
|
|
113
|
-
<div class="${pfx}-block">
|
|
114
|
-
<div data-js="countdown-day" class="${pfx}-digit"></div>
|
|
115
|
-
<div class="${pfx}-label">${options.labelDays}</div>
|
|
116
|
-
</div>
|
|
117
|
-
<div class="${pfx}-block">
|
|
118
|
-
<div data-js="countdown-hour" class="${pfx}-digit"></div>
|
|
119
|
-
<div class="${pfx}-label">${options.labelHours}</div>
|
|
120
|
-
</div>
|
|
121
|
-
<div class="${pfx}-block">
|
|
122
|
-
<div data-js="countdown-minute" class="${pfx}-digit"></div>
|
|
123
|
-
<div class="${pfx}-label">${options.labelMinutes}</div>
|
|
124
|
-
</div>
|
|
125
|
-
<div class="${pfx}-block">
|
|
126
|
-
<div data-js="countdown-second" class="${pfx}-digit"></div>
|
|
127
|
-
<div class="${pfx}-label">${options.labelSeconds}</div>
|
|
128
|
-
</div>
|
|
129
|
-
</span>
|
|
130
|
-
<span data-js="countdown-endtext" class="${pfx}-endtext"></span>
|
|
131
|
-
`,
|
|
132
|
-
styles: (style || `
|
|
133
|
-
.${pfx} {
|
|
134
|
-
text-align: center;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.${pfx}-block {
|
|
138
|
-
display: inline-block;
|
|
139
|
-
margin: 0 10px;
|
|
140
|
-
padding: 10px;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.${pfx}-digit {
|
|
144
|
-
font-size: 5rem;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.${pfx}-endtext {
|
|
148
|
-
font-size: 5rem;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.${pfx}-cont {
|
|
152
|
-
display: inline-block;
|
|
153
|
-
}
|
|
154
|
-
`) + options.styleAdditional,
|
|
155
|
-
...props
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
var countdown_default = plugin;
|
|
161
|
-
export {
|
|
162
|
-
countdown_default as default
|
|
163
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Editor } from 'grapesjs';
|
|
2
|
-
export declare const typeForm = "form";
|
|
3
|
-
export declare const typeInput = "input";
|
|
4
|
-
export declare const typeTextarea = "textarea";
|
|
5
|
-
export declare const typeSelect = "select";
|
|
6
|
-
export declare const typeCheckbox = "checkbox";
|
|
7
|
-
export declare const typeRadio = "radio";
|
|
8
|
-
export declare const typeButton = "button";
|
|
9
|
-
export declare const typeLabel = "label";
|
|
10
|
-
export declare const typeOption = "option";
|
|
11
|
-
export default function (editor: Editor): void;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { BlockProperties, Plugin } from 'grapesjs';
|
|
2
|
-
export type PluginOptions = {
|
|
3
|
-
/**
|
|
4
|
-
* Which blocks to add.
|
|
5
|
-
* @default ['form', 'input', 'textarea', 'select', 'button', 'label', 'checkbox', 'radio']
|
|
6
|
-
*/
|
|
7
|
-
blocks?: string[];
|
|
8
|
-
/**
|
|
9
|
-
* Category name for blocks.
|
|
10
|
-
* @default 'Forms'
|
|
11
|
-
*/
|
|
12
|
-
category?: BlockProperties['category'];
|
|
13
|
-
/**
|
|
14
|
-
* Add custom block options, based on block id.
|
|
15
|
-
* @default (blockId) => ({})
|
|
16
|
-
* @example (blockId) => blockId === 'input' ? { attributes: {...} } : {};
|
|
17
|
-
*/
|
|
18
|
-
block?: (blockId: string) => {};
|
|
19
|
-
};
|
|
20
|
-
declare const plugin: Plugin<PluginOptions>;
|
|
21
|
-
export default plugin;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import loadBlocks from "./blocks.js";
|
|
2
|
-
import loadComponents from "./components.js";
|
|
3
|
-
import loadTraits from "./traits.js";
|
|
4
|
-
const plugin = (editor, opts = {}) => {
|
|
5
|
-
const config = {
|
|
6
|
-
blocks: ["form", "input", "textarea", "select", "button", "label", "checkbox", "radio"],
|
|
7
|
-
category: { id: "forms", label: "Forms" },
|
|
8
|
-
block: () => ({}),
|
|
9
|
-
...opts
|
|
10
|
-
};
|
|
11
|
-
loadComponents(editor);
|
|
12
|
-
loadTraits(editor);
|
|
13
|
-
loadBlocks(editor, config);
|
|
14
|
-
};
|
|
15
|
-
var forms_default = plugin;
|
|
16
|
-
export {
|
|
17
|
-
forms_default as default
|
|
18
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { default as blocks } from './blocks/index.js';
|
|
2
|
-
export { default as customCode } from './code/index.js';
|
|
3
|
-
export { default as forms } from './forms/index.js';
|
|
4
|
-
export { default as rte } from './rte/index.js';
|
|
5
|
-
export { default as tabs } from './tabs/index.js';
|
|
6
|
-
export { default as typed } from './typed/index.js';
|
|
7
|
-
export { default as countdown } from './countdown.js';
|
|
8
|
-
export { default as tooltip } from './tooltip.js';
|
|
9
|
-
export { default as tuiImageEditor } from './tuiImageEditor.js';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { default as default2 } from "./blocks/index.js";
|
|
2
|
-
import { default as default3 } from "./code/index.js";
|
|
3
|
-
import { default as default4 } from "./forms/index.js";
|
|
4
|
-
import { default as default5 } from "./rte/index.js";
|
|
5
|
-
import { default as default6 } from "./tabs/index.js";
|
|
6
|
-
import { default as default7 } from "./typed/index.js";
|
|
7
|
-
import { default as default8 } from "./countdown.js";
|
|
8
|
-
import { default as default9 } from "./tooltip.js";
|
|
9
|
-
import { default as default10 } from "./tuiImageEditor.js";
|
|
10
|
-
export {
|
|
11
|
-
default2 as blocks,
|
|
12
|
-
default8 as countdown,
|
|
13
|
-
default3 as customCode,
|
|
14
|
-
default4 as forms,
|
|
15
|
-
default5 as rte,
|
|
16
|
-
default6 as tabs,
|
|
17
|
-
default9 as tooltip,
|
|
18
|
-
default10 as tuiImageEditor,
|
|
19
|
-
default7 as typed
|
|
20
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
.gjs-rte-toolbar {
|
|
2
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.44);
|
|
3
|
-
border-radius: 3px;
|
|
4
|
-
}
|
|
5
|
-
.gjs-rte-action {
|
|
6
|
-
font-size: 1rem;
|
|
7
|
-
border-right: none;
|
|
8
|
-
padding: 10px;
|
|
9
|
-
min-width: 35px;
|
|
10
|
-
}
|
|
11
|
-
.gjs-rte-actionbar {
|
|
12
|
-
max-width: 600px;
|
|
13
|
-
flex-wrap: wrap;
|
|
14
|
-
}
|
|
15
|
-
.rte-hilite-btn {
|
|
16
|
-
padding: 3px 6px;
|
|
17
|
-
border-radius: 3px;
|
|
18
|
-
background: rgba(210, 120, 201, 0.3);
|
|
19
|
-
}
|
|
20
|
-
.rte-color-picker {
|
|
21
|
-
display: none;
|
|
22
|
-
padding: 10px;
|
|
23
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), 0 2px 5px rgba(0, 0, 0, 0.34);
|
|
24
|
-
border-radius: 5px;
|
|
25
|
-
position: absolute;
|
|
26
|
-
top: 55px;
|
|
27
|
-
width: 250px;
|
|
28
|
-
transition: all 2s ease;
|
|
29
|
-
}
|
|
30
|
-
.rte-color-picker:before {
|
|
31
|
-
content: "";
|
|
32
|
-
position: absolute;
|
|
33
|
-
top: -20px;
|
|
34
|
-
left: 46%;
|
|
35
|
-
border-width: 10px;
|
|
36
|
-
border-style: solid;
|
|
37
|
-
}
|
|
38
|
-
.rte-color-picker.dark {
|
|
39
|
-
background: rgba(0, 0, 0, 0.8);
|
|
40
|
-
}
|
|
41
|
-
.rte-color-picker.dark:before {
|
|
42
|
-
border-color: transparent transparent rgba(0, 0, 0, 0.75) transparent;
|
|
43
|
-
}
|
|
44
|
-
.rte-color-picker.light {
|
|
45
|
-
background: rgba(255, 255, 255, 0.75);
|
|
46
|
-
}
|
|
47
|
-
.rte-color-picker.light:before {
|
|
48
|
-
border-color: transparent transparent rgba(255, 255, 255, 0.75) transparent;
|
|
49
|
-
}
|
|
50
|
-
.rte-color-picker > div {
|
|
51
|
-
width: 30px;
|
|
52
|
-
display: inline-block;
|
|
53
|
-
height: 30px;
|
|
54
|
-
margin: 5px;
|
|
55
|
-
border-radius: 100%;
|
|
56
|
-
opacity: 0.7;
|
|
57
|
-
}
|
|
58
|
-
.rte-color-picker > div:hover {
|
|
59
|
-
opacity: 1;
|
|
60
|
-
}
|
|
61
|
-
.picker-wrapper {
|
|
62
|
-
padding: 20px;
|
|
63
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import loadBlocks from "./blocks.js";
|
|
2
|
-
import loadComponents from "./components/index.js";
|
|
3
|
-
import defaultOptions from "./options.js";
|
|
4
|
-
const plugin = (editor, opts = {}) => {
|
|
5
|
-
const options = {
|
|
6
|
-
...defaultOptions,
|
|
7
|
-
...opts
|
|
8
|
-
};
|
|
9
|
-
loadComponents(editor, options);
|
|
10
|
-
loadBlocks(editor, options);
|
|
11
|
-
};
|
|
12
|
-
var tabs_default = plugin;
|
|
13
|
-
export {
|
|
14
|
-
tabs_default as default
|
|
15
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { TabTemplate, TabTemplateProps, TabsOptions } from './types.js';
|
|
2
|
-
declare const defaultOptions: TabsOptions;
|
|
3
|
-
export declare const resolveTemplate: (template: TabTemplate | undefined, props: TabTemplateProps) => string | undefined;
|
|
4
|
-
export declare const mergeStyles: (userStyle?: (config: TabsOptions) => string) => (config: TabsOptions) => string;
|
|
5
|
-
export default defaultOptions;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const defaultStyle = (config) => `
|
|
2
|
-
.${config.classTab} {
|
|
3
|
-
padding: 7px 14px;
|
|
4
|
-
display: inline-block;
|
|
5
|
-
border-radius: 3px;
|
|
6
|
-
margin-right: 10px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.${config.classTab}:focus {
|
|
10
|
-
outline: none;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.${config.classTab}.${config.classTabActive} {
|
|
14
|
-
background-color: #0d94e6;
|
|
15
|
-
color: white;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.${config.classTabContainer} {
|
|
19
|
-
display: inline-block;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.${config.classTabContent} {
|
|
23
|
-
animation: fadeEffect 1s;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.${config.classTabContents} {
|
|
27
|
-
min-height: 100px;
|
|
28
|
-
padding: 10px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@keyframes fadeEffect {
|
|
32
|
-
from {opacity: 0;}
|
|
33
|
-
to {opacity: 1;}
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
const defaultOptions = {
|
|
37
|
-
// Block settings
|
|
38
|
-
tabsBlock: {},
|
|
39
|
-
tabsProps: {},
|
|
40
|
-
tabContainerProps: {},
|
|
41
|
-
tabProps: {},
|
|
42
|
-
tabContentProps: {},
|
|
43
|
-
tabContentsProps: {},
|
|
44
|
-
// Class names
|
|
45
|
-
classTab: "tab",
|
|
46
|
-
classTabContainer: "tab-container",
|
|
47
|
-
classTabActive: "tab-active",
|
|
48
|
-
classTabContent: "tab-content",
|
|
49
|
-
classTabContents: "tab-contents",
|
|
50
|
-
// Selectors and types
|
|
51
|
-
selectorTab: "aria-controls",
|
|
52
|
-
typeTabs: "tabs",
|
|
53
|
-
typeTabContainer: "tab-container",
|
|
54
|
-
typeTab: "tab",
|
|
55
|
-
typeTabContent: "tab-content",
|
|
56
|
-
typeTabContents: "tab-contents",
|
|
57
|
-
// Templates
|
|
58
|
-
templateTab: ({ index }) => `<span data-gjs-highlightable="false">Tab ${index}</span>`,
|
|
59
|
-
templateTabContent: ({ index }) => `<div>Tab Content ${index}</div>`,
|
|
60
|
-
// Style
|
|
61
|
-
style: defaultStyle
|
|
62
|
-
};
|
|
63
|
-
const resolveTemplate = (template, props) => {
|
|
64
|
-
if (!template) {
|
|
65
|
-
return void 0;
|
|
66
|
-
}
|
|
67
|
-
if (typeof template === "function") {
|
|
68
|
-
return template(props);
|
|
69
|
-
}
|
|
70
|
-
return template;
|
|
71
|
-
};
|
|
72
|
-
const mergeStyles = (userStyle) => {
|
|
73
|
-
return userStyle || defaultStyle;
|
|
74
|
-
};
|
|
75
|
-
var options_default = defaultOptions;
|
|
76
|
-
export {
|
|
77
|
-
options_default as default,
|
|
78
|
-
mergeStyles,
|
|
79
|
-
resolveTemplate
|
|
80
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import type { ComponentDefinition } from 'grapesjs';
|
|
2
|
-
export interface TabsOptions {
|
|
3
|
-
tabsBlock?: ComponentDefinition | null;
|
|
4
|
-
tabsProps?: ComponentDefinition;
|
|
5
|
-
tabContainerProps?: ComponentDefinition;
|
|
6
|
-
tabProps?: ComponentDefinition;
|
|
7
|
-
tabContentProps?: ComponentDefinition;
|
|
8
|
-
tabContentsProps?: ComponentDefinition;
|
|
9
|
-
classTab: string;
|
|
10
|
-
classTabContainer: string;
|
|
11
|
-
classTabActive: string;
|
|
12
|
-
classTabContent: string;
|
|
13
|
-
classTabContents: string;
|
|
14
|
-
selectorTab: string;
|
|
15
|
-
typeTabs: string;
|
|
16
|
-
typeTabContainer: string;
|
|
17
|
-
typeTab: string;
|
|
18
|
-
typeTabContent: string;
|
|
19
|
-
typeTabContents: string;
|
|
20
|
-
templateTab: TabTemplate;
|
|
21
|
-
templateTabContent?: TabTemplate;
|
|
22
|
-
style?: (config: TabsOptions) => string;
|
|
23
|
-
}
|
|
24
|
-
export interface TabTemplateProps {
|
|
25
|
-
index: number;
|
|
26
|
-
}
|
|
27
|
-
export type TabTemplate = string | ((props: TabTemplateProps) => string);
|
|
28
|
-
export interface TabConfig {
|
|
29
|
-
selectorTab: string;
|
|
30
|
-
typeTab: string;
|
|
31
|
-
typeTabContainer: string;
|
|
32
|
-
classTab: string;
|
|
33
|
-
classTabActive: string;
|
|
34
|
-
typeTabs: string;
|
|
35
|
-
templateTab: TabTemplate;
|
|
36
|
-
typeTabContent: string;
|
|
37
|
-
templateTabContent?: TabTemplate;
|
|
38
|
-
tabProps?: ComponentDefinition;
|
|
39
|
-
}
|
|
40
|
-
export interface TabContainerConfig {
|
|
41
|
-
typeTabContainer: string;
|
|
42
|
-
typeTabs: string;
|
|
43
|
-
typeTab: string;
|
|
44
|
-
classTabContainer: string;
|
|
45
|
-
tabContainerProps?: ComponentDefinition;
|
|
46
|
-
}
|
|
47
|
-
export interface TabContentConfig {
|
|
48
|
-
typeTabContent: string;
|
|
49
|
-
classTabContent: string;
|
|
50
|
-
tabContentProps?: ComponentDefinition;
|
|
51
|
-
}
|
|
52
|
-
export interface TabContentsConfig {
|
|
53
|
-
typeTabContents: string;
|
|
54
|
-
classTabContents: string;
|
|
55
|
-
tabContentsProps?: ComponentDefinition;
|
|
56
|
-
}
|
|
57
|
-
export interface TabsConfig {
|
|
58
|
-
typeTabs: string;
|
|
59
|
-
typeTab: string;
|
|
60
|
-
typeTabContent: string;
|
|
61
|
-
typeTabContents: string;
|
|
62
|
-
typeTabContainer: string;
|
|
63
|
-
classTabActive: string;
|
|
64
|
-
selectorTab: string;
|
|
65
|
-
tabsProps?: ComponentDefinition;
|
|
66
|
-
style?: (config: TabsOptions) => string;
|
|
67
|
-
}
|
|
68
|
-
export interface TabComponentProps {
|
|
69
|
-
classactive: string;
|
|
70
|
-
selectortab: string;
|
|
71
|
-
}
|
|
72
|
-
export interface TabAttributes {
|
|
73
|
-
role?: string;
|
|
74
|
-
id?: string;
|
|
75
|
-
'aria-labelledby'?: string;
|
|
76
|
-
hidden?: boolean;
|
|
77
|
-
[key: string]: any;
|
|
78
|
-
}
|
|
79
|
-
export interface CustomWindow extends Window {
|
|
80
|
-
_isEditor?: boolean;
|
|
81
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { BlockProperties, ComponentDefinition, Plugin } from 'grapesjs';
|
|
2
|
-
type TraitsProperty = ComponentDefinition['traits'];
|
|
3
|
-
export type PluginOptions = {
|
|
4
|
-
/**
|
|
5
|
-
* The ID used to create tooltip block and component
|
|
6
|
-
* @default 'tooltip'
|
|
7
|
-
*/
|
|
8
|
-
id?: string;
|
|
9
|
-
/**
|
|
10
|
-
* The ID used to create tooltip block and component
|
|
11
|
-
* @default 'Tooltip'
|
|
12
|
-
*/
|
|
13
|
-
labelTooltip?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Object to extend the default tooltip block. Pass a falsy value to avoid adding the block.
|
|
16
|
-
* @example
|
|
17
|
-
* { label: 'Tooltip', category: 'Extra', ... }
|
|
18
|
-
*/
|
|
19
|
-
blockTooltip?: Partial<BlockProperties>;
|
|
20
|
-
/**
|
|
21
|
-
* Object to extend the default tooltip properties.
|
|
22
|
-
* @example
|
|
23
|
-
* { name: 'Tooltip', droppable: false, ... }
|
|
24
|
-
*/
|
|
25
|
-
propsTooltip?: ComponentDefinition;
|
|
26
|
-
/**
|
|
27
|
-
* A function which allows to extend default traits by receiving the original array and returning a new one.
|
|
28
|
-
*/
|
|
29
|
-
extendTraits?: (traits: TraitsProperty) => TraitsProperty;
|
|
30
|
-
/**
|
|
31
|
-
* Tooltip attribute prefix.
|
|
32
|
-
* @default 'data-tooltip'
|
|
33
|
-
*/
|
|
34
|
-
attrTooltip?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Tooltip class prefix.
|
|
37
|
-
* @default 'tooltip-component'
|
|
38
|
-
*/
|
|
39
|
-
classTooltip?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Custom CSS styles for the tooltip component, this will replace the default one.
|
|
42
|
-
* @default 'tooltip-component'
|
|
43
|
-
*/
|
|
44
|
-
style?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Additional CSS styles for the tooltip component.
|
|
47
|
-
* @default 'tooltip-component'
|
|
48
|
-
*/
|
|
49
|
-
styleAdditional?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Make all tooltip relative classes private.
|
|
52
|
-
* @default true
|
|
53
|
-
*/
|
|
54
|
-
privateClasses?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Indicate if the tooltip can be styled.
|
|
57
|
-
* You can pass an array of which properties can be styled.
|
|
58
|
-
* @example ['color', 'background-color']
|
|
59
|
-
*/
|
|
60
|
-
stylableTooltip?: string[] | boolean;
|
|
61
|
-
/**
|
|
62
|
-
* If true, force the tooltip to be shown when the default "Style tooltip" trait button is clicked.
|
|
63
|
-
* @default true
|
|
64
|
-
*/
|
|
65
|
-
showTooltipOnStyle?: boolean;
|
|
66
|
-
};
|
|
67
|
-
declare const plugin: Plugin<PluginOptions>;
|
|
68
|
-
export default plugin;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { cmpId } from "./utils.js";
|
|
2
|
-
var blocks_default = (editor, opts) => {
|
|
3
|
-
const bm = editor.BlockManager;
|
|
4
|
-
const { block } = opts;
|
|
5
|
-
block && bm.add(cmpId, {
|
|
6
|
-
label: "Typed",
|
|
7
|
-
media: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><path d="M212.3 44l2.3 49.6h-6A60 60 0 00204 75c-3.2-6-7.5-10.5-12.9-13.3a44.9 44.9 0 00-21.1-4.3h-29.8V219c0 13 1.4 21 4.2 24.3 4 4.4 10 6.6 18.2 6.6h7.4v5.7H80.2V250h7.5c9 0 15.3-2.7 19-8.2 2.4-3.3 3.5-10.9 3.5-22.7V57.3H84.8a71 71 0 00-21.1 2.2 29 29 0 00-13.9 11.3 46.1 46.1 0 00-6.9 22.8H37L39.5 44h172.8zM245 22h18v256h-18z"/></svg>',
|
|
8
|
-
content: { type: cmpId },
|
|
9
|
-
select: true,
|
|
10
|
-
...block
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
blocks_default as default
|
|
15
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Editor } from 'grapesjs';
|
|
2
|
-
import type { RequiredPluginOptions } from './index.js';
|
|
3
|
-
declare global {
|
|
4
|
-
interface Window {
|
|
5
|
-
Typed: any;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
declare const _default: (editor: Editor, opts: RequiredPluginOptions) => void;
|
|
9
|
-
export default _default;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { BlockProperties, ComponentDefinition, Plugin } from 'grapesjs';
|
|
2
|
-
export interface PluginOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Library to load asynchronously in case `Typed` is not found.
|
|
5
|
-
* @default 'https://cdn.jsdelivr.net/npm/typed.js@2.0.11'
|
|
6
|
-
*/
|
|
7
|
-
script?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Object to extend the default block, eg. `{ label: 'Typed', ... }`.
|
|
10
|
-
* Pass a falsy value to avoid adding the block
|
|
11
|
-
* @default {}
|
|
12
|
-
*/
|
|
13
|
-
block?: Partial<BlockProperties>;
|
|
14
|
-
/**
|
|
15
|
-
* Customize the component props. The final object should be returned.
|
|
16
|
-
* @default (props) => props
|
|
17
|
-
* @example
|
|
18
|
-
* props: props => {
|
|
19
|
-
* props.traits = props.traits.map(trait => {
|
|
20
|
-
* if (trait.name == 'strings') {
|
|
21
|
-
* trait.label = 'Custom <b>trait<b/> label';
|
|
22
|
-
* }
|
|
23
|
-
* // this trait will be removed
|
|
24
|
-
* if (trait.name == 'fade-out-class') return;
|
|
25
|
-
* return trait;
|
|
26
|
-
* }).filter(Boolean);
|
|
27
|
-
*
|
|
28
|
-
* return props;
|
|
29
|
-
* }
|
|
30
|
-
*/
|
|
31
|
-
props?: (p: ComponentDefinition) => ComponentDefinition;
|
|
32
|
-
}
|
|
33
|
-
export type RequiredPluginOptions = Required<PluginOptions>;
|
|
34
|
-
declare const plugin: Plugin<PluginOptions>;
|
|
35
|
-
export default plugin;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import loadBlocks from "./blocks.js";
|
|
2
|
-
import loadComponents from "./components.js";
|
|
3
|
-
import loadTraits from "./traits.js";
|
|
4
|
-
const plugin = (editor, opts = {}) => {
|
|
5
|
-
const options = {
|
|
6
|
-
script: "https://cdn.jsdelivr.net/npm/typed.js@2.0.11",
|
|
7
|
-
block: {},
|
|
8
|
-
props: (p) => p,
|
|
9
|
-
...opts
|
|
10
|
-
};
|
|
11
|
-
loadComponents(editor, options);
|
|
12
|
-
loadBlocks(editor, options);
|
|
13
|
-
loadTraits(editor);
|
|
14
|
-
};
|
|
15
|
-
var typed_default = plugin;
|
|
16
|
-
export {
|
|
17
|
-
typed_default as default
|
|
18
|
-
};
|