Skip to content

Commit

Permalink
fix(pageicons): hierarchi hidden title margin
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyurec committed Nov 18, 2022
1 parent d5d3ee4 commit 7ac7da8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/modules/pageIcons/pageIcons.css
Expand Up @@ -22,6 +22,9 @@
.awLi-hideTitle .awLi-icon {
margin-right: 0;
}
.namespaces .awLi-hideTitle .awLi-icon {
margin-right: 0.34em;
}

/* color */
.awLi-color:is(
Expand Down
5 changes: 3 additions & 2 deletions src/modules/pageIcons/pageIcons.ts
Expand Up @@ -120,7 +120,7 @@ export const setStyleToLinkList = (linkList: HTMLElement[], noDefaultIcon?: bool
export const processLinkItem = async (linkItem: HTMLElement, noDefaultIcon?: boolean) => {
const linkText = linkItem.textContent;
if (linkText && !linkText.startsWith(' ')) {
const pageTitle = linkItem.childNodes[1]?.textContent?.trim() || linkItem.textContent?.trim() || '';
const pageTitle = linkItem.getAttribute('data-ref') || linkItem.childNodes[1]?.textContent?.trim() || linkItem.textContent?.trim() || '';
if (pageTitle) {
const pageProps = await getPropsByPageName(pageTitle);
if (pageProps) {
Expand Down Expand Up @@ -149,7 +149,8 @@ const hideTitle = (linkItem: HTMLElement, pageProps: propsObject) => {
linkItem.classList.add('awLi-hideTitle');
const linkText = linkItem.textContent;
const titleText = pageProps['hidetitletext'] || '';
linkItem.textContent = linkText!.replace(titleText, '');
const regexp = new RegExp(titleText, 'i');
linkItem.textContent = linkText!.replace(regexp, '');
} else {
linkItem.classList.remove('awLi-hideTitle');
}
Expand Down

0 comments on commit 7ac7da8

Please sign in to comment.