-
Notifications
You must be signed in to change notification settings - Fork 177
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
MWPW-148054: Mnemonics list in a text block #2405
Changes from 2 commits
b4c1416
c49524f
eb97805
8b6dcca
2e68e94
3967310
46138f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -76,7 +76,21 @@ function decorateLinkFarms(el) { | |||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
export default function init(el) { | ||||||||||||||||||||||||||||
export async function loadMnemonicList(foreground) { | ||||||||||||||||||||||||||||
try { | ||||||||||||||||||||||||||||
const { base } = getConfig(); | ||||||||||||||||||||||||||||
const stylePromise = new Promise((resolve) => { | ||||||||||||||||||||||||||||
loadStyle(`${base}/blocks/mnemonic-list/mnemonic-list.css`, resolve); | ||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||
const loadModule = import('../mnemonic-list/mnemonic-list.js') | ||||||||||||||||||||||||||||
.then(({ decorateMnemonicList }) => decorateMnemonicList(foreground)); | ||||||||||||||||||||||||||||
await Promise.all([stylePromise, loadModule]); | ||||||||||||||||||||||||||||
} catch (err) { | ||||||||||||||||||||||||||||
window.lana?.log(`Failed to load mnemonic list module: ${err}`); | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @robert-bogos might have some suggestions on how to categorize this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tags are required to LANA logs in order to facilitate filtering them in Splunk. For this particular use case I would go for:
Suggested change
You can see examples and read more about it in here. |
||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
export default async function init(el) { | ||||||||||||||||||||||||||||
el.classList.add('text-block', 'con-block'); | ||||||||||||||||||||||||||||
let rows = el.querySelectorAll(':scope > div'); | ||||||||||||||||||||||||||||
if (rows.length > 1) { | ||||||||||||||||||||||||||||
|
@@ -117,4 +131,13 @@ export default function init(el) { | |||||||||||||||||||||||||||
lastActionArea.insertAdjacentElement('afterend', div); | ||||||||||||||||||||||||||||
div.append(lastActionArea); | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
const mnemonicList = el.querySelector('.mnemonic-list'); | ||||||||||||||||||||||||||||
if (mnemonicList) { | ||||||||||||||||||||||||||||
const foreground = mnemonicList?.closest('.foreground'); | ||||||||||||||||||||||||||||
if (foreground) { | ||||||||||||||||||||||||||||
mnemonicList.querySelectorAll('p').forEach((product) => product.removeAttribute('class')); | ||||||||||||||||||||||||||||
await loadMnemonicList(foreground); | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: you might be able to avoid some nesting here to make it a bit easier to follow.
Suggested change
|
||||||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance we can use
loadBlock
(link), since it shares a lot of the functionality added here?