File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
src/components/modules/toolbar Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,6 @@ export default class InlineToolbar extends Module<InlineToolbarNodes> {
7676 // Get the value from the config
7777 this . align = config . alignInlineToolbar ?? 'left' ;
7878
79- console . log ( this . align ) ;
80-
8179 window . requestIdleCallback ( ( ) => {
8280 this . make ( ) ;
8381 } , { timeout : 2000 } ) ;
@@ -232,13 +230,17 @@ export default class InlineToolbar extends Module<InlineToolbarNodes> {
232230
233231 let newX : number ;
234232
235- // Calculate x based on alignment
236- if ( this . align === 'left' ) {
237- newX = selectionRect . x - wrapperOffset . x ;
238- } else if ( this . align === 'right' ) {
239- newX = selectionRect . x + selectionRect . width - popoverWidth - wrapperOffset . x ;
240- } else { // center (default)
241- newX = selectionRect . x + selectionRect . width / 2 - popoverWidth / 2 - wrapperOffset . x ;
233+ switch ( this . align ) {
234+ default :
235+ case 'left' :
236+ newX = selectionRect . x - wrapperOffset . x ;
237+ break ;
238+ case 'right' :
239+ newX = selectionRect . x + selectionRect . width - popoverWidth - wrapperOffset . x ;
240+ break ;
241+ case 'center' :
242+ newX = selectionRect . x + selectionRect . width / 2 - popoverWidth / 2 - wrapperOffset . x ;
243+ break ;
242244 }
243245
244246 const newCoords = {
You can’t perform that action at this time.
0 commit comments