# html-support/utils

module

<a id="interfaces">

## Interfaces

<a id="interface-GHSViewAttributes">

### `GHSViewAttributes`

<a id="functions">

## Functions

<a id="function-getHtmlAttributeName">

### `getHtmlAttributeName( viewElementName ) → string` _(internal)_

Returns the attribute name of the model element that holds raw HTML attributes.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-html-support/src/utils.ts#L257)

#### Parameters

* `viewElementName: string`

#### Returns

* `string`

<a id="function-mergeViewElementAttributes">

### `mergeViewElementAttributes( target, source ) → GHSViewAttributes` _(internal)_

Merges view element attribute objects.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-html-support/src/utils.ts#L105)

#### Parameters

* `target: GHSViewAttributes`
* `source: GHSViewAttributes`

#### Returns

* `GHSViewAttributes`

<a id="function-modifyGhsAttribute">

### `modifyGhsAttribute( writer, item, ghsAttributeName, subject, callback ) → void` _(internal)_

Updates a GHS attribute on a specified item.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-html-support/src/utils.ts#L133)

#### Parameters

* `writer: ModelWriter`

* `item: ModelDocumentSelection | ModelItem`

* `ghsAttributeName: string`

* `subject: 'attributes'`

* `callback: ModifyGhsAttributesCallback`

  That receives a map as an argument and should modify it (add or remove entries).

#### Returns

* `void`

<a id="function-modifyGhsAttribute">

### `modifyGhsAttribute( writer, item, ghsAttributeName, subject, callback ) → void`

Updates a GHS attribute on a specified item.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-html-support/src/utils.ts#L159)

#### Parameters

* `writer: ModelWriter`

* `item: ModelDocumentSelection | ModelItem`

* `ghsAttributeName: string`

* `subject: 'styles'`

* `callback: ModifyGhsStylesCallback`

  That receives a map as an argument and should modify it (add or remove entries).

#### Returns

* `void`

<a id="function-modifyGhsAttribute">

### `modifyGhsAttribute( writer, item, ghsAttributeName, subject, callback ) → void` _(internal)_

Updates a GHS attribute on a specified item.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-html-support/src/utils.ts#L147)

#### Parameters

* `writer: ModelWriter`

* `item: ModelDocumentSelection | ModelItem`

* `ghsAttributeName: string`

* `subject: 'classes'`

* `callback: ModifyGhsClassesCallback`

  That receives a set as an argument and should modify it (add or remove entries).

#### Returns

* `void`

<a id="function-removeFormatting">

### `removeFormatting( ghsAttributeName, itemRange, writer ) → void` _(internal)_

Strips the `styles`, and `classes` keys from the GHS attribute value on the given item.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-html-support/src/utils.ts#L223)

#### Parameters

* `ghsAttributeName: string`
* `itemRange: ModelRange`
* `writer: ModelWriter`

#### Returns

* `void`

<a id="function-removeViewAttributes">

### `removeViewAttributes( writer, viewAttributes, viewElement ) → void` _(internal)_

Helper function for the downcast converter. Removes attributes on the given view element.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-html-support/src/utils.ts#L82)

#### Parameters

* `writer: ViewDowncastWriter`

  The view writer.

* `viewAttributes: GHSViewAttributes`

  The GHS attribute value.

* `viewElement: ViewElement`

  The view element to update.

#### Returns

* `void`

<a id="function-setViewAttributes">

### `setViewAttributes( writer, viewAttributes, viewElement ) → void` _(internal)_

Helper function for the downcast converter. Sets attributes on the given view element.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-html-support/src/utils.ts#L58)

#### Parameters

* `writer: ViewDowncastWriter`

  The view writer.

* `viewAttributes: GHSViewAttributes`

  The GHS attribute value.

* `viewElement: ViewElement`

  The view element to update.

#### Returns

* `void`

<a id="function-toPascalCase">

### `toPascalCase( data ) → string` _(internal)_

Transforms passed string to PascalCase format. Examples:

* `div` => `Div`
* `h1` => `H1`
* `table` => `Table`

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-html-support/src/utils.ts#L248)

#### Parameters

* `data: string`

#### Returns

* `string`

<a id="function-updateViewAttributes">

### `updateViewAttributes( writer, oldViewAttributes, newViewAttributes, viewElement ) → void` _(internal)_

Helper function for the downcast converter. Updates attributes on the given view element.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-html-support/src/utils.ts#L35)

#### Parameters

* `writer: ViewDowncastWriter`

  The view writer.

* `oldViewAttributes: GHSViewAttributes`

  The previous GHS attribute value.

* `newViewAttributes: GHSViewAttributes`

  The current GHS attribute value.

* `viewElement: ViewElement`

  The view element to update.

#### Returns

* `void`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
