@@ -278,107 +278,115 @@ class ToolBarHandler {
278278 static color = ( ) : void => { } ;
279279}
280280
281- export const CTRL_KEY = navigator ?. platform ?. indexOf ( 'Mac' ) !== - 1 ? '⌘' : 'Ctrl' ;
282- export const ALT_KEY = navigator ?. platform ?. indexOf ( 'Mac' ) !== - 1 ? '⌥' : 'Alt' ;
281+ export const GET_CTRL_KEY = ( ) => {
282+ if ( typeof window !== 'undefined' ) {
283+ return navigator ?. platform ?. indexOf ( 'Mac' ) !== - 1 ? '⌘' : 'Ctrl' ;
284+ }
285+ }
286+ export const GET_ALT_KEY = ( ) => {
287+ if ( typeof window !== 'undefined' ) {
288+ return navigator ?. platform ?. indexOf ( 'Mac' ) !== - 1 ? '⌥' : 'Alt' ;
289+ }
290+ }
283291
284292export const DEFAULT_TOOLBARS : Record < string , IToolbarItemConfig > = {
285293 undo : {
286294 id : 'undo' ,
287295 name : 'undo' ,
288296 type : 'button' ,
289297 icon : UNDO_ICON ,
290- shortKey : `${ CTRL_KEY } +Z` ,
291- shortKeyWithCode : `${ CTRL_KEY } +90` ,
298+ shortKey : `${ GET_CTRL_KEY ( ) } +Z` ,
299+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +90` ,
292300 handler : ToolBarHandler . undo ,
293301 } ,
294302 redo : {
295303 id : 'redo' ,
296304 name : 'redo' ,
297305 type : 'button' ,
298306 icon : REDO_ICON ,
299- shortKey : `${ CTRL_KEY } +Y` ,
300- shortKeyWithCode : `${ CTRL_KEY } +89` ,
307+ shortKey : `${ GET_CTRL_KEY ( ) } +Y` ,
308+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +89` ,
301309 handler : ToolBarHandler . redo ,
302310 } ,
303311 bold : {
304312 id : 'bold' ,
305313 name : 'bold' ,
306314 type : 'button' ,
307315 icon : BOLD_ICON ,
308- shortKey : `${ CTRL_KEY } +B` ,
309- shortKeyWithCode : `${ CTRL_KEY } +66` ,
316+ shortKey : `${ GET_CTRL_KEY ( ) } +B` ,
317+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +66` ,
310318 handler : ToolBarHandler . bold ,
311319 } ,
312320 italic : {
313321 id : 'italic' ,
314322 name : 'italic' ,
315323 type : 'button' ,
316324 icon : ITALIC_ICON ,
317- shortKey : `${ CTRL_KEY } +I` ,
318- shortKeyWithCode : `${ CTRL_KEY } +73` ,
325+ shortKey : `${ GET_CTRL_KEY ( ) } +I` ,
326+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +73` ,
319327 handler : ToolBarHandler . italic ,
320328 } ,
321329 strike : {
322330 id : 'strike' ,
323331 name : 'strike' ,
324332 type : 'button' ,
325333 icon : STRIKE_ICON ,
326- shortKey : `${ CTRL_KEY } +D` ,
327- shortKeyWithCode : `${ CTRL_KEY } +68` ,
334+ shortKey : `${ GET_CTRL_KEY ( ) } +D` ,
335+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +68` ,
328336 handler : ToolBarHandler . strike ,
329337 } ,
330338 h1 : {
331339 id : 'h1' ,
332340 name : 'h1' ,
333341 type : 'button' ,
334342 icon : H1_ICON ,
335- shortKey : `${ CTRL_KEY } +1` ,
336- shortKeyWithCode : `${ CTRL_KEY } +49` ,
343+ shortKey : `${ GET_CTRL_KEY ( ) } +1` ,
344+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +49` ,
337345 handler : ToolBarHandler . h1 ,
338346 } ,
339347 h2 : {
340348 id : 'h2' ,
341349 name : 'h2' ,
342350 type : 'button' ,
343351 icon : H2_ICON ,
344- shortKey : `${ CTRL_KEY } +2` ,
345- shortKeyWithCode : `${ CTRL_KEY } +50` ,
352+ shortKey : `${ GET_CTRL_KEY ( ) } +2` ,
353+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +50` ,
346354 handler : ToolBarHandler . h2 ,
347355 } ,
348356 ul : {
349357 id : 'ul' ,
350358 name : 'unorderedlist' ,
351359 type : 'button' ,
352360 icon : LIST_UNORDERED_ICON ,
353- shortKey : `${ CTRL_KEY } +U` ,
354- shortKeyWithCode : `${ CTRL_KEY } +85` ,
361+ shortKey : `${ GET_CTRL_KEY ( ) } +U` ,
362+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +85` ,
355363 handler : ToolBarHandler . ul ,
356364 } ,
357365 ol : {
358366 id : 'ol' ,
359367 name : 'orderedlist' ,
360368 type : 'button' ,
361369 icon : LIST_ORDERED_ICON ,
362- shortKey : `${ CTRL_KEY } +O` ,
363- shortKeyWithCode : `${ CTRL_KEY } +79` ,
370+ shortKey : `${ GET_CTRL_KEY ( ) } +O` ,
371+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +79` ,
364372 handler : ToolBarHandler . ol ,
365373 } ,
366374 checklist : {
367375 id : 'checklist' ,
368376 name : 'checklist' ,
369377 type : 'button' ,
370378 icon : LIST_CHECK_ICON ,
371- shortKey : `${ CTRL_KEY } +${ ALT_KEY } +C` ,
372- shortKeyWithCode : `${ CTRL_KEY } +${ ALT_KEY } +67` ,
379+ shortKey : `${ GET_CTRL_KEY ( ) } +${ GET_ALT_KEY ( ) } +C` ,
380+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +${ GET_ALT_KEY ( ) } +67` ,
373381 handler : ToolBarHandler . checkList ,
374382 } ,
375383 underline : {
376384 id : 'underline' ,
377385 name : 'underline' ,
378386 type : 'button' ,
379387 icon : UNDERLINE_ICON ,
380- shortKey : `${ CTRL_KEY } +R` ,
381- shortKeyWithCode : `${ CTRL_KEY } +82` ,
388+ shortKey : `${ GET_CTRL_KEY ( ) } +R` ,
389+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +82` ,
382390 handler : ToolBarHandler . underline ,
383391 } ,
384392 font : {
@@ -394,17 +402,17 @@ export const DEFAULT_TOOLBARS: Record<string, IToolbarItemConfig> = {
394402 name : 'link' ,
395403 type : 'button' ,
396404 icon : LINK_ICON ,
397- shortKey : `${ CTRL_KEY } +L` ,
398- shortKeyWithCode : `${ CTRL_KEY } +76` ,
405+ shortKey : `${ GET_CTRL_KEY ( ) } +L` ,
406+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +76` ,
399407 handler : ToolBarHandler . link ,
400408 } ,
401409 image : {
402410 id : 'image' ,
403411 name : 'image' ,
404412 type : 'button' ,
405413 icon : IMAGE_ICON ,
406- shortKey : `${ CTRL_KEY } +G` ,
407- shortKeyWithCode : `${ CTRL_KEY } +71` ,
414+ shortKey : `${ GET_CTRL_KEY ( ) } +G` ,
415+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +71` ,
408416 params : { imageUploadToServer : false } ,
409417 handler : ToolBarHandler . image ,
410418 } ,
@@ -414,26 +422,26 @@ export const DEFAULT_TOOLBARS: Record<string, IToolbarItemConfig> = {
414422 type : 'button' ,
415423 icon : FILE_ICON ,
416424 params : { } ,
417- shortKey : `${ CTRL_KEY } +F` ,
418- shortKeyWithCode : `${ CTRL_KEY } +70` ,
425+ shortKey : `${ GET_CTRL_KEY ( ) } +F` ,
426+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +70` ,
419427 handler : ToolBarHandler . file ,
420428 } ,
421429 code : {
422430 id : 'code' ,
423431 name : 'code' ,
424432 type : 'button' ,
425433 icon : CODE_ICON ,
426- shortKey : `${ CTRL_KEY } +K` ,
427- shortKeyWithCode : `${ CTRL_KEY } +75` ,
434+ shortKey : `${ GET_CTRL_KEY ( ) } +K` ,
435+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +75` ,
428436 handler : ToolBarHandler . code ,
429437 } ,
430438 table : {
431439 id : 'table' ,
432440 name : 'table' ,
433441 type : 'button' ,
434442 icon : TABLE_ICON ,
435- shortKey : `${ CTRL_KEY } +${ ALT_KEY } +T` ,
436- shortKeyWithCode : `${ CTRL_KEY } +${ ALT_KEY } +84` ,
443+ shortKey : `${ GET_CTRL_KEY ( ) } +${ GET_ALT_KEY ( ) } +T` ,
444+ shortKeyWithCode : `${ GET_CTRL_KEY ( ) } +${ GET_ALT_KEY ( ) } +84` ,
437445 handler : ToolBarHandler . table ,
438446 } ,
439447 fullscreen : {
0 commit comments