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.tsx30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index 26528b2b3..6aca8f2ca 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -1,4 +1,4 @@
-import { action, computed, IReactionDisposer, makeObservable, observable, reaction } from 'mobx';
+import { action, computed, makeObservable, observable } from 'mobx';
import * as React from 'react';
import * as rp from 'request-promise';
import { ClientUtils, returnFalse } from '../../../ClientUtils';
@@ -9,7 +9,7 @@ import { Id } from '../../../fields/FieldSymbols';
import { List } from '../../../fields/List';
import { listSpec } from '../../../fields/Schema';
import { ScriptField } from '../../../fields/ScriptField';
-import { BoolCast, Cast, DocCast, ScriptCast, StrCast } from '../../../fields/Types';
+import { BoolCast, Cast, ScriptCast, StrCast } from '../../../fields/Types';
import { WebField } from '../../../fields/URLField';
import { GetEffectiveAcl, TraceMobx } from '../../../fields/util';
import { GestureUtils } from '../../../pen-gestures/GestureUtils';
@@ -22,7 +22,7 @@ import { DragManager } from '../../util/DragManager';
import { dropActionType } from '../../util/DropActionTypes';
import { ImageUtils } from '../../util/Import & Export/ImageUtils';
import { SnappingManager } from '../../util/SnappingManager';
-import { UndoManager, undoBatch } from '../../util/UndoManager';
+import { UndoManager } from '../../util/UndoManager';
import { ViewBoxBaseComponent } from '../DocComponent';
import { FieldViewProps } from '../nodes/FieldView';
import { DocumentView } from '../nodes/DocumentView';
@@ -45,6 +45,7 @@ export interface CollectionViewProps extends React.PropsWithChildren<FieldViewPr
childLayoutTemplate?: () => Doc | undefined; // specify a layout Doc template to use for children of the collection
childHideDecorationTitle?: boolean;
childHideResizeHandles?: boolean;
+ childHideDecorations?: boolean;
childDragAction?: dropActionType;
childXPadding?: number;
childYPadding?: number;
@@ -67,7 +68,7 @@ export function CollectionSubView<X>() {
private gestureDisposer?: GestureUtils.GestureEventDisposer;
protected _mainCont?: HTMLDivElement;
- constructor(props: any) {
+ constructor(props: X & SubCollectionViewProps) {
super(props);
makeObservable(this);
}
@@ -227,7 +228,6 @@ export function CollectionSubView<X>() {
}
}
- @undoBatch
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected onGesture(e: Event, ge: GestureUtils.GestureEvent) {}
@@ -294,7 +294,6 @@ export function CollectionSubView<X>() {
return false;
}
- @undoBatch
protected async onExternalDrop(e: React.DragEvent, options: DocumentOptions, completed?: (docs: Doc[]) => void) {
if (e.ctrlKey) {
e.stopPropagation(); // bcz: this is a hack to stop propagation when dropping an image on a text document with shift+ctrl
@@ -386,7 +385,7 @@ export function CollectionSubView<X>() {
addDocument(htmlDoc);
if (srcWeb) {
const iframe = DocumentView.Selected()[0].ContentDiv?.getElementsByTagName('iframe')?.[0];
- const focusNode = iframe?.contentDocument?.getSelection()?.focusNode as any;
+ const focusNode = iframe?.contentDocument?.getSelection()?.focusNode;
if (focusNode) {
const anchor = srcWeb?.ComponentView?.getAnchor?.(true);
anchor && DocUtils.MakeLink(htmlDoc, anchor, {});
@@ -465,23 +464,6 @@ export function CollectionSubView<X>() {
if (item.kind === 'file') {
const file = item.getAsFile();
file?.type && files.push(file);
-
- file?.type === 'application/json' &&
- ClientUtils.readUploadedFileAsText(file).then(result => {
- const json = JSON.parse(result as string);
- addDocument(
- Docs.Create.TreeDocument(
- json['rectangular-puzzle'].crossword.clues[0].clue.map((c: any) => {
- const label = Docs.Create.LabelDocument({ title: c['#text'], _width: 120, _height: 20 });
- const proto = Doc.GetProto(label);
- proto._width = 120;
- proto._height = 20;
- return proto;
- }),
- { _width: 150, _height: 600, title: 'across', backgroundColor: 'white', _createDocOnCR: true }
- )
- );
- });
}
}
this.slowLoadDocuments(files, options, generatedDocuments, text, completed, addDocument).then(batch.end);