#15596 closed enhancement (fixed)
Allow JS functions in TinyMCE $initArray
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.2 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | TinyMCE | Keywords: | |
Focuses: | Cc: |
Description
r16090 allowed booleans, JSON-encoded arrays and objects to be passed to the TinyMCE configuration, by not wrapping them in quotes. If the check for {
and [
could be expanded to include (
, we could also pass anonymous functions (of the form (function() { if ( someClientSideProperty ) return 'a'; return 'b'; })()
), which allows integration of client-side information in the TinyMCE configuration. This would greatly increase the flexibility of plugins to pass extra information to TinyMCE without jumping through hoops.
Change History (5)
#2
@
14 years ago
Indeed, my proposal covered only TinyMCE init, but there are other places where Javascript is generated, like in WP_Script::print_script_l10n()
, which is used more and more as a generic data passing method, not just for localization.
We should keep backwards compatibility in mind: I wouldn't want a string like '(Closed)'
to be interpreted as a non-string. But the same goes for '[Closed]'
and '{Closed}'
, which will not be embedded in quotes now, even if they should be. Maybe add "
to the list too, so once can "self-escape" and pass a variable as '"[This is a string, not an array]"'
?
This would be sooo neat.
Ran into the issue myself, and I had to do weird a workaround to get multi-dimensional objects in there, aka: