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 28 | 1x 1x 58x 29x 58x 29x 29x 29x | import { promoteLink } from 'roosterjs-content-model-api';
import type { DeleteSelectionStep } from 'roosterjs-content-model-types';
/**
* @internal
*/
export const handleAutoLink: DeleteSelectionStep = context => {
const { deleteResult, insertPoint } = context;
Eif (deleteResult == 'notDeleted' || deleteResult == 'nothingToDelete') {
const { marker, paragraph } = insertPoint;
const index = paragraph.segments.indexOf(marker);
const segBefore = index > 0 ? paragraph.segments[index - 1] : null;
Iif (
segBefore?.segmentType == 'Text' &&
promoteLink(segBefore, paragraph, {
autoLink: true,
}) &&
context.formatContext
) {
context.formatContext.canUndoByBackspace = true;
}
// Do not set deleteResult here since we haven't really start a new paragraph, we need other delete step to keep working on it
}
};
|