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

itext not going to edit mode #35

Open
sathishravula opened this issue Jun 27, 2018 · 7 comments
Open

itext not going to edit mode #35

sathishravula opened this issue Jun 27, 2018 · 7 comments

Comments

@sathishravula
Copy link

itext not entering into editable mode is there any reasons

@dragonwt
Copy link

the same question

@Sherry-Xu-2018
Copy link

i got the same issue.

@qarthandgi
Copy link

Is this resolved? Anyone figure out a solution?

@surajwaghmare
Copy link

surajwaghmare commented Feb 3, 2020

Hi,
I resolved this issue by making IText forcefully editable.
if (!IsAddLabelTrue) { if (canvas.getActiveObject() && canvas.getActiveObject().type === "i-text") { canvas.setActiveObject(canvas.getActiveObject()); canvas.getActiveObject().editable = true; canvas.getActiveObject().selectAll(); canvas.getActiveObject().enterEditing(); canvas.getActiveObject().hasControls = false; } }

@saching6
Copy link

I am having the same issue, the above solution does not seem to work.

Hi,
I resolved this issue by making IText forcefully editable.
if (!IsAddLabelTrue) { if (canvas.getActiveObject() && canvas.getActiveObject().type === "i-text") { canvas.setActiveObject(canvas.getActiveObject()); canvas.getActiveObject().editable = true; canvas.getActiveObject().selectAll(); canvas.getActiveObject().enterEditing(); canvas.getActiveObject().hasControls = false; } }

@surajwaghmare
Copy link

Hi @saching6,
On mouse:down event I write this code for IText.
You have to put below lines of code on event trigger:

canvas.setActiveObject(canvas.getActiveObject());
canvas.getActiveObject().editable = true;
canvas.getActiveObject().selectAll();
canvas.getActiveObject().enterEditing();

Or please create a JSFiddle of your issue so anyone can help you on that.

@adamjarling
Copy link

adamjarling commented Jan 3, 2021

Hey @saching6 and @surajwaghmare , I think I found a solution for both desktop and mobile, enabling Fabric's Textbox and IText. But it requires using an updated version of the fabric.adapted.js file. Here's an updated version in my fork of this repo: https://github.com/adamjarling/OpenseadragonFabricjsOverlay/blob/master/fabric/fabric.adapted-4.0.0-rc.1-itext-fix.js

I experimented replacing the defined eventMapping values defined here:

https://github.com/adamjarling/OpenseadragonFabricjsOverlay/blob/c9c6611312dfaa57743090de45c3e54b38cdf1cb/fabric/fabric.adapted-4.0.0-rc.1-itext-fix.js#L12684

with the regular string values Fabric uses in extending the IText prototype here:

https://github.com/adamjarling/OpenseadragonFabricjsOverlay/blob/c9c6611312dfaa57743090de45c3e54b38cdf1cb/fabric/fabric.adapted-4.0.0-rc.1-itext-fix.js#L30995

If you search the file fabric.adapted.js for "adapted" (in JSDoc headers), that should help diff between fabric.js (Fabric's version) and fabric.adapted.js.

If you search my forked repo's fabric.adapted-4.0.0-rc.1-itext-fix.js file for "adapted AA", you'll see where I made updates to fabric.adapted.js. Thus far it seems to work, fingers crossed.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants