Use a stable and modifiable data structure for jsToolbar elements
The […] order of enumerating the properties […] is not specified.
(see ECMA-262 12.6.4)
We (Planio) haven't seen any bugs with the current implementation but find it lacking in that we cannot add a button at a specific position in the toolbar without adding it to core js files (which has become more difficult since the
jstoolbar-textile.min.js is shipped with core without any apparent clues how it is generated, but that's not the point here).
Would the Redmine team be open to switching the aforementioned
jsToolBar.prototype.elements to a data structure with a guaranteed ordering and the ability to add elements at a specified absolute ("at position X") or relative ("after button X") place?
#3 Updated by Mischa The Evil about 9 years ago
Felix Schäfer wrote:
[...] but find it lacking in that we cannot add a button at a specific position in the toolbar without adding it to core js files [...]
I agree on that.
[...] switching the aforementioned
jsToolBar.prototype.elementsto a data structure with a guaranteed ordering and the ability to add elements at a specified absolute ("at position X") or relative ("after button X") place?
To me this sounds like a good idea. This will give plugin developers (thinking about custom macros, custom syntax, etc.; like the often used WikiNG plugin) the control they need.
#4 Updated by Yukinari TOYOTA about 9 years ago
I have an experience of similar problem.
In that case, I want to add a special image button after the original image button.
I solved this problem by modifying/replacing `jsToolBar.prototype.elements` at runtime.
However, it is not straightforward so new API is welcome.