I have Textbox with text "This is google.com", I want to set hyper link to only word "google.com" not the whole textbox text. How do I set/get hyper link to the substring?
var canvas = new fabric.Canvas('c');
var urlText = new fabric.Textbox("This is google.com", {
});
urlText.setSelectionStyles({ underline: true }, 8, 18)
urlText.setSelectionStyles({linkURL: "https://www.google.com/"}, 2, 4)
urlText.setSelectionStyles({linkName:"google.com"}, 8, 18)
urlText.setSelectionStyles({fill:"rgba(0,0,255,1)"}, 8, 18)
canvas.add(urlText);
canvas {
border: 1px solid #999;
}
<script src="https://rawgit.com/kangax/fabric.js/master/dist/fabric.js"></script>
<canvas id="c" width="1000" height="500"></canvas>
Can you please help me out to get clickable event on google.com?
Thanks. Any help will be appreciated.