Can i add ui.TextEditor to the items of standard.HeaderedRecord #2775
Answered
by
kumilingus
Naveena1321
asked this question in
Q&A
-
IntroductionCan i add ui.TextEditor to the items of standard.HeaderedRecord Steps to reproduceNo response Restrictions & ConstraintsNo response Does your question relate to JointJS or JointJS+. Select both if applicable.JointJS, JointJS+ |
Beta Was this translation helpful? Give feedback.
Answered by
kumilingus
Oct 21, 2024
Replies: 1 comment
-
Here is an example of how to edit an item to a double-click. paper.on('element:magnet:pointerdblclick', (elementView: dia.ElementView, evt: dia.Event, magnet: SVGElement) => {
evt.stopPropagation();
const element = elementView.model as Records;
const id = elementView.findAttribute('item-id', magnet);
graph.startBatch('edit-item');
element.attr([`itemLabel_${id}`, 'itemText'], { textWrap: false });
function close() {
ui.TextEditor.close();
element.removeAttr([`itemLabel_${id}`, 'itemText']);
graph.stopBatch('edit-item');
}
ui.TextEditor.edit(magnet, {
cellView: elementView,
textProperty: [...element.getItemPathArray(id), 'label'],
onKeydown: (evt: KeyboardEvent) => {
if (evt.code === 'Enter') {
evt.stopPropagation();
close();
}
},
onOutsidePointerdown: () => close()
});
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Naveena1321
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is an example of how to edit an item to a double-click.