Skip to content

Refactored some cdn urls #7826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions panel/models/katex.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,40 @@
from bokeh.models import Markup

from ..config import config
from ..io.resources import bundled_files
from ..util import classproperty


class KaTeX(Markup):
"""
A bokeh model that renders text using KaTeX.
"""

__css__ = ["https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.css"]
__css_raw__ = [f"{config.npm_cdn}/katex@0.6.0/dist/katex.min.css"]

__javascript__ = [
"https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js",
__javascript_raw__ = [
f"{config.npm_cdn}/katex@0.6.0/dist/katex.min.js",
f"{config.npm_cdn}/[email protected]/dist/contrib/auto-render.min.js"
]

__js_skip__ = {
'katex': __javascript__[:1],
'renderMathInElement': __javascript__[1:]
}
@classproperty
def __javascript__(cls):
return bundled_files(cls)

@classproperty
def __css__(cls):
return bundled_files(cls, 'css')

@classproperty
def __js_skip__(cls):
return {
'katex': cls.__javascript__[:1],
'renderMathInElement': cls.__javascript__[1:]
}

__js_require__ = {
'paths': {
'katex': "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min",
'katex': f"{config.npm_cdn}/katex@0.6.0/dist/katex.min",
'autoLoad': f"{config.npm_cdn}/[email protected]/dist/contrib/auto-render.min"
},
'exports': {'katex': 'katex', 'autoLoad': 'renderMathInElement'}
Expand Down
7 changes: 4 additions & 3 deletions panel/models/quill.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Any, Bool, Either, Enum, List, String,
)

from ..config import config
from ..io.resources import bundled_files
from ..util import classproperty
from .layout import HTMLBox
Expand All @@ -13,12 +14,12 @@ class QuillInput(HTMLBox):
"""

__css_raw__ = [
'https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.bubble.css',
'https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.snow.css',
f'{config.npm_cdn}/[email protected]/dist/quill.bubble.css',
f'{config.npm_cdn}/[email protected]/dist/quill.snow.css',
]

__javascript_raw__ = [
'https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.js',
f'{config.npm_cdn}/[email protected]/dist/quill.js',
]

@classproperty
Expand Down
5 changes: 5 additions & 0 deletions panel/models/vizzu.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from bokeh.models.sources import DataSource

from ..config import config
from ..io.resources import bundled_files
from ..util import classproperty

VIZZU_VERSION = "0.15"
Expand All @@ -34,6 +35,10 @@ class VizzuChart(LayoutDOM):
f"{config.npm_cdn}/vizzu@{VIZZU_VERSION}/dist/vizzu.min.js"
]

@classproperty
def __javascript__(cls):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this is correct. Let's skip Vizzu for now. We'll likely move it into an extension anyway.

return bundled_files(cls)

@classproperty
def __js_skip__(cls):
return {
Expand Down