Snippets Tab
  • 26 Jul 2023
  • 2 Minutes to read
  • Dark
    Light

Snippets Tab

  • Dark
    Light

Article summary

The Snippets tab contains small portions of code that can be inserted into a file in the Code Editor with a single click. The available snippets are organized into groups in the Snippets tab, as in Figure 1, which displays several groups, with the Metric group expanded to show the snippets it contains.

Table  Description automatically generated

 

Note
You can drag and drop this tab into a different area of the App Builder screen, if desired.


Important
You can add snippets only to Apps that use TcEx 4.0.x. If working with an App that uses a TcEx version older than 4.0.x, a message stating “Snippets not available for this version of TCEX” will be displayed in the Snippets tab.


Hovering over a snippet will display the Insert CodeIcon  Description automatically generatedicon to the right of the snippet. Hover over this icon to display a preview of the snippet’s code (Figure 2).

Graphical user interface, text, application  Description automatically generated

 

To insert a snippet into the Code Editor, position the cursor in the desired location in the Code Editor and click Insert CodeIcon  Description automatically generated.

Note
You can use your browser’s “undo” function (e.g., Command-Z) to remove a snippet that was erroneously inserted.

Creating Snippets

To create your own groups and snippets, click AddIcon  Description automatically generatedat the upper-right corner of the Snippets tab. The Create Snippet window will be displayed (Figure 3).

Graphical user interface, application  Description automatically generated

 

  • Group: Enter the name of the group. Entering the name of an existing group will insert the snippet in that group. Entering the name of a group that does not exist will create a new group into which the snippet will be inserted.
  • Name: Enter a name for the snippet.
  • Snippet: Enter the snippet’s code.
  • Click the SAVE button.

Managing User-Created Snippets

You may edit and delete snippets that you created. To access these operations, hover the cursor over the snippet. In addition to the Insert CodeIcon  Description automatically generatedicon, EditIcon  Description automatically generatedand Deleteicons will be displayed (Figure 4).

Table  Description automatically generated

 

Click EditIcon  Description automatically generatedto edit the snippet. The Edit Snippet window will be displayed (Figure 5).

Graphical user interface, text, application, email  Description automatically generated

 

  • Group: Click in the box to enter the name of a different group to which the snippet will be added. If the group already exists, its name will be displayed below the box as you enter text into the box. If the group does not exist, a new group will be created, and the snippet will be removed from its existing group and added to the new group after clicking the SAVE button.
  • Name: Click in the box to modify the snippet’s name.
  • Snippet: Click in the box to modify the snippet’s code.
  • Click the SAVE button to save any changes to the snippet.

Click Deleteto delete the snippet. The Delete Snippet window will be displayed. Click the DELETE button to delete the snippet.

Important
If a group contains only one snippet and the snippet is moved to another group or deleted, then the group will be deleted automatically (i.e., a group must contain at least one snippet to exist).

ThreatConnect® is a registered trademark of ThreatConnect, Inc.

20084-09 v.07.B


Was this article helpful?

What's Next