aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSubView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
-rw-r--r--src/client/views/collections/CollectionSubView.tsx25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index 4ac755b9d..01a8da313 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -356,12 +356,16 @@ export function CollectionSubView<X>() {
return !!added;
}
if (de.complete.annoDragData) {
- const dropCreator = de.complete.annoDragData.dropDocCreator;
- de.complete.annoDragData.dropDocCreator = () => {
- const dropped = dropCreator(this._props.isAnnotationOverlay ? this.Document : undefined);
- this.addDocument(dropped);
- return dropped;
- };
+ if (![de.complete.annoDragData.dragDocument.embedContainer, de.complete.annoDragData.dragDocument].includes(this.Document)) {
+ de.complete.annoDragData.dropDocCreator = () => this.getAnchor?.(true) || this.Document;
+ } else {
+ const dropCreator = de.complete.annoDragData.dropDocCreator;
+ de.complete.annoDragData.dropDocCreator = () => {
+ const dropped = dropCreator(this._props.isAnnotationOverlay ? this.Document : undefined);
+ this.addDocument(dropped);
+ return dropped;
+ };
+ }
return true;
}
return false;
@@ -415,7 +419,7 @@ export function CollectionSubView<X>() {
const tags = html.split('<');
if (tags[0] === '') tags.splice(0, 1);
let img = tags[0].startsWith('img') ? tags[0] : tags.length > 1 && tags[1].startsWith('img') ? tags[1] : '';
- const cors = img.includes('corsProxy') ? img.match(/http.*corsProxy\//)![0] : '';
+ const cors = img.includes('corsproxy') ? img.match(/http.*corsproxy\//)![0] : '';
img = cors ? img.replace(cors, '') : img;
if (img) {
const imgSrc = img.split('src="')[1].split('"')[0];
@@ -563,10 +567,11 @@ export function CollectionSubView<X>() {
Doc.addCurrentlyLoading(loading);
DocUtils.uploadFileToDoc(file, {}, loading).then(d => {
if (d && d?.type === DocumentType.IMG) {
- const imgTemplate = DocListCast(DocCast(Doc.UserDoc().template_user)?.data).find(d => d.title === 'shower');
+ const imgTemplate = DocCast(Doc.UserDoc().defaultImageLayout);
if (imgTemplate) {
- d.layout_fieldKey = 'layout_shower';
- d.layout_shower = imgTemplate;
+ const templateFieldKey = StrCast(imgTemplate.title);
+ d.layout_fieldKey = templateFieldKey;
+ d[templateFieldKey] = imgTemplate;
}
}
});