{"action":"created","comment":{"url":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/comments/55484232","id":55484232,"diff_hunk":"@@ -555,10 +555,104 @@ function EditorService(spellcheck, $rootScope, $timeout, $q) {\n             scope.model.$setViewValue(val);\n         }\n     }\n+\n+    this.generateImageTag = function(data) {\n+        var url = data.url, caption = data.caption;\n+        var promiseFinished;\n+        // if this is a SD archive, we use its properties\n+        if (data._type === 'archive' || data.type === 'picture') {\n+            // get expected renditions list\n+            promiseFinished = renditionsService.get().then(function(renditionsList) {\n+                // ]use the first rendtion as default\n+                var firstRendition = data.renditions[renditionsList[0].name];\n+                if (angular.isDefined(firstRendition)) {\n+                    url = firstRendition.href;\n+                } else {\n+                    // use \"viewImage\" rendtion as fallback\n+                    url = data.renditions.viewImage.href;\n+                }\n+                caption = data.description_text;\n+                return renditionsList;\n+            });\n+        }\n+        // when previous promise is finished, compose the html\n+        return $q.when(promiseFinished, function(renditionsList) {\n+            var html = ['<img',","path":"scripts/superdesk/editor2/editor.js","position":37,"original_position":37,"commit_id":"b082ef7891241c0c5f9de7bf32daa5c6be4ff21e","original_commit_id":"b082ef7891241c0c5f9de7bf32daa5c6be4ff21e","user":{"login":"ahilles107","id":298610,"avatar_url":"https://avatars.githubusercontent.com/u/298610?v=3","gravatar_id":"","url":"https://api.github.com/users/ahilles107","html_url":"https://github.com/ahilles107","followers_url":"https://api.github.com/users/ahilles107/followers","following_url":"https://api.github.com/users/ahilles107/following{/other_user}","gists_url":"https://api.github.com/users/ahilles107/gists{/gist_id}","starred_url":"https://api.github.com/users/ahilles107/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahilles107/subscriptions","organizations_url":"https://api.github.com/users/ahilles107/orgs","repos_url":"https://api.github.com/users/ahilles107/repos","events_url":"https://api.github.com/users/ahilles107/events{/privacy}","received_events_url":"https://api.github.com/users/ahilles107/received_events","type":"User","site_admin":false},"body":"Why we build html here? We don't have option to use template file for this? ","created_at":"2016-03-09T08:19:13Z","updated_at":"2016-03-09T08:19:13Z","html_url":"https://github.com/superdesk/superdesk-client-core/pull/122#discussion_r55484232","pull_request_url":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/122","_links":{"self":{"href":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/comments/55484232"},"html":{"href":"https://github.com/superdesk/superdesk-client-core/pull/122#discussion_r55484232"},"pull_request":{"href":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/122"}}},"pull_request":{"url":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/122","id":61907515,"html_url":"https://github.com/superdesk/superdesk-client-core/pull/122","diff_url":"https://github.com/superdesk/superdesk-client-core/pull/122.diff","patch_url":"https://github.com/superdesk/superdesk-client-core/pull/122.patch","issue_url":"https://api.github.com/repos/superdesk/superdesk-client-core/issues/122","number":122,"state":"open","locked":false,"title":"Pa image crop","user":{"login":"vied12","id":180617,"avatar_url":"https://avatars.githubusercontent.com/u/180617?v=3","gravatar_id":"","url":"https://api.github.com/users/vied12","html_url":"https://github.com/vied12","followers_url":"https://api.github.com/users/vied12/followers","following_url":"https://api.github.com/users/vied12/following{/other_user}","gists_url":"https://api.github.com/users/vied12/gists{/gist_id}","starred_url":"https://api.github.com/users/vied12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vied12/subscriptions","organizations_url":"https://api.github.com/users/vied12/orgs","repos_url":"https://api.github.com/users/vied12/repos","events_url":"https://api.github.com/users/vied12/events{/privacy}","received_events_url":"https://api.github.com/users/vied12/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-07T11:56:03Z","updated_at":"2016-03-09T08:19:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07e30d46145ede44060a19d439c7f4f476d29068","assignee":{"login":"vied12","id":180617,"avatar_url":"https://avatars.githubusercontent.com/u/180617?v=3","gravatar_id":"","url":"https://api.github.com/users/vied12","html_url":"https://github.com/vied12","followers_url":"https://api.github.com/users/vied12/followers","following_url":"https://api.github.com/users/vied12/following{/other_user}","gists_url":"https://api.github.com/users/vied12/gists{/gist_id}","starred_url":"https://api.github.com/users/vied12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vied12/subscriptions","organizations_url":"https://api.github.com/users/vied12/orgs","repos_url":"https://api.github.com/users/vied12/repos","events_url":"https://api.github.com/users/vied12/events{/privacy}","received_events_url":"https://api.github.com/users/vied12/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/122/commits","review_comments_url":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/122/comments","review_comment_url":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/superdesk/superdesk-client-core/issues/122/comments","statuses_url":"https://api.github.com/repos/superdesk/superdesk-client-core/statuses/b082ef7891241c0c5f9de7bf32daa5c6be4ff21e","head":{"label":"superdesk:pa-image-crop","ref":"pa-image-crop","sha":"b082ef7891241c0c5f9de7bf32daa5c6be4ff21e","user":{"login":"superdesk","id":5527298,"avatar_url":"https://avatars.githubusercontent.com/u/5527298?v=3","gravatar_id":"","url":"https://api.github.com/users/superdesk","html_url":"https://github.com/superdesk","followers_url":"https://api.github.com/users/superdesk/followers","following_url":"https://api.github.com/users/superdesk/following{/other_user}","gists_url":"https://api.github.com/users/superdesk/gists{/gist_id}","starred_url":"https://api.github.com/users/superdesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superdesk/subscriptions","organizations_url":"https://api.github.com/users/superdesk/orgs","repos_url":"https://api.github.com/users/superdesk/repos","events_url":"https://api.github.com/users/superdesk/events{/privacy}","received_events_url":"https://api.github.com/users/superdesk/received_events","type":"Organization","site_admin":false},"repo":{"id":50631400,"name":"superdesk-client-core","full_name":"superdesk/superdesk-client-core","owner":{"login":"superdesk","id":5527298,"avatar_url":"https://avatars.githubusercontent.com/u/5527298?v=3","gravatar_id":"","url":"https://api.github.com/users/superdesk","html_url":"https://github.com/superdesk","followers_url":"https://api.github.com/users/superdesk/followers","following_url":"https://api.github.com/users/superdesk/following{/other_user}","gists_url":"https://api.github.com/users/superdesk/gists{/gist_id}","starred_url":"https://api.github.com/users/superdesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superdesk/subscriptions","organizations_url":"https://api.github.com/users/superdesk/orgs","repos_url":"https://api.github.com/users/superdesk/repos","events_url":"https://api.github.com/users/superdesk/events{/privacy}","received_events_url":"https://api.github.com/users/superdesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/superdesk/superdesk-client-core","description":"Common client modules for superdesk apps.","fork":false,"url":"https://api.github.com/repos/superdesk/superdesk-client-core","forks_url":"https://api.github.com/repos/superdesk/superdesk-client-core/forks","keys_url":"https://api.github.com/repos/superdesk/superdesk-client-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/superdesk/superdesk-client-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/superdesk/superdesk-client-core/teams","hooks_url":"https://api.github.com/repos/superdesk/superdesk-client-core/hooks","issue_events_url":"https://api.github.com/repos/superdesk/superdesk-client-core/issues/events{/number}","events_url":"https://api.github.com/repos/superdesk/superdesk-client-core/events","assignees_url":"https://api.github.com/repos/superdesk/superdesk-client-core/assignees{/user}","branches_url":"https://api.github.com/repos/superdesk/superdesk-client-core/branches{/branch}","tags_url":"https://api.github.com/repos/superdesk/superdesk-client-core/tags","blobs_url":"https://api.github.com/repos/superdesk/superdesk-client-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/superdesk/superdesk-client-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/superdesk/superdesk-client-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/superdesk/superdesk-client-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/superdesk/superdesk-client-core/statuses/{sha}","languages_url":"https://api.github.com/repos/superdesk/superdesk-client-core/languages","stargazers_url":"https://api.github.com/repos/superdesk/superdesk-client-core/stargazers","contributors_url":"https://api.github.com/repos/superdesk/superdesk-client-core/contributors","subscribers_url":"https://api.github.com/repos/superdesk/superdesk-client-core/subscribers","subscription_url":"https://api.github.com/repos/superdesk/superdesk-client-core/subscription","commits_url":"https://api.github.com/repos/superdesk/superdesk-client-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/superdesk/superdesk-client-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/superdesk/superdesk-client-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/superdesk/superdesk-client-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/superdesk/superdesk-client-core/contents/{+path}","compare_url":"https://api.github.com/repos/superdesk/superdesk-client-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/superdesk/superdesk-client-core/merges","archive_url":"https://api.github.com/repos/superdesk/superdesk-client-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/superdesk/superdesk-client-core/downloads","issues_url":"https://api.github.com/repos/superdesk/superdesk-client-core/issues{/number}","pulls_url":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls{/number}","milestones_url":"https://api.github.com/repos/superdesk/superdesk-client-core/milestones{/number}","notifications_url":"https://api.github.com/repos/superdesk/superdesk-client-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/superdesk/superdesk-client-core/labels{/name}","releases_url":"https://api.github.com/repos/superdesk/superdesk-client-core/releases{/id}","deployments_url":"https://api.github.com/repos/superdesk/superdesk-client-core/deployments","created_at":"2016-01-29T02:33:16Z","updated_at":"2016-02-01T00:37:29Z","pushed_at":"2016-03-09T06:44:41Z","git_url":"git://github.com/superdesk/superdesk-client-core.git","ssh_url":"git@github.com:superdesk/superdesk-client-core.git","clone_url":"https://github.com/superdesk/superdesk-client-core.git","svn_url":"https://github.com/superdesk/superdesk-client-core","homepage":"","size":1915,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":12,"forks":16,"open_issues":12,"watchers":1,"default_branch":"master"}},"base":{"label":"superdesk:master","ref":"master","sha":"e4e9d06869f606564e4ba9cf5942655fc0411f23","user":{"login":"superdesk","id":5527298,"avatar_url":"https://avatars.githubusercontent.com/u/5527298?v=3","gravatar_id":"","url":"https://api.github.com/users/superdesk","html_url":"https://github.com/superdesk","followers_url":"https://api.github.com/users/superdesk/followers","following_url":"https://api.github.com/users/superdesk/following{/other_user}","gists_url":"https://api.github.com/users/superdesk/gists{/gist_id}","starred_url":"https://api.github.com/users/superdesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superdesk/subscriptions","organizations_url":"https://api.github.com/users/superdesk/orgs","repos_url":"https://api.github.com/users/superdesk/repos","events_url":"https://api.github.com/users/superdesk/events{/privacy}","received_events_url":"https://api.github.com/users/superdesk/received_events","type":"Organization","site_admin":false},"repo":{"id":50631400,"name":"superdesk-client-core","full_name":"superdesk/superdesk-client-core","owner":{"login":"superdesk","id":5527298,"avatar_url":"https://avatars.githubusercontent.com/u/5527298?v=3","gravatar_id":"","url":"https://api.github.com/users/superdesk","html_url":"https://github.com/superdesk","followers_url":"https://api.github.com/users/superdesk/followers","following_url":"https://api.github.com/users/superdesk/following{/other_user}","gists_url":"https://api.github.com/users/superdesk/gists{/gist_id}","starred_url":"https://api.github.com/users/superdesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superdesk/subscriptions","organizations_url":"https://api.github.com/users/superdesk/orgs","repos_url":"https://api.github.com/users/superdesk/repos","events_url":"https://api.github.com/users/superdesk/events{/privacy}","received_events_url":"https://api.github.com/users/superdesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/superdesk/superdesk-client-core","description":"Common client modules for superdesk apps.","fork":false,"url":"https://api.github.com/repos/superdesk/superdesk-client-core","forks_url":"https://api.github.com/repos/superdesk/superdesk-client-core/forks","keys_url":"https://api.github.com/repos/superdesk/superdesk-client-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/superdesk/superdesk-client-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/superdesk/superdesk-client-core/teams","hooks_url":"https://api.github.com/repos/superdesk/superdesk-client-core/hooks","issue_events_url":"https://api.github.com/repos/superdesk/superdesk-client-core/issues/events{/number}","events_url":"https://api.github.com/repos/superdesk/superdesk-client-core/events","assignees_url":"https://api.github.com/repos/superdesk/superdesk-client-core/assignees{/user}","branches_url":"https://api.github.com/repos/superdesk/superdesk-client-core/branches{/branch}","tags_url":"https://api.github.com/repos/superdesk/superdesk-client-core/tags","blobs_url":"https://api.github.com/repos/superdesk/superdesk-client-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/superdesk/superdesk-client-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/superdesk/superdesk-client-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/superdesk/superdesk-client-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/superdesk/superdesk-client-core/statuses/{sha}","languages_url":"https://api.github.com/repos/superdesk/superdesk-client-core/languages","stargazers_url":"https://api.github.com/repos/superdesk/superdesk-client-core/stargazers","contributors_url":"https://api.github.com/repos/superdesk/superdesk-client-core/contributors","subscribers_url":"https://api.github.com/repos/superdesk/superdesk-client-core/subscribers","subscription_url":"https://api.github.com/repos/superdesk/superdesk-client-core/subscription","commits_url":"https://api.github.com/repos/superdesk/superdesk-client-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/superdesk/superdesk-client-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/superdesk/superdesk-client-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/superdesk/superdesk-client-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/superdesk/superdesk-client-core/contents/{+path}","compare_url":"https://api.github.com/repos/superdesk/superdesk-client-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/superdesk/superdesk-client-core/merges","archive_url":"https://api.github.com/repos/superdesk/superdesk-client-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/superdesk/superdesk-client-core/downloads","issues_url":"https://api.github.com/repos/superdesk/superdesk-client-core/issues{/number}","pulls_url":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls{/number}","milestones_url":"https://api.github.com/repos/superdesk/superdesk-client-core/milestones{/number}","notifications_url":"https://api.github.com/repos/superdesk/superdesk-client-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/superdesk/superdesk-client-core/labels{/name}","releases_url":"https://api.github.com/repos/superdesk/superdesk-client-core/releases{/id}","deployments_url":"https://api.github.com/repos/superdesk/superdesk-client-core/deployments","created_at":"2016-01-29T02:33:16Z","updated_at":"2016-02-01T00:37:29Z","pushed_at":"2016-03-09T06:44:41Z","git_url":"git://github.com/superdesk/superdesk-client-core.git","ssh_url":"git@github.com:superdesk/superdesk-client-core.git","clone_url":"https://github.com/superdesk/superdesk-client-core.git","svn_url":"https://github.com/superdesk/superdesk-client-core","homepage":"","size":1915,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":12,"forks":16,"open_issues":12,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/122"},"html":{"href":"https://github.com/superdesk/superdesk-client-core/pull/122"},"issue":{"href":"https://api.github.com/repos/superdesk/superdesk-client-core/issues/122"},"comments":{"href":"https://api.github.com/repos/superdesk/superdesk-client-core/issues/122/comments"},"review_comments":{"href":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/122/comments"},"review_comment":{"href":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/superdesk/superdesk-client-core/pulls/122/commits"},"statuses":{"href":"https://api.github.com/repos/superdesk/superdesk-client-core/statuses/b082ef7891241c0c5f9de7bf32daa5c6be4ff21e"}}}}