Detecting when a snippet template is being used in an inline slot


Does anyone know how I can determine, in a snippet template being used to assemble items in a slot, that the slot is the sys_inline_variant one that is used when an author uses the Insert > Insert Inline Template option in an Ephox EditLine control?

In ordinary slots, you can check the name of the slot using $ but that doesn’t seem to work in sys_inline_variant.



I’ve found a workaround: create a new dispatch template that sets a variable, say $isinlineslot, to 1 and then sets $sys.template to whatever snippet template should be used for each content type. Then edit the sys_inline_variant slot so that all allowed content types are set up to use that new dispatch template. You can then check whether $isinlineslot is true or false in your snippet templates, and vary the HTML accordingly.

For example, we want to change the float CSS for images that are inline compared to ones added in non-inline slots. But we had only one snippet template set up for displaying images.

Unfortunately, this will only work for new items added using the Insert > Insert Inline Template option. Existing content has to be fixed in the database, updating both the PSX_OBJECTRELATIONSHIP table and any table containing the HTML generated by the EditLive control (because the template to be used in assembly is stored twice.) Fortunately, we use Oracle, so could search and replace CLOB fields using regular expressions.