Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ export class TextareaContent extends React.Component<IProps, IState> {
}

public render() {
const filler = 'Please enter value (if applicable)';
let display;
if (this.state.isEditing) {
display = <div onClick={this.toggleEditField()}>{this.makeEditingTextarea()}</div>;
display = this.makeEditingTextarea();
} else {
let value = getValueFromPath(this.props.path, this.props.assessment) || filler;
value = value.match('^(\n| )*$') ? filler : value;
display = (
<div onClick={this.toggleEditField()}>
{this.state.useRawValue ? value : <Markdown content={value} />}
</div>
);
if (this.state.useRawValue) {
display = getValueFromPath(this.props.path, this.props.assessment);
} else {
const filler = 'Please enter value (if applicable)';
let value = getValueFromPath(this.props.path, this.props.assessment) || '';
value = value.match('^(\n| )*$') ? filler : value;
display = <Markdown content={value} />;
}
}
return display;
return <div onClick={this.toggleEditField()}>{display}</div>;
}

private saveEditAssessment = (e: any) => {
Expand Down
19 changes: 14 additions & 5 deletions src/utils/xmlParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,23 @@ export const exportXml = () => {
};
let xmlStr = builder.buildObject(xml);
xmlStr = xmlStr.replace(/(&#xD;)+/g, '');
const element = document.createElement('a');
const file = new Blob([xmlStr], { endings: 'native', type: 'text/xml;charset=UTF-8' });
element.href = URL.createObjectURL(file);
element.download = title + '.xml';
element.click();
download(title + '.xml', xmlStr);
}
};

const download = (filename: string, text: string) => {
const element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);

element.style.display = 'none';
document.body.appendChild(element);

element.click();

document.body.removeChild(element);
};

const exportLibrary = (library: Library) => {
const deployment = {
$: {
Expand Down