aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/CollectionNoteTakingView.scss1
-rw-r--r--src/client/views/collections/CollectionNoteTakingView.tsx37
2 files changed, 12 insertions, 26 deletions
diff --git a/src/client/views/collections/CollectionNoteTakingView.scss b/src/client/views/collections/CollectionNoteTakingView.scss
index c0297a648..a878033ed 100644
--- a/src/client/views/collections/CollectionNoteTakingView.scss
+++ b/src/client/views/collections/CollectionNoteTakingView.scss
@@ -116,6 +116,7 @@
position: absolute;
display: flex;
flex-direction: column;
+ align-items: center;
top: 0;
left: 0;
width: 100%;
diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx
index d3b3778a7..50390957a 100644
--- a/src/client/views/collections/CollectionNoteTakingView.tsx
+++ b/src/client/views/collections/CollectionNoteTakingView.tsx
@@ -1,7 +1,6 @@
import React = require("react");
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { CursorProperty } from "csstype";
-import { action, computed, IReactionDisposer, observable, reaction, runInAction } from "mobx";
+import { action, computed, IReactionDisposer, observable, reaction } from "mobx";
import { observer } from "mobx-react";
import { DataSym, Doc, HeightSym, Opt, WidthSym } from "../../../fields/Doc";
import { Id } from "../../../fields/FieldSymbols";
@@ -10,8 +9,9 @@ import { listSpec } from "../../../fields/Schema";
import { SchemaHeaderField } from "../../../fields/SchemaHeaderField";
import { BoolCast, Cast, NumCast, ScriptCast, StrCast } from "../../../fields/Types";
import { TraceMobx } from "../../../fields/util";
-import { emptyFunction, returnEmptyDoclist, returnFalse, returnTrue, returnZero, setupMoveUpEvents, smoothScroll, Utils } from "../../../Utils";
+import { emptyFunction, returnEmptyDoclist, returnFalse, returnTrue, returnZero, smoothScroll, Utils } from "../../../Utils";
import { Docs, DocUtils } from "../../documents/Documents";
+import { DocumentType } from '../../documents/DocumentTypes';
import { DragManager, dropActionType } from "../../util/DragManager";
import { SnappingManager } from "../../util/SnappingManager";
import { Transform } from "../../util/Transform";
@@ -22,11 +22,11 @@ import { LightboxView } from "../LightboxView";
import { CollectionFreeFormDocumentView } from "../nodes/CollectionFreeFormDocumentView";
import { DocFocusOptions, DocumentView, DocumentViewProps, ViewAdjustment } from "../nodes/DocumentView";
import { StyleProp } from "../StyleProvider";
-import { CollectionNoteTakingViewFieldColumn } from "./CollectionNoteTakingViewFieldColumn";
import "./CollectionNoteTakingView.scss";
+import CollectionNoteTakingViewDivider from "./CollectionNoteTakingViewDivider";
+import { CollectionNoteTakingViewFieldColumn } from "./CollectionNoteTakingViewFieldColumn";
import { CollectionSubView } from "./CollectionSubView";
import { CollectionViewType } from "./CollectionView";
-import CollectionNoteTakingViewDivider from "./CollectionNoteTakingViewDivider";
const _global = (window /* browser */ || global /* node */) as any;
@@ -310,7 +310,12 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
}
const index = this.columnHeaders.indexOf(existingHeader)
const endColValue = index == this.columnHeaders.length - 1 ? this.PanelWidth : this.columnStartXCoords[index+1]
- return endColValue - colStartXCoords[index] - 3 * this.xMargin
+ const maxWidth = endColValue - colStartXCoords[index] - 3 * this.xMargin
+ if (d.type === DocumentType.RTF) {
+ return maxWidth
+ }
+ const width = d[WidthSym]()
+ return width < maxWidth ? width : maxWidth
}
getDocHeight(d?: Doc) {
@@ -366,21 +371,15 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
colStart += colWidth + dividerWidth
}
this.columnStartXCoords = newColXCoords
- // console.log(newColXCoords)
}
// TODO: This is where you want to create a copy of the document to take its place
@action
onPointerOver = (e: React.PointerEvent) => {
if (DragManager.docsBeingDragged.length && this.childDocList) {
- const col = this.getClientColumn(e)
- const colStartXCoords = this.columnStartXCoords
- // console.log(col)
const clientY = e.clientY
- // const clientX = e.clientX
let dropInd = -1;
let dropAfter = 0;
- const length = this._docXfs.length
//TODO get the nodes in the doc
this._docXfs.forEach((cd, i) => {
//TODO need to write your own function for this, or make sure you're properly updating the fields
@@ -400,7 +399,6 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
})
const docs = this.childDocList;
const newDocs = DragManager.docsBeingDragged;
- const length2 = docs.length
if (docs) {
const insertInd = dropInd === -1 ? docs.length : dropInd + dropAfter;
const offset = newDocs.reduce((off, ndoc) => this.filteredChildren.find((fdoc, i) => ndoc === fdoc && i < insertInd) ? off + 1 : off, 0);
@@ -410,17 +408,6 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
}
}
- //used in onPointerOver to swap two nodes in the rendered filtered children list
- swapNodes = (i: number, j: number) => {
-
- }
-
- //plj added this
- @action
- onPointerDown = (e: React.PointerEvent) => {
-
- }
-
getClientColumn = (e: React.PointerEvent): number => {
const clientX = e.clientX
const numColumns = this.columnHeaders.length
@@ -652,7 +639,6 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
const coords = [...this.columnStartXCoords]
coords[colIndex] += movementX
this.columnStartXCoords = coords
- console.log(this.columnStartXCoords)
}
//
@@ -754,7 +740,6 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
}}
onScroll={action(e => this._scroll = e.currentTarget.scrollTop)}
onPointerOver={this.onPointerOver}
- onPointerDown={this.onPointerDown}
onDrop={this.onExternalDrop.bind(this)}
onContextMenu={this.onContextMenu}
onWheel={e => this.props.isContentActive(true) && e.stopPropagation()}