-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Support parent dir for RTL timeline and fix a small bug for editable point items #2235
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
But I think we should also check it the <html>
tag has a direction. But this could be done in a separate PR if you want.
@mojoaxel it already does it =) |
// Create the DOM, props, and emitter | ||
this._create(container); | ||
|
||
if (!options || (options && typeof options.rtl == "undefined")) { | ||
this.options.rtl = window.getComputedStyle(this.dom.root, null).direction == "rtl"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should be better something like this:
// check if the timelines root element or one of its parents has a direction
var directionFromDom, domNode = this.dom.root;
while (!directionFromDom && domNode) {
directionFromDom = window.getComputedStyle(domNode, null).direction;
domNode = domNode.parentElement;
}
this.options.rtl = (directionFromDom && (directionFromDom.toLowerCase() == "rtl"));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add this to another PR? Or do you want to revert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just change it and push the changes to your branch. Would be cool, if you test it before, I didn't ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it and submitted another PR =)
We can now define a rtl timeline buy reading the closest parent dir. closes #2027.
and fix a small bug I caused in a previous PR which made editable point items unuseable...