Skip to content

Commit

Permalink
FIXED pdf generation for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
danielc-n committed Sep 25, 2024
1 parent e3f7325 commit b0473ea
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
"is-electron": "^2.2.1",
"isomorphic-git": "^1.24.0",
"js-yaml": "^4.1.0",
"jxl-pdf": "0.6.4",
"jxl-pdf": "0.6.5",
"localforage": "1.10.0",
"lodash.isequal": "^4.5.0",
"markdown-translatable": "1.3.0",
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/components/Sync/Gitea/Gitea.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Gitea = ({

const getAuth = async () => {
const authentication = await localforage.getItem('authentication');
setLocalDefaultOwner(authentication !== undefined ? authentication.user.login : '');
setLocalDefaultOwner(authentication ? authentication.user.login : '');
return authentication;
};

Expand Down
19 changes: 12 additions & 7 deletions renderer/src/layouts/editor/InnerFramePopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { WrapperTemplate } from './pdfGenInterface/pdfGenWrappers/WrapperTemplat
import ExpandMore from '../../../../public/icons/expand_more.svg';
import { SelectOption } from './SelectOptions';
import packageInfo from '../../../../package.json';
import * as logger from '../../logger';

export function findProjectInfo(meta, autoGrapha) {
return autoGrapha?.filter((a) => `${a.name }_${ a.id}` === meta)[0];
Expand Down Expand Up @@ -81,11 +82,7 @@ function messageToPeople(json) {
} else if (json.type === 'section') {
message += `Starting to prepare ${ json.args[0]}`;
} else if (json.type === 'wrappedSection') {
message
+= `Preparing section of type ${
json.args[0]
} from ${
json.args[1].split('-')[0]}`;
message += `Preparing section of type ${json.args[0]} from ${json.args[1].split('-')[0]}`;
if (json.args[1].split('-')[1]) {
message += ` to ${ json.args[1].split('-')[1]}`;
}
Expand All @@ -103,12 +100,20 @@ function createSection(folder, pickerJson) {
const fs = window.require('fs');
const fixedPath = fixPath(folder);

const projects = fs.readdirSync(fixedPath);
let projects;
try {
if (!fs.existsSync(fixedPath)) {
fs.mkdirSync(fixedPath);
}
projects = fs.readdirSync(fixedPath);
} catch (err) {
logger.error('InnerFramePopup.js', `Error reading project dir: ${err}`);
}

let currentMetadataPath = '';
// eslint-disable-next-line
for (const project of projects) {
currentMetadataPath = path.join(fixedPath, project, 'metadata.json');
currentMetadataPath = fixPath(path.join(fixedPath, project, 'metadata.json'));
if (fs.existsSync(currentMetadataPath)) {
const jsontest = fs.readFileSync(currentMetadataPath, 'utf-8');
const jsonParse = JSON.parse(jsontest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export function WrapperTemplate({

<ul className={sortableListClassName}>
{/* eslint-disable-next-line */}
{console.log("sections\n",JSON.parse(sections)[0].source) || Object.keys(JSON.parse(sections)).map((k, index) => (
{Object.keys(JSON.parse(sections)).map((k, index) => (
<li
id={index}
className={itemClassName}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14302,10 +14302,10 @@ just-diff@^5.0.1:
resolved "https://registry.yarnpkg.com/just-diff/-/just-diff-5.2.0.tgz#60dca55891cf24cd4a094e33504660692348a241"
integrity sha512-6ufhP9SHjb7jibNFrNxyFZ6od3g+An6Ai9mhGRvcYe8UJlH0prseN64M+6ZBBUoKYHZsitDP42gAJ8+eVWr3lw==

[email protected].4:
version "0.6.4"
resolved "https://registry.yarnpkg.com/jxl-pdf/-/jxl-pdf-0.6.4.tgz#efbe0b693e61bdc44ebdb0370754ac9401c5db92"
integrity sha512-KGHtxxp6wdZnVNC1tP/b77LkImBauWsiIP1h2iA7LhDwJTG4nMpRpwQWp4mUO6YYj4LEFHEx4dnDMIemloqF+g==
[email protected].5:
version "0.6.5"
resolved "https://registry.yarnpkg.com/jxl-pdf/-/jxl-pdf-0.6.5.tgz#cac19ee9eb3c5f334a8de3e6fb0c4d30358e2c19"
integrity sha512-EEjGVG9d30HOtElqu3v7fLzjae6xdXifoc97ne/Q3xFrpaDZGLhFZpfSUKimSzRcnZnVzO285u1Yb7H3mLKQVw==
dependencies:
commander "^11.1.0"
fontkit "^2.0.2"
Expand Down

0 comments on commit b0473ea

Please sign in to comment.