/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/widgets/src/utils.js
33 строки
822 B
Renatho De Carli Rosa
Update Eslint JSDoc package, introducing JSDoc line alignment check (#25300)
09 июн 2021, 10:27
Не верифицирован
09 июн 2021, 10:27
a7e2895
Код
Авторство
О чём код?
// @ts-check /** * Get the internal widget id from block. * * @typedef {Object} Attributes * @property {string} __internalWidgetId The internal widget id. * @typedef {Object} Block * @property {Attributes} attributes The attributes of the block. * * @param {Block} block The block. * @return {string} The internal widget id. */ export function getWidgetIdFromBlock( block ) { return block.attributes.__internalWidgetId; } /** * Add internal widget id to block's attributes. * * @param {Block} block The block. * @param {string} widgetId The widget id. * @return {Block} The updated block. */ export function addWidgetIdToBlock( block, widgetId ) { return { ...block, attributes: { ...( block.attributes || {} ), __internalWidgetId: widgetId, }, }; }