Class: Inkpen::Extensions::SlashCommands
- Defined in:
- lib/inkpen/extensions/slash_commands.rb
Overview
SlashCommands Extension
Adds “/” command palette for quick insertion of blocks and formatting. Similar to Notion’s slash commands or Dropbox Paper’s “/” menu.
Constant Summary collapse
- DEFAULT_COMMANDS =
Default command set matching Notion/Paper experience
[ # Text blocks { name: "paragraph", label: "Text", description: "Plain text block", icon: "text", group: "Basic", shortcut: nil }, { name: "heading1", label: "Heading 1", description: "Large heading", icon: "h1", group: "Basic", shortcut: "#" }, { name: "heading2", label: "Heading 2", description: "Medium heading", icon: "h2", group: "Basic", shortcut: "##" }, { name: "heading3", label: "Heading 3", description: "Small heading", icon: "h3", group: "Basic", shortcut: "###" }, # Lists { name: "bullet_list", label: "Bullet List", description: "Unordered list", icon: "list", group: "Lists", shortcut: "-" }, { name: "ordered_list", label: "Numbered List", description: "Ordered list", icon: "list-ordered", group: "Lists", shortcut: "1." }, { name: "task_list", label: "Task List", description: "Checklist with checkboxes", icon: "check-square", group: "Lists", shortcut: "[]" }, # Blocks { name: "blockquote", label: "Quote", description: "Quote block", icon: "quote", group: "Blocks", shortcut: ">" }, { name: "code_block", label: "Code Block", description: "Code with syntax highlighting", icon: "code", group: "Blocks", shortcut: "```" }, { name: "horizontal_rule", label: "Divider", description: "Horizontal line", icon: "minus", group: "Blocks", shortcut: "---" }, # Media { name: "image", label: "Image", description: "Upload or embed an image", icon: "image", group: "Media", shortcut: nil }, { name: "youtube", label: "YouTube", description: "Embed a YouTube video", icon: "youtube", group: "Media", shortcut: nil }, # Advanced { name: "table", label: "Table", description: "Insert a table", icon: "table", group: "Advanced", shortcut: nil }, { name: "callout", label: "Callout", description: "Highlighted callout box", icon: "alert-circle", group: "Advanced", shortcut: nil }, { name: "section", label: "Section", description: "Page section with width control", icon: "layout", group: "Advanced", shortcut: nil }, { name: "preformatted", label: "Plain Text", description: "Preformatted text for ASCII art", icon: "file-text", group: "Advanced", shortcut: nil } ].freeze
- DEFAULT_GROUPS =
%w[Basic Lists Blocks Media Advanced].freeze
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#enabled?, #initialize, #to_h, #to_json
Constructor Details
This class inherits a constructor from Inkpen::Extensions::Base
Instance Method Details
#name ⇒ Object
59 60 61 |
# File 'lib/inkpen/extensions/slash_commands.rb', line 59 def name :slash_commands end |
#to_config ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/inkpen/extensions/slash_commands.rb', line 63 def to_config { trigger: [:trigger], commands: [:commands], groups: [:groups], maxSuggestions: [:max_suggestions], allowFiltering: [:allow_filtering], showIcons: [:show_icons], showDescriptions: [:show_descriptions], showShortcuts: [:show_shortcuts], suggestionClass: [:suggestion_class], itemClass: [:item_class], activeClass: [:active_class], groupClass: [:group_class] }.compact end |