{"action":"created","issue":{"url":"https://api.github.com/repos/ckeditor/ckeditor5/issues/1006","repository_url":"https://api.github.com/repos/ckeditor/ckeditor5","labels_url":"https://api.github.com/repos/ckeditor/ckeditor5/issues/1006/labels{/name}","comments_url":"https://api.github.com/repos/ckeditor/ckeditor5/issues/1006/comments","events_url":"https://api.github.com/repos/ckeditor/ckeditor5/issues/1006/events","html_url":"https://github.com/ckeditor/ckeditor5/issues/1006","id":318024483,"number":1006,"title":"Pasted plain text should inherit formatting of the surrounding text","user":{"login":"gauravjain028","id":2246860,"avatar_url":"https://avatars2.githubusercontent.com/u/2246860?v=4","gravatar_id":"","url":"https://api.github.com/users/gauravjain028","html_url":"https://github.com/gauravjain028","followers_url":"https://api.github.com/users/gauravjain028/followers","following_url":"https://api.github.com/users/gauravjain028/following{/other_user}","gists_url":"https://api.github.com/users/gauravjain028/gists{/gist_id}","starred_url":"https://api.github.com/users/gauravjain028/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gauravjain028/subscriptions","organizations_url":"https://api.github.com/users/gauravjain028/orgs","repos_url":"https://api.github.com/users/gauravjain028/repos","events_url":"https://api.github.com/users/gauravjain028/events{/privacy}","received_events_url":"https://api.github.com/users/gauravjain028/received_events","type":"User","site_admin":false},"labels":[{"id":167749396,"url":"https://api.github.com/repos/ckeditor/ckeditor5/labels/status:discussion","name":"status:discussion","color":"e6e6e6","default":false},{"id":164194249,"url":"https://api.github.com/repos/ckeditor/ckeditor5/labels/type:enhancement","name":"type:enhancement","color":"84b6eb","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/ckeditor/ckeditor5/milestones/15","html_url":"https://github.com/ckeditor/ckeditor5/milestone/15","labels_url":"https://api.github.com/repos/ckeditor/ckeditor5/milestones/15/labels","id":3230960,"number":15,"title":"backlog","description":null,"creator":{"login":"Reinmar","id":156149,"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":48,"closed_issues":0,"state":"open","created_at":"2018-03-30T12:24:37Z","updated_at":"2018-04-27T10:55:30Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2018-04-26T13:14:33Z","updated_at":"2018-04-27T11:10:40Z","closed_at":null,"author_association":"NONE","body":"## Is this a bug report or feature request? (choose one)\r\n\r\n🐞 Bug report  \r\n\r\n## 💻 Version of CKEditor\r\n\r\n1.0.0.beta.2\r\n\r\n## 📋 Steps to reproduce\r\n\r\n1. Add some content in any H tag and make it bold.\r\n2. Copy some plain text from somewhere else like from address bar of Browser.\r\n3. Paste the content in between the H tag added in step 1\r\n\r\n## ✅ Expected result\r\nThe new text should be Bold as well.\r\n\r\n## ❎ Actual result\r\nThe new text is not Bold.\r\n\r\n## 📃 Other details that might be useful\r\n![copy-paste-issue](https://user-images.githubusercontent.com/2246860/39307832-8c2f4716-4981-11e8-8e98-0752e52d6f96.gif)\r\n"},"comment":{"url":"https://api.github.com/repos/ckeditor/ckeditor5/issues/comments/384940028","html_url":"https://github.com/ckeditor/ckeditor5/issues/1006#issuecomment-384940028","issue_url":"https://api.github.com/repos/ckeditor/ckeditor5/issues/1006","id":384940028,"user":{"login":"scofalik","id":1502228,"avatar_url":"https://avatars1.githubusercontent.com/u/1502228?v=4","gravatar_id":"","url":"https://api.github.com/users/scofalik","html_url":"https://github.com/scofalik","followers_url":"https://api.github.com/users/scofalik/followers","following_url":"https://api.github.com/users/scofalik/following{/other_user}","gists_url":"https://api.github.com/users/scofalik/gists{/gist_id}","starred_url":"https://api.github.com/users/scofalik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scofalik/subscriptions","organizations_url":"https://api.github.com/users/scofalik/orgs","repos_url":"https://api.github.com/users/scofalik/repos","events_url":"https://api.github.com/users/scofalik/events{/privacy}","received_events_url":"https://api.github.com/users/scofalik/received_events","type":"User","site_admin":false},"created_at":"2018-04-27T11:10:40Z","updated_at":"2018-04-27T11:10:40Z","author_association":"CONTRIBUTOR","body":"There are two workarounds I can see:\r\n\r\n1. In `Clipboard#event:inputTransformation`.\r\n2. In `Model#event:insertContent`.\r\n\r\nIn the first one, you need to overwrite the default `Clipboard`s event `inputTransformation` callback:\r\n\r\nhttps://github.com/ckeditor/ckeditor5-clipboard/blob/master/src/clipboard.js#L160-L176\r\n\r\nYou basically need to copy it and modify a little.\r\n\r\nAfter `data.content` is converted to `modelFragment`, you'd need to check if the model fragment has exactly one `model.Text` node with no attributes. If so, you'd have to re-write `editor.model.document.selection` attributes on that text node (using `model.change()` and the `model.Writer`). [Refer to API docs](https://docs.ckeditor.com/ckeditor5/latest/api/index.html). The last one thing is to call `evt.stop()`. AFAICS, at this moment, there are no callbacks added with lower priority to `inputTransformation` event so you should be fine.\r\n\r\nSecond solution is similar in a way that you will also add a callback to an event. This time it is `model.Model#event:insertContent` event. `insertContent` is a decorated method, which means that calling it fires an event. In the event you have a chance to modify the parameters.\r\n\r\nSo, basically, you add a callback to that event. As above, you need to check if inserted model is just a text node. If so, re-write attributes. Keep in mind that selection is given as one of arguments (the second one) so you should not get it from the `Editor` instance.\r\n\r\nNote, that the second solution may affect other features. Every feature that use `model.Model#insertContent` will be affected. This may not be a desired effect, although `insertContent` is not used _that_ heavily."}}
{"actor":{"display_login":"scofalik"}}