User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
en:template:rich_text_field [2016/08/11 10:35]
Nicolas Ronvel
en:template:rich_text_field [2017/09/06 10:13]
Nicolas Ronvel [Rich Text fields]
Line 9: Line 9:
 </​code>​ </​code>​
 +===== Snippets ======
 +Since completion of [[https://​​Gulix/​geckos/​issues/​189|Issue #189]], the Rich Text Field can have snippets. Those are chunks of text that are added via a click on a button. It can be useful when you have special characters from the ASCII table (Bullets, Cards Suit, ...), or when your card is often used with similar bits of text (default profiles, description,​ ...).
 +To add one or more snippets to a Rich Text Field, follow this code : 
 +<code javascript>​
 +"​fields":​ [
 +    {
 +        "​name":​ "​details",​
 +        "​label":​ "​Détails",​
 +        "​type":​ "​richtext",​
 +        "​snippets":​ [
 +            { "​name":​ "​btnBullet",​ "​icon":​ "​bullet.png",​ "​value":​ "​❍",​ "​tooltip":​ "​Bullet"​ }            ​
 +        ]
 +    }
 +The ''​name''​ here is the name of the button that will be created. The ''​icon''​ is the PNG file that will be used on the button. It should be placed in the ''​src/​js/​templates''​ folder. You can use standard URL value from that point (upper directory, child directory, ...). The ''​tooltip''​ value is what is displayed on the UI when the button is hovered.
 +The ''​value''​ is the string that will be inserted in the Rich Text Field when the button is clicked. It can be HTML value, such as ''<​em>​This is Italic text</​em>​ <​strong>​This is bold text</​strong>​ This is standard text''​.
 ===== Using the variables ===== ===== Using the variables =====
en/template/rich_text_field.txt · Last modified: 2017/09/14 11:32 by Nicolas Ronvel