client/posts: fix adding loop flag to non videos
This commit is contained in:
parent
9ae2b6aa44
commit
6bf5764c6c
2 changed files with 10 additions and 2 deletions
|
@ -60,7 +60,7 @@
|
||||||
<%= ctx.makeCheckbox({
|
<%= ctx.makeCheckbox({
|
||||||
text: 'Loop video',
|
text: 'Loop video',
|
||||||
name: 'loop-video',
|
name: 'loop-video',
|
||||||
checked: true,
|
checked: ctx.uploadable.flags.includes('loop'),
|
||||||
}) %>
|
}) %>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Uploadable extends events.EventTarget {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.safety = 'safe';
|
this.safety = 'safe';
|
||||||
this.flags = ['loop'];
|
this.flags = [];
|
||||||
this.anonymous = false;
|
this.anonymous = false;
|
||||||
this.order = globalOrder;
|
this.order = globalOrder;
|
||||||
globalOrder++;
|
globalOrder++;
|
||||||
|
@ -54,6 +54,12 @@ class Uploadable extends events.EventTarget {
|
||||||
get name() {
|
get name() {
|
||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_initComplete() {
|
||||||
|
if (['video'].includes(this.type)) {
|
||||||
|
this.flags.push('loop');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class File extends Uploadable {
|
class File extends Uploadable {
|
||||||
|
@ -73,6 +79,7 @@ class File extends Uploadable {
|
||||||
new CustomEvent('finish', {detail: {uploadable: this}}));
|
new CustomEvent('finish', {detail: {uploadable: this}}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this._initComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
|
@ -103,6 +110,7 @@ class Url extends Uploadable {
|
||||||
super();
|
super();
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.dispatchEvent(new CustomEvent('finish'));
|
this.dispatchEvent(new CustomEvent('finish'));
|
||||||
|
this._initComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
get mimeType() {
|
get mimeType() {
|
||||||
|
|
Loading…
Reference in a new issue