둘러싸 기 끄기
CKEditor 3.0의 태그
CKEditor 3.x의 <p> </ p> 내에서 작성된 모든 콘텐츠의 자동 포함을 끌 수 있습니까?
나는 시도했다
CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR;
그러나 이것은 둘러싸는 단락을 떠나면서 인라인 줄 바꿈을 <br />로 변경합니다.
현재 "Test"를 작성하면이 출력이 생성됩니다.
<p>
Test</p>
그러나 나는 그것이 단순히
Test
이것에 대한 구성 속성이 있습니까 아니면 다른 인라인 편집기가 이것에 더 적합합니까?
CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR;
-이것은 나에게 완벽하게 작동합니다. 브라우저 캐시를 지우려고 했습니까? 가끔 문제가됩니다.
jQuery 어댑터로 확인할 수도 있습니다.
<script type="text/javascript" src="/js/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/js/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
$(function() {
$('#your_textarea').ckeditor({
toolbar: 'Full',
enterMode : CKEDITOR.ENTER_BR,
shiftEnterMode: CKEDITOR.ENTER_P
});
});
</script>
@Tomkay의 의견에 따라 업데이트 :
CKEditor 3.6 버전부터 인라인 콘텐츠를 <p></p>
. 이것은 올바른 설정입니다.
CKEDITOR.config.autoParagraph = false;
출처 : http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.autoParagraph
인터넷에서 사람들은 config.enterMode를 CKEDITOR.ENTER_BR로 설정하면 CKEditor에서 래핑 된 단락 태그가 제거된다는 사실을 알아 차 렸습니다. 이 설정은 단락이 아닌 줄 바꿈을 삽입하기 위해 Enter 키의 동작을 변경하므로 바람직하지 않습니다.
참조 : http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enterMode "의미 적 값과 정확성 때문에 CKEDITOR.ENTER_P 설정을 사용하는 것이 좋습니다."
그러나 초기 단락 인 config.autoParagraph를 제거하도록 설계된 설정은 편집기가 실제로 최상위 블록 요소를 원 하기 때문에 "예측할 수없는 사용성 문제"를 야기하므로 권장되지 않습니다 .
참조 : http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.autoParagraph
마법은 wysiwygarea / plugin.js의 410 행에서 발생하며 편집기는 config.enterMode를 기반으로 기본 블록 요소를 선택합니다. 기본 블록 요소를 변경하는 구성 옵션을 사용하면 div로 시작할 수 있지만 메뉴를 통해 단락 형식을 변경하지 않는 한 입력을 누를 때마다 더 많은 div를 계속 얻을 수 있습니다.
참조 : http://docs.cksource.com/ckeditor_api/symbols/src/plugins_wysiwygarea_plugin.js.html
사후 처리 (서버 또는 CKEditor의 getData 이벤트에서)로 래핑 된 단락 태그를 제거 할 수 있지만 이는 autoParagraph를 비활성화하는 것과 동일한 문제로 이어집니다. 최상위 블록이 없습니다.
config.enterMode를 표준 솔루션으로 변경하는 것보다 좋은 솔루션이 아니라 소수의 절반 솔루션이 있다고 말하고 싶습니다.
config.js에서 시도하십시오.
CKEDITOR.editorConfig = function( config )
{
config.enterMode = CKEDITOR.ENTER_BR;
config.shiftEnterMode = CKEDITOR.ENTER_BR;
};
그것을 발견!
ckeditor.js line # 91 ... search for
B.config.enterMode==3?'div':'p'
로 변경
B.config.enterMode==3?'div':''
(아니 P!)
캐시와 BAM을 덤프하십시오!
이 config.js 파일 코드 만들기
CKEDITOR.editorConfig = function( config ) {
// config.enterMode = 2; //disabled <p> completely
config.enterMode = CKEDITOR.ENTER_BR; // pressing the ENTER KEY input <br/>
config.shiftEnterMode = CKEDITOR.ENTER_P; //pressing the SHIFT + ENTER KEYS input <p>
config.autoParagraph = false; // stops automatic insertion of <p> on focus
};
해결 방법으로 자랑스럽지 않은 일을하고 있습니다. 실제로 데이터베이스에 저장하는 Python 서블릿에서 다음을 수행합니다.
if description.startswith('<p>') and description.endswith('</p>'):
description = description[3:-4]
소스를 편집 (또는 서식있는 텍스트 해제)하고 p 태그를 div로 바꿉니다. 그런 다음 원하는 방식으로 div 스타일을 지정하십시오.
ckEditor won't add any wrapper element on the next submit as you've got the div in there.
(This solved my issue, I'm using Drupal and need small snippets of html which the editor always added the extra, but the rest of the time I want the wrapping p tag).
if (substr_count($this->content,'<p>') == 1)
{
$this->content = preg_replace('/<\/?p>/i', '', $this->content);
}
MAKE THIS YOUR config.js file code
CKEDITOR.editorConfig = function( config ) {
// config.enterMode = 2; //disabled <p> completely
config.enterMode = CKEDITOR.ENTER_BR // pressing the ENTER KEY input <br/>
config.shiftEnterMode = CKEDITOR.ENTER_P; //pressing the SHIFT + ENTER KEYS input <p>
config.autoParagraph = false; // stops automatic insertion of <p> on focus
};
Set such config:
CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR
CKEDITOR.config.forcePasteAsPlainText = true
In VS2015, this worked to turn the Enter key into <br>
myCKEControl.EnterMode = CKEditor.NET.EnterMode.BR
Personally, I don't care if my resulting text only has <br>
and not <p>
. It renders perfectly fine and it looks the way I want it to. In the end, it works.
참고URL : https://stackoverflow.com/questions/1977791/turn-off-enclosing-p-tags-in-ckeditor-3-0
'program story' 카테고리의 다른 글
시스템이 정의되지 않았습니다. (0) | 2020.12.01 |
---|---|
msbuild, 조건부 컴파일 기호 정의 (0) | 2020.11.30 |
memset () 또는 구조체를 0으로 초기화하는 값 초기화? (0) | 2020.11.30 |
아이폰 인터페이스 빌더 : Z- 인덱스, 버튼의 Z- 순서, 이미지, UI 요소 등? (0) | 2020.11.30 |
열거 형에 Type ( "typeof ()"사용)을 저장할 수 있습니까? (0) | 2020.11.30 |