{"action":"created","issue":{"url":"https://api.github.com/repos/ckeditor/ckeditor5-build-classic/issues/55","repository_url":"https://api.github.com/repos/ckeditor/ckeditor5-build-classic","labels_url":"https://api.github.com/repos/ckeditor/ckeditor5-build-classic/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/ckeditor/ckeditor5-build-classic/issues/55/comments","events_url":"https://api.github.com/repos/ckeditor/ckeditor5-build-classic/issues/55/events","html_url":"https://github.com/ckeditor/ckeditor5-build-classic/issues/55","id":369335108,"node_id":"MDU6SXNzdWUzNjkzMzUxMDg=","number":55,"title":"Possible Syntax Error in the \"setUpListeners\" Function","user":{"login":"CurtisConway","id":21203902,"node_id":"MDQ6VXNlcjIxMjAzOTAy","avatar_url":"https://avatars2.githubusercontent.com/u/21203902?v=4","gravatar_id":"","url":"https://api.github.com/users/CurtisConway","html_url":"https://github.com/CurtisConway","followers_url":"https://api.github.com/users/CurtisConway/followers","following_url":"https://api.github.com/users/CurtisConway/following{/other_user}","gists_url":"https://api.github.com/users/CurtisConway/gists{/gist_id}","starred_url":"https://api.github.com/users/CurtisConway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CurtisConway/subscriptions","organizations_url":"https://api.github.com/users/CurtisConway/orgs","repos_url":"https://api.github.com/users/CurtisConway/repos","events_url":"https://api.github.com/users/CurtisConway/events{/privacy}","received_events_url":"https://api.github.com/users/CurtisConway/received_events","type":"User","site_admin":false},"labels":[{"id":562083295,"node_id":"MDU6TGFiZWw1NjIwODMyOTU=","url":"https://api.github.com/repos/ckeditor/ckeditor5-build-classic/labels/status:pending","name":"status:pending","color":"e6e6e6","default":false}],"state":"open","locked":false,"assignee":{"login":"oleq","id":1099479,"node_id":"MDQ6VXNlcjEwOTk0Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/1099479?v=4","gravatar_id":"","url":"https://api.github.com/users/oleq","html_url":"https://github.com/oleq","followers_url":"https://api.github.com/users/oleq/followers","following_url":"https://api.github.com/users/oleq/following{/other_user}","gists_url":"https://api.github.com/users/oleq/gists{/gist_id}","starred_url":"https://api.github.com/users/oleq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleq/subscriptions","organizations_url":"https://api.github.com/users/oleq/orgs","repos_url":"https://api.github.com/users/oleq/repos","events_url":"https://api.github.com/users/oleq/events{/privacy}","received_events_url":"https://api.github.com/users/oleq/received_events","type":"User","site_admin":false},"assignees":[{"login":"oleq","id":1099479,"node_id":"MDQ6VXNlcjEwOTk0Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/1099479?v=4","gravatar_id":"","url":"https://api.github.com/users/oleq","html_url":"https://github.com/oleq","followers_url":"https://api.github.com/users/oleq/followers","following_url":"https://api.github.com/users/oleq/following{/other_user}","gists_url":"https://api.github.com/users/oleq/gists{/gist_id}","starred_url":"https://api.github.com/users/oleq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleq/subscriptions","organizations_url":"https://api.github.com/users/oleq/orgs","repos_url":"https://api.github.com/users/oleq/repos","events_url":"https://api.github.com/users/oleq/events{/privacy}","received_events_url":"https://api.github.com/users/oleq/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/ckeditor/ckeditor5-build-classic/milestones/10","html_url":"https://github.com/ckeditor/ckeditor5-build-classic/milestone/10","labels_url":"https://api.github.com/repos/ckeditor/ckeditor5-build-classic/milestones/10/labels","id":3245169,"node_id":"MDk6TWlsZXN0b25lMzI0NTE2OQ==","number":10,"title":"next","description":null,"creator":{"login":"Reinmar","id":156149,"node_id":"MDQ6VXNlcjE1NjE0OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/156149?v=4","gravatar_id":"","url":"https://api.github.com/users/Reinmar","html_url":"https://github.com/Reinmar","followers_url":"https://api.github.com/users/Reinmar/followers","following_url":"https://api.github.com/users/Reinmar/following{/other_user}","gists_url":"https://api.github.com/users/Reinmar/gists{/gist_id}","starred_url":"https://api.github.com/users/Reinmar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Reinmar/subscriptions","organizations_url":"https://api.github.com/users/Reinmar/orgs","repos_url":"https://api.github.com/users/Reinmar/repos","events_url":"https://api.github.com/users/Reinmar/events{/privacy}","received_events_url":"https://api.github.com/users/Reinmar/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2018-04-05T13:15:29Z","updated_at":"2018-10-16T13:58:11Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2018-10-11T22:48:28Z","updated_at":"2018-10-16T15:16:27Z","closed_at":null,"author_association":"NONE","body":"## Type of report\r\n\r\nBug\r\n\r\n## Provide detailed reproduction steps (if any)\r\n\r\n1. Import the ClassicEditor into a vue component and try to mount it on an element within the component\r\n\r\n``` html\r\n<template>\r\n    <div class=\"flex flex-row\">\r\n        <textarea ref=\"editorElement\" name=\"content\">\r\n\r\n        </textarea>\r\n    </div>\r\n</template>\r\n<script>\r\n    import ClassicEditor from '@ckeditor/ckeditor5-build-classic';\r\n\r\n    export default {\r\n        name: 'wysiwyg-editor',\r\n        mounted(){\r\n            const editorElement = this.$refs.editorElement;\r\n\r\n            ClassicEditor\r\n                .create(\r\n                    editorElement\r\n                )\r\n                .then(editor => {\r\n                    console.log(editor);\r\n                })\r\n                .catch(error => {\r\n                    console.error(error);\r\n                });\r\n        }\r\n    }\r\n</script>\r\n```\r\n\r\n2. Visit any page trying to render said component\r\n\r\n### Expected result\r\n\r\nEditor mounts to the text area included in the Vue component\r\n\r\n### Actual result\r\n\r\nYou get an error 'TypeError: Cannot read property 'eventListeners' of undefined'\r\n\r\n## Other details\r\n\r\nAt first I thought this was an issue with how Vue references it's DOM nodes and the \"editorElement\" was actually being passed through as undefined. After some head scratching and googling and no progress at all I decided to jump into the source file to see what's going on at that exact moment.\r\n\r\nSince it's all minified code I just auto formatted it and started throwing some consoles into the function.\r\n\r\n``` javascript\r\n_setUpListeners(t) {\r\n        console.log('\"this\" - before loop', this);\r\n\r\n        if (this.eventListeners) for (const e in this.eventListeners) {\r\n            console.log(e);\r\n            console.log('\"this\" - after loop', this);\r\n\r\n            const n = this.eventListeners[e].map(n => {\r\n                const [o, i] = e.split(\"@\");\r\n                return n.activateDomEventListener(o, i, t)\r\n            });\r\n            t.revertData && t.revertData.bindings.push(n)\r\n        }\r\n}\r\n```\r\n\r\nI've not seen this syntax for a loop before so forgive me if I'm not understanding it properly (it's possible a build took like babel is doing this?). But after the \"if\" passes and it moves onto the \"for\" somewhere along the line \"this\" gets unbound and is returning undefined, and then spitting out the error \"Can't find property eventListeners of undefined\".\r\n\r\nIf I do a quick reformat on this one block so the for loop is nested inside of the if statement like so:\r\n\r\n``` javascript\r\n_setUpListeners(t) {           \r\n    if (this.eventListeners){\r\n         for (const e in this.eventListeners) {\r\n             const n = this.eventListeners[e].map(n => {\r\n                 const [o, i] = e.split(\"@\");\r\n                 return n.activateDomEventListener(o, i, t)\r\n             });\r\n             t.revertData && t.revertData.bindings.push(n)\r\n        }\r\n    }\r\n}\r\n```\r\nThe CKEditor mounts to the textarea properly and it works.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ckeditor/ckeditor5-build-classic/issues/comments/430278384","html_url":"https://github.com/ckeditor/ckeditor5-build-classic/issues/55#issuecomment-430278384","issue_url":"https://api.github.com/repos/ckeditor/ckeditor5-build-classic/issues/55","id":430278384,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDI3ODM4NA==","user":{"login":"CurtisConway","id":21203902,"node_id":"MDQ6VXNlcjIxMjAzOTAy","avatar_url":"https://avatars2.githubusercontent.com/u/21203902?v=4","gravatar_id":"","url":"https://api.github.com/users/CurtisConway","html_url":"https://github.com/CurtisConway","followers_url":"https://api.github.com/users/CurtisConway/followers","following_url":"https://api.github.com/users/CurtisConway/following{/other_user}","gists_url":"https://api.github.com/users/CurtisConway/gists{/gist_id}","starred_url":"https://api.github.com/users/CurtisConway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CurtisConway/subscriptions","organizations_url":"https://api.github.com/users/CurtisConway/orgs","repos_url":"https://api.github.com/users/CurtisConway/repos","events_url":"https://api.github.com/users/CurtisConway/events{/privacy}","received_events_url":"https://api.github.com/users/CurtisConway/received_events","type":"User","site_admin":false},"created_at":"2018-10-16T15:16:27Z","updated_at":"2018-10-16T15:16:27Z","author_association":"NONE","body":"Thank you for looking into this @oleq and @pomek."}}
{"actor":{"display_login":"CurtisConway"}}