Skip to content

Commit ef3f35c

Browse files
Merge pull request #1075 from pattern-lab/fix/restore-lineage-links
Fix: Restore Lineage Link “Click Functionality”
2 parents 58830ec + a1d5e97 commit ef3f35c

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# These are supported funding model platforms
22

33
patreon: patternlab
4-

packages/uikit-workshop/dist/styleguide/css/pattern-lab.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uikit-workshop/dist/styleguide/js/patternlab-viewer.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uikit-workshop/dist/styleguide/js/pl-modal-viewer-chunk-28e3e937adece2e20a1d.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/uikit-workshop/src/sass/scss/04-components/_pattern-lineage.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
}
1313

1414
/**
15-
* Lineage link
15+
* Lineage link
1616
*/
1717
.pl-c-lineage__link {
1818
font-style: italic;
19-
color: $pl-color-gray-50;
19+
color: inherit;
2020
text-decoration: underline;
2121
display: inline-flex;
2222
align-items: center;

packages/uikit-workshop/src/scripts/components/modal-viewer.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const modalViewer = {
1414
// set up some defaults
1515
delayCheckingModalViewer: false,
1616
iframeElement: document.querySelector('.pl-js-iframe'),
17+
iframeCustomElement: document.querySelector('pl-iframe'),
1718
active: false,
1819
switchText: true,
1920
template: 'info',
@@ -170,9 +171,23 @@ export const modalViewer = {
170171
}
171172

172173
contentContainer.appendChild(templateRendered);
174+
modalViewer.addClickEvents(contentContainer);
173175
}
174176
},
175177

178+
addClickEvents(contentContainer = document) {
179+
contentContainer.querySelectorAll('.pl-js-lineage-link').forEach(link => {
180+
link.addEventListener('click', e => {
181+
const patternPartial = e.target.getAttribute('data-patternpartial');
182+
183+
if (patternPartial && modalViewer.iframeCustomElement) {
184+
e.preventDefault();
185+
modalViewer.iframeCustomElement.navigateTo(patternPartial);
186+
}
187+
});
188+
});
189+
},
190+
176191
/**
177192
* refresh the modal if a new pattern is loaded and the modal is active
178193
* @param {Object} the patternData sent back from the query

packages/uikit-workshop/src/scripts/components/panels-viewer.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -332,19 +332,6 @@ export const panelsViewer = {
332332
}
333333
}
334334

335-
// find lineage links in the rendered content and add postmessage handlers in case it's in the modal
336-
// @todo: refactor and re-enable
337-
// $('.pl-js-lineage-link', templateRendered).on('click', function(e) {
338-
// e.preventDefault();
339-
// const obj = JSON.stringify({
340-
// event: 'patternLab.updatePath',
341-
// path: urlHandler.getFileName($(this).attr('data-patternpartial')),
342-
// });
343-
// document
344-
// .querySelector('.pl-js-iframe')
345-
// .contentWindow.postMessage(obj, panelsViewer.targetOrigin);
346-
// });
347-
348335
// gather panels from plugins
349336
Dispatcher.trigger('insertPanels', [
350337
templateRendered,

0 commit comments

Comments
 (0)