mirror of
https://github.com/zadam/trilium.git
synced 2026-02-03 20:34:24 +01:00
fix(web-clipper): missing utils import
This commit is contained in:
parent
c0a2ae99cf
commit
b5ff71b1a0
@ -1,3 +1,4 @@
|
||||
import { randomString } from "../../utils";
|
||||
import TriliumServerFacade, { isDevEnv } from "./trilium_server_facade";
|
||||
|
||||
export default defineBackground(() => {
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { getBaseUrl, getPageLocationOrigin, randomString } from "../../utils.js";
|
||||
|
||||
export default defineContentScript({
|
||||
matches: [
|
||||
"<all_urls>"
|
||||
|
||||
@ -16,15 +16,13 @@
|
||||
"content_scripts": [
|
||||
{
|
||||
"js": [
|
||||
"lib/browser-polyfill.js",
|
||||
"utils.js"
|
||||
"lib/browser-polyfill.js"
|
||||
]
|
||||
}
|
||||
],
|
||||
"background": {
|
||||
"scripts": [
|
||||
"lib/browser-polyfill.js",
|
||||
"utils.js"
|
||||
"lib/browser-polyfill.js"
|
||||
]
|
||||
},
|
||||
"commands": {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
function randomString(len) {
|
||||
export function randomString(len) {
|
||||
let text = "";
|
||||
const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
@ -9,7 +9,7 @@ function randomString(len) {
|
||||
return text;
|
||||
}
|
||||
|
||||
function getBaseUrl() {
|
||||
export function getBaseUrl() {
|
||||
let output = getPageLocationOrigin() + location.pathname;
|
||||
|
||||
if (output[output.length - 1] !== '/') {
|
||||
@ -21,7 +21,7 @@ function getBaseUrl() {
|
||||
return output;
|
||||
}
|
||||
|
||||
function getPageLocationOrigin() {
|
||||
export function getPageLocationOrigin() {
|
||||
// location.origin normally returns the protocol + domain + port (eg. https://example.com:8080)
|
||||
// but for file:// protocol this is browser dependant and in particular Firefox returns "null" in this case.
|
||||
return location.protocol === 'file:' ? 'file://' : location.origin;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user