Skip to content

TagSpaces is an offline, open source, document manager with tagging support

adding word wrap in the licens and thirpdparty libs dialogs

Ilian Sapundshiev22cf557ef770
diff --git a/app/components/dialogs/LicenseDialog.js b/app/components/dialogs/LicenseDialog.js
index ea1b41e82..6d73cc9bf 100644
--- a/app/components/dialogs/LicenseDialog.js
+++ b/app/components/dialogs/LicenseDialog.js
@@ -40,6 +40,19 @@ type State = {
license?: string
};
+function printElem(elem) {
+ const printWin = window.open('', 'PRINT', 'height=400,width=600');
+ printWin.document.write('<html><head><title>License Agreement</title>');
+ printWin.document.write('</head><body >');
+ printWin.document.write(document.getElementById(elem).innerHTML);
+ printWin.document.write('</body></html>');
+ printWin.document.close(); // necessary for IE >= 10
+ printWin.focus(); // necessary for IE >= 10*/
+ printWin.print();
+ printWin.close();
+ return true;
+}
+
class LicenseDialog extends React.Component<Props, State> {
state = {
license: ''
@@ -58,16 +71,33 @@ class LicenseDialog extends React.Component<Props, State> {
});
}
+ licenseElement;
+
+ printLicense = () => {
+ printElem(this.licenseElement);
+ }
+
renderTitle = () => <DialogTitle>{i18n.t('core:license')}</DialogTitle>;
renderContent = () => (
<DialogContent style={{ overflowY: 'visible', overflowX: 'auto' }}>
- <pre>{ this.state.license }</pre>
+ <pre
+ inputRef={(ref) => { this.licenseElement = ref; }}
+ style={{ whiteSpace: 'pre-wrap' }}
+ >
+ { this.state.license }
+ </pre>
</DialogContent>
);
renderActions = () => (
<DialogActions>
+ {/* <Button
+ onClick={this.printLicense}
+ color="primary"
+ >
+ {i18n.t('core:print')}
+ </Button> */}
<Button
data-tid="confirmLicenseDialog"
onClick={this.props.onClose}
diff --git a/app/components/dialogs/ThirdPartyLibsDialog.js b/app/components/dialogs/ThirdPartyLibsDialog.js
index 36d28fc6f..5fbae77f3 100644
--- a/app/components/dialogs/ThirdPartyLibsDialog.js
+++ b/app/components/dialogs/ThirdPartyLibsDialog.js
@@ -62,7 +62,7 @@ class ThirdPartyLibsDialog extends React.Component<Props, State> {
renderContent = () => (
<DialogContent style={{ overflowX: 'auto' }}>
- <pre>{ this.state.thirdpartylibs }</pre>
+ <pre style={{ whiteSpace: 'pre-wrap' }}>{ this.state.thirdpartylibs }</pre>
</DialogContent>
);