1
0
Fork 0
mirror of https://github.com/24eme/signaturepdf synced 2026-03-14 13:55:44 +01:00

add new line with ctrl+Enter

This commit is contained in:
Gabriel Poma 2025-06-26 16:35:27 +02:00
commit 2d2df03cb4

View file

@ -550,8 +550,20 @@ function createAndAddSvgInCanvas(canvas, item, x, y, height = null) {
fill: penColor
});
fabric.Textbox.prototype.customEnterAction = function (e) {
if (e.ctrlKey) {
this.insertChars('\n', undefined, this.selectionStart)
this.exitEditing();
this.enterEditing();
this.moveCursorRight(e);
return
}
this.exitEditing()
}
addObjectInCanvas(canvas, textbox).setActiveObject(textbox);
textbox.keysMap[13] = "exitEditing";
textbox.keysMap[13] = "customEnterAction";
textbox.lockScalingFlip = true;
textbox.scaleX = currentTextScale;
textbox.scaleY = currentTextScale;