fix(core): update
This commit is contained in:
parent
aec2cf18fd
commit
beef47959b
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@designestate/dees-catalog',
|
name: '@designestate/dees-catalog',
|
||||||
version: '1.0.160',
|
version: '1.0.161',
|
||||||
description: 'website for lossless.com'
|
description: 'website for lossless.com'
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,10 @@ export class DeesDataviewCodebox extends DeesElement {
|
|||||||
public progLang: string = 'typescript';
|
public progLang: string = 'typescript';
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: String
|
type: String,
|
||||||
|
reflect: true,
|
||||||
})
|
})
|
||||||
public codeToDisplay: string = '// no code set';
|
public codeToDisplay: string = '';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -143,12 +144,15 @@ export class DeesDataviewCodebox extends DeesElement {
|
|||||||
})
|
})
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
<pre><code class="${this.progLang}">${this.codeToDisplay}</code></pre>
|
<pre><code></code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@state()
|
||||||
|
private codeToDisplayStore = '';
|
||||||
|
|
||||||
public async updated(_changedProperties) {
|
public async updated(_changedProperties) {
|
||||||
super.updated(_changedProperties);
|
super.updated(_changedProperties);
|
||||||
console.log('highlighting now');
|
console.log('highlighting now');
|
||||||
@ -159,11 +163,16 @@ export class DeesDataviewCodebox extends DeesElement {
|
|||||||
slottedCodeNodes.push(childNode as Text);
|
slottedCodeNodes.push(childNode as Text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (slottedCodeNodes[0] && slottedCodeNodes[0].wholeText) {
|
if (this.codeToDisplay && this.codeToDisplay !== this.codeToDisplayStore) {
|
||||||
this.codeToDisplay = smartstring.indent.normalize(slottedCodeNodes[0].wholeText);
|
this.codeToDisplayStore = smartstring.indent.normalize(this.codeToDisplay);
|
||||||
|
}
|
||||||
|
if (slottedCodeNodes[0] && slottedCodeNodes[0].wholeText && !this.codeToDisplay) {
|
||||||
|
this.codeToDisplayStore = smartstring.indent.normalize(slottedCodeNodes[0].wholeText);
|
||||||
|
this.codeToDisplay = this.codeToDisplayStore;
|
||||||
}
|
}
|
||||||
await domtools.plugins.smartdelay.delayFor(0);
|
await domtools.plugins.smartdelay.delayFor(0);
|
||||||
const localCodeNode = this.shadowRoot.querySelector('code');
|
const localCodeNode = this.shadowRoot.querySelector('code');
|
||||||
hlight.highlightBlock(localCodeNode);
|
const html = hlight.highlight(this.codeToDisplayStore, {language: this.progLang, ignoreIllegals: true});
|
||||||
|
localCodeNode.innerHTML = html.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user