티스토리 뷰
웹 에디터로,
스마트에디터2 사용중인데
글 등록하면, DB에는 <p><br></p>가 추가되지 않음.
근데 웹 페이지에서 저장된 글을 불러오면 <p><br></p>가 붙음.
등록한 후, 불러오는 경우에 <p><br></p>가 붙음.
방법 1)smarteditor.js 에서,
<p><br></o> 추가하지 않도록 처리 => 안 됨
//smarteditor2.js
...
_addLineBreaker : function(sContent){
if(this.oApp.sLineBreaker === "BR"){
return sContent.replace(/\r?\n/g, "<BR>");
}
var oContent = new StringBuffer(),
aContent = sContent.split('\n'), // \n을 기준으로 블럭을 나눈다.
aContentLng = aContent.length,
sTemp = "";
for (var i = 0; i < aContentLng; i++) {
sTemp = jindo.$S(aContent[i]).trim().$value();
if (i === aContentLng -1 && sTemp === "") {
break;
}
if (sTemp !== null && sTemp !== "") {
oContent.append('<P>');
oContent.append(aContent[i]);
oContent.append('</P>');
} else {
oContent.append('<P> <\/P>');
//240517, 아래 내용 주석 처리
/*if (!jindo.$Agent().navigator().ie) {
oContent.append('<P><BR></P>');
} else {
oContent.append('<P> <\/P>');
}*/
}
}
return oContent.toString();
},
...
방법 2)
불러올 때, 콘텐츠 clear 처리했는데도 안 됨....
//smart-editor-helper.js
var SE_HELPER = (function () {
//240517
// cleanHTML 함수 정의
const cleanHTML = function(html) {
return html.replace(/<p><br><\/p>/gi, '');
};
// 스마트에디터 로드
const loadedSmartEditor = function (elId, initContentsValue, callback) {
// 내부에 추가
...
// 스마트에디터 데이터 get
const getEditorContentsValue = function (elId) {
// 초기 셋팅값 설정
if (!elId || typeof elId !== 'string') {
elId = DEFAULT_SMART_EDITOR_ID;
}
if (!oEditors || !oEditors.length || !oEditors.getById[elId]) {
alert(' 스마트 에디터가 로드되어있지 않습니다. ');
return false;
}
//240517-content clear
var content = oEditors.getById[elId].getIR();
content = cleanHTML(content); // 내용 정리
return content;
//return oEditors.getById[elId].getIR();
};
...
}
}
'ERROR > WEB' 카테고리의 다른 글
[spring] ERR_TOO_MANY_REDIRECTS (0) | 2024.07.11 |
---|---|
[vue/]페이지가 안 그려질 때, 개발자도구 console (0) | 2024.02.22 |
[java/spring]an out of memory error has occurred (0) | 2023.10.30 |
[WEB/개발자모드 디버깅]console에 data가 object로 출력 (0) | 2023.09.08 |
삭제된 데이터가 그대로 조회될 때, (0) | 2022.11.07 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- html base tag
- CascadingStyleSheet
- css
- JavaScript
- border-spacing
- html layout
- scanner
- html atrribute
- typeof
- html
- ScriptTag
- 외부구성요소
- initialized
- BAEKJOON
- 입력양식
- html a tag
- Java
- caption-side
- 변수
- input type 종류
- empty-cell
- text formatting
- html input type
- improt
- selcetor
- 기본선택자
- A%B
- 스크립태그
- 미디어 태그
- html pre
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함