@studiocms/wysiwyg 0.1.0-experimental.2 → 0.1.0-experimental.3
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/wysiwyg/components/Editor.astro +24 -38
- package/dist/wysiwyg/editorPlugins/blocks/blocks.d.ts +3 -0
- package/dist/wysiwyg/editorPlugins/blocks/blocks.js +239 -0
- package/dist/wysiwyg/editorPlugins/blocks/index.d.ts +80 -0
- package/dist/wysiwyg/editorPlugins/blocks/index.js +26 -0
- package/dist/wysiwyg/editorPlugins/code/blocks.d.ts +4 -0
- package/dist/wysiwyg/editorPlugins/code/blocks.js +20 -0
- package/dist/wysiwyg/editorPlugins/code/commands.d.ts +4 -0
- package/dist/wysiwyg/editorPlugins/code/commands.js +109 -0
- package/dist/wysiwyg/editorPlugins/code/components.d.ts +4 -0
- package/dist/wysiwyg/editorPlugins/code/components.js +88 -0
- package/dist/wysiwyg/editorPlugins/code/index.d.ts +47 -0
- package/dist/wysiwyg/editorPlugins/code/index.js +28 -0
- package/dist/wysiwyg/editorPlugins/code/utils.d.ts +3 -0
- package/dist/wysiwyg/editorPlugins/code/utils.js +8 -0
- package/dist/wysiwyg/editorPlugins/countdown.d.ts +86 -0
- package/dist/wysiwyg/editorPlugins/countdown.js +163 -0
- package/dist/wysiwyg/editorPlugins/forms/blocks.d.ts +3 -0
- package/dist/wysiwyg/editorPlugins/forms/blocks.js +93 -0
- package/dist/wysiwyg/editorPlugins/forms/components.d.ts +11 -0
- package/dist/wysiwyg/editorPlugins/forms/components.js +284 -0
- package/dist/wysiwyg/editorPlugins/forms/index.d.ts +21 -0
- package/dist/wysiwyg/editorPlugins/forms/index.js +18 -0
- package/dist/wysiwyg/editorPlugins/forms/traits.d.ts +2 -0
- package/dist/wysiwyg/editorPlugins/forms/traits.js +47 -0
- package/dist/wysiwyg/editorPlugins/index.d.ts +9 -0
- package/dist/wysiwyg/editorPlugins/index.js +20 -0
- package/dist/wysiwyg/editorPlugins/rte/colorPicker.d.ts +95 -0
- package/dist/wysiwyg/editorPlugins/rte/colorPicker.js +185 -0
- package/dist/wysiwyg/editorPlugins/rte/index.d.ts +48 -0
- package/dist/wysiwyg/editorPlugins/rte/index.js +369 -0
- package/dist/wysiwyg/editorPlugins/rte/styles.css +63 -0
- package/dist/wysiwyg/editorPlugins/tabs/blocks.d.ts +3 -0
- package/dist/wysiwyg/editorPlugins/tabs/blocks.js +19 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/Tab.d.ts +10 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/Tab.js +100 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/TabContainer.d.ts +5 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/TabContainer.js +23 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/TabContent.d.ts +5 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/TabContent.js +23 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/TabContents.d.ts +4 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/TabContents.js +19 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/Tabs.d.ts +4 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/Tabs.js +169 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/index.d.ts +4 -0
- package/dist/wysiwyg/editorPlugins/tabs/components/index.js +29 -0
- package/dist/wysiwyg/editorPlugins/tabs/index.d.ts +5 -0
- package/dist/wysiwyg/editorPlugins/tabs/index.js +15 -0
- package/dist/wysiwyg/editorPlugins/tabs/options.d.ts +5 -0
- package/dist/wysiwyg/editorPlugins/tabs/options.js +80 -0
- package/dist/wysiwyg/editorPlugins/tabs/types.d.ts +81 -0
- package/dist/wysiwyg/editorPlugins/tabs/types.js +0 -0
- package/dist/wysiwyg/editorPlugins/tooltip.d.ts +68 -0
- package/dist/wysiwyg/editorPlugins/tooltip.js +318 -0
- package/dist/wysiwyg/editorPlugins/tuiImageEditor.d.ts +86 -0
- package/dist/wysiwyg/editorPlugins/tuiImageEditor.js +204 -0
- package/dist/wysiwyg/editorPlugins/typed/blocks.d.ts +4 -0
- package/dist/wysiwyg/editorPlugins/typed/blocks.js +15 -0
- package/dist/wysiwyg/editorPlugins/typed/components.d.ts +9 -0
- package/dist/wysiwyg/editorPlugins/typed/components.js +109 -0
- package/dist/wysiwyg/editorPlugins/typed/index.d.ts +35 -0
- package/dist/wysiwyg/editorPlugins/typed/index.js +18 -0
- package/dist/wysiwyg/editorPlugins/typed/traits.d.ts +3 -0
- package/dist/wysiwyg/editorPlugins/typed/traits.js +18 -0
- package/dist/wysiwyg/editorPlugins/typed/utils.d.ts +2 -0
- package/dist/wysiwyg/editorPlugins/typed/utils.js +6 -0
- package/package.json +2 -14
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var TabContents_default = (editor, config) => {
|
|
2
|
+
const { Components } = editor;
|
|
3
|
+
Components.addType(config.typeTabContents, {
|
|
4
|
+
model: {
|
|
5
|
+
defaults: {
|
|
6
|
+
name: "Tab Contents",
|
|
7
|
+
draggable: false,
|
|
8
|
+
droppable: false,
|
|
9
|
+
copyable: false,
|
|
10
|
+
removable: false,
|
|
11
|
+
classes: config.classTabContents,
|
|
12
|
+
...config.tabContentsProps
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
TabContents_default as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { resolveTemplate } from "../options.js";
|
|
2
|
+
var Tabs_default = (editor, config) => {
|
|
3
|
+
const { Components } = editor;
|
|
4
|
+
const script = function(props) {
|
|
5
|
+
const el = this;
|
|
6
|
+
const classTabActive = props.classactive;
|
|
7
|
+
const selectorTab = props.selectortab;
|
|
8
|
+
const { history } = window;
|
|
9
|
+
const _isEditor = window._isEditor;
|
|
10
|
+
const attrSelected = "ariaSelected";
|
|
11
|
+
const roleTab = "[role=tab]";
|
|
12
|
+
const roleTabContent = "[role=tabpanel]";
|
|
13
|
+
const { body, location } = document;
|
|
14
|
+
const matches = body.matches || // biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
15
|
+
body.webkitMatchesSelector || // biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
16
|
+
body.mozMatchesSelector || // biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
17
|
+
body.msMatchesSelector;
|
|
18
|
+
const each = (items, clb) => {
|
|
19
|
+
Array.from(items).forEach(clb);
|
|
20
|
+
};
|
|
21
|
+
const hideContents = () => {
|
|
22
|
+
each(el.querySelectorAll(roleTabContent), (i) => {
|
|
23
|
+
i.hidden = true;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const getTabId = (item) => item.getAttribute(selectorTab) || "";
|
|
27
|
+
const qS = (elem, qs) => elem.querySelector(qs);
|
|
28
|
+
const getAllTabs = () => el.querySelectorAll(roleTab);
|
|
29
|
+
const upTabIdx = (item, val) => {
|
|
30
|
+
if (!_isEditor) {
|
|
31
|
+
item.tabIndex = Number.parseInt(val);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const activeTab = (tabEl) => {
|
|
35
|
+
each(getAllTabs(), (item) => {
|
|
36
|
+
item.className = item.className.replace(classTabActive, "").trim();
|
|
37
|
+
item.setAttribute(attrSelected, "false");
|
|
38
|
+
upTabIdx(item, "-1");
|
|
39
|
+
});
|
|
40
|
+
hideContents();
|
|
41
|
+
tabEl.className += ` ${classTabActive}`;
|
|
42
|
+
tabEl.setAttribute(attrSelected, "true");
|
|
43
|
+
upTabIdx(tabEl, "0");
|
|
44
|
+
const tabContentId = getTabId(tabEl);
|
|
45
|
+
const tabContent = tabContentId && qS(el, `#${tabContentId}`);
|
|
46
|
+
if (tabContent) {
|
|
47
|
+
tabContent.hidden = false;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const getTabByHash = () => {
|
|
51
|
+
const hashId = (location.hash || "").replace("#", "");
|
|
52
|
+
const qrStr = (att) => `${roleTab}[${att}=${hashId}]`;
|
|
53
|
+
return hashId ? qS(el, qrStr(selectorTab)) : null;
|
|
54
|
+
};
|
|
55
|
+
const getSelectedTab = (target) => {
|
|
56
|
+
return Array.from(getAllTabs()).find((item) => item.contains(target));
|
|
57
|
+
};
|
|
58
|
+
let tabToActive = qS(el, `.${classTabActive}${roleTab}`);
|
|
59
|
+
tabToActive = tabToActive || getTabByHash() || qS(el, roleTab);
|
|
60
|
+
if (tabToActive) activeTab(tabToActive);
|
|
61
|
+
el.addEventListener("click", (ev) => {
|
|
62
|
+
let target = ev.target;
|
|
63
|
+
if (!target) return;
|
|
64
|
+
let found = matches.call(target, roleTab);
|
|
65
|
+
if (!found) {
|
|
66
|
+
const selectedTab = getSelectedTab(target);
|
|
67
|
+
if (selectedTab) {
|
|
68
|
+
target = selectedTab;
|
|
69
|
+
found = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (found && !ev.__trg && target.className.indexOf(classTabActive) < 0) {
|
|
73
|
+
ev.preventDefault();
|
|
74
|
+
ev.__trg = 1;
|
|
75
|
+
activeTab(target);
|
|
76
|
+
const id = getTabId(target);
|
|
77
|
+
try {
|
|
78
|
+
history?.pushState(null, "", `#${id}`);
|
|
79
|
+
} catch (e) {
|
|
80
|
+
console.error("History API is not supported", e);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const styleText = config.style ? config.style(config) : "";
|
|
86
|
+
const defTabs = [1, 2, 3].map((i) => ({
|
|
87
|
+
type: config.typeTab,
|
|
88
|
+
components: resolveTemplate(config.templateTab, { index: i })
|
|
89
|
+
}));
|
|
90
|
+
Components.addType(config.typeTabs, {
|
|
91
|
+
model: {
|
|
92
|
+
defaults: {
|
|
93
|
+
name: "Tabs",
|
|
94
|
+
classactive: config.classTabActive,
|
|
95
|
+
selectortab: config.selectorTab,
|
|
96
|
+
"script-props": ["classactive", "selectortab"],
|
|
97
|
+
script,
|
|
98
|
+
traits: [
|
|
99
|
+
{
|
|
100
|
+
type: "button",
|
|
101
|
+
label: "Add Tab",
|
|
102
|
+
text: "Add Tab",
|
|
103
|
+
full: true,
|
|
104
|
+
command: (editor2) => {
|
|
105
|
+
const selected = editor2.getSelected();
|
|
106
|
+
selected?.addTab();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
components: [
|
|
111
|
+
{ type: config.typeTabContainer, components: defTabs },
|
|
112
|
+
{ type: config.typeTabContents }
|
|
113
|
+
],
|
|
114
|
+
styles: styleText,
|
|
115
|
+
...config.tabsProps
|
|
116
|
+
},
|
|
117
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
118
|
+
isTabsComponent(comp) {
|
|
119
|
+
return comp.findTabs !== void 0;
|
|
120
|
+
},
|
|
121
|
+
init() {
|
|
122
|
+
const component = this;
|
|
123
|
+
component.findTabs().forEach((tab, index) => {
|
|
124
|
+
this.__onTab(tab, index + 1, {});
|
|
125
|
+
});
|
|
126
|
+
const container = component.getTabContainerType();
|
|
127
|
+
let tabCount = component.findTabs().length;
|
|
128
|
+
this.listenTo(container?.components(), "add", (tab) => {
|
|
129
|
+
tabCount++;
|
|
130
|
+
tab.__initTab?.(tabCount);
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
134
|
+
__onTab(tab, index, v, opts = {}) {
|
|
135
|
+
if (!opts.avoidStore && !opts.temporary) {
|
|
136
|
+
tab.__initTab(index);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
getTabContainerType() {
|
|
140
|
+
return this.findType(config.typeTabContainer)[0];
|
|
141
|
+
},
|
|
142
|
+
getContentsType() {
|
|
143
|
+
return this.findType(config.typeTabContents)[0] || this;
|
|
144
|
+
},
|
|
145
|
+
findTabs() {
|
|
146
|
+
return this.findType(config.typeTab);
|
|
147
|
+
},
|
|
148
|
+
findContents() {
|
|
149
|
+
return this.findType(config.typeTabContent);
|
|
150
|
+
},
|
|
151
|
+
addTab(content) {
|
|
152
|
+
const component = this;
|
|
153
|
+
const container = component.getTabContainerType();
|
|
154
|
+
const currentTabs = component.findTabs();
|
|
155
|
+
const templateProps = {
|
|
156
|
+
index: currentTabs.length + 1
|
|
157
|
+
};
|
|
158
|
+
const finalContent = content ? typeof content === "function" ? content(templateProps) : content : resolveTemplate(config.templateTab, templateProps);
|
|
159
|
+
container?.append({
|
|
160
|
+
type: config.typeTab,
|
|
161
|
+
components: finalContent
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
export {
|
|
168
|
+
Tabs_default as default
|
|
169
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Tab from "./Tab.js";
|
|
2
|
+
import TabContainer from "./TabContainer.js";
|
|
3
|
+
import TabContent from "./TabContent.js";
|
|
4
|
+
import TabContents from "./TabContents.js";
|
|
5
|
+
import Tabs from "./Tabs.js";
|
|
6
|
+
const components = [
|
|
7
|
+
TabContainer,
|
|
8
|
+
// Load container first
|
|
9
|
+
TabContent,
|
|
10
|
+
// Then content components
|
|
11
|
+
TabContents,
|
|
12
|
+
Tab,
|
|
13
|
+
// Then individual tabs
|
|
14
|
+
Tabs
|
|
15
|
+
// Finally the main tabs component
|
|
16
|
+
];
|
|
17
|
+
var components_default = (editor, config) => {
|
|
18
|
+
const opts = {
|
|
19
|
+
...config,
|
|
20
|
+
defaultModel: editor.DomComponents.getType("default").model,
|
|
21
|
+
editor
|
|
22
|
+
};
|
|
23
|
+
for (const component of components) {
|
|
24
|
+
component(editor, opts);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
components_default as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
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;
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,68 @@
|
|
|
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;
|