Skip to content

Commit 815f636

Browse files
authored
Merge pull request #1365 from WolframResearch/bugfix/Sidebar8
Bugfix/sidebar8
2 parents 9edc9f1 + 7671d33 commit 815f636

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

Source/Chatbook/Actions.wl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ regenerateAssistantMessage[ chatOutput_CellObject, True(*sidebarCellQ_*) ] := En
118118

119119
With[ { sbc = sidebarCell, cic = chatInputCell }, (* "Set" is HoldFirst so we must inject values *)
120120
FrontEndExecute[ {
121-
FrontEnd`SetOptions[ chatOutput, Deletable -> True ],
122121
FrontEnd`NotebookDelete @ chatOutput,
123122
FrontEnd`SetValue @ FEPrivate`Set[ FrontEnd`CurrentValue[ sbc, { TaggingRules, "ChatEvaluationCell" } ], cic ], (* use TaggingRules to pass CellObject around *)
124123
FrontEnd`SetOptions[ chatInputFieldCell, CellTags -> { "SidebarChatInputCell", "RegenerateChatOutput" } ] (* backdoor to re-evaluation in side bar *)

Source/Chatbook/ChatModes/UI.wl

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ makeSidebarChatSubDockedCellExpression[ nbo_NotebookObject, sidebarCell_CellObje
102102
DeleteCases[ makeWorkspaceChatSubDockedCellExpression @ content, _[ Magnification | CellTags, _] ],
103103
Cell[
104104
CellTags -> "SidebarSubDockedCell",
105+
Deletable -> True, (* this cell can be replaced so override Deletable -> False inherited from the main sidebar cell *)
105106
FontSize -> 12,
106107
Magnification -> Dynamic[ 0.85*AbsoluteCurrentValue[ nbo, Magnification ] ],
107108
ShowStringCharacters -> False ] ];
@@ -152,12 +153,7 @@ removeSidebarChatSubDockedCell // beginDefinition;
152153

153154
removeSidebarChatSubDockedCell[ nbo_NotebookObject, sidebarCell_CellObject ] := Module[ { subDockedCell },
154155
subDockedCell = First[ Cells[ sidebarCell, CellTags -> "SidebarSubDockedCell" ], Missing @ "NoSidebarSubDockedCell" ];
155-
If[ ! MissingQ @ subDockedCell,
156-
FrontEndExecute[ {
157-
FrontEnd`SetOptions[ subDockedCell, Deletable -> True ],
158-
FrontEnd`NotebookDelete @ subDockedCell
159-
} ]
160-
]
156+
If[ ! MissingQ @ subDockedCell, NotebookDelete @ subDockedCell ]
161157
];
162158

163159
removeSidebarChatSubDockedCell // endDefinition;
@@ -167,11 +163,7 @@ removeSidebarChatSubDockedCell // endDefinition;
167163
(*removeSidebarTopCell*)
168164
removeSidebarTopCell // beginDefinition;
169165

170-
removeSidebarTopCell[ nbo_NotebookObject, sidebarTopCell_CellObject ] :=
171-
FrontEndExecute[ {
172-
FrontEnd`SetOptions[ sidebarTopCell, Deletable -> True ],
173-
FrontEnd`NotebookDelete @ sidebarTopCell
174-
} ];
166+
removeSidebarTopCell[ nbo_NotebookObject, sidebarTopCell_CellObject ] := NotebookDelete @ sidebarTopCell;
175167

176168
removeSidebarTopCell // endDefinition;
177169

@@ -182,12 +174,7 @@ removeSidebarScrollingContentCell // beginDefinition;
182174

183175
removeSidebarScrollingContentCell[ nbo_NotebookObject, sidebarCell_CellObject ] := Module[ { scrollablePaneCell },
184176
scrollablePaneCell = First[ Cells[ sidebarCell, CellTags -> "SidebarScrollingContentCell" ], Missing @ "NoScrollingSidebarCell" ];
185-
If[ ! MissingQ @ scrollablePaneCell,
186-
FrontEndExecute[ {
187-
FrontEnd`SetOptions[ scrollablePaneCell, Deletable -> True ],
188-
FrontEnd`NotebookDelete @ scrollablePaneCell
189-
} ]
190-
]
177+
If[ ! MissingQ @ scrollablePaneCell, NotebookDelete @ scrollablePaneCell ]
191178
];
192179

193180
removeSidebarScrollingContentCell // endDefinition;
@@ -221,6 +208,7 @@ Module[ { sidebarCellObj, dockedCellObj, chatInputCellObj },
221208
],
222209
Background -> color @ "NA_NotebookBackground",
223210
CellTags -> "SidebarScrollingContentCell",
211+
Deletable -> True, (* this cell can be replaced so override Deletable -> False inherited from the main sidebar cell *)
224212
Magnification -> Dynamic[ 0.85*AbsoluteCurrentValue[ nbo, Magnification ] ]
225213
] ]
226214
]
@@ -333,9 +321,8 @@ sidebarHideButton[ Dynamic[ nbo_ ] ] := Button[
333321
tr @ "SidebarToolbarButtonTooltipHideSidebar"
334322
],
335323
CurrentValue[ $FrontEndSession, "ShowNotebookAssistant" ] = False;
336-
FrontEndToken[nbo, "HideSidebar"],
337-
Appearance -> "Suppressed",
338-
Evaluator -> None
324+
FrontEndTokenExecute[nbo, "HideSidebar"],
325+
Appearance -> "Suppressed"
339326
]
340327

341328
sidebarHideButton // endDefinition;

0 commit comments

Comments
 (0)