-
Notifications
You must be signed in to change notification settings - Fork 11
Published updates #161
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
base: support/4.x
Are you sure you want to change the base?
Published updates #161
Changes from all commits
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 | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -150,14 +150,14 @@ Get an Item from the content store. | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| `getItem(path: string, config?: CrafterConfig)` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | ------------- |:--------------:| | ||||||||||||||||||||||||||
| | path | The item’s path in the content store | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). | | ||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | ------------- |:--------------------------------------------------------------------------------------:| | ||||||||||||||||||||||||||
| | path | The item’s path in the content store | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). | | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #### Returns | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| [Item](../models/README.md#Item) - from the content store | ||||||||||||||||||||||||||
| [Item](../models/src/item.ts) - from the content store | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #### Examples | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -194,14 +194,14 @@ Get the list of Items directly under a folder in the content store. | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| `getChildren(path: string, config?: CrafterConfig)` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | ------------- |:--------------:| | ||||||||||||||||||||||||||
| | path | The folder’s path | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). | | ||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | ------------- |:-----------------------------------------------------------------------------------------:| | ||||||||||||||||||||||||||
| | path | The folder’s path | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). | | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #### Returns | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| [Item](../models/README.md#Item)[] - List of Items from the content store | ||||||||||||||||||||||||||
| [Item](../models/src/item.ts)[] - List of Items from the content store | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #### Examples | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -226,15 +226,15 @@ Get the complete Item hierarchy under the specified folder in the content store. | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| `getTree(path: string, depth: number, config: CrafterConfig)` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | ------------- |:--------------:| | ||||||||||||||||||||||||||
| | path | The folder’s path | | ||||||||||||||||||||||||||
| | depth | Amount of levels to include. Optional. Default is `1` | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). | | ||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | ------------- |:-----------------------------------------------------------------------------------------:| | ||||||||||||||||||||||||||
| | path | The folder’s path | | ||||||||||||||||||||||||||
| | depth | Amount of levels to include. Optional. Default is `1` | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). | | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #### Returns | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| [Item](../models/README.md#Item) - from the content store | ||||||||||||||||||||||||||
| [Item](../models/src/item.ts) - from the content store | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #### Examples | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -259,33 +259,33 @@ Get the complete Item hierarchy under the specified folder in the content store. | |||||||||||||||||||||||||
| ### Get Navigation Tree | ||||||||||||||||||||||||||
| Returns the navigation tree with the specified depth for the specified store URL. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| `getNavTree(path: string, depth: number, currentPageUrl: string, config: CrafterConfig)` | ||||||||||||||||||||||||||
| `getNavTree(path: string, depth?: number, currentPageUrl?: string, config?: CrafterConfig)` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | -------------- |:--------------:| | ||||||||||||||||||||||||||
| | path | The folder’s path | | ||||||||||||||||||||||||||
| | depth | Amount of levels to include. Optional. Default is `1` | | ||||||||||||||||||||||||||
| | currentPageUrl | The URL of the current page. Optional. Default is `''` | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). | | ||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | -------------- |:-----------------------------------------------------------------------------------------:| | ||||||||||||||||||||||||||
| | path | The folder’s path | | ||||||||||||||||||||||||||
| | depth | Amount of levels to include. Optional. Default is `1` | | ||||||||||||||||||||||||||
| | currentPageUrl | The URL of the current page. Optional. Default is `''` | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). | | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #### Returns | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| [NavigationItem](../models/README.md#NavigationItem) - from the content store | ||||||||||||||||||||||||||
| [NavigationItem](../models/src/NavigationItem.ts) - from the content store | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #### Examples | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - Get the navigation tree of the root folder from the site (depth = 3): | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```typescript | ||||||||||||||||||||||||||
| import { getTree } from '@craftercms/content'; | ||||||||||||||||||||||||||
| import { getNavTree } from '@craftercms/content'; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // Example 1: Config supplied inline | ||||||||||||||||||||||||||
| getTree('/site/website', 3, { site: 'editorial' }).subscribe((tree) => { | ||||||||||||||||||||||||||
| getNavTree('/site/website', 3, '', { site: 'editorial' }).subscribe((tree) => { | ||||||||||||||||||||||||||
| console.log(tree); | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // Example 2: Services pre-configured (see "Usage" section above), config param omitted. | ||||||||||||||||||||||||||
| getTree('/site/website', 3).subscribe((tree) => { | ||||||||||||||||||||||||||
| // Example 2: Services pre-configured (see "Usage" section above); currentPageUrl omitted (defaults to ''). | ||||||||||||||||||||||||||
| getNavTree('/site/website', 3).subscribe((tree) => { | ||||||||||||||||||||||||||
| console.log(tree); | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
@@ -295,15 +295,15 @@ Returns the navigation items that form the breadcrumb for the specified store UR | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| `getNavBreadcrumb(path: string, root: string, config: CrafterConfig)` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | -------------- |:--------------:| | ||||||||||||||||||||||||||
| | path | The folder’s path | | ||||||||||||||||||||||||||
| | root | the root URL, basically the starting point of the breadcrumb. Optional. Default is `''` | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). | | ||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | -------------- |:-----------------------------------------------------------------------------------------:| | ||||||||||||||||||||||||||
| | path | The folder’s path | | ||||||||||||||||||||||||||
| | root | the root URL, basically the starting point of the breadcrumb. Optional. Default is `''` | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). | | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
Comment on lines
+298
to
303
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. Signature/table mismatch for getNavBreadcrumb + minor grammar Root and config are shown as optional in the table, but the signature above shows them required. Also, tighten the root description. Apply: -`getNavBreadcrumb(path: string, root: string, config: CrafterConfig)`
+`getNavBreadcrumb(path: string, root?: string, config?: CrafterConfig)`And refine table wording: -| root | the root URL, basically the starting point of the breadcrumb. Optional. Default is `''` |
+| root | The root URL; starting point of the breadcrumb. Optional. Default is `''`. |
-| config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |
+| config | Crafter configuration. Optional. Default in [CrafterConfig.ts](../models/src/CrafterConfig.ts). |📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[grammar] ~298-~298: There might be a mistake here. (QB_NEW_EN) [grammar] ~299-~299: There might be a mistake here. (QB_NEW_EN) [grammar] ~300-~300: There might be a mistake here. (QB_NEW_EN) |
||||||||||||||||||||||||||
| #### Returns | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| [NavigationItem](../models/README.md#NavigationItem)[] - List of NavigationItem from the content store | ||||||||||||||||||||||||||
| [NavigationItem](../models/src/NavigationItem.ts)[] - List of NavigationItem from the content store | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #### Examples | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -313,7 +313,7 @@ Returns the navigation items that form the breadcrumb for the specified store UR | |||||||||||||||||||||||||
| import { getNavBreadcrumb } from '@craftercms/content'; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // Example 1: Config supplied inline | ||||||||||||||||||||||||||
| getNavBreadcrumb('/site/website').subscribe((navBreadcrumb) => { | ||||||||||||||||||||||||||
| getNavBreadcrumb('/site/website', '/', { site: 'editorial' }).subscribe((navBreadcrumb) => { | ||||||||||||||||||||||||||
| console.log(navBreadcrumb); | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -328,11 +328,11 @@ Transforms a URL, based on the current site’s configuration. | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - `transform(transformerName: string, path: string, config: CrafterConfig)` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | --------------- |:--------------:| | ||||||||||||||||||||||||||
| | transformerName | Name of the transformer to apply | | ||||||||||||||||||||||||||
| | path | URL that will be transformed | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). | | ||||||||||||||||||||||||||
| | Parameters | | | ||||||||||||||||||||||||||
| | --------------- |:-----------------------------------------------------------------------------------------:| | ||||||||||||||||||||||||||
| | transformerName | Name of the transformer to apply | | ||||||||||||||||||||||||||
| | path | URL that will be transformed | | ||||||||||||||||||||||||||
| | config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). | | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
Comment on lines
+331
to
336
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. 🛠️ Refactor suggestion Signature/table mismatch for transform config optionality Table marks config optional; signature above shows it required. Align these and fix config phrasing. - - `transform(transformerName: string, path: string, config: CrafterConfig)`
+ - `transform(transformerName: string, path: string, config?: CrafterConfig)` And: -| config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |
+| config | Crafter configuration. Optional. Default in [CrafterConfig.ts](../models/src/CrafterConfig.ts). |📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| #### Returns | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
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.
🛠️ Refactor suggestion
Signature/table mismatch for getTree: make depth and config optional or fix table
The table marks depth and config as optional, but the signature above shows both required. Align these.
Proposed fix:
And keep the table as-is (with optional), plus the config phrasing nit:
If the API truly requires both, then instead change the table to remove “Optional” and the default note.
📝 Committable suggestion
🤖 Prompt for AI Agents