Merge pull request #3624 from riking/copy-fix
Turn off automatic share link copying
This commit is contained in:
commit
703927d1c0
|
@ -1,6 +1,5 @@
|
|||
{{#if controller.link}}
|
||||
<h3>{{view.title}}</h3>
|
||||
<span class="copy-text {{if copied "success"}}">{{i18n 'share.copied'}}</span>
|
||||
|
||||
{{#if date}}
|
||||
<span class="date">{{displayDate}}</span>
|
||||
|
@ -19,4 +18,3 @@
|
|||
<a href {{action "close"}} aria-label='{{i18n 'share.close'}}' title='{{i18n 'share.close'}}'>{{fa-icon "times-circle"}}</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
<span class="hidden" id="copy-target"></span>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import copyText from 'discourse/lib/copy-text';
|
||||
|
||||
export default Discourse.View.extend({
|
||||
templateName: 'share',
|
||||
|
@ -36,6 +35,9 @@ export default Discourse.View.extend({
|
|||
var $linkForTouch = $('#share-link .share-for-touch a');
|
||||
$linkForTouch.attr('href',self.get('controller.link'));
|
||||
$linkForTouch.html(self.get('controller.link'));
|
||||
var range = window.document.createRange();
|
||||
range.selectNode($linkForTouch[0]);
|
||||
window.getSelection().addRange(range);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -63,7 +65,6 @@ export default Discourse.View.extend({
|
|||
var $currentTarget = $(e.currentTarget),
|
||||
$currentTargetOffset = $currentTarget.offset(),
|
||||
$shareLink = $('#share-link'),
|
||||
copyElement = document.getElementById('copy-target'),
|
||||
url = $currentTarget.data('share-url'),
|
||||
postNumber = $currentTarget.data('post-number'),
|
||||
date = $currentTarget.children().data('time');
|
||||
|
@ -94,18 +95,10 @@ export default Discourse.View.extend({
|
|||
$shareLink.css({left: "" + x + "px"});
|
||||
}
|
||||
|
||||
self.set('controller.copied', false);
|
||||
|
||||
const copySuccess = copyText(url, copyElement);
|
||||
|
||||
self.set('controller.link', url);
|
||||
self.set('controller.postNumber', postNumber);
|
||||
self.set('controller.date', date);
|
||||
|
||||
Ember.run.later(null, function() {
|
||||
self.set('controller.copied', copySuccess);
|
||||
}, 50);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
|
@ -114,7 +114,6 @@ en:
|
|||
topic: 'share a link to this topic'
|
||||
post: 'post #%{postNumber}'
|
||||
close: 'close'
|
||||
copied: 'copied to clipboard'
|
||||
twitter: 'share this link on Twitter'
|
||||
facebook: 'share this link on Facebook'
|
||||
google+: 'share this link on Google+'
|
||||
|
|
Loading…
Reference in New Issue