aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/PropertiesButtons.tsx
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2020-12-17 16:22:06 +0530
committerusodhi <61431818+usodhi@users.noreply.github.com>2020-12-17 16:22:06 +0530
commit48fd017c46b930ae94e341ae73bfc35006008b44 (patch)
tree488aae6f3864622548c01433867309cc0bd03a24 /src/client/views/PropertiesButtons.tsx
parent563d86f03f63f60ec47aef23d2022c660ee18697 (diff)
parentf4f4cb6b3a639c3e1c0d291f1d290e80097cfa06 (diff)
merged
Diffstat (limited to 'src/client/views/PropertiesButtons.tsx')
-rw-r--r--src/client/views/PropertiesButtons.tsx42
1 files changed, 17 insertions, 25 deletions
diff --git a/src/client/views/PropertiesButtons.tsx b/src/client/views/PropertiesButtons.tsx
index 9de4f9c67..4413d28f5 100644
--- a/src/client/views/PropertiesButtons.tsx
+++ b/src/client/views/PropertiesButtons.tsx
@@ -55,8 +55,8 @@ export class PropertiesButtons extends React.Component<{}, {}> {
@computed get selectedDoc() { return SelectionManager.SelectedSchemaDoc() || this.selectedDocumentView?.rootDoc; }
@computed get selectedDocumentView() {
- if (SelectionManager.SelectedDocuments().length) {
- return SelectionManager.SelectedDocuments()[0];
+ if (SelectionManager.Views().length) {
+ return SelectionManager.Views()[0];
} else return undefined;
}
@@ -187,7 +187,7 @@ export class PropertiesButtons extends React.Component<{}, {}> {
@action @undoBatch
onLock = () => {
- SelectionManager.SelectedDocuments().forEach(dv => dv.toggleLockPosition());
+ SelectionManager.Views().forEach(dv => dv.docView?.toggleLockPosition());
}
@computed
@@ -224,7 +224,7 @@ export class PropertiesButtons extends React.Component<{}, {}> {
@undoBatch
@action
setDictation = () => {
- SelectionManager.SelectedDocuments().forEach(dv => dv.rootDoc._showAudio = dv.rootDoc._showAudio === !dv.rootDoc._showAudio);
+ SelectionManager.Views().forEach(dv => dv.rootDoc._showAudio = dv.rootDoc._showAudio === !dv.rootDoc._showAudio);
}
@computed
@@ -244,7 +244,7 @@ export class PropertiesButtons extends React.Component<{}, {}> {
@undoBatch
@action
setTitle = () => {
- SelectionManager.SelectedDocuments().forEach(dv => dv.rootDoc._showTitle = dv.rootDoc._showTitle === undefined ? "title" : undefined);
+ SelectionManager.Views().forEach(dv => dv.rootDoc._showTitle = dv.rootDoc._showTitle === undefined ? "title" : undefined);
}
@computed
@@ -263,7 +263,7 @@ export class PropertiesButtons extends React.Component<{}, {}> {
@undoBatch
@action
setCaption = () => {
- SelectionManager.SelectedDocuments().forEach(dv => dv.rootDoc._showCaption = dv.rootDoc._showCaption === undefined ? "caption" : undefined);
+ SelectionManager.Views().forEach(dv => dv.rootDoc._showCaption = dv.rootDoc._showCaption === undefined ? "caption" : undefined);
}
@computed
@@ -282,7 +282,7 @@ export class PropertiesButtons extends React.Component<{}, {}> {
@undoBatch
@action
setChrome = () => {
- SelectionManager.SelectedDocuments().forEach(dv => dv.rootDoc._chromeStatus = dv.rootDoc._chromeStatus === "disabled" ? "enabled" : "disabled");
+ SelectionManager.Views().forEach(dv => dv.rootDoc._chromeStatus = dv.rootDoc._chromeStatus === "disabled" ? "enabled" : "disabled");
}
@computed
@@ -325,21 +325,13 @@ export class PropertiesButtons extends React.Component<{}, {}> {
const value = e.target.value;
this.selectedDoc && (this.selectedDoc.onClickBehavior = e.target.value);
- SelectionManager.SelectedDocuments().forEach(dv => {
- if (value === "nothing") {
- dv.noOnClick();
- } else if (value === "enterPortal") {
- dv.noOnClick();
- dv.makeIntoPortal();
- } else if (value === "toggleDetail") {
- dv.noOnClick();
- dv.toggleDetail();
- } else if (value === "linkInPlace") {
- dv.noOnClick();
- dv.toggleFollowLink("inPlace", true, false);
- } else if (value === "linkOnRight") {
- dv.noOnClick();
- dv.toggleFollowLink("add:right", false, false);
+ SelectionManager.Views().forEach(dv => {
+ dv.docView?.noOnClick();
+ switch (value) {
+ case "enterPortal": dv.docView?.makeIntoPortal(); break;
+ case "toggleDetail": dv.docView?.toggleDetail(); break;
+ case "linkInPlace": dv.docView?.toggleFollowLink("inPlace", true, false); break;
+ case "linkOnRight": dv.docView?.toggleFollowLink("add:right", false, false); break;
}
});
}
@@ -347,7 +339,7 @@ export class PropertiesButtons extends React.Component<{}, {}> {
@undoBatch @action
editOnClickScript = () => {
if (this.selectedDoc) {
- if (SelectionManager.SelectedDocuments().length) SelectionManager.SelectedDocuments().forEach(dv => DocUtils.makeCustomViewClicked(dv.rootDoc, undefined, "onClick"));
+ if (SelectionManager.Views().length) SelectionManager.Views().forEach(dv => DocUtils.makeCustomViewClicked(dv.rootDoc, undefined, "onClick"));
else DocUtils.makeCustomViewClicked(this.selectedDoc, undefined, "onClick");
}
}
@@ -432,7 +424,7 @@ export class PropertiesButtons extends React.Component<{}, {}> {
@action @undoBatch
changeFitToBox = () => {
if (this.selectedDoc) {
- if (SelectionManager.SelectedDocuments().length) SelectionManager.SelectedDocuments().forEach(dv => dv.rootDoc._fitToBox = !dv.rootDoc._fitToBox);
+ if (SelectionManager.Views().length) SelectionManager.Views().forEach(dv => dv.rootDoc._fitToBox = !dv.rootDoc._fitToBox);
else this.selectedDoc._fitToBox = !this.selectedDoc._fitToBox;
}
}
@@ -440,7 +432,7 @@ export class PropertiesButtons extends React.Component<{}, {}> {
@action @undoBatch
changeClusters = () => {
if (this.selectedDoc) {
- if (SelectionManager.SelectedDocuments().length) SelectionManager.SelectedDocuments().forEach(dv => dv.rootDoc._useClusters = !dv.rootDoc._useClusters);
+ if (SelectionManager.Views().length) SelectionManager.Views().forEach(dv => dv.rootDoc._useClusters = !dv.rootDoc._useClusters);
else this.selectedDoc._useClusters = !this.selectedDoc._useClusters;
}
}