Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 1x 1x 28x 22x 14x | import { formatSegmentWithContentModel } from './formatSegmentWithContentModel'; import type { ContentModelImage, IEditor } from 'roosterjs-content-model-types'; /** * Invoke a callback to format the selected image using Content Model * @param editor The editor object * @param apiName Name of API this calling this function. This is mostly for logging. * @param callback The callback to format the image. It will be called with current selected table. If no table is selected, it will not be called. */ export function formatImageWithContentModel( editor: IEditor, apiName: string, callback: (segment: ContentModelImage) => void ) { formatSegmentWithContentModel( editor, apiName, (_, __, segment) => { if (segment?.segmentType == 'Image') { callback(segment); } }, undefined /** segmentHasStyleCallback **/, undefined /** includingFormatHolder */ ); } |