trim leading and trailing spaces in cmsAdmin v 2.62
In v2.62 the edtor does not trim the leading or trailing spaces before inserting into the database. I can't think of where this not appropriate and all leading and trailing spaces should be deleted.
If there is a use case to have leading or trailing spaces then an option to trim spaces defaulted ON would be good.
I don't think we ever trimmed spaces? And is it for text fields or wysiwyg fields?
In general we like to keep options and "non-obvious" behaviour to a minimum. We could probably write you a plugin to strip leading/trailing whitespace on save though if you wanted that. Let me know if you do and I'll whip it up for you. I think it should just be a few lines of code and would provide an easy way to enable that functionality.
Thanks for the feedback! I'll have a discussion with Dave about how we will proceed on this one. Let us know if you find anything else for us to review :).
Ross Fairbairn - Consulting
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/
It's definitely not a bug, in that we never intended whitespace to be stripped and that the database is accurately storing and retrieving what was entered in, so it's operating as designed.
The issue remains of if it's intuitive and what the user would expect to happen. We've got people relying on the feature right now for sorting and padding. So the problem we run in to is if we started stripping whitespace it would break functionality for those users and confuse other users who intended spaces (or other whitespace characters) to be saved. We also need to consider is how many support queries adding or removing a feature will generate and the added complexity of adding more options to the settings.
So I think a plugin is the best way to handle it right now, and we'll keep the idea open of an advanced plugin that has this and a lot of other forum enhancements and ideas. That would allow advanced users to tweak the settings and still keep the UI simple for regular users.
Jeff, if you do write a plugin, could you post it on this thread? Thanks!
Point taken, here is a simple plugin for any who need it.
Plugin Name: Trim Whitespace
Description: trims leading and trailing whitespace on text fields using trim()
Author: Jeff Shields
Author URI: http://yaadev.com
Requires at least: 2.50