Skip to content

Commit 9580dd3

Browse files
committed
Remove prev sel
1 parent ac5d1cd commit 9580dd3

File tree

7 files changed

+8
-18
lines changed

7 files changed

+8
-18
lines changed

dist/grapesjs-tabs.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/grapesjs-tabs.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "grapesjs-tabs",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "Simple tabs component plugin for GrapesJS",
55
"main": "dist/grapesjs-tabs.min.js",
66
"scripts": {

src/components/Tab.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export const role = 'tab';
33
export default (dc, {
44
defaultModel, typeTabs, selectorTab, editor, ...config
55
}) => {
6-
const prvSel = config.selectorTabPrev;
76
const traits = [
87
{
98
full: 1,
@@ -69,8 +68,7 @@ export default (dc, {
6968
},
7069

7170
getTabContent() {
72-
const attrs = this.getAttributes();
73-
const id = attrs[prvSel] || attrs[selectorTab];
71+
const id = this.getAttributes()[selectorTab];
7472
const tabs = this.getTabsType();
7573
if (!tabs || !id) return;
7674
const contents = tabs.findContents();

src/components/Tabs.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export default (dc, {
77
const el = this;
88
const classTabActive = props.classactive;
99
const selectorTab = props.selectortab;
10-
const prevsel = props.prevsel;
1110
const { history, _isEditor } = window;
1211
const attrTabindex = 'tabIndex';
1312
const attrSelected = 'ariaSelected';
@@ -25,10 +24,7 @@ export default (dc, {
2524
each(el.querySelectorAll(roleTabContent), i => i.hidden = true);
2625
}
2726

28-
const getTabId = (item) => {
29-
return (prevsel && item.getAttribute(prevsel)) || item.getAttribute(selectorTab);
30-
}
31-
27+
const getTabId = item => item.getAttribute(selectorTab)
3228
const qS = (elem, qs) => elem.querySelector(qs);
3329
const getAllTabs = () => el.querySelectorAll(roleTab);
3430
const upTabIdx = (item, val) => !_isEditor && (item[attrTabindex] = val);
@@ -51,7 +47,7 @@ export default (dc, {
5147
const getTabByHash = () => {
5248
const hashId = (location.hash || '').replace('#', '');
5349
const qrStr = att => `${roleTab}[${att}=${hashId}]`;
54-
return hashId && (qS(el, qrStr(prevsel)) || qS(el, qrStr(selectorTab)));
50+
return hashId && qS(el, qrStr(selectorTab));
5551
};
5652

5753
const getSelectedTab = (target) => {
@@ -107,7 +103,6 @@ export default (dc, {
107103
name: 'Tabs',
108104
classactive: config.classTabActive,
109105
selectortab: config.selectorTab,
110-
prevsel: config.selectorTabPrev,
111106
'script-props': ['classactive', 'selectortab'],
112107
script,
113108
traits,

src/options.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ export default {
3636
// The attribute used inside tabs as a selector for tab contents
3737
selectorTab: 'aria-controls',
3838

39-
// Special option, used mainly to support previous plugin version
40-
selectorTabPrev: 'href',
41-
4239
// Tabs component id
4340
typeTabs: 'tabs',
4441

0 commit comments

Comments
 (0)