@peerboard/core
Advanced tools
Comparing version 0.0.23 to 0.0.24
@@ -59,2 +59,3 @@ "use strict"; | ||
exports.createForum = function (forumID, container, options) { | ||
var _a; | ||
if (typeof window === 'undefined') { | ||
@@ -65,7 +66,12 @@ console.warn('peerboard: window is not defined, cannot create forum, potentially used in ssr'); | ||
var opts = __assign(__assign(__assign({}, defaultOptions()), { scrollToTopOnNavigationChanged: true }), options); | ||
var usesHashRouting = (_a = opts === null || opts === void 0 ? void 0 : opts.prefix) === null || _a === void 0 ? void 0 : _a.includes("#"); | ||
if (!opts.usePathFromQs) { | ||
// Auto resolve final location using part after the prefix | ||
if (opts.prefix && opts.prefix !== "/") { | ||
var pathname = document.location.pathname; | ||
if (usesHashRouting) { | ||
pathname += document.location.hash; | ||
} | ||
// Cut everything before the prefix to support /{lang}/{prefix}/{peer-board-path} cases | ||
var matches = new RegExp("(.*/" + trimLeftSlash(opts.prefix) + ")(.*)").exec(document.location.pathname); | ||
var matches = new RegExp("(.*/" + trimLeftSlash(opts.prefix) + ")(.*)").exec(pathname); | ||
// Let's use current path and the root as best guess | ||
@@ -89,3 +95,6 @@ var prefix = document.location.pathname; | ||
} | ||
opts.path += document.location.search + document.location.hash; | ||
// No need to add extra stuff since it's already counted at path in hash routing case | ||
if (!usesHashRouting) { | ||
opts.path += document.location.search + document.location.hash; | ||
} | ||
} | ||
@@ -92,0 +101,0 @@ return exports.loadSdk(options.sdkURL).then(function () { |
@@ -74,2 +74,3 @@ 'use strict'; | ||
var createForum = function (forumID, container, options) { | ||
var _a; | ||
if (typeof window === 'undefined') { | ||
@@ -80,7 +81,12 @@ console.warn('peerboard: window is not defined, cannot create forum, potentially used in ssr'); | ||
var opts = __assign(__assign(__assign({}, defaultOptions()), { scrollToTopOnNavigationChanged: true }), options); | ||
var usesHashRouting = (_a = opts === null || opts === void 0 ? void 0 : opts.prefix) === null || _a === void 0 ? void 0 : _a.includes("#"); | ||
if (!opts.usePathFromQs) { | ||
// Auto resolve final location using part after the prefix | ||
if (opts.prefix && opts.prefix !== "/") { | ||
var pathname = document.location.pathname; | ||
if (usesHashRouting) { | ||
pathname += document.location.hash; | ||
} | ||
// Cut everything before the prefix to support /{lang}/{prefix}/{peer-board-path} cases | ||
var matches = new RegExp("(.*/" + trimLeftSlash(opts.prefix) + ")(.*)").exec(document.location.pathname); | ||
var matches = new RegExp("(.*/" + trimLeftSlash(opts.prefix) + ")(.*)").exec(pathname); | ||
// Let's use current path and the root as best guess | ||
@@ -104,3 +110,6 @@ var prefix = document.location.pathname; | ||
} | ||
opts.path += document.location.search + document.location.hash; | ||
// No need to add extra stuff since it's already counted at path in hash routing case | ||
if (!usesHashRouting) { | ||
opts.path += document.location.search + document.location.hash; | ||
} | ||
} | ||
@@ -107,0 +116,0 @@ return loadSdk(options.sdkURL).then(function () { |
@@ -76,2 +76,3 @@ (function (global, factory) { | ||
var createForum = function (forumID, container, options) { | ||
var _a; | ||
if (typeof window === 'undefined') { | ||
@@ -82,7 +83,12 @@ console.warn('peerboard: window is not defined, cannot create forum, potentially used in ssr'); | ||
var opts = __assign(__assign(__assign({}, defaultOptions()), { scrollToTopOnNavigationChanged: true }), options); | ||
var usesHashRouting = (_a = opts === null || opts === void 0 ? void 0 : opts.prefix) === null || _a === void 0 ? void 0 : _a.includes("#"); | ||
if (!opts.usePathFromQs) { | ||
// Auto resolve final location using part after the prefix | ||
if (opts.prefix && opts.prefix !== "/") { | ||
var pathname = document.location.pathname; | ||
if (usesHashRouting) { | ||
pathname += document.location.hash; | ||
} | ||
// Cut everything before the prefix to support /{lang}/{prefix}/{peer-board-path} cases | ||
var matches = new RegExp("(.*/" + trimLeftSlash(opts.prefix) + ")(.*)").exec(document.location.pathname); | ||
var matches = new RegExp("(.*/" + trimLeftSlash(opts.prefix) + ")(.*)").exec(pathname); | ||
// Let's use current path and the root as best guess | ||
@@ -106,3 +112,6 @@ var prefix = document.location.pathname; | ||
} | ||
opts.path += document.location.search + document.location.hash; | ||
// No need to add extra stuff since it's already counted at path in hash routing case | ||
if (!usesHashRouting) { | ||
opts.path += document.location.search + document.location.hash; | ||
} | ||
} | ||
@@ -109,0 +118,0 @@ return loadSdk(options.sdkURL).then(function () { |
{ | ||
"name": "@peerboard/core", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"description": "peerboard.com frontend components", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61807
595