clipper(web): make ready for publishing

This commit is contained in:
Abdullah Atta
2022-11-28 16:39:57 +05:00
parent 7cd6a6e9ee
commit 47dcbba522
4 changed files with 10 additions and 11 deletions

View File

@@ -33,7 +33,7 @@ const ACTION = {
const common = {
name: "Notesnook Web Clipper",
version: "1.0",
version: "0.1",
description: "Clip web pages.",
permissions: [
"activeTab",
@@ -42,7 +42,6 @@ const common = {
"contextMenus",
"notifications"
],
key: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmXQb9xwsSWbvAbBVnWa+DwsXLtRLbjfLyWRZtT5KF8bjCrEg3InvntWlk1PrNo73lsTov1m8Y5K9fJcCVKuYZkTCmNf4iGsHqOafi9ny5MX53oQ53+/s7gao2ZicHtTylnCIqn8f/l+RkV3tHO8BwANDLX2TTe7zCYLzFH19jiKAI+7qmUDZvyCH/OMVohluUCQO94s7sghslalwPbAcQQLpAKxYdd5GJDn4FryitsCMTYX962X+O6Tivq2QPML/Gm7BrZqJsU1enFRH1ss0UK0b9COpEYqqPhZ+GJP5K6WOL46NX+CvZnQmux1ehTZgIhw64IQJ57TvG2kIQTA8ZQIDAQAB",
content_scripts: [
{
js: ["nnContentScript.bundle.js"],

View File

@@ -5,8 +5,7 @@
"allowJs": true,
"jsx": "react-jsx",
"maxNodeModuleJsDepth": 5,
"declaration": false,
"noEmit": true
"declaration": false
},
"include": ["src", "global.d.ts"]
}

View File

@@ -293,8 +293,10 @@ function clonePseudoElements(
}
function copyUserInput(original: HTMLElement, clone: HTMLElement) {
if (original instanceof HTMLTextAreaElement) clone.innerHTML = original.value;
if (original instanceof HTMLInputElement)
if (
original instanceof HTMLInputElement ||
original instanceof HTMLTextAreaElement
)
clone.setAttribute("value", original.value);
}

View File

@@ -429,10 +429,9 @@ function getElementViewportInfo(el: HTMLElement) {
}
function toDocument(head: HTMLElement, body: HTMLElement) {
const newHTMLDocument = document.implementation.createHTMLDocument();
newHTMLDocument.head.outerHTML = head.outerHTML;
newHTMLDocument.body.outerHTML = body.outerHTML;
return newHTMLDocument;
const doc = document.implementation.createHTMLDocument();
doc.documentElement.replaceChildren(head, body);
return doc;
}
function cleanup() {
@@ -475,7 +474,7 @@ async function getPage(
const head = document.createElement("head");
const title = document.createElement("title");
title.innerHTML = document.title;
title.innerText = document.title;
head.appendChild(title);
return {