update
This commit is contained in:
@@ -16,6 +16,8 @@ export const defaultDocumentSettings: plugins.shared.interfaces.IDocumentSetting
|
||||
enableTopDraftText: true,
|
||||
enableDefaultHeader: true,
|
||||
enableDefaultFooter: true,
|
||||
languageCode: 'EN',
|
||||
vatGroupPositions: true,
|
||||
};
|
||||
|
||||
|
||||
@@ -97,6 +99,7 @@ export class DeDocument extends DeesElement {
|
||||
color: #333;
|
||||
padding: 0px;
|
||||
position: relative;
|
||||
font-family: 'Dees Sans', sans-serif;
|
||||
}
|
||||
|
||||
.betweenPagesSpacer {
|
||||
@@ -112,6 +115,12 @@ export class DeDocument extends DeesElement {
|
||||
}
|
||||
|
||||
public async firstUpdated(_changedProperties: Map<string | number | symbol, unknown>) {
|
||||
domtools.plugins.smartdelay.delayFor(0).then(() => {
|
||||
this.documentSettings = {
|
||||
...defaultDocumentSettings,
|
||||
...this.documentSettings,
|
||||
}
|
||||
});
|
||||
const resizeObserver = new ResizeObserver((entries) => {
|
||||
for (const entry of entries) {
|
||||
const width = entry.contentRect.width;
|
||||
@@ -126,13 +135,19 @@ export class DeDocument extends DeesElement {
|
||||
})
|
||||
}
|
||||
|
||||
public latestDocumentSettings: plugins.shared.interfaces.IDocumentSettings = null;
|
||||
public latestRenderedLetterData: plugins.tsclass.business.ILetter = null;
|
||||
|
||||
|
||||
public async renderDocument() {
|
||||
const domtools = await this.domtoolsPromise;
|
||||
|
||||
|
||||
this.latestDocumentSettings = this.documentSettings;
|
||||
this.latestRenderedLetterData = this.letterData;
|
||||
|
||||
console.log(`rendering with settings:`);
|
||||
console.log(this.latestDocumentSettings);
|
||||
|
||||
const domtools = await this.domtoolsPromise;
|
||||
const documentBuildContainer = document.createElement('div');
|
||||
document.body.appendChild(documentBuildContainer);
|
||||
|
||||
@@ -199,13 +214,13 @@ export class DeDocument extends DeesElement {
|
||||
}
|
||||
}
|
||||
this.adjustDePageScaling();
|
||||
this.latestRenderedLetterData = this.letterData;
|
||||
}
|
||||
|
||||
async updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void> {
|
||||
super.updated(changedProperties);
|
||||
const domtools = await this.domtoolsPromise;
|
||||
const renderedDocIsUpToDate = domtools.convenience.smartjson.deepEqualObjects(this.letterData, this.latestRenderedLetterData);
|
||||
let renderedDocIsUpToDate = domtools.convenience.smartjson.deepEqualObjects(this.letterData, this.latestRenderedLetterData)
|
||||
&& domtools.convenience.smartjson.deepEqualObjects(this.documentSettings, this.latestDocumentSettings);
|
||||
if (!renderedDocIsUpToDate) {
|
||||
this.renderDocument();
|
||||
}
|
||||
|
Reference in New Issue
Block a user