@mediafly/js-ui 51.2.0 → 51.2.2-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/lib/dropdown-menu/dropdown-menu-action.component.html +5 -3
- package/lib/rich-text/rich-text.service.d.ts +6 -0
- package/lib/rich-text/rich-text.service.js +113 -0
- package/lib/rich-text/rich-text.service.js.map +1 -1
- package/lib/tabs/tab-group.html +1 -0
- package/lib/tsconfig.deploy.tsbuildinfo +2 -2
- package/package.json +1 -1
- package/src/components/dropdown-menu/dropdown-menu-action.component.html +5 -3
- package/src/components/rich-text/rich-text.service.ts +137 -0
- package/src/components/tabs/tab-group.html +1 -0
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<li>
|
|
2
2
|
<a
|
|
3
3
|
class="o-dropdown-menu__item o-dropdown-menu__item--link"
|
|
4
|
+
ng-attr-tabindex="{{ $ctrl.disable ? -1 : 0 }}"
|
|
4
5
|
ng-class="{ 'is-disabled': $ctrl.disable }"
|
|
5
6
|
ng-disabled="$ctrl.disable"
|
|
6
7
|
ng-if="$ctrl.actionSref"
|
|
7
8
|
ng-keyup="$ctrl.keyPress($event)"
|
|
8
9
|
ng-transclude
|
|
9
10
|
target="{{ $ctrl.actionHrefTarget }}"
|
|
10
|
-
tabindex="0"
|
|
11
11
|
ui-sref="{{ $ctrl.actionSref.state }}({{ $ctrl.actionSref.params }})"
|
|
12
|
-
ui-sref-opts="{{ $ctrl.actionSref.options }}"
|
|
12
|
+
ui-sref-opts="{{ $ctrl.actionSref.options }}"
|
|
13
|
+
></a>
|
|
13
14
|
|
|
14
15
|
<a
|
|
15
16
|
class="o-dropdown-menu__item o-dropdown-menu__item--link"
|
|
17
|
+
ng-attr-tabindex="{{ $ctrl.disable ? -1 : 0 }}"
|
|
16
18
|
ng-click="$ctrl.performAction()"
|
|
17
19
|
ng-href="{{ $ctrl.actionHref }}"
|
|
18
20
|
ng-class="{ 'is-disabled': $ctrl.disable }"
|
|
@@ -21,5 +23,5 @@
|
|
|
21
23
|
ng-keyup="$ctrl.keyPress($event)"
|
|
22
24
|
ng-transclude
|
|
23
25
|
target="{{ $ctrl.actionHrefTarget }}"
|
|
24
|
-
|
|
26
|
+
></a>
|
|
25
27
|
</li>
|
|
@@ -5,6 +5,12 @@ export default class RichTextService {
|
|
|
5
5
|
constructor($sanitize: sanitize.ISanitizeService);
|
|
6
6
|
/** Older versions of Quill rendered some things differently. Patch those up. */
|
|
7
7
|
backwardsCompatibleHtml(html: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Transform <ul><li> into <ol><li data-list="bullet">,
|
|
10
|
+
* and <ol><li> into <ol><li data-list="ordered">
|
|
11
|
+
* accounting for any pattern of nested <ul> and <ol> tags.
|
|
12
|
+
*/
|
|
13
|
+
fixBulletPoints(html: string): string;
|
|
8
14
|
/**
|
|
9
15
|
* Transform <font> tags from the old Quill editor into <span> tags, as used by the new editor.
|
|
10
16
|
* Quill used to set fonts using <font color="#000000" face="Open Sans">
|
|
@@ -29,12 +29,120 @@ let RichTextService = class RichTextService {
|
|
|
29
29
|
}
|
|
30
30
|
/** Older versions of Quill rendered some things differently. Patch those up. */
|
|
31
31
|
backwardsCompatibleHtml(html) {
|
|
32
|
+
console.log(`-----> backwardsCompatibleHtml (${html.length}) ${html}`);
|
|
32
33
|
html = this.removeZeroWidthNoBreakSpaces(html);
|
|
34
|
+
console.log(`-----> after removeZeroWidthNoBreakSpaces (${html.length}) ${html}`);
|
|
33
35
|
html = this.removeCursor(html);
|
|
36
|
+
console.log(`-----> after removeCursor (${html.length}) ${html}`);
|
|
34
37
|
html = this.fixWrappingCursor(html);
|
|
38
|
+
console.log(`-----> after fixWrappingCursor (${html.length}) ${html}`);
|
|
35
39
|
html = this.fixFontTags(html);
|
|
40
|
+
console.log(`-----> after fixFontTags (${html.length}) ${html}`);
|
|
41
|
+
html = this.fixBulletPoints(html);
|
|
36
42
|
return html;
|
|
37
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Transform <ul><li> into <ol><li data-list="bullet">,
|
|
46
|
+
* and <ol><li> into <ol><li data-list="ordered">
|
|
47
|
+
* accounting for any pattern of nested <ul> and <ol> tags.
|
|
48
|
+
*/
|
|
49
|
+
fixBulletPoints(html) {
|
|
50
|
+
console.log(`-----> fixBulletPoints`, html);
|
|
51
|
+
if (!html) {
|
|
52
|
+
return html;
|
|
53
|
+
}
|
|
54
|
+
let newHtml = '';
|
|
55
|
+
const olStartTag = `<ol`;
|
|
56
|
+
const olEndTag = `</ol>`;
|
|
57
|
+
const ulStartTag = `<ul`;
|
|
58
|
+
const ulEndTag = `</ul>`;
|
|
59
|
+
const liStartTag = `<li`;
|
|
60
|
+
const listStack = []; // Stack of <ol> and <ul> tags
|
|
61
|
+
let parsedLength = 0;
|
|
62
|
+
let currentListType;
|
|
63
|
+
while (parsedLength < html.length) {
|
|
64
|
+
console.log(`-----> parsedLength ${parsedLength}`);
|
|
65
|
+
// Find the start of the next <ol>, <ul> or <li> tag
|
|
66
|
+
const olStart = html.indexOf(olStartTag, parsedLength);
|
|
67
|
+
const ulStart = html.indexOf(ulStartTag, parsedLength);
|
|
68
|
+
const liStart = html.indexOf(liStartTag, parsedLength);
|
|
69
|
+
// Find what might be the end of the current list (or might be the end of a nested list)
|
|
70
|
+
let nextListEnd;
|
|
71
|
+
switch (currentListType) {
|
|
72
|
+
case 'ol':
|
|
73
|
+
nextListEnd = html.indexOf(olEndTag, parsedLength);
|
|
74
|
+
break;
|
|
75
|
+
case 'ul':
|
|
76
|
+
nextListEnd = html.indexOf(ulEndTag, parsedLength);
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
nextListEnd = -1;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
// Find which tag comes next
|
|
83
|
+
const nextItemPos = Math.min(olStart === -1 ? html.length : olStart, ulStart === -1 ? html.length : ulStart, liStart === -1 ? html.length : liStart, nextListEnd === -1 ? html.length : nextListEnd);
|
|
84
|
+
newHtml += html.substring(parsedLength, nextItemPos);
|
|
85
|
+
parsedLength = nextItemPos;
|
|
86
|
+
switch (nextItemPos) {
|
|
87
|
+
case olStart:
|
|
88
|
+
case ulStart:
|
|
89
|
+
// We've found the start of a list
|
|
90
|
+
newHtml += `<ol>`;
|
|
91
|
+
const listTagEnd = html.indexOf('>', nextItemPos);
|
|
92
|
+
console.log(`-----> listTagEnd ${listTagEnd}`);
|
|
93
|
+
if (listTagEnd === -1) {
|
|
94
|
+
// Invalid HTML. Dump the lot.
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
parsedLength = listTagEnd + 1;
|
|
98
|
+
if (nextItemPos === olStart) {
|
|
99
|
+
listStack.push('ol');
|
|
100
|
+
currentListType = 'ol';
|
|
101
|
+
console.log(`-----> push ol`);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
listStack.push('ul');
|
|
105
|
+
currentListType = 'ul';
|
|
106
|
+
console.log(`-----> push ul`);
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
case liStart:
|
|
110
|
+
// We've found a list item
|
|
111
|
+
if (!currentListType) {
|
|
112
|
+
// Invalid HTML. Dump the lot.
|
|
113
|
+
return '';
|
|
114
|
+
}
|
|
115
|
+
const liTagEnd = html.indexOf('>', liStart + 1);
|
|
116
|
+
if (liTagEnd === -1) {
|
|
117
|
+
// Invalid HTML. Dump the lot.
|
|
118
|
+
return '';
|
|
119
|
+
}
|
|
120
|
+
let liTag = html.substring(liStart, liTagEnd + 1);
|
|
121
|
+
if (liTag.indexOf('data-list') === -1) {
|
|
122
|
+
const dataAttr = ` data-list="${currentListType === 'ol' ? 'ordered' : 'bullet'}"`;
|
|
123
|
+
liTag = `<li${dataAttr}` + liTag.substring(3);
|
|
124
|
+
}
|
|
125
|
+
newHtml += liTag;
|
|
126
|
+
parsedLength = liTagEnd + 1;
|
|
127
|
+
break;
|
|
128
|
+
case nextListEnd:
|
|
129
|
+
// We've reached the end of the current list. Write out the closing tag and pop the stack
|
|
130
|
+
newHtml += olEndTag;
|
|
131
|
+
parsedLength = nextListEnd + olEndTag.length;
|
|
132
|
+
console.log(`-----> pop ${listStack[listStack.length - 1]}`);
|
|
133
|
+
listStack.pop();
|
|
134
|
+
currentListType = listStack[listStack.length - 1];
|
|
135
|
+
console.log(`-----> (now in ${currentListType})`);
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (listStack.length > 0) {
|
|
140
|
+
// We didn't close the last list. Invalid HTML. Dump the lot.
|
|
141
|
+
return '';
|
|
142
|
+
}
|
|
143
|
+
console.log(`-----> newHtml`, newHtml);
|
|
144
|
+
return newHtml;
|
|
145
|
+
}
|
|
38
146
|
/**
|
|
39
147
|
* Transform <font> tags from the old Quill editor into <span> tags, as used by the new editor.
|
|
40
148
|
* Quill used to set fonts using <font color="#000000" face="Open Sans">
|
|
@@ -135,9 +243,14 @@ let RichTextService = class RichTextService {
|
|
|
135
243
|
}
|
|
136
244
|
/** Clean up the HTML, ready for save */
|
|
137
245
|
sanitizeHtml(html) {
|
|
246
|
+
console.log(`-----> -------------`);
|
|
247
|
+
console.log(`-----> html initial (${html.length}) ${html}`);
|
|
138
248
|
html = this.removeZeroWidthNoBreakSpaces(html);
|
|
249
|
+
console.log(`-----> after removeZeroWidthNoBreakSpaces (${html.length}) ${html}`);
|
|
139
250
|
html = this.removeCursor(html);
|
|
251
|
+
console.log(`-----> after removeCursor (${html.length}) ${html}`);
|
|
140
252
|
html = this.$sanitize(html);
|
|
253
|
+
console.log(`-----> after $sanitize (${html.length}) ${html}`);
|
|
141
254
|
return html;
|
|
142
255
|
}
|
|
143
256
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text.service.js","sourceRoot":"","sources":["../../src/components/rich-text/rich-text.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,sDAA2C;AAC3C,8CAAkD;AAElD,8GAA8G;AAC9G,iBAAO,CAAC,MAAM,CAAC,KA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@ -4,6 +4,7 @@
|
|
|
4
4
|
role="tablist"
|
|
5
5
|
>
|
|
6
6
|
<li id="{{ tab.tabId }}"
|
|
7
|
+
ng-attr-tabindex="{{tab.isDisabled || tab.isHidden ? -1 : 0}}"
|
|
7
8
|
ng-repeat="tab in $ctrl.tabs"
|
|
8
9
|
ng-class="{ 'is-active': tab.tabId === $ctrl.activeTab, 'is-disabled': tab.isDisabled }"
|
|
9
10
|
ng-click="$ctrl.startTabChange(tab)"
|
|
@@ -1382,8 +1382,8 @@
|
|
|
1382
1382
|
"affectsGlobalScope": false
|
|
1383
1383
|
},
|
|
1384
1384
|
"../src/components/rich-text/rich-text.service.ts": {
|
|
1385
|
-
"version": "
|
|
1386
|
-
"signature": "
|
|
1385
|
+
"version": "d2f18d62b9f7f3e9d60bc2f511cc18d822acb4741b57eaf1e2644c1c4251bd2e",
|
|
1386
|
+
"signature": "058d8cb2e2cfdc94bd15180d80ef5d04ed10d3f1d2e1b12fb3ddcc81b6f9f35c",
|
|
1387
1387
|
"affectsGlobalScope": false
|
|
1388
1388
|
},
|
|
1389
1389
|
"../src/components/rich-text/rich-text.component.ts": {
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<li>
|
|
2
2
|
<a
|
|
3
3
|
class="o-dropdown-menu__item o-dropdown-menu__item--link"
|
|
4
|
+
ng-attr-tabindex="{{ $ctrl.disable ? -1 : 0 }}"
|
|
4
5
|
ng-class="{ 'is-disabled': $ctrl.disable }"
|
|
5
6
|
ng-disabled="$ctrl.disable"
|
|
6
7
|
ng-if="$ctrl.actionSref"
|
|
7
8
|
ng-keyup="$ctrl.keyPress($event)"
|
|
8
9
|
ng-transclude
|
|
9
10
|
target="{{ $ctrl.actionHrefTarget }}"
|
|
10
|
-
tabindex="0"
|
|
11
11
|
ui-sref="{{ $ctrl.actionSref.state }}({{ $ctrl.actionSref.params }})"
|
|
12
|
-
ui-sref-opts="{{ $ctrl.actionSref.options }}"
|
|
12
|
+
ui-sref-opts="{{ $ctrl.actionSref.options }}"
|
|
13
|
+
></a>
|
|
13
14
|
|
|
14
15
|
<a
|
|
15
16
|
class="o-dropdown-menu__item o-dropdown-menu__item--link"
|
|
17
|
+
ng-attr-tabindex="{{ $ctrl.disable ? -1 : 0 }}"
|
|
16
18
|
ng-click="$ctrl.performAction()"
|
|
17
19
|
ng-href="{{ $ctrl.actionHref }}"
|
|
18
20
|
ng-class="{ 'is-disabled': $ctrl.disable }"
|
|
@@ -21,5 +23,5 @@
|
|
|
21
23
|
ng-keyup="$ctrl.keyPress($event)"
|
|
22
24
|
ng-transclude
|
|
23
25
|
target="{{ $ctrl.actionHrefTarget }}"
|
|
24
|
-
|
|
26
|
+
></a>
|
|
25
27
|
</li>
|
|
@@ -19,14 +19,146 @@ export default class RichTextService {
|
|
|
19
19
|
/** Older versions of Quill rendered some things differently. Patch those up. */
|
|
20
20
|
backwardsCompatibleHtml(html: string): string {
|
|
21
21
|
|
|
22
|
+
console.log(`-----> backwardsCompatibleHtml (${html.length}) ${html}`)
|
|
22
23
|
html = this.removeZeroWidthNoBreakSpaces(html)
|
|
24
|
+
console.log(`-----> after removeZeroWidthNoBreakSpaces (${html.length}) ${html}`)
|
|
23
25
|
html = this.removeCursor(html)
|
|
26
|
+
console.log(`-----> after removeCursor (${html.length}) ${html}`)
|
|
24
27
|
html = this.fixWrappingCursor(html)
|
|
28
|
+
console.log(`-----> after fixWrappingCursor (${html.length}) ${html}`)
|
|
25
29
|
html = this.fixFontTags(html)
|
|
30
|
+
console.log(`-----> after fixFontTags (${html.length}) ${html}`)
|
|
31
|
+
html = this.fixBulletPoints(html)
|
|
26
32
|
|
|
27
33
|
return html
|
|
28
34
|
}
|
|
29
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Transform <ul><li> into <ol><li data-list="bullet">,
|
|
38
|
+
* and <ol><li> into <ol><li data-list="ordered">
|
|
39
|
+
* accounting for any pattern of nested <ul> and <ol> tags.
|
|
40
|
+
*/
|
|
41
|
+
fixBulletPoints(html: string): string {
|
|
42
|
+
|
|
43
|
+
console.log(`-----> fixBulletPoints`, html)
|
|
44
|
+
|
|
45
|
+
if (!html) {
|
|
46
|
+
return html
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let newHtml: string = ''
|
|
50
|
+
|
|
51
|
+
const olStartTag = `<ol`
|
|
52
|
+
const olEndTag = `</ol>`
|
|
53
|
+
const ulStartTag = `<ul`
|
|
54
|
+
const ulEndTag = `</ul>`
|
|
55
|
+
const liStartTag = `<li`
|
|
56
|
+
|
|
57
|
+
const listStack: string[] = [] // Stack of <ol> and <ul> tags
|
|
58
|
+
|
|
59
|
+
let parsedLength = 0
|
|
60
|
+
let currentListType: string | undefined
|
|
61
|
+
while (parsedLength < html.length) {
|
|
62
|
+
console.log(`-----> parsedLength ${parsedLength}`)
|
|
63
|
+
|
|
64
|
+
// Find the start of the next <ol>, <ul> or <li> tag
|
|
65
|
+
const olStart = html.indexOf(olStartTag, parsedLength)
|
|
66
|
+
const ulStart = html.indexOf(ulStartTag, parsedLength)
|
|
67
|
+
const liStart = html.indexOf(liStartTag, parsedLength)
|
|
68
|
+
|
|
69
|
+
// Find what might be the end of the current list (or might be the end of a nested list)
|
|
70
|
+
let nextListEnd: number
|
|
71
|
+
switch (currentListType) {
|
|
72
|
+
case 'ol':
|
|
73
|
+
nextListEnd = html.indexOf(olEndTag, parsedLength)
|
|
74
|
+
break
|
|
75
|
+
case 'ul':
|
|
76
|
+
nextListEnd = html.indexOf(ulEndTag, parsedLength)
|
|
77
|
+
break
|
|
78
|
+
default:
|
|
79
|
+
nextListEnd = -1
|
|
80
|
+
break
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Find which tag comes next
|
|
84
|
+
const nextItemPos = Math.min(
|
|
85
|
+
olStart === -1 ? html.length : olStart,
|
|
86
|
+
ulStart === -1 ? html.length : ulStart,
|
|
87
|
+
liStart === -1 ? html.length : liStart,
|
|
88
|
+
nextListEnd === -1 ? html.length : nextListEnd)
|
|
89
|
+
|
|
90
|
+
newHtml += html.substring(parsedLength, nextItemPos)
|
|
91
|
+
parsedLength = nextItemPos
|
|
92
|
+
|
|
93
|
+
switch (nextItemPos) {
|
|
94
|
+
case olStart:
|
|
95
|
+
case ulStart:
|
|
96
|
+
// We've found the start of a list
|
|
97
|
+
newHtml += `<ol>`
|
|
98
|
+
|
|
99
|
+
const listTagEnd = html.indexOf('>', nextItemPos)
|
|
100
|
+
console.log(`-----> listTagEnd ${listTagEnd}`)
|
|
101
|
+
if (listTagEnd === -1) {
|
|
102
|
+
// Invalid HTML. Dump the lot.
|
|
103
|
+
return ''
|
|
104
|
+
}
|
|
105
|
+
parsedLength = listTagEnd + 1
|
|
106
|
+
|
|
107
|
+
if (nextItemPos === olStart) {
|
|
108
|
+
listStack.push('ol')
|
|
109
|
+
currentListType = 'ol'
|
|
110
|
+
console.log(`-----> push ol`)
|
|
111
|
+
} else {
|
|
112
|
+
listStack.push('ul')
|
|
113
|
+
currentListType = 'ul'
|
|
114
|
+
console.log(`-----> push ul`)
|
|
115
|
+
}
|
|
116
|
+
break
|
|
117
|
+
|
|
118
|
+
case liStart:
|
|
119
|
+
// We've found a list item
|
|
120
|
+
if (!currentListType) {
|
|
121
|
+
// Invalid HTML. Dump the lot.
|
|
122
|
+
return ''
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const liTagEnd = html.indexOf('>', liStart + 1)
|
|
126
|
+
if (liTagEnd === -1) {
|
|
127
|
+
// Invalid HTML. Dump the lot.
|
|
128
|
+
return ''
|
|
129
|
+
}
|
|
130
|
+
let liTag = html.substring(liStart, liTagEnd + 1)
|
|
131
|
+
|
|
132
|
+
if (liTag.indexOf('data-list') === -1) {
|
|
133
|
+
const dataAttr = ` data-list="${currentListType === 'ol' ? 'ordered' : 'bullet'}"`
|
|
134
|
+
liTag = `<li${dataAttr}` + liTag.substring(3)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
newHtml += liTag
|
|
138
|
+
parsedLength = liTagEnd + 1
|
|
139
|
+
break
|
|
140
|
+
|
|
141
|
+
case nextListEnd:
|
|
142
|
+
// We've reached the end of the current list. Write out the closing tag and pop the stack
|
|
143
|
+
newHtml += olEndTag
|
|
144
|
+
parsedLength = nextListEnd + olEndTag.length
|
|
145
|
+
console.log(`-----> pop ${listStack[listStack.length - 1]}`)
|
|
146
|
+
listStack.pop()
|
|
147
|
+
currentListType = listStack[listStack.length - 1]
|
|
148
|
+
console.log(`-----> (now in ${currentListType})`)
|
|
149
|
+
break
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (listStack.length > 0) {
|
|
154
|
+
// We didn't close the last list. Invalid HTML. Dump the lot.
|
|
155
|
+
return ''
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
console.log(`-----> newHtml`, newHtml)
|
|
159
|
+
return newHtml
|
|
160
|
+
}
|
|
161
|
+
|
|
30
162
|
/**
|
|
31
163
|
* Transform <font> tags from the old Quill editor into <span> tags, as used by the new editor.
|
|
32
164
|
* Quill used to set fonts using <font color="#000000" face="Open Sans">
|
|
@@ -148,9 +280,14 @@ export default class RichTextService {
|
|
|
148
280
|
/** Clean up the HTML, ready for save */
|
|
149
281
|
sanitizeHtml(html: string): string {
|
|
150
282
|
|
|
283
|
+
console.log(`-----> -------------`)
|
|
284
|
+
console.log(`-----> html initial (${html.length}) ${html}`)
|
|
151
285
|
html = this.removeZeroWidthNoBreakSpaces(html)
|
|
286
|
+
console.log(`-----> after removeZeroWidthNoBreakSpaces (${html.length}) ${html}`)
|
|
152
287
|
html = this.removeCursor(html)
|
|
288
|
+
console.log(`-----> after removeCursor (${html.length}) ${html}`)
|
|
153
289
|
html = this.$sanitize(html)
|
|
290
|
+
console.log(`-----> after $sanitize (${html.length}) ${html}`)
|
|
154
291
|
|
|
155
292
|
return html
|
|
156
293
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
role="tablist"
|
|
5
5
|
>
|
|
6
6
|
<li id="{{ tab.tabId }}"
|
|
7
|
+
ng-attr-tabindex="{{tab.isDisabled || tab.isHidden ? -1 : 0}}"
|
|
7
8
|
ng-repeat="tab in $ctrl.tabs"
|
|
8
9
|
ng-class="{ 'is-active': tab.tabId === $ctrl.activeTab, 'is-disabled': tab.isDisabled }"
|
|
9
10
|
ng-click="$ctrl.startTabChange(tab)"
|