2017-03-02 5 views
0

MS 워드, 오픈 오피스 작가 또는 웹 사이트에서 텍스트를 복사하여 리치 텍스트 편집기에 붙여 넣습니다. 그러나 웹 사이트에 붙여 넣기 후에는 굵게, 기울임 꼴 및 밑줄을 제외한 모든 스타일을 제거하려고합니다. 아래 샘플 코드는 그것을 달성하기 위해 노력했지만 h1, h2, h3 등의 경우에는 여전히 작동하지 않습니다. 그것을 달성하는 방법을 제안하십시오. 미리 감사드립니다.굵게, 기울임 꼴 및 밑줄을 제외한 모든 스타일을 제거한 후 텍스트 붙여 넣기

tinymce.init({ 
     selector : "#job_description", 
     menubar : false, 
     statusbar : false, 
     theme : "modern", 
     toolbar : "bold italic underline | bullist numlist", 
     content_css : "resources/css/richTextEditor.css", 
     plugins: 'paste', 
     paste_auto_cleanup_on_paste : true, 
     paste_remove_styles: true, 
     paste_remove_styles_if_webkit: true, 
     paste_strip_class_attributes: true 

     }); 

richTextEditor.css : -

.mce-item-table { 
    /*overflow-x:hidden!important;*/ 
    width: auto!important; 
} 

.mce-content-body span,p{ 
    font-size: 16px!important; 
    text-decoration: none!important; 
    color: #858585!important; 
    font-weight: 400!important; 
    font-family: 'Roboto', sans-serif !important; 
} 

답변

0

페이스트 플러그인 <h1> 같은 의미 정확한 태그를 제거하지 않습니다 - 당신은이 작업을 수행하려면 나는 paste_postprocess 필터를 구현하는 것이 한 다음이를 변환 할 수 있습니다 태그를 원하는대로 추가하십시오.

https://www.tinymce.com/docs/plugins/paste/#paste_postprocess