CK editor 엔터오류

DONNIE·2023년 8월 28일
0

라이브러리

목록 보기
1/4
  • 에러

    아래 이미지처럼 긴 글 복붙시 글자가 겹쳐짐

  • 해결

// CKEditor 초기화
ClassicEditor.create(document.querySelector('#editor'), editorConfig);

  1. 커서 위치 조작
const editorConfig = {
    // ... 기타 설정 ...

    on: {
        instanceReady: function (event) {
            const editorInstance = event.editor;

            // 데이터를 설정하고 커서를 원하는 위치로 이동
            editorInstance.setData('TEXT TO SET');
            editorInstance.model.change(writer => {
                writer.setSelection(writer.createPositionAt(editorInstance.model.document.getRoot(), 'end'));
            });
        }
    }
};
// CKEditor 초기화
ClassicEditor.create(document.querySelector('#editor'), editorConfig);
  1. config에 엔터시 shift+enter와 동일한 기능하도록 추가, 실패
const editorConfig = {
    // ... 기타 설정 ...

    on: {
        instanceReady: function (event) {
            const editorInstance = event.editor;

            editorInstance.keystrokes.set('Enter', (evt, data) => {
                if (!evt.shiftKey) {
                    // Shift 키가 눌려있지 않은 경우 Enter 키 입력 시 줄 바꾸기 동작 수행
                    editorInstance.execute('enter');
                    return true; // 커스텀 동작 실행
                } else {
                    // Shift 키가 눌려진 경우 기본 Enter 키 동작 실행
                    return false; // 기본 동작 실행
                }
            });
        }
    }
};
  1. 개어이없음, css 확인
    height 가 들어가 있었음;; 뺴니까 잘 됨;;

![](https://velog.velcdn.com/images/ahrkwltlarh/post/46317bed-ba1b-4433-96a1-ad063f2be96a/image.png)

법규

profile
후론트엔드 개발자

0개의 댓글