Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to make a custom time marker title editable #105

Closed
ryamaguchi0220 opened this issue Sep 20, 2019 · 4 comments · Fixed by #117
Closed

Option to make a custom time marker title editable #105

ryamaguchi0220 opened this issue Sep 20, 2019 · 4 comments · Fixed by #117
Labels
enhancement New feature or request

Comments

@ryamaguchi0220
Copy link
Contributor

ryamaguchi0220 commented Sep 20, 2019

Once a custom time marker is added, the custom time marker title can't be edited anymore.
This means that we need to remove and re-add it to change the title.
I think it would be a good idea to add an option to make a custom time marker title editable.

@callmeteus
Copy link

callmeteus commented Sep 22, 2019

I had the same problem, had to do a workaround for it:

  1. Add a unique class to the time marker
  2. Listen once to the "changed" event
  3. Get the DOM element with the given class
  4. Change the DOM element title

For example, assuming there is a timeline with var name "timeline", and a dataset with var name "items":

const onChange = () => {
timeline.off("changed", onChange);

document.querySelector(".unique-class-name").setAttribute("title", "New element title");
};

timeline.on("changed", onChange);

items.add({
 start: 1,
 end: 5,
 content: "Test",
 className: "unique-class-name"
});

@ryamaguchi0220
Copy link
Contributor Author

ryamaguchi0220 commented Sep 22, 2019

@theprometeus Thank you for sharing the workaround.
However, this issue mentions the custom time marker's title which was added by #86, not the custom time's title.

@mojoaxel
Copy link
Member

mojoaxel commented Oct 4, 2019

It would be nice to have a custom events that gets fired every time a marker was edited. That way these edits could be saved or something!

@ryamaguchi0220
Copy link
Contributor Author

ryamaguchi0220 commented Oct 4, 2019

@mojoaxel I think so too.
I'm going to do it after this issue gets resolved.

yotamberk pushed a commit that referenced this issue Oct 4, 2019
* feat(timeline): add an option to make the custom marker editable (#105)

* chore(docs): update the timeline document (#105)

* chore(docs): add new example of custom time markers (#105)

* chore(docs): add new example of editable custom time markers (#105)

* chore(docs): add the links to the example overview (#105)

* fix(docs): don't use foo and bar (#105)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants