Replies: 7 comments 10 replies
-
It's a great idea. Some widgets generate multiple DOM nodes (eg scrollable, but there are others). It may be useful to be able to use different prefixes to identify them so that attributes can be assigned independently. It's long irritated me that so much of the mapping from widget attributes to DOM attributes is hand wired for each widget. With the declarative approach we could even have the generated DOM nodes specified as an object tree that would allow these mappings to be expressed. The tree would be automatically instantiated and the output nodes passed to the render/refresh function for it to do any further customisation as required. |
Beta Was this translation helpful? Give feedback.
-
I think that's a good idea, since I would like to have a "should" convention for "core-names" like eg: So plugin authors are able to use their own prefixes. eg: I would use: |
Beta Was this translation helpful? Give feedback.
-
@Jermolene @saqimtiaz Just a reminder. I've landed here again and at "[IDEA] widgets, that allow "actions" should be able to pass on "user defined" variables and attributes" #5155 with the problem that the |
Beta Was this translation helpful? Give feedback.
-
@pmario thanks for the reminder. I've had a few busy weeks at work and need to catch up on a few other things first, after which I'll take another look at how we might implement this and #5155 in an elegant and backwards compatible manner. |
Beta Was this translation helpful? Give feedback.
-
In my PR #5695 I'm surrounding the div of the tc-tiddler-frames with 4 keyboard widgets, where the first one needs to create a div in order for the storyview-animations to work correctly. Now I also found, that my muuri storyview plugin (https://github.com/BurningTreeC/tiddlywiki-muuri) needs that first div to be of class tc-tiddler-frame. The optimal solution would be to set the classes (tc-tiddler-frame etc.) on that first div created by the keyboard widget and all data-attributes (and attributes like tabindex), too. |
Beta Was this translation helpful? Give feedback.
-
What would it take to get a PR out for this? I'd like to give it a try, but I'd need some advice |
Beta Was this translation helpful? Give feedback.
-
Thank you @saqimtiaz, I was also thinking about a method in the widget base class The logic and approach though are something I'm hoping to elaborate here |
Beta Was this translation helpful? Give feedback.
-
With the introduction of the
<$eventcatcher>
widget, and a desire to use attribute selectors for CSS, I am increasingly finding the need to be able to specify custom attributes on the DOM nodes generated by thebutton
,reveal
anddroppable
widgets.Currently the only workaround is to wrap the widgets in an additional wrapper
div/span
which leads to a more cluttered DOM structure and potentially negates some of the performance savings to be had from the above approaches.One potential solution would be that user-defined attributes that are prefixed with
data-
are used to assign custom attributes. So<$droppable tag="div" data-node-title="mytitle">
would give us<div class="tc-droppable" data-node-title="mytitle">
This is reminiscent of #5155 that discusses allowing user-defined widget attributes that are turned into variables for actions strings.
Also relevant here for a longer term vision might be this brief discussion with @Jermolene about a more declarative syntax for widgets:
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions