Adding alt+enter action to copy HTML entity
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
This commit is contained in:
		
							parent
							
								
									976055c5c7
								
							
						
					
					
						commit
						6078260659
					
				
					 2 changed files with 6 additions and 5 deletions
				
			
		
							
								
								
									
										7
									
								
								main.py
									
										
									
									
									
								
							
							
						
						
									
										7
									
								
								main.py
									
										
									
									
									
								
							| 
						 | 
					@ -86,15 +86,16 @@ class KeywordQueryEventListener(EventListener):
 | 
				
			||||||
                image_path = get_character_icon(char)
 | 
					                image_path = get_character_icon(char)
 | 
				
			||||||
                encoded = htmlentities.encode(char.character)
 | 
					                encoded = htmlentities.encode(char.character)
 | 
				
			||||||
                if "&" in encoded:
 | 
					                if "&" in encoded:
 | 
				
			||||||
                    entity = " - " + encoded
 | 
					                    sep = " - "
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    entity = ""
 | 
					                    sep = ""
 | 
				
			||||||
                items.append(
 | 
					                items.append(
 | 
				
			||||||
                    ExtensionResultItem(
 | 
					                    ExtensionResultItem(
 | 
				
			||||||
                        icon=image_path,
 | 
					                        icon=image_path,
 | 
				
			||||||
                        name=char.name.capitalize() + " - " + char.character,
 | 
					                        name=char.name.capitalize() + " - " + char.character,
 | 
				
			||||||
                        description=char.block + " - U+" + char.code + entity,
 | 
					                        description=char.block + " - U+" + char.code + sep + encoded,
 | 
				
			||||||
                        on_enter=CopyToClipboardAction(char.character),
 | 
					                        on_enter=CopyToClipboardAction(char.character),
 | 
				
			||||||
 | 
					                        on_alt_enter=CopyToClipboardAction(encoded),
 | 
				
			||||||
                    )
 | 
					                    )
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
        return RenderResultListAction(items)
 | 
					        return RenderResultListAction(items)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "name": "Symbol search",
 | 
					  "name": "Symbol search",
 | 
				
			||||||
  "description": "Search symbols in ASCII and Unicode and copy them to the clipboard. Dark mode friendly.",
 | 
					  "description": "Search symbols in ASCII and Unicode. Enter to copy the symbol, alt+enter to copy the HTML entity. Dark mode friendly.",
 | 
				
			||||||
  "developer_name": "Ivan Boothe",
 | 
					  "developer_name": "Ivan Boothe",
 | 
				
			||||||
  "icon": "images/insertion-symbol.png",
 | 
					  "icon": "images/insertion-symbol.png",
 | 
				
			||||||
  "required_api_version": "^2.0.0",
 | 
					  "required_api_version": "^2.0.0",
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@
 | 
				
			||||||
      "id": "symbol",
 | 
					      "id": "symbol",
 | 
				
			||||||
      "type": "keyword",
 | 
					      "type": "keyword",
 | 
				
			||||||
      "name": "Symbol",
 | 
					      "name": "Symbol",
 | 
				
			||||||
      "description": "Search symbols in ASCII and Unicode and copy them to the clipboard. Dark mode friendly.",
 | 
					      "description": "Search symbols in ASCII and Unicode. Enter to copy the symbol, alt+enter to copy the HTML entity. Dark mode friendly.",
 | 
				
			||||||
      "default_value": "sym"
 | 
					      "default_value": "sym"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue