Skip to content

Commit

Permalink
Merge pull request #1075 from pattern-lab/fix/restore-lineage-links
Browse files Browse the repository at this point in the history
Fix: Restore Lineage Link “Click Functionality”
  • Loading branch information
bmuenzenmeyer committed Oct 14, 2019
2 parents 58830ec + a1d5e97 commit ef3f35c
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
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

0 comments on commit ef3f35c

Please sign in to comment.