Skip to content
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

Add lazy loading to md image #337

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: ✨ use markdown-viewer in dataset page
  • Loading branch information
nicolaskempf57 committed Dec 22, 2023
commit d4a8deb50395b7113dece31b2772517c0b4875f9
2 changes: 2 additions & 0 deletions udata_front/theme/gouvfr/assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as dsfr from "@gouvfr/dsfr/dist/dsfr/dsfr.module";
import Chart from "./components/charts/chart.vue";
import Threads from "./components/discussions/Threads.vue";
import ThreadCreate from "./components/discussions/ThreadCreate/ThreadCreate.vue";
import MarkdownViewer from "./components/Markdown/MarkdownViewer.vue";
import MenuSearch from "./components/search/menu-search.vue";
import Search from "./components/search/search.vue";
import FeaturedButton from './components/utils/featured.vue';
Expand Down Expand Up @@ -58,6 +59,7 @@ const configAndMountApp = (el) => {
app.component("search", Search);
app.component("follow-button", FollowButton);
app.component("featured-button", FeaturedButton);
app.component("markdown-viewer", MarkdownViewer);
app.component("read-more", ReadMore);
app.component("request-membership", RequestMembership);
app.component("dataset-resources", Resources);
Expand Down
3 changes: 2 additions & 1 deletion udata_front/theme/gouvfr/templates/dataset/display.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ <h1 class="fr-mb-5v fr-h3">
</h1>
<h2 id="description" class="subtitle fr-mb-1w">{{ _('Description') }}</h2>
<read-more max-height="description" class="fr-mb-n1w">
{{ dataset.description|markdown }}
<markdown-viewer data-content="{{dataset.description|to_json}}"></markdown-viewer>
Copy link
Contributor

Choose a reason for hiding this comment

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

If we keep this idea, we should apply the same logic for other markdown contents? In particular, I'm thinking of pages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is indeed the idea to have a unified viewer for all contents. This could allow us to use DSFR tables everywhere for example instead of our custom ones.

</read-more>
<noscript>{{ dataset.description | markdown }}</noscript>
</section>
<section class="fr-col-12 fr-col-md-4" data-read-more-max-height="description">
{% if sysadmin %}
Expand Down