client/posts: improve placeholder in file dropper

The default one was too long to fit in the sidebar
This commit is contained in:
rr- 2017-02-21 19:09:18 +01:00
parent d00d282bff
commit 5467ca6b7e
3 changed files with 7 additions and 2 deletions

View file

@ -15,7 +15,7 @@
</label> </label>
<% if (ctx.allowUrls) { %> <% if (ctx.allowUrls) { %>
<div class='url-holder'> <div class='url-holder'>
<input type='text' name='url' placeholder='Alternatively, paste an URL here.'/> <input type='text' name='url' placeholder='<%- ctx.urlPlaceholder %>'/>
<% if (ctx.lock) { %> <% if (ctx.lock) { %>
<button>Confirm</button> <button>Confirm</button>
<% } else { %> <% } else { %>

View file

@ -18,6 +18,8 @@ class FileDropperControl extends events.EventTarget {
allowUrls: options.allowUrls, allowUrls: options.allowUrls,
lock: options.lock, lock: options.lock,
id: 'file-' + Math.random().toString(36).substring(7), id: 'file-' + Math.random().toString(36).substring(7),
urlPlaceholder:
options.urlPlaceholder || 'Alternatively, paste an URL here.',
}); });
this._dropperNode = source.querySelector('.file-dropper'); this._dropperNode = source.querySelector('.file-dropper');

View file

@ -72,7 +72,10 @@ class PostEditSidebarControl extends events.EventTarget {
if (this._contentInputNode) { if (this._contentInputNode) {
this._contentFileDropper = new FileDropperControl( this._contentFileDropper = new FileDropperControl(
this._contentInputNode, {allowUrls: true, lock: true}); this._contentInputNode, {
allowUrls: true,
lock: true,
urlPlaceholder: '...or paste an URL here.'});
this._contentFileDropper.addEventListener('fileadd', e => { this._contentFileDropper.addEventListener('fileadd', e => {
this._newPostContent = e.detail.files[0]; this._newPostContent = e.detail.files[0];
}); });