{"action":"created","issue":{"url":"https://api.github.com/repos/quilljs/quill/issues/985","repository_url":"https://api.github.com/repos/quilljs/quill","labels_url":"https://api.github.com/repos/quilljs/quill/issues/985/labels{/name}","comments_url":"https://api.github.com/repos/quilljs/quill/issues/985/comments","events_url":"https://api.github.com/repos/quilljs/quill/issues/985/events","html_url":"https://github.com/quilljs/quill/issues/985","id":177611960,"number":985,"title":"formatText(x,…) off-by-1 if preceding video, compared to getText()[x]","user":{"login":"unhammer","id":56868,"avatar_url":"https://avatars.githubusercontent.com/u/56868?v=3","gravatar_id":"","url":"https://api.github.com/users/unhammer","html_url":"https://github.com/unhammer","followers_url":"https://api.github.com/users/unhammer/followers","following_url":"https://api.github.com/users/unhammer/following{/other_user}","gists_url":"https://api.github.com/users/unhammer/gists{/gist_id}","starred_url":"https://api.github.com/users/unhammer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unhammer/subscriptions","organizations_url":"https://api.github.com/users/unhammer/orgs","repos_url":"https://api.github.com/users/unhammer/repos","events_url":"https://api.github.com/users/unhammer/events{/privacy}","received_events_url":"https://api.github.com/users/unhammer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-17T21:54:49Z","updated_at":"2016-09-17T23:50:41Z","closed_at":null,"body":"I was hoping I could always use indices from getText() to call formatText(), but there are situations where the indices get offset.\r\n\r\n**Steps for Reproduction**\r\n\r\n1. Insert example content with a video element at top:\r\n`quill.setContents({\"ops\":[{\"insert\":{\"video\":\"http://example.com\"}},{\"insert\":\"ABCDE\"}]})`\r\n2. get the text out (`\"ABCDE\\n\"`) note that e.g. index 2 is \"C\" with `console.log( quill.getText()[2])`\r\n3. try to format from the letter \"C\" onwards with `quill.formatText(2,3,\"bold\",true)`\r\n\r\n**Expected behavior**:\r\nIt should be possible to formatText using a certain index of getText()'s string, and have quill apply the formatting to that character in the document.\r\n\r\n**Actual behavior**:\r\nQuill is offset by 1 character if there's a video element before, so the first bold character in the example above is \"B\".\r\n\r\n**Platforms**:\r\n\r\nFirefox 48 on Linux.\r\n\r\n**Version**:\r\n\r\n1.0.3\r\n"},"comment":{"url":"https://api.github.com/repos/quilljs/quill/issues/comments/247815088","html_url":"https://github.com/quilljs/quill/issues/985#issuecomment-247815088","issue_url":"https://api.github.com/repos/quilljs/quill/issues/985","id":247815088,"user":{"login":"jhchen","id":192974,"avatar_url":"https://avatars.githubusercontent.com/u/192974?v=3","gravatar_id":"","url":"https://api.github.com/users/jhchen","html_url":"https://github.com/jhchen","followers_url":"https://api.github.com/users/jhchen/followers","following_url":"https://api.github.com/users/jhchen/following{/other_user}","gists_url":"https://api.github.com/users/jhchen/gists{/gist_id}","starred_url":"https://api.github.com/users/jhchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhchen/subscriptions","organizations_url":"https://api.github.com/users/jhchen/orgs","repos_url":"https://api.github.com/users/jhchen/repos","events_url":"https://api.github.com/users/jhchen/events{/privacy}","received_events_url":"https://api.github.com/users/jhchen/received_events","type":"User","site_admin":false},"created_at":"2016-09-17T23:50:41Z","updated_at":"2016-09-17T23:50:41Z","body":"`getText()` only extracts string contents from Quill. For things like video and images there is none. It was considered at some point to insert a filler character for video/images to make the lengths/indices line up but that introduces its own set of issues.\r\n\r\nWhat is your specific use case?"}}
{"actor":{"display_login":"jhchen"}}