aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/global/globalScripts.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-10-10 18:58:39 -0400
committerbobzel <zzzman@gmail.com>2024-10-10 18:58:39 -0400
commit5752dff8ff7b1b2858542feec0b1bb037461bf1a (patch)
tree04080d4a596b0e5199b5ec95ab625fbb590f2a75 /src/client/views/global/globalScripts.ts
parent36735ff00a55ae587af5f69eef495533a1f35393 (diff)
parentd347fc59feefd91a796012892da57511787bb6d0 (diff)
Merge branch 'master' into nathan-starter
Diffstat (limited to 'src/client/views/global/globalScripts.ts')
-rw-r--r--src/client/views/global/globalScripts.ts27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/client/views/global/globalScripts.ts b/src/client/views/global/globalScripts.ts
index 6c3f4eaff..903e04ad7 100644
--- a/src/client/views/global/globalScripts.ts
+++ b/src/client/views/global/globalScripts.ts
@@ -4,6 +4,7 @@ import { runInAction } from 'mobx';
import { Doc, DocListCast, Opt, StrListCast } from '../../../fields/Doc';
import { DocData } from '../../../fields/DocSymbols';
import { InkTool } from '../../../fields/InkField';
+import { List } from '../../../fields/List';
import { BoolCast, Cast, NumCast, StrCast } from '../../../fields/Types';
import { WebField } from '../../../fields/URLField';
import { Gestures } from '../../../pen-gestures/GestureTypes';
@@ -16,7 +17,6 @@ import { UndoManager, undoable } from '../../util/UndoManager';
import { GestureOverlay } from '../GestureOverlay';
import { InkTranscription } from '../InkTranscription';
import { InkingStroke } from '../InkingStroke';
-import { MainView } from '../MainView';
import { PropertiesView } from '../PropertiesView';
import { CollectionFreeFormView } from '../collections/collectionFreeForm';
import { CollectionFreeFormDocumentView } from '../nodes/CollectionFreeFormDocumentView';
@@ -40,6 +40,7 @@ import { VideoBox } from '../nodes/VideoBox';
import { WebBox } from '../nodes/WebBox';
import { RichTextMenu } from '../nodes/formattedText/RichTextMenu';
import { GPTPopup, GPTPopupMode } from '../pdf/GPTPopup/GPTPopup';
+import { OpenWhere } from '../nodes/OpenWhere';
// eslint-disable-next-line prefer-arrow-callback
ScriptingGlobals.add(function IsNoneSelected() {
@@ -241,31 +242,15 @@ ScriptingGlobals.add(function showFreeform(
['pile', {
checkResult: (doc: Doc) => doc._type_collection == CollectionViewType.Freeform,
setDoc: (doc: Doc, dv: DocumentView) => {
- doc._type_collection = CollectionViewType.Freeform;
const newCol = Docs.Create.CarouselDocument(DocListCast(doc[Doc.LayoutFieldKey(doc)]), {
+ title: doc.title + "_carousel",
_width: 250,
_height: 200,
_layout_fitWidth: false,
_layout_autoHeight: true,
+ childFilters: new List<string>(StrListCast(doc.childFilters))
});
-
-
- const iconMap: { [key: number]: string } = {
- 0: 'star',
- 1: 'heart',
- 2: 'cloud',
- 3: 'bolt'
- };
-
- for (let i=0; i<4; i++){
- if (isAttrFiltered(iconMap[i])){
- newCol[iconMap[i]] = true
- }
- }
-
- newCol && dv.ComponentView?.addDocument?.(newCol);
- DocumentView.showDocument(newCol, { willZoomCentered: true })
-
+ dv._props.addDocTab?.(newCol, OpenWhere.addRight);
},
}],
]);
@@ -301,7 +286,7 @@ ScriptingGlobals.add(function setTagFilter(tag: string, added: boolean, checkRes
added ? Doc.setDocFilter(selected, 'tags', tag, 'check') : Doc.setDocFilter(selected, 'tags', tag, 'remove');
} else {
SnappingManager.PropertiesWidth < 5 && SnappingManager.SetPropertiesWidth(0);
- SnappingManager.SetPropertiesWidth(MainView.Instance.propertiesWidth() < 15 ? 250 : 0);
+ SnappingManager.SetPropertiesWidth(SnappingManager.PropertiesWidth < 15 ? 250 : 0);
PropertiesView.Instance?.CloseAll();
runInAction(() => (PropertiesView.Instance.openFilters = SnappingManager.PropertiesWidth > 5));
}