diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/ContextMenu.tsx | 9 | ||||
-rw-r--r-- | src/client/views/Main.tsx | 8 | ||||
-rw-r--r-- | src/fields/KeyStore.ts | 1 |
3 files changed, 6 insertions, 12 deletions
diff --git a/src/client/views/ContextMenu.tsx b/src/client/views/ContextMenu.tsx index 9109b56bb..cfa8ea7b7 100644 --- a/src/client/views/ContextMenu.tsx +++ b/src/client/views/ContextMenu.tsx @@ -49,7 +49,7 @@ export class ContextMenu extends React.Component { //maxX and maxY will change if the UI/font size changes, but will work for any amount //of items added to the menu let maxX = window.innerWidth - 150; - let maxY = window.innerHeight - (this._items.length * 34 + 30); + let maxY = window.innerHeight - ((this._items.length + 1/*for search box*/) * 34 + 30); this._pageX = x > maxX ? maxX : x; this._pageY = y > maxY ? maxY : y; @@ -83,11 +83,8 @@ export class ContextMenu extends React.Component { return ( <div className="contextMenu-cont" style={style} ref={this.ref}> <input className="contextMenu-item" type="text" placeholder="Search . . ." value={this._searchString} onChange={this.onChange}></input> - {this._items.filter(prop => { - return prop.description.toLowerCase().indexOf(this._searchString.toLowerCase()) !== -1; - }).map(prop => { - return <ContextMenuItem {...prop} key={prop.description} /> - })} + {this._items.filter(prop => prop.description.toLowerCase().indexOf(this._searchString.toLowerCase()) !== -1). + map(prop => <ContextMenuItem {...prop} key={prop.description} />)} </div> ) } diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index 87d8eb648..09778ac77 100644 --- a/src/client/views/Main.tsx +++ b/src/client/views/Main.tsx @@ -147,6 +147,7 @@ export class Main extends React.Component { if (!CurrentUserUtils.MainDocId) { this.userDocument.GetTAsync(KeyStore.ActiveWorkspace, Document).then(doc => { if (doc) { + CurrentUserUtils.MainDocId = doc.Id; this.openWorkspace(doc); } else { this.createNewWorkspace(); @@ -171,9 +172,9 @@ export class Main extends React.Component { var dockingLayout = { content: [{ type: 'row', content: [CollectionDockingView.makeDocumentConfig(freeformDoc)] }] }; let mainDoc = Documents.DockDocument(JSON.stringify(dockingLayout), { title: `Main Container ${list.Data.length + 1}` }, id); list.Data.push(mainDoc); + CurrentUserUtils.MainDocId = mainDoc.Id; // bcz: strangely, we need a timeout to prevent exceptions/issues initializing GoldenLayout (the rendering engine for Main Container) setTimeout(() => { - mainDoc.Set(KeyStore.ActiveFrame, freeformDoc); this.openWorkspace(mainDoc); let pendingDocument = Documents.SchemaDocument([], { title: "New Mobile Uploads" }) mainDoc.Set(KeyStore.OptionalRightCollection, pendingDocument); @@ -186,7 +187,6 @@ export class Main extends React.Component { openWorkspace = (doc: Document, fromHistory = false): void => { this.mainContainer = doc; fromHistory || window.history.pushState(null, doc.Title, "/doc/" + doc.Id); - this.mainContainer.GetTAsync(KeyStore.ActiveFrame, Document, field => this.mainfreeform = field); this.userDocument.GetTAsync(KeyStore.OptionalRightCollection, Document).then(col => { // if there is a pending doc, and it has new data, show it (syip: we use a timeout to prevent collection docking view from being uninitialized) setTimeout(() => { @@ -264,8 +264,6 @@ export class Main extends React.Component { [React.createRef<HTMLDivElement>(), "table", "Add Schema", addSchemaNode], ] - let addClick = (creator: () => Document) => action(() => this.mainfreeform!.GetList<Document>(KeyStore.Data, []).push(creator())); - return < div id="add-nodes-menu" > <input type="checkbox" id="add-menu-toggle" /> <label htmlFor="add-menu-toggle" title="Add Node"><p>+</p></label> @@ -274,7 +272,7 @@ export class Main extends React.Component { <ul id="add-options-list"> {btns.map(btn => <li key={btn[1]} ><div ref={btn[0]}> - <button className="round-button add-button" title={btn[2]} onPointerDown={setupDrag(btn[0], btn[3])} onClick={addClick(btn[3])}> + <button className="round-button add-button" title={btn[2]} onPointerDown={setupDrag(btn[0], btn[3])}> <FontAwesomeIcon icon={btn[1]} size="sm" /> </button> </div></li>)} diff --git a/src/fields/KeyStore.ts b/src/fields/KeyStore.ts index 20e8cd930..09dddf962 100644 --- a/src/fields/KeyStore.ts +++ b/src/fields/KeyStore.ts @@ -27,7 +27,6 @@ export namespace KeyStore { export const ColumnsKey = new Key("SchemaColumns"); export const SchemaSplitPercentage = new Key("SchemaSplitPercentage"); export const Caption = new Key("Caption"); - export const ActiveFrame = new Key("ActiveFrame"); export const ActiveWorkspace = new Key("ActiveWorkspace"); export const DocumentText = new Key("DocumentText"); export const LinkedToDocs = new Key("LinkedToDocs"); |