Skip to content

Commit

Permalink
fix: add lost elements info
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Apr 4, 2020
1 parent e52cfa5 commit edc80bf
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 42 deletions.
2 changes: 1 addition & 1 deletion projects/ledge-render/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ledge-framework/render",
"version": "0.0.2",
"version": "0.0.3",
"description": "Ledge Framework render, a powerful markdown render.",
"license": "MPL-2.0",
"repository": "https:/phodal/ledge",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,44 +51,40 @@ export class LedgeQuadrantComponent implements OnInit, AfterViewInit {
],
};

const {textValueKey, textValueKey} = this.buildGraphConfig(data, key, graphConfig);
const textValue = data.config[key];
graphConfig.children[0].style.text = textValue;
switch (key) {
case 'left':
graphConfig.top = 'middle';
graphConfig.left = 30;
graphConfig.children[0].style.text = '';
for (const textValueKey of textValue) {
graphConfig.children[0].style.text += textValueKey + '\n';
}
break;
case 'right':
graphConfig.top = 'middle';
graphConfig.right = 30;
graphConfig.children[0].style.text = '';
for (const textValueKey of textValue) {
graphConfig.children[0].style.text += textValueKey + '\n';
}
break;
case 'bottom':
graphConfig.left = 'center';
graphConfig.bottom = 30;
break;
case 'top':
graphConfig.left = 'center';
graphConfig.top = 30;
break;
}

graphic.push(graphConfig);
}
}
}

private buildGraphConfig(data, key: string, graphConfig: any) {
const textValue = data.config[key];
graphConfig.children[0].style.text = textValue;
switch (key) {
case 'left':
graphConfig.top = 'middle';
graphConfig.left = 30;
graphConfig.children[0].style.text = '';
for (const textValueKey of textValue) {
graphConfig.children[0].style.text += textValueKey + '\n';
}
break;
case 'right':
graphConfig.top = 'middle';
graphConfig.right = 30;
graphConfig.children[0].style.text = '';
for (const textValueKey of textValue) {
graphConfig.children[0].style.text += textValueKey + '\n';
}
break;
case 'bottom':
graphConfig.left = 'center';
graphConfig.bottom = 30;
break;
case 'top':
graphConfig.left = 'center';
graphConfig.top = 30;
break;
}
return {textValueKey, textValueKey};
}

buildOption(data) {
if (!data.children) {
return;
Expand All @@ -115,7 +111,10 @@ export class LedgeQuadrantComponent implements OnInit, AfterViewInit {
this.buildConfig(data, graphic);

return {
title: {text: data.name, left: 'center',},
title: {
text: data.name,
left: 'center',
},
graphic,
series: [
{
Expand Down
12 changes: 6 additions & 6 deletions projects/ledge-render/src/lib/ledge-render.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@
</div>

<div *ngSwitchCase="'heading'">
<h1 *ngIf="item.depth === 1" [innerHTML]="item.text" id="{{item.anchor}}"></h1>
<h2 *ngIf="item.depth === 2" [innerHTML]="item.text" id="{{item.anchor}}"></h2>
<h3 *ngIf="item.depth === 3" [innerHTML]="item.text" id="{{item.anchor}}"></h3>
<h4 *ngIf="item.depth === 4" [innerHTML]="item.text" id="{{item.anchor}}"></h4>
<h5 *ngIf="item.depth === 5" [innerHTML]="item.text" id="{{item.anchor}}"></h5>
<h6 *ngIf="item.depth === 6" [innerHTML]="item.text" id="{{item.anchor}}"></h6>
<h1 *ngIf="item.depth === 1" [innerHTML]="item.text" class="ledge-heading" id="{{item.anchor}}"></h1>
<h2 *ngIf="item.depth === 2" [innerHTML]="item.text" class="ledge-heading" id="{{item.anchor}}"></h2>
<h3 *ngIf="item.depth === 3" [innerHTML]="item.text" class="ledge-heading" id="{{item.anchor}}"></h3>
<h4 *ngIf="item.depth === 4" [innerHTML]="item.text" class="ledge-heading" id="{{item.anchor}}"></h4>
<h5 *ngIf="item.depth === 5" [innerHTML]="item.text" class="ledge-heading" id="{{item.anchor}}"></h5>
<h6 *ngIf="item.depth === 6" [innerHTML]="item.text" class="ledge-heading" id="{{item.anchor}}"></h6>
</div>

<div *ngSwitchCase="'code'">
Expand Down
2 changes: 1 addition & 1 deletion projects/ledge-render/src/lib/ledge-render.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export class LedgeRenderComponent implements OnInit, AfterViewInit, OnChanges {
}
}

private stringify(str: any) {
stringify(str: any) {
return JSON.stringify(str);
}
}

0 comments on commit edc80bf

Please sign in to comment.