diff --git a/packages/solara-enterprise/solara_enterprise/search/search.py b/packages/solara-enterprise/solara_enterprise/search/search.py index 863d02936..42da7af06 100644 --- a/packages/solara-enterprise/solara_enterprise/search/search.py +++ b/packages/solara-enterprise/solara_enterprise/search/search.py @@ -10,6 +10,14 @@ class SearchWidget(ipyvue.VueTemplate): query = traitlets.Unicode("", allow_none=True).tag(sync=True) search_open = traitlets.Bool(False).tag(sync=True) failed = traitlets.Bool(False).tag(sync=True) + cdn = traitlets.Unicode(None, allow_none=True).tag(sync=True) + + @traitlets.default("cdn") + def _cdn(self): + import solara.settings + + if not solara.settings.assets.proxy: + return solara.settings.assets.cdn @solara.component diff --git a/packages/solara-enterprise/solara_enterprise/search/search.vue b/packages/solara-enterprise/solara_enterprise/search/search.vue index 148381883..5e9fac156 100644 --- a/packages/solara-enterprise/solara_enterprise/search/search.vue +++ b/packages/solara-enterprise/solara_enterprise/search/search.vue @@ -154,7 +154,7 @@ module.exports = { return base }, getCdn() { - return window.solara ? window.solara.cdn : `${this.getJupyterBaseUrl()}_solara/cdn`; + return this.cdn || (window.solara ? window.solara.cdn : `${this.getJupyterBaseUrl()}_solara/cdn`); }, } } diff --git a/solara/components/echarts.py b/solara/components/echarts.py index 036230e0d..b2d8a65c5 100644 --- a/solara/components/echarts.py +++ b/solara/components/echarts.py @@ -20,6 +20,14 @@ class EchartsWidget(ipyvuetify.VuetifyTemplate): on_mouseout = traitlets.Callable(None, allow_none=True) # same, for performance on_mouseout_enabled = traitlets.Bool(False).tag(sync=True) + cdn = traitlets.Unicode(None, allow_none=True).tag(sync=True) + + @traitlets.default("cdn") + def _cdn(self): + import solara.settings + + if not solara.settings.assets.proxy: + return solara.settings.assets.cdn def vue_on_click(self, data): if self.on_click is not None: diff --git a/solara/components/echarts.vue b/solara/components/echarts.vue index 334e1b7e4..7a93eaefa 100644 --- a/solara/components/echarts.vue +++ b/solara/components/echarts.vue @@ -110,7 +110,7 @@ module.exports = { return base; }, getCdn() { - return window.solara ? window.solara.cdn : `${this.getJupyterBaseUrl()}_solara/cdn` + return this.cdn || (window.solara ? window.solara.cdn : `${this.getJupyterBaseUrl()}_solara/cdn`); }, }, }; diff --git a/solara/components/markdown.py b/solara/components/markdown.py index 6ffa3b873..3ec900f08 100644 --- a/solara/components/markdown.py +++ b/solara/components/markdown.py @@ -76,6 +76,12 @@ def _markdown_template( html, style="", ): + cdn = None + import solara.settings + + if not solara.settings.assets.proxy: + cdn = solara.settings.assets.cdn + template = ( """