-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(cssscoping): you can now use angular styling for blog posts This PR enables the possibility to use the angular CSS styles from the holding component in the blog posts * feat(blogcomponentcss): update to show the scoped CSS by making a special H1
- Loading branch information
1 parent
4ae475e
commit ce599ed
Showing
10 changed files
with
130 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
::slotted(h1) { | ||
h1 { | ||
color: rgb(51, 6, 37); | ||
background-color: rgb(248, 211, 236); | ||
padding: 5px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Returns an array of nodes coninting all the html comments in the element. | ||
* When a searchText is given this is narrowed down to only comments that contian this text | ||
* @param rootElem Element to search nto | ||
* @param searchText optional string that needs to be in a HTML comment | ||
*/ | ||
export function findComments(rootElem: HTMLElement, searchText?: string) { | ||
const comments = []; | ||
// Fourth argument, which is actually obsolete according to the DOM4 standard, seems required in IE 11 | ||
const iterator = document.createNodeIterator( | ||
rootElem, | ||
NodeFilter.SHOW_COMMENT, | ||
{ | ||
acceptNode: node => { | ||
// Logic to determine whether to accept, reject or skip node | ||
// In this case, only accept nodes that have content | ||
// that is containing our searchText, by rejecting any other nodes. | ||
if (searchText && node.nodeValue && !node.nodeValue.includes(searchText)) { | ||
return NodeFilter.FILTER_REJECT; | ||
} | ||
return NodeFilter.FILTER_ACCEPT; | ||
}, | ||
} | ||
// , false // IE-11 support requires this parameter. | ||
); | ||
let curNode; | ||
// tslint:disable-next-line: no-conditional-assignment | ||
while ((curNode = iterator.nextNode())) { | ||
comments.push(curNode); | ||
} | ||
return comments; | ||
} |
17 changes: 17 additions & 0 deletions
17
projects/scullyio/ng-lib/src/lib/utils/fromMutationObserver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {Observable} from 'rxjs'; | ||
/** | ||
* Returns an observable that fires a mutation when the domMutationObserves does that. | ||
* if flattens the mutations to make handling easier, so you only get 1 mutationRecord at a time. | ||
* @param elm the elm to obse with a mutationObserver | ||
* @param config the config for the mutationobserver | ||
*/ | ||
export function fromMutationObserver( | ||
elm: HTMLElement, | ||
config: MutationObserverInit | ||
): Observable<MutationRecord> { | ||
return new Observable(obs => { | ||
const observer = new MutationObserver(mutations => mutations.forEach(mutation => obs.next(mutation))); | ||
observer.observe(elm, config); | ||
return () => observer.disconnect(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters