In all my posts I am using images with a set of actions. For example:
?lightbox=1200,1200&cropResize=256,256
Is there a way to make it default in order to avoid copy/paste? It can be an implicit site wide default, or a set of options in the antimatter.
Or an option for the editor to insert the Markdown media tag with those items added.
Hmm, pretty sure it’s doable with Javascript. I did a similar thing in my Typography Helper plugin, but to be honest I don’t remember off the top of my head how exactly it might work. You’d have to piggyback onto the existing button functions… or maybe tack on some JS like “if this string gets inserted add this other string”.
Yes, I am comfortable with javascript, just don’t know where to change it so it survive upgrades. I am not familiar with Grav’s Javascript compile stages…
What I would like to change is what this + button does:
So it inserts my special image tag instead of default one.
I ended up by finding the workaround. There are 2 files: grav/user/plugins/admin/themes/grav/js/admin.min.js grav/user/plugins/admin/themes/grav/app/forms/fields/files.js
containing UriToMarkdown function, that is actually generating the string and used by that button.
I have hardcoded my value there. But it will be overwritten by the next upgrade.
It would be much better to have a template string in the configuration somewhere…
This is a good idea, but I think it will only be called when page is saved. Having it inserted with the correct format is more convenient, because for some cases I want to change the size values.
@Artiom, You could also add an extra header field in the page blueprint containing the entire param string, or multiple fields for each size separately.
Or, if the number of different sized is limited, you could use a selectbox filled with values from the config file. Or a combination of a selectbox and free text. Or, …
Then in onAdminSave, you can get the values from the header of the page and, when having a value, use that value instead of the value from the config file.