2017-11-07 5 views
-2

CKeditor에서 붙여 넣기 (CTRL + V) 옵션을 비활성화 할 수 없었습니다. 지금 오른쪽 클릭 붙여 넣기 옵션이 비활성화되어 있지만. 다음은 CKeditor 웹 페이지 양식에서 붙여 넣기 옵션을 완전히 비활성화하십시오.

는 CKeditor

CKEDITOR.editorConfig = function(config) { 
config.extraPlugins = 'wordcount,notification'; 

config.wordcount = { 

    // Whether or not you want to show the Paragraphs Count 
    showParagraphs: false, 

    // Whether or not you want to show the Word Count 
    showWordCount: true, 

    // Whether or not you want to show the Char Count 
    showCharCount: true, 

    // Whether or not you want to count Spaces as Chars 
    countSpacesAsChars: true, 

    // Whether or not to include Html chars in the Char Count 
    countHTML: false, 

    // Maximum allowed Word Count, -1 is default for unlimited 
    maxWordCount: -1, 

    // Maximum allowed Char Count, -1 is default for unlimited 
    maxCharCount: 2000 
}; 
// The toolbar groups arrangement, optimized for a single toolbar row. 
config.toolbarGroups = [ 
    { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }, 
    { name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, 
    { name: 'editing',  groups: [ 'find', 'selection', 'spellchecker' ] }, 
    { name: 'forms' }, 
    { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, 
    { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] }, 
    { name: 'links' }, 
    { name: 'insert' }, 
    { name: 'styles' }, 
    { name: 'colors' }, 
    { name: 'tools' }, 
    { name: 'others' }, 
    { name: 'about' } 
]; 
CKEDITOR.config.toolbar = [ 
    ['Format','FontSize'], 

    ['Bold','Italic','Underline','StrikeThrough','-','Undo','Redo','-','Cut','Copy','Paste','Find','Replace','-','Outdent','Indent','-','Print'], 

    ['NumberedList','BulletedList','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], 
    ['-','Link'] 
] ; 
// The default plugins included in the basic setup define some buttons that 
// are not needed in a basic editor. They are removed here. 
config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript'; 

// Dialog windows are also simplified. 
config.removeDialogTabs = 'link:advanced'; 

}에 대한 config.js 파일입니다;

This is how the editor looks like

컨트롤러 기능 로딩이 편집기는 위의 그림과 같이

public function edit_cv(){ 
$user_id= $this->CI->session->userdata('id'); 
$this->addJS("tnpcell/edit.js"); 
$this->addJS("ckeditor/ckeditor.js"); 
$this->addJS("ckeditor/samples/js/sample.js"); 
$data['cv_data'] = $this->cv_model->get_achievements($user_id); 
foreach ($data['cv_data'] as $row){ 
     $row->editor_content = urldecode($row->editor_content); 
     $row->skype_id = urldecode($row->skype_id); 
     $row->shoe_size = urldecode($row->shoe_size); 
     $row->blood_group = urldecode($row->blood_group); 
     $row->specialization = urldecode($row->specialization); 
     $row->editor_content = str_replace('$.ol.$', '<ol>', $row->editor_content); 
     $row->editor_content = str_replace('$.ul.$', '<ul>', $row->editor_content); 
     $row->editor_content = str_replace('$.li.$', '<li>', $row->editor_content); 
     $row->editor_content = str_replace('$./ol.$', '</ol>', $row->editor_content); 
     $row->editor_content = str_replace('$./ul.$', '</ul>', $row->editor_content); 
     $row->editor_content = str_replace('$./li.$', '</li>', $row->editor_content); 
     $row->editor_content = str_replace('$.nbsp.$', '&nbsp;', $row->editor_content); 
} 
$data['project_data'] = $this->cv_model->get_project($user_id); 
foreach ($data['project_data'] as $row) { 
     $row->title = urldecode($row->title); 
     $row->role = urldecode($row->role); 
} 
$this->load->model('course_structure/basic_model','',TRUE); 
$this->load->model('student/student_academic_model','',TRUE); 
$data['student_academic']=$this->student_academic_model->get_stu_academic_details_by_id($user_id); 
$data['branch_name']=$this->basic_model->get_branch_details_by_id($data['student_academic']->branch_id)[0]->name; 

$this->drawHeader("Edit Your CV"); 
$this->load->view('tnpcell/edit_cv',$data); 
$this->drawFooter(); 

}

나는 사용자가 에디터의 분야 (의 텍스트를 붙여 넣기 할 수 없어야합니다 - 이것도). 그러나 현재 Ctrl + V를 사용하여 일부 텍스트를 붙여 넣을 수 있습니다.

+1

전혀 도움이되지 않는 한 가지 질문에 대한 도움이 필요하지 않습니다. 무엇을 시도 했습니까? 코드 등은 어디에 있습니까? –

+0

실제로 비트 컴플렉스 코드입니다. 이 편집기에서 사용 된 모든 코드를 업로드 할 수 없습니다. 그러나 지금은 거의 공유하지 못했습니다. – hellokuldeep

답변

1

paste 이벤트를 취소 할 수 있습니다.

CKEDITOR.instances.editor1.on('paste', function(evt) { 
    evt.cancel(); 
}); 
+0

편집기를로드하는 컨트롤러에 이것을 써야합니까? – hellokuldeep

+0

정보가 충분하지 않기 때문에 컨트롤러에서 사용하는 방법을 모르겠습니다. 그것은 순수한 JavaScript이며 CKEditor 인스턴스가 초기화 된 후에 호출되어야하므로 인스턴스 이름을 사용할 수 있습니다. 이 데모에서는'editor1'을 사용했습니다. – Wizard