@@ -31,13 +31,14 @@ import Video from '@lucide/svelte/icons/video';
3131import { isTextSelection } from '@tiptap/core' ;
3232import { isMac } from '../utils.js' ;
3333import type { EdraToolBarCommands } from './types.js' ;
34+ import strings from '../strings.js' ;
3435
3536const commands : Record < string , EdraToolBarCommands [ ] > = {
3637 'undo-redo' : [
3738 {
3839 icon : Undo ,
3940 name : 'undo' ,
40- tooltip : 'Undo' ,
41+ tooltip : strings . command . undo ,
4142 shortCut : `${ isMac ? '⌘' : 'Ctrl+' } Z` ,
4243 onClick : ( editor ) => {
4344 editor . chain ( ) . focus ( ) . undo ( ) . run ( ) ;
@@ -49,7 +50,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
4950 {
5051 icon : Redo ,
5152 name : 'redo' ,
52- tooltip : 'Redo' ,
53+ tooltip : strings . command . redo ,
5354 shortCut : `${ isMac ? '⌘' : 'Ctrl+' } Y` ,
5455 onClick : ( editor ) => {
5556 editor . chain ( ) . focus ( ) . redo ( ) . run ( ) ;
@@ -63,7 +64,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
6364 {
6465 icon : Heading1 ,
6566 name : 'h1' ,
66- tooltip : 'Heading 1' ,
67+ tooltip : strings . command . h1 ,
6768 shortCut : `${ isMac ? '⌘⌥' : 'Ctrl+Alt+' } 1` ,
6869 onClick : ( editor ) => {
6970 editor . chain ( ) . focus ( ) . toggleHeading ( { level : 1 } ) . run ( ) ;
@@ -81,7 +82,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
8182 {
8283 icon : Heading2 ,
8384 name : 'h2' ,
84- tooltip : 'Heading 2' ,
85+ tooltip : strings . command . h2 ,
8586 shortCut : `${ isMac ? '⌘⌥' : 'Ctrl+Alt+' } 2` ,
8687 onClick : ( editor ) => {
8788 editor . chain ( ) . focus ( ) . toggleHeading ( { level : 2 } ) . run ( ) ;
@@ -99,7 +100,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
99100 {
100101 icon : Heading3 ,
101102 name : 'h3' ,
102- tooltip : 'Heading 3' ,
103+ tooltip : strings . command . h3 ,
103104 shortCut : `${ isMac ? '⌘⌥' : 'Ctrl+Alt+' } 3` ,
104105 onClick : ( editor ) => {
105106 editor . chain ( ) . focus ( ) . toggleHeading ( { level : 3 } ) . run ( ) ;
@@ -117,7 +118,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
117118 {
118119 icon : Heading4 ,
119120 name : 'h4' ,
120- tooltip : 'Heading 4' ,
121+ tooltip : strings . command . h4 ,
121122 shortCut : `${ isMac ? '⌘⌥' : 'Ctrl+Alt+' } 4` ,
122123 onClick : ( editor ) => {
123124 editor . chain ( ) . focus ( ) . toggleHeading ( { level : 4 } ) . run ( ) ;
@@ -137,7 +138,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
137138 {
138139 icon : Link ,
139140 name : 'link' ,
140- tooltip : 'Link' ,
141+ tooltip : strings . command . link ,
141142 onClick : ( editor ) => {
142143 if ( editor . isActive ( 'link' ) ) {
143144 editor . chain ( ) . focus ( ) . unsetLink ( ) . run ( ) ;
@@ -173,7 +174,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
173174 {
174175 icon : Bold ,
175176 name : 'bold' ,
176- tooltip : 'Bold' ,
177+ tooltip : strings . command . bold ,
177178 shortCut : `${ isMac ? '⌘' : 'Ctrl+' } B` ,
178179 onClick : ( editor ) => {
179180 editor . chain ( ) . focus ( ) . toggleBold ( ) . run ( ) ;
@@ -191,7 +192,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
191192 {
192193 icon : Italic ,
193194 name : 'italic' ,
194- tooltip : 'Italic' ,
195+ tooltip : strings . command . italic ,
195196 shortCut : `${ isMac ? '⌘' : 'Ctrl+' } I` ,
196197 onClick : ( editor ) => {
197198 editor . chain ( ) . focus ( ) . toggleItalic ( ) . run ( ) ;
@@ -209,7 +210,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
209210 {
210211 icon : Underline ,
211212 name : 'underline' ,
212- tooltip : 'Underline' ,
213+ tooltip : strings . command . underline ,
213214 shortCut : `${ isMac ? '⌘' : 'Ctrl+' } U` ,
214215 onClick : ( editor ) => {
215216 editor . chain ( ) . focus ( ) . toggleUnderline ( ) . run ( ) ;
@@ -227,7 +228,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
227228 {
228229 icon : StrikeThrough ,
229230 name : 'strikethrough' ,
230- tooltip : 'Strikethrough' ,
231+ tooltip : strings . command . strikethrough ,
231232 shortCut : `${ isMac ? '⌘⇧' : 'Ctrl+Shift+' } S` ,
232233 onClick : ( editor ) => {
233234 editor . chain ( ) . focus ( ) . toggleStrike ( ) . run ( ) ;
@@ -245,7 +246,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
245246 {
246247 icon : Quote ,
247248 name : 'blockQuote' ,
248- tooltip : 'BlockQuote' ,
249+ tooltip : strings . command . blockQuote ,
249250 shortCut : `${ isMac ? '⌘⇧' : 'Ctrl+Shift+' } B` ,
250251 onClick : ( editor ) => {
251252 editor . chain ( ) . focus ( ) . toggleBlockquote ( ) . run ( ) ;
@@ -263,7 +264,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
263264 {
264265 icon : Code ,
265266 name : 'code' ,
266- tooltip : 'Inline Code' ,
267+ tooltip : strings . command . code ,
267268 shortCut : `${ isMac ? '⌘' : 'Ctrl+' } E` ,
268269 onClick : ( editor ) => {
269270 editor . chain ( ) . focus ( ) . toggleCode ( ) . run ( ) ;
@@ -281,7 +282,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
281282 {
282283 icon : Superscript ,
283284 name : 'superscript' ,
284- tooltip : 'Superscript' ,
285+ tooltip : strings . command . superscript ,
285286 shortCut : `${ isMac ? '⌘' : 'Ctrl+' } .` ,
286287 onClick : ( editor ) => {
287288 editor . chain ( ) . focus ( ) . toggleSuperscript ( ) . run ( ) ;
@@ -296,7 +297,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
296297 {
297298 icon : Subscript ,
298299 name : 'subscript' ,
299- tooltip : 'Subscript' ,
300+ tooltip : strings . command . subscript ,
300301 shortCut : `${ isMac ? '⌘' : 'Ctrl+' } ,` ,
301302 onClick : ( editor ) => {
302303 editor . chain ( ) . focus ( ) . toggleSubscript ( ) . run ( ) ;
@@ -313,7 +314,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
313314 {
314315 icon : AlignLeft ,
315316 name : 'align-left' ,
316- tooltip : 'Align Left' ,
317+ tooltip : strings . command . alignLeft ,
317318 shortCut : `${ isMac ? '⌘⇧' : 'Ctrl+Shift+' } L` ,
318319 onClick : ( editor ) => {
319320 editor . chain ( ) . focus ( ) . toggleTextAlign ( 'left' ) . run ( ) ;
@@ -329,7 +330,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
329330 {
330331 icon : AlignCenter ,
331332 name : 'align-center' ,
332- tooltip : 'Align Center' ,
333+ tooltip : strings . command . alignCenter ,
333334 shortCut : `${ isMac ? '⌘⇧' : 'Ctrl+Shift+' } E` ,
334335 onClick : ( editor ) => {
335336 editor . chain ( ) . focus ( ) . toggleTextAlign ( 'center' ) . run ( ) ;
@@ -345,7 +346,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
345346 {
346347 icon : AlignRight ,
347348 name : 'align-right' ,
348- tooltip : 'Align Right' ,
349+ tooltip : strings . command . alignRight ,
349350 shortCut : `${ isMac ? '⌘⇧' : 'Ctrl+Shift+' } R` ,
350351 onClick : ( editor ) => {
351352 editor . chain ( ) . focus ( ) . toggleTextAlign ( 'right' ) . run ( ) ;
@@ -361,7 +362,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
361362 {
362363 icon : AlighJustify ,
363364 name : 'align-justify' ,
364- tooltip : 'Align Justify' ,
365+ tooltip : strings . command . alignJustify ,
365366 shortCut : `${ isMac ? '⌘⇧' : 'Ctrl+Shift+' } J` ,
366367 onClick : ( editor ) => {
367368 editor . chain ( ) . focus ( ) . toggleTextAlign ( 'justify' ) . run ( ) ;
@@ -379,7 +380,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
379380 {
380381 icon : List ,
381382 name : 'bulletList' ,
382- tooltip : 'Bullet List' ,
383+ tooltip : strings . command . bulletList ,
383384 shortCut : `${ isMac ? '⌘⇧' : 'Ctrl+Shift+' } 8` ,
384385 onClick : ( editor ) => {
385386 editor . chain ( ) . focus ( ) . toggleBulletList ( ) . run ( ) ;
@@ -392,7 +393,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
392393 {
393394 icon : ListOrdered ,
394395 name : 'orderedList' ,
395- tooltip : 'Ordered List' ,
396+ tooltip : strings . command . orderedList ,
396397 shortCut : `${ isMac ? '⌘⇧' : 'Ctrl+Shift+' } 7` ,
397398 onClick : ( editor ) => {
398399 editor . chain ( ) . focus ( ) . toggleOrderedList ( ) . run ( ) ;
@@ -410,7 +411,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
410411 {
411412 icon : ListChecks ,
412413 name : 'taskList' ,
413- tooltip : 'Task List' ,
414+ tooltip : strings . command . taskList ,
414415 shortCut : `${ isMac ? '⌘⇧' : 'Ctrl+Shift+' } 9` ,
415416 onClick : ( editor ) => {
416417 editor . chain ( ) . focus ( ) . toggleTaskList ( ) . run ( ) ;
@@ -430,7 +431,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
430431 {
431432 icon : Image ,
432433 name : 'image-placeholder' ,
433- tooltip : 'Image Placeholder' ,
434+ tooltip : strings . command . imagePlaceholder ,
434435 onClick : ( editor ) => {
435436 editor . chain ( ) . focus ( ) . insertImagePlaceholder ( ) . run ( ) ;
436437 } ,
@@ -439,7 +440,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
439440 {
440441 icon : Video ,
441442 name : 'video-placeholder' ,
442- tooltip : 'Video Placeholder' ,
443+ tooltip : strings . command . videoPlaceholder ,
443444 onClick : ( editor ) => {
444445 editor . chain ( ) . focus ( ) . insertVideoPlaceholder ( ) . run ( ) ;
445446 } ,
@@ -448,7 +449,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
448449 {
449450 icon : Audio ,
450451 name : 'audio-placeholder' ,
451- tooltip : 'Audio Placeholder' ,
452+ tooltip : strings . command . audioPlaceholder ,
452453 onClick : ( editor ) => {
453454 editor . chain ( ) . focus ( ) . insertAudioPlaceholder ( ) . run ( ) ;
454455 } ,
@@ -457,7 +458,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
457458 {
458459 icon : IFrame ,
459460 name : 'iframe-placeholder' ,
460- tooltip : 'IFrame Placeholder' ,
461+ tooltip : strings . command . iframePlaceholder ,
461462 onClick : ( editor ) => {
462463 editor . chain ( ) . focus ( ) . insertIFramePlaceholder ( ) . run ( ) ;
463464 } ,
@@ -468,7 +469,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
468469 {
469470 icon : Table ,
470471 name : 'table' ,
471- tooltip : 'Table' ,
472+ tooltip : strings . command . table ,
472473 onClick : ( editor ) => {
473474 if ( editor . isActive ( 'table' ) ) {
474475 const del = confirm ( 'Do you really want to delete this table??' ) ;
@@ -486,7 +487,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
486487 {
487488 icon : Radical ,
488489 name : 'mathematics' ,
489- tooltip : 'Inline Expression' ,
490+ tooltip : strings . command . inlineExpression ,
490491 onClick : ( editor ) => {
491492 let latex = 'a^2 + b^2 = c^2' ;
492493 const chain = editor . chain ( ) . focus ( ) ;
@@ -502,7 +503,7 @@ const commands: Record<string, EdraToolBarCommands[]> = {
502503 {
503504 icon : SquareRadical ,
504505 name : 'mathematics' ,
505- tooltip : 'Block Expression' ,
506+ tooltip : strings . command . blockExpression ,
506507 onClick : ( editor ) => {
507508 const latex = 'a^2 + b^2 = c^2' ;
508509 editor . chain ( ) . focus ( ) . insertBlockMath ( { latex } ) . run ( ) ;
0 commit comments