Skip to content

Commit

Permalink
chore: trigger netlify
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbalex committed Nov 4, 2020
1 parent 0c2d61e commit 528a77c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 0 additions & 3 deletions src/pdf/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ export const getDomElByJSONSchemaField = (elID: string): string => {
};

export const getAllDomFields = (): Fields => {
const containerInnerHTML = document.querySelector("#container");
console.log("html", containerInnerHTML);

const allInputs = document.getElementsByTagName("input");

let fields: Fields = [];
Expand Down
2 changes: 1 addition & 1 deletion src/pdf/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const createTextElement = (
w: number,
h: number
) => {
console.log(label, id);
console.debug(label, id);
if (id === null || id === "") {
return;
}
Expand Down
4 changes: 4 additions & 0 deletions src/pdf/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { PDFDocument } from "pdf-lib";
import { AnyAction, Store } from "redux";
import { getAllDomFields } from "./dom";
import { createTextElement } from "./generate";
import { getAllFields } from "./schema";

const download = (arrayBuffer: any, type: string) => {
var blob = new Blob([arrayBuffer], { type: type });
Expand All @@ -20,7 +21,10 @@ export const getPDF = async (store: Store<any, AnyAction>) => {

const { width, height } = page.getSize();

// get fields from dom
const fields = getAllDomFields();
const fieldsSchema = getAllFields(store);

fields.forEach((field) => {
createTextElement(
page,
Expand Down
8 changes: 6 additions & 2 deletions src/pdf/schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ import { Fields } from "./field";
export const getAllFields = (store: Store<any, AnyAction>): Fields => {
const state = store.getState();
const schema = state.jsonforms?.core?.schema?.properties;
const uischema = state.jsonforms?.core?.uischema?.properties;
const uischema = state.jsonforms?.core?.uischema;
const data = state.jsonforms?.core?.data;


if (schema === null) {
console.error("schema not defined", state);
}

console.log("schema", state.jsonforms);
console.log("schema", schema);
console.log("uischema", uischema);
console.log("data", data);

return [{ id: "", label: "" }];
};

0 comments on commit 528a77c

Please sign in to comment.