-
Notifications
You must be signed in to change notification settings - Fork 332
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
feat(timeline): add an option to make the custom marker editable #117
Conversation
const marker = document.createElement('div'); | ||
marker.className = `vis-custom-time-marker`; | ||
marker.innerHTML = title; | ||
marker.style.position = 'absolute'; | ||
if (editable) { | ||
marker.setAttribute('contenteditable', 'true'); | ||
marker.addEventListener('pointerdown', function () { |
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.
Doing focus()
is necessary since the default is prevented by here.
If you have any better ideas, please share it.
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.
Thanks!
Could you please also add a new example that demonstrates the use of this new feature.
@mojoaxel |
@@ -0,0 +1,50 @@ | |||
<!DOCTYPE HTML> |
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 example file needs to be added to the example overview.
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.
Fixed in 4a52f8b
@@ -0,0 +1,41 @@ | |||
<!DOCTYPE HTML> |
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 example file needs to be added to the example overview.
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.
Fixed in 4a52f8b
|
||
<script type="text/javascript"> | ||
var container = document.getElementById('visualization'); | ||
var items = new vis.DataSet(); |
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.
It would be nice if some dummy-data would be displayed.
Something like this
var items = [
{x: '2014-06-11', y: 10},
{x: '2014-06-12', y: 25},
{x: '2014-06-13', y: 30},
{x: '2014-06-14', y: 10},
{x: '2014-06-15', y: 15},
{x: '2014-06-16', y: 30}
];
var dataset = new vis.DataSet(items);
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 think so too.
However, I'm not sure if it would be nice to use vis.Graph2d
instead of vis.Timeline
like this since these examples are the timeline documents, not the graph2d documents.
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 are write, I copied the wrong example code. Feel free to add some data-points or leave it as it is.
|
||
<script type="text/javascript"> | ||
var container = document.getElementById('visualization'); | ||
var items = new vis.DataSet(); |
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.
please add some dummy-data (see above).
var id1 = "foo"; | ||
var id2 = "bar"; |
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.
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.
Fixed in 9cf487a
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.
LGTM
Closes #105
Demo
https://visjs.github.io/vis-timeline/examples/timeline/markers/customTimeMarkersEditable.html