Jump to content

CKEditor Shortcode/HannaCode instead of <img>


Andreas Augustin
 Share

Recommended Posts

Hi!

How can I modify CkEditor in Processwire?

I want to change the output for the uploaded images. Instead of an html <img> tag, I want to insert an Shortcode/Hanna-Code.

E.g. [[image caption="Some Caption Text" src="http://url-to-image.com/image.jpg"]]

Can someone help me?

 

Link to comment
Share on other sites

one way is to use a custom dropdown (richcombo) and let the editor put the caption and src.
alternately you could use the Hanna Code Helper module which works on a right click in the editor;

not sure how you would get the src, might be better to add tags to the images field and then have the editors put the tag in.
[[image caption="Some Caption Text" tag="some-tag"]]
that's how the Soundmanager textformatter works;

there is also already a module for image references

 

Link to comment
Share on other sites

11 hours ago, Robin S said:

For manipulating images embedded in a CKEditor field I use a textformatter, following the same general principles as this module: http://modules.processwire.com/modules/textformatter-image-interceptor/

I thought this module is only for adding classes etc to <img> tags? And does this module  put the tag into the field or does the module this formatting while rendering?

Link to comment
Share on other sites

2 hours ago, Andreas Augustin said:

And does this module  put the tag into the field or does the module this formatting while rendering?

The idea is not to need a Hanna tag - just let your editors insert images into the CKEditor field and then do any manipulation of the images (whatever it is you are currently doing in your Hanna tag) in your textformatter module. Not sure exactly what you are doing in your tag but the Image Interceptor module is pretty comprehensive so there's a good chance it already covers what you need. Or you can build your own simple textformatter to parse images from the HTML and manipulate the markup as needed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...