{"action":"created","issue":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/1778","labels_url":"https://api.github.com/repos/kangax/fabric.js/issues/1778/labels{/name}","comments_url":"https://api.github.com/repos/kangax/fabric.js/issues/1778/comments","events_url":"https://api.github.com/repos/kangax/fabric.js/issues/1778/events","html_url":"https://github.com/kangax/fabric.js/pull/1778","id":46615971,"number":1778,"title":"A Textbox with text wrapping and box resizing (subclasses IText)","user":{"login":"jafferhaider","id":793773,"avatar_url":"https://avatars.githubusercontent.com/u/793773?v=3","gravatar_id":"","url":"https://api.github.com/users/jafferhaider","html_url":"https://github.com/jafferhaider","followers_url":"https://api.github.com/users/jafferhaider/followers","following_url":"https://api.github.com/users/jafferhaider/following{/other_user}","gists_url":"https://api.github.com/users/jafferhaider/gists{/gist_id}","starred_url":"https://api.github.com/users/jafferhaider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jafferhaider/subscriptions","organizations_url":"https://api.github.com/users/jafferhaider/orgs","repos_url":"https://api.github.com/users/jafferhaider/repos","events_url":"https://api.github.com/users/jafferhaider/events{/privacy}","received_events_url":"https://api.github.com/users/jafferhaider/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":127,"created_at":"2014-10-23T11:49:42Z","updated_at":"2015-10-20T07:30:54Z","closed_at":"2015-07-14T21:25:00Z","pull_request":{"url":"https://api.github.com/repos/kangax/fabric.js/pulls/1778","html_url":"https://github.com/kangax/fabric.js/pull/1778","diff_url":"https://github.com/kangax/fabric.js/pull/1778.diff","patch_url":"https://github.com/kangax/fabric.js/pull/1778.patch"},"body":"For [Issue 187](https://github.com/kangax/fabric.js/issues/187). This is a more fully featured implementation than [Pull Request 725](https://github.com/kangax/fabric.js/pull/725). \r\n\r\nI need this feature for my product, so I fully intend to support this class if it is made official.\r\n\r\n### Demo\r\nCheck it out [a demo](http://jsfiddle.net/jafferhaider/51u08n39/92/).\r\n\r\n### Summary of features\r\n- Subclasses IText, so gets all of its goodness.\r\n- Text wraps as user types and/or resizes a Textbox. Works with all textAlign values.\r\n- User can change width of Textbox. Height is automatically set based on text wrapping. Font size and scale does not change.\r\n- Support for resizing in Groups. Only the width of a Textbox changes. The Textbox updates its scaleX/Y values to undo scale values of its parent Group so that font size remains the same.\r\n- Refactored the ton of `this.text.split(this._reNewline)` calls into a function that gets overwritten by subclasses.\r\n- Fixed bug in Justify text (was present in both Text and IText classes).\r\n- Tested on latest versions of Safari (OSX & iOS), Chrome (OSX & Win), Firefox and Internet Explorer.\r\n\r\n### Open issues / TODOs\r\n1. Need to add support for Styles. It is not required for my usage of this widget so contributions are welcome.\r\n2. ~~Justify alignment needs to be fixed in IText.~~\r\n3. ~~Inheritance bug in IText.toSVG(). The `callSuper` in `_setSVGTextLineText` goes into a recursive loop if called on a Textbox object. It works fine if I replace the `callSuper` call with a call to a copy of `Text._setSVGTextLineText`. Have you encountered something like this before? Any opinions on how to fix this?~~\r\n\r\nPlease list changes that you'd like me to make before this can be made official. I saw in the other pull request that @kangax wasn't too sure about the 'Textbox' name ... we can change it."},"comment":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/comments/149462500","html_url":"https://github.com/kangax/fabric.js/pull/1778#issuecomment-149462500","issue_url":"https://api.github.com/repos/kangax/fabric.js/issues/1778","id":149462500,"user":{"login":"Stefanoviic","id":15209279,"avatar_url":"https://avatars.githubusercontent.com/u/15209279?v=3","gravatar_id":"","url":"https://api.github.com/users/Stefanoviic","html_url":"https://github.com/Stefanoviic","followers_url":"https://api.github.com/users/Stefanoviic/followers","following_url":"https://api.github.com/users/Stefanoviic/following{/other_user}","gists_url":"https://api.github.com/users/Stefanoviic/gists{/gist_id}","starred_url":"https://api.github.com/users/Stefanoviic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stefanoviic/subscriptions","organizations_url":"https://api.github.com/users/Stefanoviic/orgs","repos_url":"https://api.github.com/users/Stefanoviic/repos","events_url":"https://api.github.com/users/Stefanoviic/events{/privacy}","received_events_url":"https://api.github.com/users/Stefanoviic/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T07:30:54Z","updated_at":"2015-10-20T07:30:54Z","body":"Having the same bug as @wendon \r\n\r\n\"If you click in middle of text and hit enter several times and try to add some words, cursor position seems to incorrect. After digging source code, I guess startPosition is incorrect when original text has '\\n' values.Any thoughts on this issue?\"\r\n\r\nAny update on this?"}}