@@ -8,7 +8,7 @@ import { injectShotstackStyles } from "@styles/inject";
88import { GOOGLE_FONTS_BY_FILENAME } from "../fonts/google-fonts" ;
99
1010import { BackgroundColorPicker } from "./background-color-picker" ;
11- import { BaseToolbar , FONT_SIZES , TOOLBAR_ICONS } from "./base-toolbar" ;
11+ import { BaseToolbar , FONT_SIZES } from "./base-toolbar" ;
1212import { EffectPanel } from "./composites/EffectPanel" ;
1313import { SpacingPanel } from "./composites/SpacingPanel" ;
1414import { StylePanel , type StylePanelOptions } from "./composites/StylePanel" ;
@@ -127,24 +127,6 @@ export class RichTextToolbar extends BaseToolbar {
127127 </div>
128128 <div class="ss-toolbar-mode-divider"></div>
129129
130- <div class="ss-toolbar-dropdown">
131- <button data-action="text-edit-toggle" class="ss-toolbar-btn ss-toolbar-btn--text-edit" title="Edit text">
132- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
133- ${ TOOLBAR_ICONS . textCursor }
134- </svg>
135- <span>Edit text</span>
136- </button>
137- <div data-text-edit-popup class="ss-toolbar-popup ss-toolbar-popup--text-edit">
138- <div class="ss-toolbar-popup-header">Edit Text</div>
139- <div class="ss-toolbar-text-area-wrapper">
140- <textarea data-text-edit-area class="ss-toolbar-text-area" rows="4" placeholder="Enter text..."></textarea>
141- <div class="ss-autocomplete-popup" data-autocomplete-popup>
142- <div class="ss-autocomplete-items" data-autocomplete-items></div>
143- </div>
144- </div>
145- </div>
146- </div>
147-
148130 <div class="ss-toolbar-group ss-toolbar-group--bordered">
149131 <button data-action="size-down" class="ss-toolbar-btn" title="Decrease font size">
150132 <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
@@ -203,6 +185,23 @@ export class RichTextToolbar extends BaseToolbar {
203185
204186 <div class="ss-toolbar-divider"></div>
205187
188+ <div class="ss-toolbar-dropdown">
189+ <button data-action="text-edit-toggle" class="ss-toolbar-btn ss-toolbar-btn--text-edit ss-toolbar-btn--primary" title="Edit text">
190+ <span>Edit text</span>
191+ </button>
192+ <div data-text-edit-popup class="ss-toolbar-popup ss-toolbar-popup--text-edit">
193+ <div class="ss-toolbar-popup-header">Edit Text</div>
194+ <div class="ss-toolbar-text-area-wrapper">
195+ <textarea data-text-edit-area class="ss-toolbar-text-area" rows="4" placeholder="Enter text..."></textarea>
196+ <div class="ss-autocomplete-popup" data-autocomplete-popup>
197+ <div class="ss-autocomplete-items" data-autocomplete-items></div>
198+ </div>
199+ </div>
200+ </div>
201+ </div>
202+
203+ <div class="ss-toolbar-divider"></div>
204+
206205 <!-- Formatting Group -->
207206 <button data-action="align-cycle" class="ss-toolbar-btn" title="Text alignment">
208207 <svg data-align-icon width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
@@ -835,12 +834,10 @@ export class RichTextToolbar extends BaseToolbar {
835834
836835 // Double-clicking the canvas text opens the edit popup for the current
837836 // selection — same path as the "Edit text" toolbar button.
838- this . unsubCanvasDoubleClick = this . edit . getInternalEvents ( ) . on ( InternalEvent . CanvasClipDoubleClicked , ( { player } ) => {
837+ this . unsubCanvasDoubleClick = this . edit . getInternalEvents ( ) . on ( InternalEvent . CanvasClipDoubleClicked , ( ) => {
839838 if ( this . selectedTrackIdx < 0 || this . selectedClipIdx < 0 ) return ;
840- const selectedClipId = this . edit . getClipId ( this . selectedTrackIdx , this . selectedClipIdx ) ;
841- if ( selectedClipId && player . clipId === selectedClipId ) {
842- this . openTextEditPopup ( ) ;
843- }
839+ if ( ! this . container || ! this . container . classList . contains ( "visible" ) ) return ;
840+ this . openTextEditPopup ( ) ;
844841 } ) ;
845842 }
846843
@@ -1133,13 +1130,12 @@ export class RichTextToolbar extends BaseToolbar {
11331130 }
11341131
11351132 /** Open the edit-text popup and focus its textarea. Idempotent if already open. */
1136- public openTextEditPopup ( ) : void {
1133+ private openTextEditPopup ( ) : void {
11371134 if ( ! this . isPopupOpen ( this . textEditPopup ) ) {
11381135 this . toggleTextEditPopup ( ) ;
1139- } else {
1140- this . textEditArea ?. focus ( ) ;
1141- this . textEditArea ?. select ( ) ;
11421136 }
1137+ this . textEditArea ?. focus ( ) ;
1138+ this . textEditArea ?. select ( ) ;
11431139 }
11441140
11451141 private debouncedApplyTextEdit ( ) : void {
0 commit comments