Fix bug of missing error encode.

This commit is contained in:
Paulo Gustavo Veiga 2022-01-31 19:56:33 -08:00
parent ab4eddf1c2
commit 5821a776df
2 changed files with 10 additions and 3 deletions

View File

@ -58,7 +58,10 @@ class MDExporter implements Exporter {
}
result += '\n';
return Promise.resolve(result);
// Encode as url response ...
const blob = new Blob([result], { type: 'text/markdown' });
const urlStr = URL.createObjectURL(blob);
return Promise.resolve(urlStr);
}
private traverseBranch(prefix: string, branches: Array<INodeModel>) {

View File

@ -35,8 +35,12 @@ class TxtExporter implements Exporter {
const { mindmap } = this;
const branches = mindmap.getBranches();
const retult = this.traverseBranch('', branches);
return Promise.resolve(retult);
const txtStr = this.traverseBranch('', branches);
// Encode as url response ...
const blob = new Blob([txtStr], { type: 'text/pain' });
const result = URL.createObjectURL(blob);
return Promise.resolve(result);
}
private traverseBranch(prefix: string, branches: INodeModel[]) {