Chrome 브라우저에서 텍스트 입력을위한 리치 편집기로 Ckeditor를 사용하고 있습니다. 또한 시스템에서 데이터를 가져온 후 bs4로 쉽게 구문 분석 할 수 있도록 일부 HTML ID 태그를 추가했습니다.Ckeditor allowedContent for html tag
CKEDITOR.replace('editor', {
toolbar : 'Basic',
uiColor : '#9AB8F3',
height : '70%',
startupShowBorders: false,
})
그리고 config.js에서 :
다음
은 HTML 내 설정입니다config.toolbarGroups = [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'forms' },
{ name: 'tools' },
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'others' },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'about' }
];
// Remove some buttons provided by the standard plugins, which are
// not needed in the Standard(s) toolbar.
config.removeButtons = 'Underline,Subscript,Superscript';
// Set the most common block elements.
config.format_tags = 'p;h1;h2;h3;pre';
// Simplify the dialog windows.
config.removeDialogTabs = 'image:advanced;link:advanced';
config.allowedContent = True;
};
config.jd에서 모든 html 태그 내용을 config.allowedContent = *;
으로 보존 할 수 있도록 지시를 이미 따라갔습니다. 대신이의
<span style='font-size:11.0pt;'> content </span>
을 내가 원하는 : (CKEDITOR.instances.editor.getData()
에 의해) 데이터를 가져 오는 때 다음과 같은 결과를 얻었다 그러나, 그것은 작동하지 않는 것 같다 즉
<span id="news_content" style='font-size:11.0pt;'> content </span>
, 아직 밖으로 모두 제거합니다 내가 추가 한 HTML 태그 나는 소스 코드를 확인
, 나는
<textarea name="editor" id="editor" rows="100" cols="40" style="visibility: hidden; display: none;">
, 같은 텍스트 영역의 내용, 즉 숨겨진 형식으로 넣어되는 태그와 함께 한, 두 번 생산 된 것을 발견하고 편집기는 다른 버전을 생성합니다 내가 편집 할 수있는 실제 텍스트 영역. 그러나 모든 html 태그가 거기에서 제거되기 때문에 이것은 쓸모가 없습니다.
그래서 내 질문은 편집 및 제출 후 ID 태그 HTML을 구문 분석 할 수 있도록 실제 텍스트 영역에서 html 태그를 유지하는 방법입니다. 아무도 이것에 조언 할 수 있 었는가? 고마워.