{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/5839","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/5839/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/5839/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/5839/events","html_url":"https://github.com/joomla/joomla-cms/pull/5839","id":54959095,"number":5839,"title":"Use Joomla API for loading editors scripts","user":{"login":"dgt41","id":3889375,"avatar_url":"https://avatars.githubusercontent.com/u/3889375?v=3","gravatar_id":"","url":"https://api.github.com/users/dgt41","html_url":"https://github.com/dgt41","followers_url":"https://api.github.com/users/dgt41/followers","following_url":"https://api.github.com/users/dgt41/following{/other_user}","gists_url":"https://api.github.com/users/dgt41/gists{/gist_id}","starred_url":"https://api.github.com/users/dgt41/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgt41/subscriptions","organizations_url":"https://api.github.com/users/dgt41/orgs","repos_url":"https://api.github.com/users/dgt41/repos","events_url":"https://api.github.com/users/dgt41/events{/privacy}","received_events_url":"https://api.github.com/users/dgt41/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joomla/joomla-cms/labels/PR-staging","name":"PR-staging","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":32,"created_at":"2015-01-21T00:04:21Z","updated_at":"2015-02-03T00:54:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/5839","html_url":"https://github.com/joomla/joomla-cms/pull/5839","diff_url":"https://github.com/joomla/joomla-cms/pull/5839.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/5839.patch"},"body":"#### Editors tinyMCE and NONE use inline script for initialization\r\n\r\nThe plugins for those two editors inject some `<script type=\"text/javascript\">Some code</script>` in the body of the rendered output.\r\nJoomla should NOT encourage devs to throw scripts without using the API.\r\nAlso this breaks anyones code that tries to do anything with the page’s scripts (if scripts are running wild, you have to preg_match etc…)\r\n\r\n#### B/C\r\nThere should be no b/c problems with this! We just adhere to the proper (the API) way of doing things!\r\n\r\n#### Testing\r\nApply the patch \r\nSelect editor none and verify that everything still works (e.g. edit an article)\r\nSelect editor tinyMCE\r\nGo to plugin->editor - tinyMCE and select Functionality = Simple \r\nverify that everything still works (e.g. edit an article)\r\n\r\nRepeat for Functionality = Advanced and Extended!\r\n\r\nNote: CodeMirror wasn’t touched by this PR, maybe @okonomiyaki3000 is up to the task?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/72571334","html_url":"https://github.com/joomla/joomla-cms/pull/5839#issuecomment-72571334","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/5839","id":72571334,"user":{"login":"phproberto","id":1119272,"avatar_url":"https://avatars.githubusercontent.com/u/1119272?v=3","gravatar_id":"","url":"https://api.github.com/users/phproberto","html_url":"https://github.com/phproberto","followers_url":"https://api.github.com/users/phproberto/followers","following_url":"https://api.github.com/users/phproberto/following{/other_user}","gists_url":"https://api.github.com/users/phproberto/gists{/gist_id}","starred_url":"https://api.github.com/users/phproberto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phproberto/subscriptions","organizations_url":"https://api.github.com/users/phproberto/orgs","repos_url":"https://api.github.com/users/phproberto/repos","events_url":"https://api.github.com/users/phproberto/events{/privacy}","received_events_url":"https://api.github.com/users/phproberto/received_events","type":"User","site_admin":false},"created_at":"2015-02-03T00:54:18Z","updated_at":"2015-02-03T00:54:18Z","body":"Cool. Thanks! :)\r\n\r\nFor the name I think I'd use the method name like:\r\n`/media/editors/none/js/on-init.js`\r\n`/media/editors/none/js/on-get-insert-method.js` (this can be moved also to an external file)\r\n\r\nWe should also add the media to the [plugin manifest](https://github.com/joomla/joomla-cms/blob/staging/plugins/editors/none/none.xml) so it can be installed/uninstalled without leaving orphan files. Apparently all editor plugins are missing that :dancer: \r\n\r\nAnd if you want to fix more issues the codemirror plugin is loading the css directly from the plugin folder. Access to assets inside plugins folder is forbidden in robots.txt and then any asset loaded from there will throw an error in webmaster tools after the latest Webmaster Guidelines update:\r\n\r\n> Disallowing crawling of Javascript or CSS files in your site’s robots.txt directly harms how well our algorithms render and index your content and can result in suboptimal rankings.\r\n\r\nSee more in: http://googlewebmastercentral.blogspot.com.es/2014/10/updating-our-technical-webmaster.html\r\n\r\nAbout JS loading my preference is: `external js` > `addScriptDeclaration` > `embed script inside body`\r\n\r\nThe reason is that when you are searching for JS you usually go to the head section of the page. And there are existing procesors that get head scripts and compress them. That can be done also within the body but it costs more to execute regular expressions there. "}}