aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-04-10 20:42:09 -0400
committerbobzel <zzzman@gmail.com>2025-04-10 20:42:09 -0400
commit1ab64fef6e861a2958bbd826f086b8aac7d0c359 (patch)
treebe4e1c1d035ec9c15ecca6b3bc3303d09d0ea70d /src
parent75e76f1ec098ea9cbcd76432002da1bb73d74eba (diff)
fixed dashfieldviews in text boxes to show ellipsis for long lines and to hide dropdown menu when field is not editable. fixed pasting from pdf's to work and to display the entire text box.
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/formattedText/DashFieldView.scss3
-rw-r--r--src/client/views/nodes/formattedText/DashFieldView.tsx5
-rw-r--r--src/client/views/pdf/PDFViewer.tsx13
3 files changed, 10 insertions, 11 deletions
diff --git a/src/client/views/nodes/formattedText/DashFieldView.scss b/src/client/views/nodes/formattedText/DashFieldView.scss
index 2e2e1d41c..6db8abc7f 100644
--- a/src/client/views/nodes/formattedText/DashFieldView.scss
+++ b/src/client/views/nodes/formattedText/DashFieldView.scss
@@ -42,6 +42,9 @@
user-select: all;
min-width: 100%;
display: inline-block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ max-width: 100%;
}
}
}
diff --git a/src/client/views/nodes/formattedText/DashFieldView.tsx b/src/client/views/nodes/formattedText/DashFieldView.tsx
index bb0efa917..7ea5d1fcf 100644
--- a/src/client/views/nodes/formattedText/DashFieldView.tsx
+++ b/src/client/views/nodes/formattedText/DashFieldView.tsx
@@ -184,7 +184,7 @@ export class DashFieldViewInternal extends ObservableReactComponent<IDashFieldVi
getFinfo={this.finfo}
setColumnValues={returnFalse}
allowCRs
- oneLine={!this._expanded}
+ oneLine={!this._expanded && this._props.editable}
finishEdit={this.finishEdit}
transform={Transform.Identity}
menuTarget={null}
@@ -275,7 +275,7 @@ export class DashFieldViewInternal extends ObservableReactComponent<IDashFieldVi
</span>
)}
{this._props.fieldKey.startsWith('#') || this._hideValue ? null : this.fieldValueContent}
- {!this.values.length ? null : (
+ {!this.values.length || !this.props.editable ? null : (
<select className="dashFieldView-select" tabIndex={-1} defaultValue={this._dashDoc && Field.toKeyValueString(this._dashDoc, this._fieldKey)} onChange={this.selectVal}>
<option value="-unset-">-unset-</option>
{this.values.map(val => (
@@ -308,6 +308,7 @@ export class DashFieldView {
this.dom.style.height = node.attrs.height;
this.dom.style.position = 'relative';
this.dom.style.display = 'inline-flex';
+ this.dom.style.maxWidth = '100%';
this.dom.onkeypress = function (e: KeyboardEvent) {
e.stopPropagation();
};
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index ed2f661e6..9aa0e8e8b 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -134,7 +134,7 @@ export class PDFViewer extends ObservableReactComponent<IViewerProps> {
componentWillUnmount = () => {
Object.values(this._disposers).forEach(disposer => disposer?.());
- document.removeEventListener('copy', this.copy);
+ document.removeEventListener('copy', this.copy, true);
};
copy = (e: ClipboardEvent) => {
@@ -262,16 +262,11 @@ export class PDFViewer extends ObservableReactComponent<IViewerProps> {
}
return;
}
- document.removeEventListener('copy', this.copy);
- document.addEventListener('copy', this.copy);
+ document.removeEventListener('copy', this.copy, true);
+ document.addEventListener('copy', this.copy, true);
const eventBus = new PDFJSViewer.EventBus();
eventBus._on('pagesinit', this.pagesinit);
- eventBus._on(
- 'pagerendered',
- action(() => {
- this._showWaiting = false;
- })
- );
+ eventBus._on('pagerendered',action(() => (this._showWaiting = false))); // prettier-ignore
const pdfLinkService = new PDFJSViewer.PDFLinkService({ eventBus });
const pdfFindController = new PDFJSViewer.PDFFindController({ linkService: pdfLinkService, eventBus });
this._pdfViewer = new PDFJSViewer.PDFViewer({