From ad2ea924b5c039ebb8df9dd97d1f5ecaeb02fb14 Mon Sep 17 00:00:00 2001 From: Mikk Andresen Date: Tue, 1 Dec 2015 14:16:44 +0200 Subject: [PATCH 1/2] aceEditorCSS to allow absolute paths to resources to include external CSS --- src/static/js/ace.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/static/js/ace.js b/src/static/js/ace.js index 455bfaa36..a5e365ce0 100644 --- a/src/static/js/ace.js +++ b/src/static/js/ace.js @@ -229,7 +229,12 @@ function Ace2Editor() $$INCLUDE_CSS("../static/css/pad.css"); $$INCLUDE_CSS("../static/custom/pad.css"); - var additionalCSS = _(hooks.callAll("aceEditorCSS")).map(function(path){ return '../static/plugins/' + path }); + var additionalCSS = _(hooks.callAll("aceEditorCSS")).map(function(path){ + if (path.match(/\/\//)) { // Allow urls to external CSS - http(s):// and //some/path.css + return path; + } + return '../static/plugins/' + path; + }); includedCSS = includedCSS.concat(additionalCSS); pushStyleTagsFor(iframeHTML, includedCSS); @@ -308,7 +313,12 @@ window.onload = function () {\n\ $$INCLUDE_CSS("../static/custom/pad.css"); - var additionalCSS = _(hooks.callAll("aceEditorCSS")).map(function(path){ return '../static/plugins/' + path }); + var additionalCSS = _(hooks.callAll("aceEditorCSS")).map(function(path){ + if (path.match(/\/\//)) { // Allow urls to external CSS - http(s):// and //some/path.css + return path; + } + return '../static/plugins/' + path } + ); includedCSS = includedCSS.concat(additionalCSS); pushStyleTagsFor(outerHTML, includedCSS); From 03a4828d312662246a9c7fbcbe3125d81323303b Mon Sep 17 00:00:00 2001 From: Mikk Andresen Date: Wed, 2 Dec 2015 13:15:27 +0200 Subject: [PATCH 2/2] Update aceEditorCSS hook documentation --- doc/api/hooks_client-side.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/hooks_client-side.md b/doc/api/hooks_client-side.md index 367e06884..1c9ca5af1 100644 --- a/doc/api/hooks_client-side.md +++ b/doc/api/hooks_client-side.md @@ -111,7 +111,7 @@ Called from: src/static/js/ace.js Things in context: None -This hook is provided to allow custom CSS files to be loaded. The return value should be an array of paths relative to the plugins directory. +This hook is provided to allow custom CSS files to be loaded. The return value should be an array of resource urls or paths relative to the plugins directory. ## aceInitInnerdocbodyHead Called from: src/static/js/ace.js