cowork-dash 0.1.8__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cowork_dash/assets/app.js CHANGED
@@ -118,6 +118,40 @@ if (typeof window.mermaidObserver === 'undefined') {
118
118
  attachMermaidObserver();
119
119
  }
120
120
 
121
+ // Prevent clicks on "Add to Canvas" buttons from toggling the collapsible
122
+ // We need to intercept the toggle event on the details element, not the click
123
+ (function initAddToCanvasButtons() {
124
+ function setupButtonHandlers() {
125
+ // Track if button was clicked to prevent details toggle
126
+ let buttonClicked = false;
127
+
128
+ // When button is clicked, set flag (uses capture to run first)
129
+ document.addEventListener('click', function(e) {
130
+ const button = e.target.closest('.add-to-canvas-btn');
131
+ if (button) {
132
+ buttonClicked = true;
133
+ // Reset flag after a short delay to allow for the toggle event
134
+ setTimeout(() => { buttonClicked = false; }, 50);
135
+ }
136
+ }, true);
137
+
138
+ // Intercept the toggle event on details elements
139
+ document.addEventListener('toggle', function(e) {
140
+ if (buttonClicked && e.target.classList.contains('display-inline-container')) {
141
+ // Button was clicked, prevent the toggle by reverting it
142
+ // The toggle has already happened, so we need to undo it
143
+ e.target.open = !e.target.open;
144
+ }
145
+ }, true);
146
+ }
147
+
148
+ if (document.readyState === 'loading') {
149
+ document.addEventListener('DOMContentLoaded', setupButtonHandlers);
150
+ } else {
151
+ setupButtonHandlers();
152
+ }
153
+ })();
154
+
121
155
  // Auto-scroll chat messages to bottom
122
156
  (function initChatAutoScroll() {
123
157
  let chatMessages = null;