ibm-wch-sdk-edit-api
v5.0.361
Published
Software development kit to simplify the development of Angular based single page applications against Watson Content Hub.
Downloads
14
Readme
ibm-wch-sdk-edit-api
Exposes framework independent APIs for ibm-wch-sdk-edit-ng and similar SDKs.
Details
Refer to the documentation.
Changes
Class documentation
Refer to the documentation.
Edit API
The edit API defines interfaces for consumers and providers of inline edit functionality.
- interfaces: list of interfaces a consumer of the inline edit API can use to interact with a provider of this functionality.
- provider: list of interfaces a provider of the inline edit API has to satisfy
- modules: modules that the provider can use as context from the consuming host.
Changelog
Current
Changed
- Improved readme
Added
- Initial version
Interfaces
This section describes the interfaces exposed by the module.
WchInlineEditService
The WchInlineEditService
interface allows a client to interact with the inline edit implementation. The implementation of this interface makes sure to load the inline edit provider and to fulfill the interface contract with the provider.
A consumer of this interface calls the registerComponent
message for each HTML element that is supposed to be edited. The result of this call is an Observable. The inline edit registration begins as soon as someone subscribes to this observable and ends as soon as this subscription ends. It is in the responsibility of the consumer to make sure that the HTML element exists for the duration of the subscription.
Index
External modules
- "index"
- "interfaces/inline.edit.service"
- "modules/modules"
- "modules/wch.config"
- "provider/disposable"
- "provider/editable.event"
- "provider/inline.edit.provider"
Interfaces
This section describes the interfaces exposed by the module.
WchInlineEditService
The WchInlineEditService
interface allows a client to interact with the inline edit implementation. The implementation of this interface makes sure to load the inline edit provider and to fulfill the interface contract with the provider.
A consumer of this interface calls the registerComponent
message for each HTML element that is supposed to be edited. The result of this call is an Observable. The inline edit registration begins as soon as someone subscribes to this observable and ends as soon as this subscription ends. It is in the responsibility of the consumer to make sure that the HTML element exists for the duration of the subscription.
Provider
The edit provider is a piece of javascript code that implements inline edit functionality. It is dynamically loaded by the SPA (typically via the SDK). The provider needs to conform to the following pattern:
Initialization
Ehe edit module implements the WchInlineEditProvider
interface, i.e. it exposes a register
function. This function will be invoked for each editable HTML element and allows the edit provider to attach the desired edit hooks to the elements. The method is provided with:
- a reference to the actual HTML element
- an accessor expression that identifies the element on a content item to be edited. This expression is relative to the current rendering context
- a reactive stream of rendering contexts. Note that the rendering contexts can change during the lifetime of this registration. Also there is no guarantee that the element pointed to by the accessor actually exists on the context. If a provide subscribes to the sequence of rendering contexts, it needs to make sure to NOT throw an exception in the subscribe block under any circumstances
Result
The result of a registration is an event provider. The purpose of this provider is to communicate inline edit operations on the HTML element to the host, i.e. the host registers for events on that event provider and the edit provider is responsible to firing these events (if the event is supported).
The event provider can optionally implement the Disposable
interface. If implemented the host will call its dispose
method after registration, before the HTML element gets removed from the DOM (so it's the inverse operation to the registration call).
Modules
The inline-edit-provider
can use the global require
function to access functionality (modules) provided by the edit host. The result of the require
call is a Promise that resolves to an API object. This section lists the available modules.
WCH_LOGGER_MODULE
The wch-logger
module provides access the to logging APIs. Edit providers are encouraged to use this API instead of the console
to issue logging statements (see LoggerService).
WCH_INFO_MODULE
The wch-info
module exposes information about the entry point URLs and whether or not the system is in preview mode or in live mode (see UrlConfig).
WCH_CONFIG_MODULE
The wch-config
module exposes information about configured URLs for the current tenant, e.g. the URL to the authoring host.
ibm-wch-sdk-edit-api > "index"
External module: "index"
Index
ibm-wch-sdk-edit-api > "interfaces/inline.edit.service"
External module: "interfaces/inline.edit.service"
Index
Interfaces
Type aliases
Type aliases
AccessorType
Ƭ AccessorType: * string
| null
*
Defined in interfaces/inline.edit.service.ts:7
ibm-wch-sdk-edit-api > "modules/modules"
External module: "modules/modules"
Index
Variables
Variables
<Const>
WCH_ACTIVE_PAGE_MODULE
● WCH_ACTIVE_PAGE_MODULE: "wch-active-page" = "wch-active-page"
Defined in modules/modules.ts:10
Token used to require the active page service see: PromiseLike
<Const>
WCH_CONFIG_MODULE
● WCH_CONFIG_MODULE: "wch-config" = "wch-config"
Defined in modules/modules.ts:31
Token used to require the WchConfig service see: PromiseLike
<Const>
WCH_INFO_MODULE
● WCH_INFO_MODULE: "wch-info" = "wch-info"
Defined in modules/modules.ts:24
Token used to require the WchInfo service see: PromiseLike
<Const>
WCH_LOGGER_MODULE
● WCH_LOGGER_MODULE: "wch-logger" = "wch-logger"
Defined in modules/modules.ts:17
Token used to require the logger service see: PromiseLike
ibm-wch-sdk-edit-api > "modules/wch.config"
External module: "modules/wch.config"
Index
Interfaces
ibm-wch-sdk-edit-api > "provider/disposable"
External module: "provider/disposable"
Index
Interfaces
ibm-wch-sdk-edit-api > "provider/editable.event"
External module: "provider/editable.event"
Index
Interfaces
ibm-wch-sdk-edit-api > "provider/inline.edit.provider"
External module: "provider/inline.edit.provider"
Index
Interfaces
Type aliases
Type aliases
WchInlineEditRegistration
Ƭ WchInlineEditRegistration: function
Defined in provider/inline.edit.provider.ts:10
Type declaration
▸(nativeElement: any
, accessor: AccessorType, onRenderingContext: Observable
<RenderingContext
>): WchInlineEditRegistrationResult
Parameters:
| Param | Type |
| ------ | ------ |
| nativeElement | any
|
| accessor | AccessorType |
| onRenderingContext | Observable
<RenderingContext
> |
Returns: WchInlineEditRegistrationResult
WchInlineEditRegistrationResult
Ƭ WchInlineEditRegistrationResult: * EventTargetLike
| EventTargetLike
& Disposable
Defined in provider/inline.edit.provider.ts:8
Interfaces
This section describes the interfaces exposed by the module.
WchInlineEditService
The WchInlineEditService
interface allows a client to interact with the inline edit implementation. The implementation of this interface makes sure to load the inline edit provider and to fulfill the interface contract with the provider.
A consumer of this interface calls the registerComponent
message for each HTML element that is supposed to be edited. The result of this call is an Observable. The inline edit registration begins as soon as someone subscribes to this observable and ends as soon as this subscription ends. It is in the responsibility of the consumer to make sure that the HTML element exists for the duration of the subscription.
Index
External modules
- "index"
- "interfaces/inline.edit.service"
- "modules/modules"
- "modules/wch.config"
- "provider/disposable"
- "provider/editable.event"
- "provider/inline.edit.provider"
ibm-wch-sdk-edit-api > "interfaces/inline.edit.service" > WchInlineEditService
Interface: WchInlineEditService
Implementation of the edit service used by the wchEditable directive.
Hierarchy
WchInlineEditService
Index
Methods
Methods
registerComponent
▸ registerComponent(nativeElement: any
, accessor: AccessorType, onRenderingContext: Observable
<RenderingContext
>): Observable
<EventTargetLike
>
Defined in interfaces/inline.edit.service.ts:27
Registers a particular DOM element as editable
Parameters:
| Param | Type | Description |
| ------ | ------ | ------ |
| nativeElement | any
| the DOM element to be edited |
| accessor | AccessorType | string identifying the member in the content item record to be edited. The value of 'null' means the the content item itself will be edited. |
| onRenderingContext | Observable
<RenderingContext
> | the rendering context assocuiated with the edit operation. The same DOM element might represent multiple contexts over time |
Returns: Observable
<EventTargetLike
>
the observable representing the registration result. The observable exposes an event producer
that a client can attach to to receive edit events. The registration will only complete when subscribing to the
observable and it will end when unsubscribing.
ibm-wch-sdk-edit-api > "modules/wch.config" > WchConfig
Interface: WchConfig
Exposes server side configuration for the current tenant
Hierarchy
WchConfig
Index
Properties
Properties
apiUrl
● apiUrl: URL
Defined in modules/wch.config.ts:8
authoringUIBaseUrl
● authoringUIBaseUrl: URL
Defined in modules/wch.config.ts:11
deliveryUrl
● deliveryUrl: URL
Defined in modules/wch.config.ts:14
previewApiUrl
● previewApiUrl: URL
Defined in modules/wch.config.ts:17
previewDeliveryUrl
● previewDeliveryUrl: URL
Defined in modules/wch.config.ts:20
ibm-wch-sdk-edit-api > "provider/disposable" > Disposable
Interface: Disposable
Implemented by objects that expose a life cycle. Calling the dispose method signals the end of this life cycle.
Hierarchy
Disposable
Index
Properties
Properties
dispose
● dispose: function
Defined in provider/disposable.ts:7
Type declaration
▸(): void
Returns: void
ibm-wch-sdk-edit-api > "provider/editable.event" > WchEditableEvent
Interface: WchEditableEvent
Event issued by the edit provider.
Hierarchy
WchEditableEvent
Index
Properties
Properties
data
● data: any
Defined in provider/editable.event.ts:13
target
● target: HTMLElement
Defined in provider/editable.event.ts:11
type
● type: string
Defined in provider/editable.event.ts:9
ibm-wch-sdk-edit-api > "provider/inline.edit.provider" > WchInlineEditProvider
Interface: WchInlineEditProvider
Hierarchy
WchInlineEditProvider
Index
Properties
Properties
register
● register: WchInlineEditRegistration
Defined in provider/inline.edit.provider.ts:14