mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Ignore empty nodes from serialization
This commit is contained in:
parent
9596686c7e
commit
cac5951d0c
@ -24,7 +24,7 @@ import Exporter from './Exporter';
|
|||||||
class MDExporter implements Exporter {
|
class MDExporter implements Exporter {
|
||||||
private mindmap: Mindmap;
|
private mindmap: Mindmap;
|
||||||
|
|
||||||
private footNotes = [];
|
private footNotes: string[] = [];
|
||||||
|
|
||||||
constructor(mindmap: Mindmap) {
|
constructor(mindmap: Mindmap) {
|
||||||
this.mindmap = mindmap;
|
this.mindmap = mindmap;
|
||||||
@ -63,32 +63,34 @@ class MDExporter implements Exporter {
|
|||||||
|
|
||||||
private traverseBranch(prefix: string, branches: Array<INodeModel>) {
|
private traverseBranch(prefix: string, branches: Array<INodeModel>) {
|
||||||
let result = '';
|
let result = '';
|
||||||
branches.forEach((node) => {
|
branches
|
||||||
result = `${result}${prefix}- ${node.getText()}`;
|
.filter((n) => n.getText() !== undefined)
|
||||||
node.getFeatures().forEach((f) => {
|
.forEach((node) => {
|
||||||
const type = f.getType();
|
result = `${result}${prefix}- ${node.getText()}`;
|
||||||
// Dump all features ...
|
node.getFeatures().forEach((f) => {
|
||||||
if (type === 'link') {
|
const type = f.getType();
|
||||||
result = `${result} ( [link](${(f as LinkModel).getUrl()}) )`;
|
// Dump all features ...
|
||||||
}
|
if (type === 'link') {
|
||||||
|
result = `${result} ( [link](${(f as LinkModel).getUrl()}) )`;
|
||||||
|
}
|
||||||
|
|
||||||
if (type === 'note') {
|
if (type === 'note') {
|
||||||
const note = f as NoteModel;
|
const note = f as NoteModel;
|
||||||
this.footNotes.push(note.getText());
|
this.footNotes.push(note.getText());
|
||||||
result = `${result}[^${this.footNotes.length}] `;
|
result = `${result}[^${this.footNotes.length}] `;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(type === 'icon'){
|
// if(type === 'icon'){
|
||||||
// const icon = f as IconModel;
|
// const icon = f as IconModel;
|
||||||
// result = result + ` ![${icon.getIconType().replace('_','')}!](https://app.wisemapping.com/images/${icon.getIconType()}.svg )`
|
// result = result + ` ![${icon.getIconType().replace('_','')}!](https://app.wisemapping.com/images/${icon.getIconType()}.svg )`
|
||||||
// }
|
// }
|
||||||
|
});
|
||||||
|
result = `${result}\n`;
|
||||||
|
|
||||||
|
if (node.getChildren().filter((n) => n.getText() !== undefined).length > 0) {
|
||||||
|
result += this.traverseBranch(`${prefix}\t`, node.getChildren());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
result = `${result}\n`;
|
|
||||||
|
|
||||||
if (node.getChildren().length > 0) {
|
|
||||||
result += this.traverseBranch(`${prefix}\t`, node.getChildren());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,22 +39,24 @@ class TxtExporter implements Exporter {
|
|||||||
return Promise.resolve(retult);
|
return Promise.resolve(retult);
|
||||||
}
|
}
|
||||||
|
|
||||||
private traverseBranch(prefix: string, branches: Array<INodeModel>) {
|
private traverseBranch(prefix: string, branches: INodeModel[]) {
|
||||||
let result = '';
|
let result = '';
|
||||||
branches.forEach((node, index) => {
|
branches
|
||||||
result = `${result}${prefix}${index + 1} ${node.getText()}`;
|
.filter((n) => n.getText() !== undefined)
|
||||||
node.getFeatures().forEach((f) => {
|
.forEach((node, index) => {
|
||||||
const type = f.getType();
|
result = `${result}${prefix}${index + 1} ${node.getText()}`;
|
||||||
if (type === 'link') {
|
node.getFeatures().forEach((f) => {
|
||||||
result = `${result} [link: ${(f as LinkModel).getUrl()}]`;
|
const type = f.getType();
|
||||||
|
if (type === 'link') {
|
||||||
|
result = `${result} [link: ${(f as LinkModel).getUrl()}]`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
result = `${result}\n`;
|
||||||
|
|
||||||
|
if (node.getChildren().filter((n) => n.getText() !== undefined).length > 0) {
|
||||||
|
result += this.traverseBranch(`\t${prefix}${index + 1}.`, node.getChildren());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
result = `${result}\n`;
|
|
||||||
|
|
||||||
if (node.getChildren().length > 0) {
|
|
||||||
result += this.traverseBranch(`\t${prefix}${index + 1}.`, node.getChildren());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ abstract class INodeModel {
|
|||||||
this.putProperty('text', text);
|
this.putProperty('text', text);
|
||||||
}
|
}
|
||||||
|
|
||||||
getText(): string {
|
getText(): string | undefined {
|
||||||
return this.getProperty('text') as string;
|
return this.getProperty('text') as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ abstract class INodeModel {
|
|||||||
this.putProperty('imageSize', `{width:${width},height:${height}}`);
|
this.putProperty('imageSize', `{width:${width},height:${height}}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getImageSize(): {width: number, height: number} {
|
getImageSize(): { width: number, height: number } {
|
||||||
const value = this.getProperty('imageSize') as string;
|
const value = this.getProperty('imageSize') as string;
|
||||||
let result;
|
let result;
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
@ -260,7 +260,7 @@ abstract class INodeModel {
|
|||||||
const tmindmap = target.getMindmap();
|
const tmindmap = target.getMindmap();
|
||||||
|
|
||||||
children.forEach((snode) => {
|
children.forEach((snode) => {
|
||||||
const tnode:INodeModel = tmindmap.createNode(snode.getType(), snode.getId());
|
const tnode: INodeModel = tmindmap.createNode(snode.getType(), snode.getId());
|
||||||
snode.copyTo(tnode);
|
snode.copyTo(tnode);
|
||||||
target.append(tnode);
|
target.append(tnode);
|
||||||
});
|
});
|
||||||
@ -289,7 +289,7 @@ abstract class INodeModel {
|
|||||||
|
|
||||||
abstract getProperty(key: string): number | string | boolean;
|
abstract getProperty(key: string): number | string | boolean;
|
||||||
|
|
||||||
abstract putProperty(key: string, value: number | string| boolean): void;
|
abstract putProperty(key: string, value: number | string | boolean): void;
|
||||||
|
|
||||||
abstract setParent(parent: INodeModel): void;
|
abstract setParent(parent: INodeModel): void;
|
||||||
|
|
||||||
|
@ -26,12 +26,12 @@ class NoteModel extends FeatureModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
getText():string {
|
getText(): string {
|
||||||
return this.getAttribute('text') as string;
|
return this.getAttribute('text') as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
setText(text:string) {
|
setText(text: string) {
|
||||||
$assert(text, 'text can not be null');
|
$assert(text, 'text can not be null');
|
||||||
this.setAttribute('text', text);
|
this.setAttribute('text', text);
|
||||||
}
|
}
|
||||||
|
@ -35,18 +35,6 @@ export const setupBlob = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const parseXMLFile = (filePath: fs.PathOrFileDescriptor, mimeType: DOMParserSupportedType) => {
|
|
||||||
const stream = fs.readFileSync(filePath, { encoding: 'utf-8' });
|
|
||||||
|
|
||||||
let content = stream.toString();
|
|
||||||
// Hack for SVG exported from the browser ...
|
|
||||||
if (mimeType == 'image/svg+xml') {
|
|
||||||
content = content.replace('<svg ', '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ');
|
|
||||||
}
|
|
||||||
|
|
||||||
return parseXMLString(content, mimeType);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const parseXMLString = (xmlStr: string, mimeType: DOMParserSupportedType) => {
|
export const parseXMLString = (xmlStr: string, mimeType: DOMParserSupportedType) => {
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
const xmlDoc = parser.parseFromString(xmlStr, mimeType);
|
const xmlDoc = parser.parseFromString(xmlStr, mimeType);
|
||||||
@ -61,6 +49,18 @@ export const parseXMLString = (xmlStr: string, mimeType: DOMParserSupportedType)
|
|||||||
return xmlDoc;
|
return xmlDoc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const parseXMLFile = (filePath: fs.PathOrFileDescriptor, mimeType: DOMParserSupportedType) => {
|
||||||
|
const stream = fs.readFileSync(filePath, { encoding: 'utf-8' });
|
||||||
|
|
||||||
|
let content = stream.toString();
|
||||||
|
// Hack for SVG exported from the browser ...
|
||||||
|
if (mimeType === 'image/svg+xml') {
|
||||||
|
content = content.replace('<svg ', '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ');
|
||||||
|
}
|
||||||
|
|
||||||
|
return parseXMLString(content, mimeType);
|
||||||
|
};
|
||||||
|
|
||||||
export const exporterAssert = async (testName: string, exporter: Exporter) => {
|
export const exporterAssert = async (testName: string, exporter: Exporter) => {
|
||||||
const actualStr = await exporter.export();
|
const actualStr = await exporter.export();
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
- Goals
|
- Goals
|
||||||
- Formulize
|
- Formulize
|
||||||
- Probono
|
- Probono
|
||||||
- null
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
1.11.1 Goals
|
1.11.1 Goals
|
||||||
1.11.2 Formulize
|
1.11.2 Formulize
|
||||||
1.12 Probono
|
1.12 Probono
|
||||||
1.12.1 null
|
|
||||||
2 Strategy 2: Talent Development
|
2 Strategy 2: Talent Development
|
||||||
2.1 Strategic Priority 2a: Personal Plans
|
2.1 Strategic Priority 2a: Personal Plans
|
||||||
2.2 Strategic Priority 2b: External learning matches organ. goals
|
2.2 Strategic Priority 2b: External learning matches organ. goals
|
||||||
@ -23,8 +22,7 @@
|
|||||||
3.1 Strategic Priority 4a:Feedback
|
3.1 Strategic Priority 4a:Feedback
|
||||||
3.2 Strategic Priority 4b: Anti Harassment
|
3.2 Strategic Priority 4b: Anti Harassment
|
||||||
3.3 Strategic Priority 4c: Diversity
|
3.3 Strategic Priority 4c: Diversity
|
||||||
3.4 null
|
3.4 So That...
|
||||||
3.5 So That...
|
|
||||||
4 Strategy 1: Recruit & Retain
|
4 Strategy 1: Recruit & Retain
|
||||||
4.1 So that...
|
4.1 So that...
|
||||||
4.2 Strategic Priority 1a: Recruitment
|
4.2 Strategic Priority 1a: Recruitment
|
||||||
@ -44,22 +42,14 @@
|
|||||||
5.1 Goals
|
5.1 Goals
|
||||||
5.1.1 Increase new clients
|
5.1.1 Increase new clients
|
||||||
5.1.1.1 Academic Research
|
5.1.1.1 Academic Research
|
||||||
5.1.1.2 null
|
|
||||||
5.1.2 Support New Products
|
5.1.2 Support New Products
|
||||||
5.1.2.1 Formulize
|
5.1.2.1 Formulize
|
||||||
5.1.2.2 null
|
|
||||||
5.1.2.3 null
|
|
||||||
5.1.3 Support CiviCRM
|
5.1.3 Support CiviCRM
|
||||||
5.1.4 Identify Opportunites
|
5.1.4 Identify Opportunites
|
||||||
5.1.4.1 null
|
|
||||||
5.1.4.2 null
|
|
||||||
5.1.4.3 null
|
|
||||||
5.1.4.4 null
|
|
||||||
6 Hosting NG Plan
|
6 Hosting NG Plan
|
||||||
7 Freeform IT Plan
|
7 Freeform IT Plan
|
||||||
7.1 Fragile
|
7.1 Fragile
|
||||||
7.2 Tools
|
7.2 Tools
|
||||||
7.3 null
|
|
||||||
8 Project Teams
|
8 Project Teams
|
||||||
8.1 Projects 1-3
|
8.1 Projects 1-3
|
||||||
8.2 Projects 4-6
|
8.2 Projects 4-6
|
||||||
@ -78,7 +68,6 @@
|
|||||||
10.5 Business Plan
|
10.5 Business Plan
|
||||||
11 Strategy 3: Safety and Wellness
|
11 Strategy 3: Safety and Wellness
|
||||||
11.1 Strategic Priority 3a: H&S Policies & Practices
|
11.1 Strategic Priority 3a: H&S Policies & Practices
|
||||||
11.1.1 null
|
|
||||||
11.2 Strategic Priority 3b: Health Promotion
|
11.2 Strategic Priority 3b: Health Promotion
|
||||||
11.2.1 Health and Wellness Committee
|
11.2.1 Health and Wellness Committee
|
||||||
11.2.2 Work-life Balance Initiative [link: http://hrcouncil.ca/hr-toolkit/workplaces-health-safety.cfm]
|
11.2.2 Work-life Balance Initiative [link: http://hrcouncil.ca/hr-toolkit/workplaces-health-safety.cfm]
|
||||||
@ -101,54 +90,45 @@
|
|||||||
14 Backlog Plan [link: https://docs.google.com/a/freeform.ca/drawings/d/1mrtkVAN3_XefJJCgfxw4Va6xk9TVDBKXDt_uzyIF4Us/edit]
|
14 Backlog Plan [link: https://docs.google.com/a/freeform.ca/drawings/d/1mrtkVAN3_XefJJCgfxw4Va6xk9TVDBKXDt_uzyIF4Us/edit]
|
||||||
14.1 Go To Backlog Plan [link: https://docs.google.com/a/freeform.ca/drawings/d/1mrtkVAN3_XefJJCgfxw4Va6xk9TVDBKXDt_uzyIF4Us/edit]
|
14.1 Go To Backlog Plan [link: https://docs.google.com/a/freeform.ca/drawings/d/1mrtkVAN3_XefJJCgfxw4Va6xk9TVDBKXDt_uzyIF4Us/edit]
|
||||||
15 Strategy Prospecting
|
15 Strategy Prospecting
|
||||||
15.1 null
|
|
||||||
15.2 null
|
|
||||||
15.3 null
|
|
||||||
16 Stategies: Forecasting
|
16 Stategies: Forecasting
|
||||||
16.1 null
|
|
||||||
16.2 null
|
|
||||||
16.3 null
|
|
||||||
17 Strategies Marketing
|
17 Strategies Marketing
|
||||||
18 null
|
18 Exit Interviews
|
||||||
19 Exit Interviews
|
18.1 As Freeform
|
||||||
19.1 As Freeform
|
18.2 Responsiblity: HZ, KS
|
||||||
19.2 Responsiblity: HZ, KS
|
18.3 Release
|
||||||
19.3 Release
|
18.4 Have Heather write procedures for exit interview process
|
||||||
19.4 Have Heather write procedures for exit interview process
|
18.5 So that
|
||||||
19.5 So that
|
19 3 Month Onboarding Process
|
||||||
20 3 Month Onboarding Process
|
20 Human Resources Plan
|
||||||
21 Human Resources Plan
|
20.1 Related Org Objectives
|
||||||
21.1 Related Org Objectives
|
20.1.1 1
|
||||||
21.1.1 1
|
20.1.2 2
|
||||||
21.1.2 2
|
20.1.3 3
|
||||||
21.1.3 3
|
20.1.4 4
|
||||||
21.1.4 4
|
20.2 Related Documents
|
||||||
21.2 Related Documents
|
20.3 Goals
|
||||||
21.3 Goals
|
20.3.1 Goal:Staff=Optimal Bus. Growth
|
||||||
21.3.1 Goal:Staff=Optimal Bus. Growth
|
20.3.1.1 So that...
|
||||||
21.3.1.1 So that...
|
20.3.1.2 Related Strategic Priorities:
|
||||||
21.3.1.2 Related Strategic Priorities:
|
20.3.1.3 KPI: HR Level equals Planned Growth
|
||||||
21.3.1.3 KPI: HR Level equals Planned Growth
|
20.3.1.4 Methodology
|
||||||
21.3.1.4 Methodology
|
20.3.1.4.1 Target
|
||||||
21.3.1.4.1 Target
|
20.3.2 Goal: Increase Job Satisfaction
|
||||||
21.3.2 Goal: Increase Job Satisfaction
|
20.3.2.1 So That
|
||||||
21.3.2.1 So That
|
20.3.2.2 Related Strategic Priorities
|
||||||
21.3.2.2 Related Strategic Priorities
|
20.3.2.3 KPI: Employee Satisfaction
|
||||||
21.3.2.2.1 null
|
20.3.2.4 Methodology
|
||||||
21.3.2.3 KPI: Employee Satisfaction
|
20.3.2.4.1 Target
|
||||||
21.3.2.3.1 null
|
20.3.3 Goal: Improve Performance
|
||||||
21.3.2.4 Methodology
|
20.3.3.1 So That
|
||||||
21.3.2.4.1 Target
|
20.3.3.2 Related Strategic Priorities
|
||||||
21.3.3 Goal: Improve Performance
|
20.3.3.3 KPI: Employee Performance
|
||||||
21.3.3.1 So That
|
20.3.3.4 Methodology
|
||||||
21.3.3.2 Related Strategic Priorities
|
20.3.3.4.1 Target
|
||||||
21.3.3.3 KPI: Employee Performance
|
20.3.4 Goal: Reduce Turnover
|
||||||
21.3.3.4 Methodology
|
20.3.4.1 So That
|
||||||
21.3.3.4.1 Target
|
20.3.4.2 Related Strategic Priorities
|
||||||
21.3.4 Goal: Reduce Turnover
|
20.3.4.3 KPI: Retention Rate
|
||||||
21.3.4.1 So That
|
20.3.4.4 Methodology
|
||||||
21.3.4.2 Related Strategic Priorities
|
20.3.4.4.1 Target
|
||||||
21.3.4.3 KPI: Retention Rate
|
20.3.5 Risk & Compliance
|
||||||
21.3.4.4 Methodology
|
|
||||||
21.3.4.4.1 Target
|
|
||||||
21.3.5 Risk & Compliance
|
|
||||||
|
Loading…
Reference in New Issue
Block a user