This commit is contained in:
BoHung Chiu 2022-11-18 20:33:23 +08:00
parent 92475fa0ed
commit 1c587dffe4
1 changed files with 9 additions and 1 deletions

View File

@ -159,7 +159,7 @@
<label class="control-label muted"><%= t(:url) %></label>
<div class="controls">
<%= f.fields_for :url_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t(:url), value: (@link.url_translations[locale] rescue nil) %>
<%= f.text_field locale, class: "input-block-level url_input", placeholder: t(:url), value: (@link.url_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
@ -244,6 +244,14 @@
filter.destroy();
} );
});
$('.url_input').on('paste', function(e){
var pastedData = e.originalEvent.clipboardData.getData('text');
var _this = $(this);
pastedData = pastedData.replace(new RegExp('^http(s|)://' + window.location.host), '');
window.setTimeout(function(){
_this.val(pastedData);
}, 0);
});
});
</script>
</div>