github.com/ngocphuongnb/tetua@v0.0.7-alpha/packages/editor/src/menu/items/code.ts (about) 1 import { MenuItem } from "../menu-item"; 2 3 export class MenuCode extends MenuItem { 4 protected command = 'code'; 5 protected label = 'Inline Code'; 6 protected isActive = false; 7 protected icon = `<svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M14.6,16.6L19.2,12L14.6,7.4L16,6L22,12L16,18L14.6,16.6M9.4,16.6L4.8,12L9.4,7.4L8,6L2,12L8,18L9.4,16.6Z" /></svg>`; 8 // protected icon = `<svg fill="currentColor" viewBox="0 0 24 24"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M16.95 8.464l1.414-1.414 4.95 4.95-4.95 4.95-1.414-1.414L20.485 12 16.95 8.464zm-9.9 0L3.515 12l3.535 3.536-1.414 1.414L.686 12l4.95-4.95L7.05 8.464z"></path></g></svg>`; 9 10 protected handler(e: MouseEvent) { 11 e.preventDefault(); 12 this.editor.tiptapEditor.chain().focus().toggleCode().run(); 13 } 14 }