Insert Line Break Operation

단락 내에 소프트 줄바꿈(Shift+Enter)을 삽입합니다.

개요

Insert line break operation은 단락 내에 소프트 break를 생성합니다. 새 블록을 생성하는 insert paragraph와 다릅니다.

인터페이스

interface InsertLineBreakOperation extends Operation {
  type: 'insertLineBreak';
  path: Path;
}

사용법

function insertLineBreak(editor: Editor, position: Path) {
  const operation: InsertLineBreakOperation = {
    type: 'insertLineBreak',
    path: position
  };
  
  editor.applyOperation(operation);
}

// 역: 줄바꿈 삭제
const inverse = {
  type: 'deleteText',
  path: position,
  length: 1
};