diff --git a/docs/en/UI/Angular/Content-Security-Strategy.md b/docs/en/UI/Angular/Content-Security-Strategy.md index 344aaf2a6e..f32317c9ca 100644 --- a/docs/en/UI/Angular/Content-Security-Strategy.md +++ b/docs/en/UI/Angular/Content-Security-Strategy.md @@ -8,12 +8,20 @@ ## API -### constructor(public nonce?: string) +### constructor + +```js +constructor(public nonce?: string) +``` - `nonce` enables whitelisting inline script or styles in order to avoid using `unsafe-inline` in [script-src](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#Unsafe_inline_script) and [style-src](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#Unsafe_inline_styles) directives. -### applyCSP(element: HTMLScriptElement | HTMLStyleElement): void +### applyCSP + +```js +applyCSP(element: HTMLScriptElement | HTMLStyleElement): void +``` This method maps the aforementioned properties to the given `element`. @@ -39,18 +47,28 @@ This method maps the aforementioned properties to the given `element`. Predefined content security strategies are accessible via `CONTENT_SECURITY_STRATEGY` constant. -### Loose(nonce: string) +### Loose + +```js +CONTENT_SECURITY_STRATEGY.Loose(nonce: string) +``` `nonce` will be set. -### None() +### None + +```js +CONTENT_SECURITY_STRATEGY.None() +``` Nothing will be done. -## What's Next? +## See Also + +- [DomInsertionService](./Dom-Insertion-Service.md) +- [ContentStrategy](./Content-Strategy.md) -TODO: Place new ContentStrategy link here. diff --git a/docs/en/UI/Angular/Content-Strategy.md b/docs/en/UI/Angular/Content-Strategy.md new file mode 100644 index 0000000000..8544042c32 --- /dev/null +++ b/docs/en/UI/Angular/Content-Strategy.md @@ -0,0 +1,95 @@ +# ContentStrategy + +`ContentStrategy` is an abstract class exposed by @abp/ng.core package. It helps you create inline scripts or styles. + +## API + + +### constructor + +```js +constructor( + public content: string, + protected domStrategy?: DomStrategy, + protected contentSecurityStrategy?: ContentSecurityStrategy +) +``` + +- `content` is set to `` element will place at the **end** of ``. + +Please refer to [ContentStrategy](./Content-Strategy.md) to see all available content strategies and how you can build your own content strategy. + + +### How to Insert Styles + +If you pass a `StyleContentStrategy` instance as the first parameter of `insertContent` method, the `DomInsertionService` will create a `` element will place at the **end** of ``. + +Please refer to [ContentStrategy](./Content-Strategy.md) to see all available content strategies and how you can build your own content strategy. + + +## API + +### insertContent + +```js +insertContent(strategy: ContentStrategy): void +``` + +`strategy` parameter is the primary focus here and is explained above. + + +## What's Next? + +- [TrackByService](./Track-By-Service.md) diff --git a/docs/en/UI/Angular/Dom-Strategy.md b/docs/en/UI/Angular/Dom-Strategy.md index 1b5fb1011a..2318e13205 100644 --- a/docs/en/UI/Angular/Dom-Strategy.md +++ b/docs/en/UI/Angular/Dom-Strategy.md @@ -6,16 +6,26 @@ ## API -### constructor(public target?: HTMLElement, public position?: InsertPosition) +### constructor + +```js +constructor( + public target?: HTMLElement, + public position?: InsertPosition +) +``` - `target` is an HTMLElement (_default: document.head_). - `position` defines where the created element will be placed. All possible values of `position` can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement) (_default: 'beforeend'_). -### insertElement(element: HTMLElement): void +### insertElement -This method inserts given `element` to `target` based on the `position`. +```js +insertElement(element: HTMLElement): void +``` +This method inserts given `element` to `target` based on the `position`. @@ -24,35 +34,56 @@ This method inserts given `element` to `target` based on the `position`. Predefined dom strategies are accessible via `DOM_STRATEGY` constant. -### AppendToBody() +### AppendToBody + +```js +DOM_STRATEGY.AppendToBody() +``` `insertElement` will place the given `element` at the end of ``. -### AppendToHead() +### AppendToHead + +```js +DOM_STRATEGY.AppendToHead() +``` `insertElement` will place the given `element` at the end of ``. -### PrependToHead() +### PrependToHead + +```js +DOM_STRATEGY.PrependToHead() +``` `insertElement` will place the given `element` at the beginning of ``. -### AfterElement(target: HTMLElement) +### AfterElement + +```js +DOM_STRATEGY.AfterElement(target: HTMLElement) +``` `insertElement` will place the given `element` after (as a sibling to) the `target`. -### BeforeElement(target: HTMLElement) +### BeforeElement + +```js +DOM_STRATEGY.BeforeElement(target: HTMLElement) +``` `insertElement` will place the given `element` before (as a sibling to) the `target`. -## What's Next? +## See Also +- [DomInsertionService](./Dom-Insertion-Service.md) +- [LazyLoadService](./Lazy-Load-Service.md) - [LoadingStrategy](./Loading-Strategy.md) - -TODO: Place new InsertionStrategy link here. +- [ContentStrategy](./Content-Strategy.md) diff --git a/docs/en/UI/Angular/Lazy-Load-Service.md b/docs/en/UI/Angular/Lazy-Load-Service.md index f165075c8f..a03381869e 100644 --- a/docs/en/UI/Angular/Lazy-Load-Service.md +++ b/docs/en/UI/Angular/Lazy-Load-Service.md @@ -185,13 +185,21 @@ In this example, the second file needs the first one to be loaded beforehand. Rx -### loaded: Set +### loaded + +```js +loaded: Set +``` All previously loaded paths are available via this property. It is a simple [JavaScript Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set). -### load(strategy: LoadingStrategy, retryTimes?: number, retryDelay?: number): Observable +### load + +```js +load(strategy: LoadingStrategy, retryTimes?: number, retryDelay?: number): Observable +``` - `strategy` parameter is the primary focus here and is explained above. - `retryTimes` defines how many times the loading will be tried again before fail (_default: 2_). @@ -202,4 +210,4 @@ All previously loaded paths are available via this property. It is a simple [Jav ## What's Next? -- [TrackByService](./Track-By-Service.md) +- [DomInsertionService](./Dom-Insertion-Service.md) diff --git a/docs/en/UI/Angular/Loading-Strategy.md b/docs/en/UI/Angular/Loading-Strategy.md index 8fb7b68a45..1a7e7b362f 100644 --- a/docs/en/UI/Angular/Loading-Strategy.md +++ b/docs/en/UI/Angular/Loading-Strategy.md @@ -7,8 +7,15 @@ ## API +### constructor -### constructor(public path: string, protected domStrategy?: DomStrategy, protected crossOriginStrategy?: CrossOriginStrategy) +```js +constructor( + public path: string, + protected domStrategy?: DomStrategy, + protected crossOriginStrategy?: CrossOriginStrategy +) +``` - `path` is set to `