Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: safe check for IS_DESKTOP_APP

Abdullah Attac20a8232cd66
diff --git a/packages/core/scripts/prebuild.mjs b/packages/core/scripts/prebuild.mjs
index d54b0c60b..12327b439 100644
--- a/packages/core/scripts/prebuild.mjs
+++ b/packages/core/scripts/prebuild.mjs
@@ -32,7 +32,10 @@ const languagesList = await langen(
path.join(ROOT_DIR, "src", "utils", "templates", "html", "languages")
);
const languageIndex = `function hasRequire() {
- return typeof require === "function" && !IS_DESKTOP_APP;
+ return (
+ typeof require === "function" &&
+ (typeof IS_DESKTOP_APP === "undefined" || !IS_DESKTOP_APP)
+ );
}
export async function loadLanguage(language) {
diff --git a/packages/core/src/utils/templates/html/builder.js b/packages/core/src/utils/templates/html/builder.js
index 2990d368c..6d0e1081b 100644
--- a/packages/core/src/utils/templates/html/builder.js
+++ b/packages/core/src/utils/templates/html/builder.js
@@ -41,7 +41,6 @@ async function preprocessHTML(templateData) {
const { content } = templateData;
let html = content.replaceAll(/<p([^>]*)><\/p>/gm, "<p$1><br/></p>");
- console.log(html);
for (const attribute in replaceableAttributes) {
html = html.replaceAll(attribute, replaceableAttributes[attribute]);
}
@@ -60,7 +59,6 @@ async function preprocessHTML(templateData) {
: await import("katex/contrib/mhchem/mhchem.js");
for (const mathBlock of mathBlocks) {
const text = mathBlock.textContent;
- console.log(text);
mathBlock.innerHTML = katex.renderToString(text, {
displayMode: true,
throwOnError: false
@@ -114,6 +112,9 @@ async function preprocessHTML(templateData) {
export default { buildHTML };
function hasRequire() {
- // eslint-disable-next-line no-undef
- return typeof require === "function" && !IS_DESKTOP_APP;
+ return (
+ typeof require === "function" &&
+ // eslint-disable-next-line no-undef
+ (typeof IS_DESKTOP_APP === "undefined" || !IS_DESKTOP_APP)
+ );
}