mirror of
https://github.com/zadam/trilium.git
synced 2026-02-11 00:04:27 +01:00
fix(web-clipper): createLink not defined in popup
This commit is contained in:
parent
f0b1319f95
commit
75e88c69bd
@ -1,4 +1,4 @@
|
||||
import { getBaseUrl, getPageLocationOrigin, randomString } from "../../utils.js";
|
||||
import { createLink, getBaseUrl, getPageLocationOrigin, randomString } from "../../utils.js";
|
||||
import Readability from "../../lib/Readability.js";
|
||||
|
||||
export default defineContentScript({
|
||||
@ -237,18 +237,6 @@ export default defineContentScript({
|
||||
return images;
|
||||
}
|
||||
|
||||
function createLink(clickAction, text, color = "lightskyblue") {
|
||||
const link = document.createElement('a');
|
||||
link.href = "javascript:";
|
||||
link.style.color = color;
|
||||
link.appendChild(document.createTextNode(text));
|
||||
link.addEventListener("click", () => {
|
||||
browser.runtime.sendMessage(null, clickAction)
|
||||
});
|
||||
|
||||
return link
|
||||
}
|
||||
|
||||
async function prepareMessageResponse(message) {
|
||||
console.info('Message: ' + message.name);
|
||||
|
||||
|
||||
@ -50,7 +50,6 @@
|
||||
<script type="module" src="../../lib/cash.min.js"></script>
|
||||
<script type="module" src="popup.js"></script>
|
||||
<script type="module" src="../../utils.js"></script>
|
||||
<script type="module" src="../../content.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
console.log("Popup script loaded");
|
||||
import { createLink } from "../../utils";
|
||||
|
||||
async function sendMessage(message) {
|
||||
try {
|
||||
|
||||
@ -26,3 +26,15 @@ export function getPageLocationOrigin() {
|
||||
// but for file:// protocol this is browser dependant and in particular Firefox returns "null" in this case.
|
||||
return location.protocol === 'file:' ? 'file://' : location.origin;
|
||||
}
|
||||
|
||||
export function createLink(clickAction, text, color = "lightskyblue") {
|
||||
const link = document.createElement('a');
|
||||
link.href = "javascript:";
|
||||
link.style.color = color;
|
||||
link.appendChild(document.createTextNode(text));
|
||||
link.addEventListener("click", () => {
|
||||
browser.runtime.sendMessage(null, clickAction)
|
||||
});
|
||||
|
||||
return link
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user