mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:36:42 +08:00
parent
57c4b6bd50
commit
fd3c3fa565
|
@ -160,12 +160,12 @@ const DiscourseURL = EmberObject.extend({
|
|||
|
||||
replaceState(path) {
|
||||
if (path.startsWith("#")) {
|
||||
path = this.router.currentURL.replace(/#.*$/, "") + path;
|
||||
path = this.routerService.currentURL.replace(/#.*$/, "") + path;
|
||||
}
|
||||
|
||||
path = withoutPrefix(path);
|
||||
|
||||
if (this.router.currentURL !== path) {
|
||||
if (this.routerService.currentURL !== path) {
|
||||
// Always use replaceState in the next runloop to prevent weird routes changing
|
||||
// while URLs are loading. For example, while a topic loads it sets `currentPost`
|
||||
// which triggers a replaceState even though the topic hasn't fully loaded yet!
|
||||
|
@ -228,7 +228,7 @@ const DiscourseURL = EmberObject.extend({
|
|||
return this.replaceState(path);
|
||||
}
|
||||
|
||||
const oldPath = this.router.currentURL;
|
||||
const oldPath = this.routerService.currentURL;
|
||||
|
||||
path = path.replace(/(https?\:)?\/\/[^\/]+/, "");
|
||||
|
||||
|
@ -415,8 +415,6 @@ const DiscourseURL = EmberObject.extend({
|
|||
handleURL(path, opts) {
|
||||
opts = opts || {};
|
||||
|
||||
const router = this.router;
|
||||
|
||||
if (opts.replaceURL) {
|
||||
this.replaceState(path);
|
||||
}
|
||||
|
@ -429,7 +427,7 @@ const DiscourseURL = EmberObject.extend({
|
|||
elementId = split[1];
|
||||
}
|
||||
|
||||
const transition = router.transitionTo(path);
|
||||
const transition = this.routerService.transitionTo(path);
|
||||
|
||||
transition._discourse_intercepted = true;
|
||||
transition._discourse_anchor = elementId;
|
||||
|
|
|
@ -4,7 +4,7 @@ import { iconHTML } from "discourse-common/lib/icon-library";
|
|||
import I18n from "discourse-i18n";
|
||||
|
||||
function initializePlugin(api) {
|
||||
const siteSettings = api.container.lookup("site-settings:main");
|
||||
const siteSettings = api.container.lookup("service:site-settings");
|
||||
|
||||
if (siteSettings.checklist_enabled) {
|
||||
api.decorateCookedElement(checklistSyntax);
|
||||
|
|
|
@ -12,7 +12,7 @@ function initLazyEmbed(api) {
|
|||
const lazyContainers = cooked.querySelectorAll(".lazy-video-container");
|
||||
|
||||
lazyContainers.forEach((container) => {
|
||||
const siteSettings = api.container.lookup("site-settings:main");
|
||||
const siteSettings = api.container.lookup("service:site-settings");
|
||||
const videoAttributes = getVideoAttributes(container);
|
||||
|
||||
if (siteSettings[`lazy_${videoAttributes.providerName}_enabled`]) {
|
||||
|
|
|
@ -100,7 +100,7 @@ export default {
|
|||
name: "inline-footnotes",
|
||||
|
||||
initialize(container) {
|
||||
if (!container.lookup("site-settings:main").display_footnotes_inline) {
|
||||
if (!container.lookup("service:site-settings").display_footnotes_inline) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ function initializePolls(api) {
|
|||
});
|
||||
api.cleanupStream(cleanUpPolls);
|
||||
|
||||
const siteSettings = api.container.lookup("site-settings:main");
|
||||
const siteSettings = api.container.lookup("service:site-settings");
|
||||
if (siteSettings.poll_enabled) {
|
||||
api.addSearchSuggestion("in:polls");
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ export default {
|
|||
name: "spoiler-alert",
|
||||
|
||||
initialize(container) {
|
||||
const siteSettings = container.lookup("site-settings:main");
|
||||
const siteSettings = container.lookup("service:site-settings");
|
||||
|
||||
if (siteSettings.spoiler_enabled) {
|
||||
withPluginApi("1.15.0", initializeSpoiler);
|
||||
|
|
Loading…
Reference in New Issue
Block a user