동적 값을 우리가 할 수있는 편집 NiceEdit JS 파일을 통해
Link
와 사용자 정의 드롭 다운을 표시하기 위해 내 블로그 게시물입니다 NicEdit에 사용자 지정 콤보 상자 추가하기
통해 다음과 같이 NicEdit에 드롭 다운 또는 콤보 상자를 추가 할 수 있습니다.당신은 아약스 호출을 통해 데이터베이스에서 드롭 다운 값을 얻을 NicEdit 모든 다운로드 우선을 표시하고 NiceEdit JS 파일을 다운로드 aspx 페이지 에 NicEdit을 구현하고 코드 (http://nicedit.com/)
<div style="height: 700px; width: 70%; overflow: scroll"> <div id="sample"><script type="text/javascript" src="../scripts/nicEdit.js"></script><script src="../nicExample/nicExample.js"></script>
<script type="text/javascript">
bkLib.onDomLoaded(function() {
// nicEditors.allTextAreas()
new nicEditor({ fullPanel: true }).panelInstance('area2');});</script>
<h4>NicEdit Textarea</h4><textarea name="area2" id="area2" style="width: 70%; height: 700px"> </textarea>
</div></div>
에 따라 활성화 할 수 있습니다 이제 nicedit
012에 드롭 다운 값을 fetech하는 코드 숨김 (.cs 파일)에 WEBMETHOD 추가 파일
// AJAX call
function getddlData() {
var ajaxResponse;
$.ajax({
type: "POST",
url: 'NicEdit.aspx/GetBookMarkData', // AJAX call to fecth dropdown data
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
cache: false,
// Text file name
success: function (response) {
// //alert(data.d); // or do some other data processing
// //return data.d;
ajaxResponse = response;
}
});
return ajaxResponse.d;
}
//의 끝에 niceEdit.js 파일에 getddlData() 아약스 기능을 추가 행 다음에 37,719,327,
이제 열린 NicEdit JS 파일 및 복사 (NO 1552 라인) 또는 검색 :
var nicEditorFontFormatSelect = nicEditorSelect.extend({
Copy complete function and create another one by changing names etc
var nicEditorInsertBookmark = nicEditorSelect.extend({
/* By Pankaj Sharma : Not Needed Now */
sel: {
'[[Location]]': "Test Name",
pre: "Test Address",
h6: "Test City",
h5: "Test State",
h4: "Test Zip",
h3: "Test ABC",
h2: "Test One",
},
init: function() {
/* Pankaj Sharma */
this.setDisplay("Insert Bookmark");
var response = getddlData();
var responseArr = response.split(",");
var strings = [];
//for (itm in this.sel) {
// // var A = itm.toUpperCase();
// //this.add( A, this.sel[itm] )
// }
for (i = 0; i < responseArr.length; i++) {
strings.push([responseArr[i], responseArr[i + 1]]);
i = i + 1;
}
for (var i in strings) {
this.add(strings[i][0], strings[i][1]);
}
/* END HERE*/
},
});
당함에는 1230 라인하거나 다음 행으로 검색하기 :
var에 nicSelectOptions = { 버튼 : { 추가 fontFormat 기능
'CustomBookmark'아래에 다음과 같은 : { 이름 : __ ('책갈피 삽입'), 유형 : 'nicEditorInsertBookmark', // 명령 'InsertBookmark'// InsertBookmark }
지금 업데이트 기능이
var nicSelectOptions = {
buttons: {
'fontSize': {
name: __('Select Font Size'),
type: 'nicEditorFontSizeSelect',
command: 'fontsize'
},
'fontFamily': {
name: __('Select Font Family'),
type: 'nicEditorFontFamilySelect',
command: 'fontname'
},
'fontFormat': {
name: __('Select Font Format'),
type: 'nicEditorFontFormatSelect',
command: 'formatBlock'
},
'CustomBookmark': {
name: __('Insert Bookmark'),
type: 'nicEditorInsertBookmark', //
command: 'InsertBookmark' //InsertBookmark
}
}
};
이제 고토 라인과 같아야 1385 또는 갱신 : 기능 (A) { 변경이
에
update: function (A) {
// alert(this.options.command);
if (this.options.command == 'InsertBookmark') {+
var editor = nicEditors.findEditor("area2");
var range = editor.getRng();
var editorField = editor.selElm();
editorField.nodeValue = editorField.nodeValue.substring(0, range.startOffset) + A + editorField.nodeValue.substring(range.endOffset, editorField.nodeValue.length);
}
else {
// alert(A);
/* END HERE */
this.ne.nicCommand(this.options.command, A);
}
this.close()
}
On DropDown options 클릭하면 텍스트 편집기의 드롭 다운 값이 커서 위치에 추가됩니다.
END, 당신은 할 수 결과
안녕 클라우스의 ID가
, 난는 .text() 함수는 텍스트가 아닌 HTML 서식을 전송하기 때문에 동일한 문제가 있지만 내가 .html로()() 대신 .test의를 사용했다 텍스트 서식을 저장하는 데 필요한 정보. 나는 그것을 바로하고 있냐? –
내가 찾고 있었던 것이 었습니다. HTML 코드가 필요하고 포맷되지 않은 텍스트는 필요하지 않습니다. 공유해 주셔서 감사합니다. – Theodoros80