mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 13:03:43 +08:00
FIX: Support using enter to change the hash, clicks should update hash
This commit is contained in:
parent
7454722247
commit
62cc029886
|
@ -1,8 +1,10 @@
|
|||
import interceptClick from 'discourse/lib/intercept-click';
|
||||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
export default {
|
||||
name: "click-interceptor",
|
||||
initialize() {
|
||||
$('#main').on('click.discourse', 'a', interceptClick);
|
||||
$(window).on('hashchange', () => DiscourseURL.routeTo(document.location.hash));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -105,7 +105,7 @@ const DiscourseURL = Ember.Object.createWithMixins({
|
|||
It contains the logic necessary to route within a topic using replaceState to
|
||||
keep the history intact.
|
||||
**/
|
||||
routeTo: function(path, opts) {
|
||||
routeTo(path, opts) {
|
||||
if (Em.isEmpty(path)) { return; }
|
||||
|
||||
if (Discourse.get('requiresRefresh')) {
|
||||
|
@ -122,6 +122,7 @@ const DiscourseURL = Ember.Object.createWithMixins({
|
|||
// Scroll to the same page, different anchor
|
||||
if (path.indexOf('#') === 0) {
|
||||
this.scrollToId(path);
|
||||
history.replaceState(undefined, undefined, path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user