@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.14",
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.0",
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 { Uploader } from '@enso-ui/uploader/bulma';
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: { Fa, Fade, HowToVideo, Uploader, },
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
- (tagId) => this.selectedTags.findIndex(({ id }) => tagId === id) !== -1,
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((tag) => {
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; $emit(tagging ? 'start-tagging' : 'stop-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 { Uploader } from '@enso-ui/uploader';
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
- Uploader,
124
+ EnsoUploader,
124
125
  VideoPlayer,
125
126
  },
126
127
 
@@ -137,7 +138,7 @@ export default {
137
138
  },
138
139
  },
139
140
 
140
- emits: ['delete', 'edit', 'start-tagging', 'stop-tagging'],
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((id) => id === tag.id);
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
- // lib
16
- import _videojs from 'video.js';
17
- const videojs = window.videojs || _videojs;
18
-
19
- // as of videojs 6.6.0
20
- const DEFAULT_EVENTS = [
21
- 'loadeddata',
22
- 'canplay',
23
- 'canplaythrough',
24
- 'play',
25
- 'pause',
26
- 'waiting',
27
- 'playing',
28
- 'ended',
29
- 'error'
30
- ]
31
-
32
- // export
33
- export default {
34
- name: 'VideoPlayer',
35
- props: {
36
- start: {
37
- type: Number,
38
- default: 0,
39
- },
40
- crossOrigin: {
41
- type: String,
42
- default: '',
43
- },
44
- playsinline: {
45
- type: Boolean,
46
- default: false,
47
- },
48
- customEventName: {
49
- type: String,
50
- default: 'statechanged',
51
- },
52
- options: {
53
- type: Object,
54
- required: true,
55
- },
56
- events: {
57
- type: Array,
58
- default: () => [],
59
- },
60
- globalOptions: {
61
- type: Object,
62
- default: () => ({
63
- // autoplay: false,
64
- controls: true,
65
- // preload: 'auto',
66
- // fluid: false,
67
- // muted: false,
68
- controlBar: {
69
- remainingTimeDisplay: false,
70
- playToggle: {},
71
- progressControl: {},
72
- fullscreenToggle: {},
73
- volumeMenuButton: {
74
- inline: false,
75
- vertical: true,
76
- }
77
- },
78
- techOrder: ['html5'],
79
- plugins: {},
80
- })
81
- },
82
- globalEvents: {
83
- type: Array,
84
- default: () => [],
85
- },
86
- trackList: {
87
- type: Array,
88
- default: () => [],
89
- }
90
- },
91
- data() {
92
- return {
93
- player: null,
94
- reseted: true,
95
- }
96
- },
97
- mounted() {
98
- if (!this.player) {
99
- this.initialize();
100
- }
101
- },
102
- beforeUnmount() {
103
- if (this.player) {
104
- this.dispose();
105
- }
106
- },
107
- methods: {
108
- initialize() {
109
-
110
- // videojs options
111
- const videoOptions = Object.assign({}, this.globalOptions, this.options)
112
-
113
- // ios fullscreen
114
- if (this.playsinline) {
115
- this.$refs.video.setAttribute('playsinline', this.playsinline)
116
- this.$refs.video.setAttribute('webkit-playsinline', this.playsinline)
117
- this.$refs.video.setAttribute('x5-playsinline', this.playsinline)
118
- this.$refs.video.setAttribute('x5-video-player-type', 'h5')
119
- this.$refs.video.setAttribute('x5-video-player-fullscreen', false)
120
- }
121
-
122
- // cross origin
123
- if (this.crossOrigin !== '') {
124
- this.$refs.video.crossOrigin = this.crossOrigin
125
- this.$refs.video.setAttribute('crossOrigin', this.crossOrigin)
126
- }
127
-
128
- // emit event
129
- const emitPlayerState = (event, value) => {
130
- if (event) {
131
- this.$emit(event, this.player)
132
- }
133
- if (value) {
134
- this.$emit(this.customEventName, { [event]: value })
135
- }
136
- }
137
-
138
- // avoid error "VIDEOJS: ERROR: Unable to find plugin: __ob__"
139
- if (videoOptions.plugins) {
140
- delete videoOptions.plugins.__ob__
141
- }
142
-
143
- // videoOptions
144
- // console.log('videoOptions', videoOptions)
145
-
146
- // player
147
- const self = this
148
- this.player = videojs(this.$refs.video, videoOptions, function() {
149
-
150
- // events
151
- const events = DEFAULT_EVENTS.concat(self.events).concat(self.globalEvents)
152
-
153
- // watch events
154
- const onEdEvents = {}
155
- for (let i = 0; i < events.length; i++) {
156
- if (typeof events[i] === 'string' && onEdEvents[events[i]] === undefined) {
157
- (event => {
158
- onEdEvents[event] = null
159
- this.on(event, () => {
160
- emitPlayerState(event, true)
161
- })
162
- })(events[i])
163
- }
164
- }
165
-
166
- // watch timeupdate
167
- this.on('timeupdate', function() {
168
- emitPlayerState('timeupdate', this.currentTime())
169
- })
170
-
171
- // player readied
172
- self.$emit('ready', this)
173
- })
174
- },
175
- dispose(callback) {
176
- if (this.player && this.player.dispose) {
177
- if (this.player.techName_ !== 'Flash') {
178
- this.player.pause && this.player.pause();
179
- }
180
- this.player.dispose();
181
- this.player = null;
182
- this.$nextTick(() => {
183
- this.reseted = false;
184
- this.$nextTick(() => {
185
- this.reseted = true;
186
- this.$nextTick(() => {
187
- callback && callback();
188
- });
189
- });
190
- });
191
- }
192
- },
193
- },
194
- watch: {
195
- options: {
196
- deep: true,
197
- handler(options, oldOptions) {
198
- this.dispose(() => {
199
- if (options && options.sources && options.sources.length) {
200
- this.initialize();
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>