Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[request] Code / content snippets for a new article's Body field
I’m using the rather awesome smd_macro to create tags to make it easier for clients to insert elements such as right aligned images and buttons within the body of an article. I’ve documented these tags for them along with the textile ones they need.
What would be very useful would be a plugin where I can define as many code snippets as one wishes that are accessible via a pull down menu above the Body textarea field.
It would work like this.
- I would create via the plugin’s admin page, for example, a code snippet for adding a smd_macro tag like this:
<txp:pic_wide align="left" />
, calling it ‘Pic -Wide’
- The ‘Pic-Wide’ option would appear in a ‘insert snipper’ pull-down menu above the Body field when writing an article.
- The author would place the cursor somewhere in the Body field where the want the snippet to appear
- Selecting the ‘Pic-Wide’ snippet from the pull-down menu would make it appear :)
Also, it would be useful if two types of snippets can be defined:
- Single tags which appear where a user places the cursor
- Opening and closing tags that appear before and after selected text
This system could be used for any text string, effectively, so not only code or textile but even content that is often re-used in different articles.
Hope this makes sense :)
Offline
Re: [request] Code / content snippets for a new article's Body field
Have you looked at QuickTags? Might be one avenue, although you’ll probably have to add the tags manually. Mary had a plugin for it once, but I’m not sure it works any more.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: [request] Code / content snippets for a new article's Body field
Thanks, this is pretty much what I need.
It works on 4.4.1 with a small tweak to the code .
I’ll have to figure out the JS files to get my own code available via a button.
Thanks!
Offline