fix: tsc errors
This commit is contained in:
parent
409b6d0218
commit
f97671596a
|
|
@ -18,9 +18,9 @@ import rehypeFormat from "rehype-format";
|
|||
import { h } from "hastscript";
|
||||
import YAML = require("yamljs");
|
||||
|
||||
import { Root as HRoot } from "hast";
|
||||
import { Root as HRoot, RootContent } from "hast";
|
||||
import { Root as MRoot } from "mdast";
|
||||
import { Node } from "hast-util-to-text/lib";
|
||||
import { Nodes } from "hast-util-to-text/lib";
|
||||
import { fileExists, formatPath, randomString } from "../../utils/str";
|
||||
import { parseCitationHTML } from "../../utils/citation";
|
||||
import {
|
||||
|
|
@ -575,8 +575,8 @@ function rehype2note(rehype: HRoot) {
|
|||
);
|
||||
|
||||
// Ignore empty lines, as they are not parsed to md
|
||||
const tempChildren = [];
|
||||
const isEmptyNode = (_n: Node) =>
|
||||
const tempChildren: RootContent[] = [];
|
||||
const isEmptyNode = (_n: Nodes) =>
|
||||
(_n.type === "text" && !_n.value.trim()) ||
|
||||
(_n.type === "element" &&
|
||||
_n.tagName === "p" &&
|
||||
|
|
@ -585,8 +585,8 @@ function rehype2note(rehype: HRoot) {
|
|||
for (const child of rehype.children) {
|
||||
if (
|
||||
tempChildren.length &&
|
||||
isEmptyNode(tempChildren[tempChildren.length - 1]) &&
|
||||
isEmptyNode(child)
|
||||
isEmptyNode(tempChildren[tempChildren.length - 1] as Nodes) &&
|
||||
isEmptyNode(child as Nodes)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ async function initializeReaderAnnotationButton(
|
|||
return [];
|
||||
}
|
||||
const hitItems: Zotero.Item[] = [];
|
||||
for (const moreButton of _document.querySelectorAll(".more")) {
|
||||
for (const moreButton of Array.from(_document.querySelectorAll(".more"))) {
|
||||
if (moreButton.getAttribute("_betternotesInitialized") === "true") {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ async function unInitializeReaderAnnotationButton(
|
|||
if (!_document) {
|
||||
return;
|
||||
}
|
||||
for (const moreButton of _document.querySelectorAll(".more")) {
|
||||
for (const moreButton of Array.from(_document.querySelectorAll(".more"))) {
|
||||
if (moreButton.getAttribute("_betternotesInitialized") === "true") {
|
||||
moreButton.removeAttribute("_betternotesInitialized");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import TreeModel = require("tree-model");
|
||||
import katex from "katex";
|
||||
import katex = require("katex");
|
||||
import { getEditorInstance, getPositionAtLine, insert } from "./editor";
|
||||
import { formatPath, getItemDataURL } from "./str";
|
||||
import { showHint } from "./hint";
|
||||
|
|
@ -220,7 +220,7 @@ async function renderNoteHTML(
|
|||
const bgNodes = doc.querySelectorAll(
|
||||
"span[style]",
|
||||
) as NodeListOf<HTMLElement>;
|
||||
for (const node of bgNodes) {
|
||||
for (const node of Array.from(bgNodes)) {
|
||||
// Browser converts #RRGGBBAA hex color to rgba function, and we convert it to rgb function,
|
||||
// because word processors don't understand colors with alpha channel
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"module": "commonjs",
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"target": "ES2016",
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue