aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/PropertiesView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-09-06 12:11:23 -0400
committerbobzel <zzzman@gmail.com>2023-09-06 12:11:23 -0400
commit530294ae0b4721f07ddbfdd584ed91ff07cdc5e3 (patch)
tree1e822db593a9340e83f7cd3fda62cebc9eea723e /src/client/views/PropertiesView.tsx
parent0717311c89ad1dc98233623f223bf784f362115a (diff)
added undo for removing dashboards and add to recently closed. fixed link menu to open up link editor more direclty
Diffstat (limited to 'src/client/views/PropertiesView.tsx')
-rw-r--r--src/client/views/PropertiesView.tsx71
1 files changed, 45 insertions, 26 deletions
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index 01329b482..6f1461fea 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -3,14 +3,12 @@ import { IconLookup } from '@fortawesome/fontawesome-svg-core';
import { faAnchor, faArrowRight, faWindowMaximize } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Checkbox, Tooltip } from '@material-ui/core';
-import { Button, Colors, EditableText, IconButton, NumberInput, Size, Slider, Type } from 'browndash-components';
+import { Colors, EditableText, IconButton, NumberInput, Size, Slider, Type } from 'browndash-components';
import { concat } from 'lodash';
-import { Lambda, action, computed, observable } from 'mobx';
+import { action, computed, IReactionDisposer, observable, reaction } from 'mobx';
import { observer } from 'mobx-react';
import { ColorState, SketchPicker } from 'react-color';
import * as Icons from 'react-icons/bs'; //{BsCollectionFill, BsFillFileEarmarkImageFill} from "react-icons/bs"
-import { GrCircleInformation } from 'react-icons/gr';
-import { Utils, emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnTrue, setupMoveUpEvents } from '../../Utils';
import { Doc, DocListCast, Field, FieldResult, HierarchyMapping, NumListCast, Opt, ReverseHierarchyMap, StrListCast } from '../../fields/Doc';
import { AclAdmin, DocAcl, DocData, Height, Width } from '../../fields/DocSymbols';
import { Id } from '../../fields/FieldSymbols';
@@ -18,28 +16,29 @@ import { InkField } from '../../fields/InkField';
import { List } from '../../fields/List';
import { ComputedField } from '../../fields/ScriptField';
import { Cast, DocCast, NumCast, StrCast } from '../../fields/Types';
-import { GetEffectiveAcl, SharingPermissions, normalizeEmail } from '../../fields/util';
+import { GetEffectiveAcl, normalizeEmail, SharingPermissions } from '../../fields/util';
+import { emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnTrue, setupMoveUpEvents, Utils } from '../../Utils';
import { DocumentType } from '../documents/DocumentTypes';
import { DocumentManager } from '../util/DocumentManager';
import { GroupManager } from '../util/GroupManager';
import { LinkManager } from '../util/LinkManager';
import { SelectionManager } from '../util/SelectionManager';
+import { SettingsManager } from '../util/SettingsManager';
import { SharingManager } from '../util/SharingManager';
import { Transform } from '../util/Transform';
-import { UndoManager, undoBatch, undoable } from '../util/UndoManager';
+import { undoable, undoBatch, UndoManager } from '../util/UndoManager';
import { EditableView } from './EditableView';
import { FilterPanel } from './FilterPanel';
import { InkStrokeProperties } from './InkStrokeProperties';
+import { DocumentView, OpenWhere, StyleProviderFunc } from './nodes/DocumentView';
+import { KeyValueBox } from './nodes/KeyValueBox';
+import { PresBox, PresEffect, PresEffectDirection } from './nodes/trails';
import { PropertiesButtons } from './PropertiesButtons';
import { PropertiesDocBacklinksSelector } from './PropertiesDocBacklinksSelector';
import { PropertiesDocContextSelector } from './PropertiesDocContextSelector';
import { PropertiesSection } from './PropertiesSection';
import './PropertiesView.scss';
import { DefaultStyleProvider } from './StyleProvider';
-import { DocumentView, OpenWhere, StyleProviderFunc } from './nodes/DocumentView';
-import { KeyValueBox } from './nodes/KeyValueBox';
-import { PresBox, PresEffect, PresEffectDirection } from './nodes/trails';
-import { SettingsManager } from '../util/SettingsManager';
const _global = (window /* browser */ || global) /* node */ as any;
interface PropertiesViewProps {
@@ -87,13 +86,6 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
@observable openTransform: boolean = true;
@observable openFilters: boolean = false;
- /**
- * autorun to set up the filter doc of a collection if that collection has been selected and the filters panel is open
- */
- private selectedDocListenerDisposer: Opt<Lambda>;
-
- // @observable selectedUser: string = "";
- // @observable addButtonPressed: boolean = false;
@observable layoutDocAcls: boolean = false;
//Pres Trails booleans:
@@ -105,14 +97,21 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
@observable inOptions: boolean = false;
@observable _controlButton: boolean = false;
+ private _disposers: { [name: string]: IReactionDisposer } = {};
componentDidMount() {
- this.selectedDocListenerDisposer?.();
- // this.selectedDocListenerDisposer = autorun(() => this.openFilters && this.selectedDoc && this.checkFilterDoc());
+ this._disposers.link = reaction(
+ () => LinkManager.currentLink,
+ link => {
+ link && this.onDoubleClick();
+ link && (this.openLinks = true);
+ },
+ { fireImmediately: true }
+ );
}
componentWillUnmount() {
- this.selectedDocListenerDisposer?.();
+ Object.values(this._disposers).forEach(disposer => disposer?.());
}
@computed get isInk() {
@@ -555,9 +554,29 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
@computed get editableTitle() {
const titles = new Set<string>();
- const title = Array.from(titles.keys()).length > 1 ? '--multiple selected--' : StrCast(this.selectedDoc?.title);
SelectionManager.Views().forEach(dv => titles.add(StrCast(dv.rootDoc.title)));
- return <EditableText val={title} setVal={this.setTitle} color={this.color} type={Type.SEC} formLabel={'Title'} fillWidth />;
+ const title = Array.from(titles.keys()).length > 1 ? '--multiple selected--' : StrCast(this.selectedDoc?.title);
+ return (
+ <div>
+ <EditableText val={title} setVal={this.setTitle} color={this.color} type={Type.SEC} formLabel={'Title'} fillWidth />
+ {LinkManager.currentLinkAnchor ? (
+ <p className="propertiesView-titleExtender">
+ <>
+ <b>Anchor:</b>
+ {LinkManager.currentLinkAnchor.title}
+ </>
+ </p>
+ ) : null}
+ {LinkManager.currentLink?.title ? (
+ <p className="propertiesView-titleExtender">
+ <>
+ <b>Link:</b>
+ {LinkManager.currentLink.title}
+ </>
+ </p>
+ ) : null}
+ </div>
+ );
}
@computed get currentType() {
@@ -1101,7 +1120,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
isOpen={this.openOptions}
setInSection={bool => (this.inOptions = bool)}
setIsOpen={bool => (this.openOptions = bool)}
- onDoubleClick={() => this.onDoubleClick()}
+ onDoubleClick={this.onDoubleClick}
/>
);
}
@@ -1209,11 +1228,11 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
}
@computed get linksSubMenu() {
- return <PropertiesSection title="Linked To" content={this.linkCount > 0 ? this.links : 'There are no current links.'} isOpen={this.openLinks} setIsOpen={bool => (this.openLinks = bool)} onDoubleClick={() => this.onDoubleClick()} />;
+ return <PropertiesSection title="Linked To" content={this.linkCount > 0 ? this.links : 'There are no current links.'} isOpen={this.openLinks} setIsOpen={bool => (this.openLinks = bool)} onDoubleClick={this.onDoubleClick} />;
}
@computed get layoutSubMenu() {
- return <PropertiesSection title="Layout" content={this.layoutPreview} isOpen={this.openLayout} setIsOpen={bool => (this.openLayout = bool)} onDoubleClick={() => this.onDoubleClick()} />;
+ return <PropertiesSection title="Layout" content={this.layoutPreview} isOpen={this.openLayout} setIsOpen={bool => (this.openLayout = bool)} onDoubleClick={this.onDoubleClick} />;
}
@computed get description() {
@@ -1699,7 +1718,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
<div className="propertiesView-type"> {this.currentType} </div>
{this.optionsSubMenu}
{this.linksSubMenu}
- {!this.selectedDoc || !LinkManager.currentLink || (!hasSelectedAnchor && this.selectedDoc !== LinkManager.currentLink) ? null : this.linkProperties}
+ {!LinkManager.currentLink || !this.openLinks ? null : this.linkProperties}
{this.inkSubMenu}
{this.contextsSubMenu}
{this.fieldsSubMenu}