@enso-ui/how-to 4.0.14 → 4.0.18
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enso-ui/how-to",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.18",
|
|
4
4
|
"description": "Basic how-to package",
|
|
5
5
|
"main": "src/bulma/pages/howTo/Index.vue",
|
|
6
6
|
"scripts": {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@enso-ui/transitions": "^2.0",
|
|
29
29
|
"@fortawesome/fontawesome-svg-core": "^1.2.2",
|
|
30
30
|
"@fortawesome/free-regular-svg-icons": "^5.2.0",
|
|
31
|
-
"@fortawesome/free-solid-svg-icons": "^5.2
|
|
31
|
+
"@fortawesome/free-solid-svg-icons": "^5.11.2",
|
|
32
32
|
"@fortawesome/vue-fontawesome": "3.0.0-5",
|
|
33
|
-
"v-tooltip": "4.0.0-beta.2",
|
|
33
|
+
"v-tooltip": "^4.0.0-beta.2",
|
|
34
34
|
"video.js": "^7.0",
|
|
35
35
|
"vue": "^3.0"
|
|
36
36
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<fade>
|
|
28
28
|
<div class="control"
|
|
29
29
|
v-if="video.name">
|
|
30
|
-
<uploader :url="uploadLink"
|
|
30
|
+
<enso-uploader :url="uploadLink"
|
|
31
31
|
:params="video"
|
|
32
32
|
:file-size-limit="20000000"
|
|
33
33
|
file-key="video"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
</span>
|
|
46
46
|
</a>
|
|
47
47
|
</template>
|
|
48
|
-
</uploader>
|
|
48
|
+
</enso-uploader>
|
|
49
49
|
<a class="button is-outlined is-success"
|
|
50
50
|
@click="video = video; update()"
|
|
51
51
|
v-if="editingVideo">
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
<script>
|
|
180
180
|
import { focus } from '@enso-ui/directives';
|
|
181
181
|
import { Fade } from '@enso-ui/transitions';
|
|
182
|
-
import {
|
|
182
|
+
import { EnsoUploader } from '@enso-ui/uploader/bulma';
|
|
183
183
|
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
184
184
|
import {
|
|
185
185
|
faBan,
|
|
@@ -199,7 +199,9 @@ export default {
|
|
|
199
199
|
|
|
200
200
|
directives: { focus },
|
|
201
201
|
|
|
202
|
-
components: {
|
|
202
|
+
components: {
|
|
203
|
+
Fa, Fade, HowToVideo, EnsoUploader,
|
|
204
|
+
},
|
|
203
205
|
|
|
204
206
|
inject: ['canAccess', 'errorHandler', 'http', 'i18n', 'route', 'toastr'],
|
|
205
207
|
|
|
@@ -236,7 +238,7 @@ export default {
|
|
|
236
238
|
? this.videos
|
|
237
239
|
: this.videos.filter(({ tagList }) => tagList
|
|
238
240
|
.filter(
|
|
239
|
-
|
|
241
|
+
tagId => this.selectedTags.findIndex(({ id }) => tagId === id) !== -1,
|
|
240
242
|
).length === this.selectedTags.length);
|
|
241
243
|
},
|
|
242
244
|
filteredTags() {
|
|
@@ -295,7 +297,7 @@ export default {
|
|
|
295
297
|
this.deselectTags();
|
|
296
298
|
},
|
|
297
299
|
deselectTags() {
|
|
298
|
-
this.tags.map(
|
|
300
|
+
this.tags.map(tag => {
|
|
299
301
|
tag.selected = false;
|
|
300
302
|
return tag;
|
|
301
303
|
});
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</span>
|
|
15
15
|
</card-control>
|
|
16
16
|
<card-control v-if="!video.poster && canAccess('howTo.posters.store')">
|
|
17
|
-
<uploader class="pt-1"
|
|
17
|
+
<enso-uploader class="pt-1"
|
|
18
18
|
:url="route('howTo.posters.store')"
|
|
19
19
|
:params="{ videoId: video.id }"
|
|
20
20
|
file-key="poster"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<fa :icon="['far', 'image']"/>
|
|
26
26
|
</span>
|
|
27
27
|
</template>
|
|
28
|
-
</uploader>
|
|
28
|
+
</enso-uploader>
|
|
29
29
|
</card-control>
|
|
30
30
|
<card-control v-if="canAccess('howTo.videos.update')">
|
|
31
31
|
<span class="icon"
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
</card-control>
|
|
36
36
|
<card-control v-if="canAccess('howTo.videos.update')">
|
|
37
37
|
<span class="icon"
|
|
38
|
-
@click="tagging = !tagging;
|
|
38
|
+
@click="tagging = !tagging;
|
|
39
|
+
$emit(tagging ? 'start-tagging' : 'stop-tagging')">
|
|
39
40
|
<fa :icon="tagging ? 'check' : 'tags'"/>
|
|
40
41
|
</span>
|
|
41
42
|
</card-control>
|
|
@@ -94,13 +95,13 @@ import { FontAwesomeIcon as Fa } from '@fortawesome/vue-fontawesome';
|
|
|
94
95
|
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
95
96
|
import { faInfo, faTags, faInfoCircle } from '@fortawesome/free-solid-svg-icons';
|
|
96
97
|
import { faTrashAlt, faEdit, faImage } from '@fortawesome/free-regular-svg-icons';
|
|
97
|
-
import VideoPlayer from './VideoPlayer.vue';
|
|
98
98
|
import {
|
|
99
99
|
Card, CardHeader, CardCollapse, CardControl, CardContent,
|
|
100
100
|
CardFooter, CardFooterItem,
|
|
101
101
|
} from '@enso-ui/card/bulma';
|
|
102
102
|
import Confirmation from '@enso-ui/confirmation/bulma';
|
|
103
|
-
import {
|
|
103
|
+
import { EnsoUploader } from '@enso-ui/uploader';
|
|
104
|
+
import VideoPlayer from './VideoPlayer.vue';
|
|
104
105
|
import 'video.js/dist/video-js.css';
|
|
105
106
|
|
|
106
107
|
library.add([faTrashAlt, faInfo, faTags, faEdit, faImage, faInfoCircle]);
|
|
@@ -120,7 +121,7 @@ export default {
|
|
|
120
121
|
CardFooterItem,
|
|
121
122
|
CardContent,
|
|
122
123
|
Fa,
|
|
123
|
-
|
|
124
|
+
EnsoUploader,
|
|
124
125
|
VideoPlayer,
|
|
125
126
|
},
|
|
126
127
|
|
|
@@ -137,7 +138,7 @@ export default {
|
|
|
137
138
|
},
|
|
138
139
|
},
|
|
139
140
|
|
|
140
|
-
emits: ['delete',
|
|
141
|
+
emits: ['delete', 'edit', 'start-tagging', 'stop-tagging'],
|
|
141
142
|
|
|
142
143
|
data: () => ({
|
|
143
144
|
tagging: false,
|
|
@@ -180,7 +181,7 @@ export default {
|
|
|
180
181
|
}).catch(this.errorHandler);
|
|
181
182
|
},
|
|
182
183
|
removeTag(tag) {
|
|
183
|
-
const index = this.video.tagList.findIndex(
|
|
184
|
+
const index = this.video.tagList.findIndex(id => id === tag.id);
|
|
184
185
|
this.video.tagList.splice(index, 1);
|
|
185
186
|
},
|
|
186
187
|
},
|
|
@@ -2,208 +2,216 @@
|
|
|
2
2
|
<div class="video-player" v-if="reseted">
|
|
3
3
|
<video class="video-js" ref="video">
|
|
4
4
|
<track v-for="crtTrack in trackList"
|
|
5
|
+
:key="crtTrack.src"
|
|
5
6
|
:kind="crtTrack.kind"
|
|
6
7
|
:label="crtTrack.label"
|
|
7
8
|
:src="crtTrack.src"
|
|
8
9
|
:srcLang="crtTrack.srcLang"
|
|
9
|
-
:default="crtTrack.default"
|
|
10
|
+
:default="crtTrack.default">
|
|
10
11
|
</video>
|
|
11
12
|
</div>
|
|
12
13
|
</template>
|
|
13
14
|
|
|
14
15
|
<script>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
16
|
+
// lib
|
|
17
|
+
import _videojs from 'video.js';
|
|
18
|
+
|
|
19
|
+
const videojs = window.videojs || _videojs;
|
|
20
|
+
|
|
21
|
+
// as of videojs 6.6.0
|
|
22
|
+
const DEFAULT_EVENTS = [
|
|
23
|
+
'loadeddata',
|
|
24
|
+
'canplay',
|
|
25
|
+
'canplaythrough',
|
|
26
|
+
'play',
|
|
27
|
+
'pause',
|
|
28
|
+
'waiting',
|
|
29
|
+
'playing',
|
|
30
|
+
'ended',
|
|
31
|
+
'error',
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
// export
|
|
35
|
+
export default {
|
|
36
|
+
name: 'VideoPlayer',
|
|
37
|
+
|
|
38
|
+
props: {
|
|
39
|
+
start: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 0,
|
|
42
|
+
},
|
|
43
|
+
crossOrigin: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: '',
|
|
46
|
+
},
|
|
47
|
+
playsinline: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
51
|
+
customEventName: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: 'statechanged',
|
|
54
|
+
},
|
|
55
|
+
options: {
|
|
56
|
+
type: Object,
|
|
57
|
+
required: true,
|
|
58
|
+
},
|
|
59
|
+
events: {
|
|
60
|
+
type: Array,
|
|
61
|
+
default: () => [],
|
|
62
|
+
},
|
|
63
|
+
globalOptions: {
|
|
64
|
+
type: Object,
|
|
65
|
+
default: () => ({
|
|
66
|
+
// autoplay: false,
|
|
67
|
+
controls: true,
|
|
68
|
+
// preload: 'auto',
|
|
69
|
+
// fluid: false,
|
|
70
|
+
// muted: false,
|
|
71
|
+
controlBar: {
|
|
72
|
+
remainingTimeDisplay: false,
|
|
73
|
+
playToggle: {},
|
|
74
|
+
progressControl: {},
|
|
75
|
+
fullscreenToggle: {},
|
|
76
|
+
volumeMenuButton: {
|
|
77
|
+
inline: false,
|
|
78
|
+
vertical: true,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
techOrder: ['html5'],
|
|
82
|
+
plugins: {},
|
|
83
|
+
}),
|
|
84
|
+
},
|
|
85
|
+
globalEvents: {
|
|
86
|
+
type: Array,
|
|
87
|
+
default: () => [],
|
|
88
|
+
},
|
|
89
|
+
trackList: {
|
|
90
|
+
type: Array,
|
|
91
|
+
default: () => [],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
emits: ['ready'],
|
|
96
|
+
|
|
97
|
+
data() {
|
|
98
|
+
return {
|
|
99
|
+
player: null,
|
|
100
|
+
reseted: true,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
watch: {
|
|
105
|
+
options: {
|
|
106
|
+
deep: true,
|
|
107
|
+
handler(options) {
|
|
108
|
+
this.dispose(() => {
|
|
109
|
+
if (options && options.sources && options.sources.length) {
|
|
110
|
+
this.initialize();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
mounted() {
|
|
118
|
+
if (!this.player) {
|
|
119
|
+
this.initialize();
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
beforeUnmount() {
|
|
124
|
+
if (this.player) {
|
|
125
|
+
this.dispose();
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
methods: {
|
|
130
|
+
initialize() {
|
|
131
|
+
// videojs options
|
|
132
|
+
const videoOptions = { ...this.globalOptions, ...this.options };
|
|
133
|
+
|
|
134
|
+
// ios fullscreen
|
|
135
|
+
if (this.playsinline) {
|
|
136
|
+
this.$refs.video.setAttribute('playsinline', this.playsinline);
|
|
137
|
+
this.$refs.video.setAttribute('webkit-playsinline', this.playsinline);
|
|
138
|
+
this.$refs.video.setAttribute('x5-playsinline', this.playsinline);
|
|
139
|
+
this.$refs.video.setAttribute('x5-video-player-type', 'h5');
|
|
140
|
+
this.$refs.video.setAttribute('x5-video-player-fullscreen', false);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// cross origin
|
|
144
|
+
if (this.crossOrigin !== '') {
|
|
145
|
+
this.$refs.video.crossOrigin = this.crossOrigin;
|
|
146
|
+
this.$refs.video.setAttribute('crossOrigin', this.crossOrigin);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// emit event
|
|
150
|
+
const emitPlayerState = (event, value) => {
|
|
151
|
+
if (event) {
|
|
152
|
+
this.$emit(event, this.player);
|
|
153
|
+
}
|
|
154
|
+
if (value) {
|
|
155
|
+
this.$emit(this.customEventName, { [event]: value });
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// avoid error "VIDEOJS: ERROR: Unable to find plugin: __ob__"
|
|
160
|
+
if (videoOptions.plugins) {
|
|
161
|
+
delete videoOptions.plugins.__ob__;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// videoOptions
|
|
165
|
+
// console.log('videoOptions', videoOptions)
|
|
166
|
+
|
|
167
|
+
// player
|
|
168
|
+
const self = this;
|
|
169
|
+
this.player = videojs(this.$refs.video, videoOptions, function () {
|
|
170
|
+
// events
|
|
171
|
+
const events = DEFAULT_EVENTS.concat(self.events).concat(self.globalEvents);
|
|
172
|
+
|
|
173
|
+
// watch events
|
|
174
|
+
const onEdEvents = {};
|
|
175
|
+
for (let i = 0; i < events.length; i++) {
|
|
176
|
+
if (typeof events[i] === 'string' && onEdEvents[events[i]] === undefined) {
|
|
177
|
+
(event => {
|
|
178
|
+
onEdEvents[event] = null;
|
|
179
|
+
this.on(event, () => {
|
|
180
|
+
emitPlayerState(event, true);
|
|
181
|
+
});
|
|
182
|
+
})(events[i]);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// watch timeupdate
|
|
187
|
+
this.on('timeupdate', function () {
|
|
188
|
+
emitPlayerState('timeupdate', this.currentTime());
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// player readied
|
|
192
|
+
self.$emit('ready', this);
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
dispose(callback) {
|
|
196
|
+
if (this.player && this.player.dispose) {
|
|
197
|
+
if (this.player.techName_ !== 'Flash') {
|
|
198
|
+
this.player.pause && this.player.pause();
|
|
199
|
+
}
|
|
200
|
+
this.player.dispose();
|
|
201
|
+
this.player = null;
|
|
202
|
+
this.$nextTick(() => {
|
|
203
|
+
this.reseted = false;
|
|
204
|
+
this.$nextTick(() => {
|
|
205
|
+
this.reseted = true;
|
|
206
|
+
this.$nextTick(() => {
|
|
207
|
+
callback && callback();
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
};
|
|
207
215
|
</script>
|
|
208
216
|
|
|
209
217
|
<style>
|