# media-embed/mediaembedresize/utils/getselectedmediaembedwidthinunits

module

<a id="functions">

## Functions

<a id="function-getSelectedMediaEmbedWidthInUnits">

### `getSelectedMediaEmbedWidthInUnits( editor, targetUnit ) → DimensionWithUnit | null` _(internal)_

Returns media embed width in specified units after resize.

```
* If no media embed is selected or command is disabled, `null` will be returned.
* If `targetUnit` percentage is passed then it will return width percentage relative to its ancestor.
```

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-media-embed/src/mediaembedresize/utils/getselectedmediaembedwidthinunits.ts#L27)

#### Parameters

* `editor: Editor`

  Editor instance.

* `targetUnit: string`

  Unit in which dimension will be returned.

#### Returns

* `DimensionWithUnit | null`

  Parsed media embed width after resize (with unit).

---

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