Skip to content

Fix: Restore Lineage Link “Click Functionality” #1075

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

Merged
merged 7 commits into from
Oct 14, 2019
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
1 change: 0 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# These are supported funding model platforms

patreon: patternlab

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
}

/**
* Lineage link
* Lineage link
*/
.pl-c-lineage__link {
font-style: italic;
color: $pl-color-gray-50;
color: inherit;
text-decoration: underline;
display: inline-flex;
align-items: center;
Expand Down
15 changes: 15 additions & 0 deletions packages/uikit-workshop/src/scripts/components/modal-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const modalViewer = {
// set up some defaults
delayCheckingModalViewer: false,
iframeElement: document.querySelector('.pl-js-iframe'),
iframeCustomElement: document.querySelector('pl-iframe'),
active: false,
switchText: true,
template: 'info',
Expand Down Expand Up @@ -170,9 +171,23 @@ export const modalViewer = {
}

contentContainer.appendChild(templateRendered);
modalViewer.addClickEvents(contentContainer);
}
},

addClickEvents(contentContainer = document) {
contentContainer.querySelectorAll('.pl-js-lineage-link').forEach(link => {
link.addEventListener('click', e => {
const patternPartial = e.target.getAttribute('data-patternpartial');

if (patternPartial && modalViewer.iframeCustomElement) {
e.preventDefault();
modalViewer.iframeCustomElement.navigateTo(patternPartial);
}
});
});
},

/**
* refresh the modal if a new pattern is loaded and the modal is active
* @param {Object} the patternData sent back from the query
Expand Down
13 changes: 0 additions & 13 deletions packages/uikit-workshop/src/scripts/components/panels-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,19 +332,6 @@ export const panelsViewer = {
}
}

// find lineage links in the rendered content and add postmessage handlers in case it's in the modal
// @todo: refactor and re-enable
// $('.pl-js-lineage-link', templateRendered).on('click', function(e) {
// e.preventDefault();
// const obj = JSON.stringify({
// event: 'patternLab.updatePath',
// path: urlHandler.getFileName($(this).attr('data-patternpartial')),
// });
// document
// .querySelector('.pl-js-iframe')
// .contentWindow.postMessage(obj, panelsViewer.targetOrigin);
// });

// gather panels from plugins
Dispatcher.trigger('insertPanels', [
templateRendered,
Expand Down