From 1ad41ca9265d5d82a3993ae7286d8ebde1c9d388 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Tue, 7 Apr 2020 11:00:29 +0300 Subject: [PATCH 1/5] docs: add content strategy documentation --- docs/en/UI/Angular/Content-Strategy.md | 95 ++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 docs/en/UI/Angular/Content-Strategy.md diff --git a/docs/en/UI/Angular/Content-Strategy.md b/docs/en/UI/Angular/Content-Strategy.md new file mode 100644 index 0000000000..e3d3ca9849 --- /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 + + +### inserted + +```js +inserted: Set +``` + +All previously inserted contents are stored via this property as hashes. It is a simple [JavaScript Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set). + + + +### 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/Lazy-Load-Service.md b/docs/en/UI/Angular/Lazy-Load-Service.md index 43ee7bc6b8..a03381869e 100644 --- a/docs/en/UI/Angular/Lazy-Load-Service.md +++ b/docs/en/UI/Angular/Lazy-Load-Service.md @@ -210,4 +210,4 @@ load(strategy: LoadingStrategy, retryTimes?: number, retryDelay?: number): Obser ## What's Next? -- [TrackByService](./Track-By-Service.md) +- [DomInsertionService](./Dom-Insertion-Service.md) diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index 8034913c4c..471e215e3a 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -349,6 +349,10 @@ "text": "Lazy Loading Scripts & Styles", "path": "UI/Angular/Lazy-Load-Service.md" }, + { + "text": "DomInsertionService", + "path": "UI/Angular/Dom-Insertion-Service.md" + }, { "text": "TrackByService", "path": "UI/Angular/Track-By-Service.md" From 6966224a89c9dc16fab93a3d62a311e4550f1ffb Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Tue, 7 Apr 2020 12:08:42 +0300 Subject: [PATCH 4/5] docs: refactor strategy docs --- .../UI/Angular/Content-Security-Strategy.md | 4 +-- docs/en/UI/Angular/Content-Strategy.md | 10 +++--- docs/en/UI/Angular/Cross-Origin-Strategy.md | 4 +-- docs/en/UI/Angular/Dom-Strategy.md | 32 ++++++++++++++++--- docs/en/UI/Angular/Loading-Strategy.md | 10 +++--- 5 files changed, 41 insertions(+), 19 deletions(-) diff --git a/docs/en/UI/Angular/Content-Security-Strategy.md b/docs/en/UI/Angular/Content-Security-Strategy.md index c45cf23c58..f32317c9ca 100644 --- a/docs/en/UI/Angular/Content-Security-Strategy.md +++ b/docs/en/UI/Angular/Content-Security-Strategy.md @@ -50,7 +50,7 @@ Predefined content security strategies are accessible via `CONTENT_SECURITY_STRA ### Loose ```js -Loose(nonce: string) +CONTENT_SECURITY_STRATEGY.Loose(nonce: string) ``` `nonce` will be set. @@ -59,7 +59,7 @@ Loose(nonce: string) ### None ```js -None() +CONTENT_SECURITY_STRATEGY.None() ``` Nothing will be done. diff --git a/docs/en/UI/Angular/Content-Strategy.md b/docs/en/UI/Angular/Content-Strategy.md index e3d3ca9849..8544042c32 100644 --- a/docs/en/UI/Angular/Content-Strategy.md +++ b/docs/en/UI/Angular/Content-Strategy.md @@ -57,7 +57,7 @@ Predefined content strategies are accessible via `CONTENT_STRATEGY` constant. ### AppendScriptToBody ```js -AppendScriptToBody(content: string) +CONTENT_STRATEGY.AppendScriptToBody(content: string) ``` Creates a `