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 script to decap preview #2016

Merged
merged 1 commit into from
Aug 9, 2024
Merged
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
9 changes: 5 additions & 4 deletions docs/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" });
w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != "dataLayer" ? "&l=" + l : "";
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, "script", "dataLayer", "GTM-WH4L8LB");
})(window, document, 'script', 'dataLayer', 'GTM-WH4L8LB');
</script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand All @@ -27,6 +27,7 @@
<body>
<!-- Include the script that builds the page and powers Decap CMS -->
<script src="../dist/admin/decap-cms.js"></script>

<!-- Google Tag Manager code -->
<iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-WH4L8LB"
Expand Down
15 changes: 15 additions & 0 deletions docs/assets/js/admin/main-preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Script for the main preview pane in the admin.

import {
Expandable,
ExpandableGroup,
Summary,
SummaryMinimal,
Multiselect,
} from '@cfpb/cfpb-design-system';

Summary.init();
SummaryMinimal.init();
ExpandableGroup.init();
Expandable.init();
Multiselect.init();
7 changes: 6 additions & 1 deletion docs/assets/js/admin/widgets/pagePreviewTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
TOGGLE_ATTRIBUTE,
toggleDetails,
} from '../../../../assets/js/toggle-details.js';
import Tabs from '../../../../assets/js/Tabs.js';
import Tabs from '../../../../assets/js/tabs.js';
import { encode } from 'html-entities';
import slugify from 'slugify';
import template from '../../../../_includes/variation-content.html';
Expand All @@ -23,6 +23,11 @@ export default class Preview extends Component {
constructor(props) {
super(props);

const { document } = this.props;
const script = document.createElement('script');
script.src = '../dist/admin/main-preview.js';
document.head.appendChild(script);

liquidEngine.registerFilter('slugify', (initial) =>
slugify(initial || '', { lower: true }),
);
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
MaxHeightTransition,
MoveTransition,
} from '@cfpb/cfpb-design-system';
import Tabs from './Tabs.js';
import Tabs from './tabs.js';
import redirectBanner from './redirect-banner.js';
import sidebar from './sidebar.js';
export * as MainStyles from '../css/main.scss';
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions esbuild/docs/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const jsPaths = [
'./docs/assets/js/interstitial.js',
'./docs/assets/js/main.js',
'./docs/assets/js/admin/decap-cms.js',
'./docs/assets/js/admin/main-preview.js',
'./docs/assets/js/search.js',
];

Expand Down
2 changes: 2 additions & 0 deletions packages/cfpb-design-system/dist/abstracts/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/cfpb-design-system/dist/abstracts/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cfpb-design-system/dist/base/index.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/cfpb-design-system/dist/base/index.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cfpb-design-system/dist/base/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/cfpb-design-system/dist/base/index.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cfpb-design-system/dist/index.css

Large diffs are not rendered by default.

Loading