당미역

본문 바로가기
2022.11
28
회원사진
/**
 * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md or http://ckeditor.com/license
 */

 CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here.
	// For complete reference see:
	// http://docs.ckeditor.com/#!/api/CKEDITOR.config

	config.uiColor = '#F2F2F2';

	// The toolbar groups arrangement, optimized for two toolbar rows.
	config.toolbarGroups = [
		{ name: 'document',	   groups: [ 'mode', 'document', 'doctools' ] },
		//{ name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
		{ name: 'basicstyles' },
		{ name: 'links' },
		{ name: 'blocks' },
		{ name: 'insert' },
		{ name: 'align' },
		{ name: 'cleanup' },
    { name: 'codesnippet' },
    { name: 'imgur' },
		//'/',
		{ name: 'paragraph',   groups: [ 'list' ] },
		{ name: 'styles' },
		{ name: 'colors' },
		{ name: 'tools' },
		{ name: 'about' }
	];
	// Whether the toolbar can be collapsed by the user.
	//config.toolbarCanCollapse = true;
	//config.toolbarStartupExpanded = true;

	// Remove some buttons provided by the standard plugins, which are
	// not needed in the Standard(s) toolbar.
	config.removeButtons = 'PasteText,PasteFromWord,Cut,Copy,Paste,Undo,Redo,Anchor,Blockquote,HorizontalRule,Format,Font,Image,Styles,SpecialChar,Templates';

	// Set the most common block elements.
	config.format_tags = 'p;h1;h2;h3;pre';

	// Simplify the dialog windows.
	config.removeDialogTabs = 'image:advanced;link:advanced;link:upload';

	// Set the file uploader
	config.filebrowserUploadUrl = g5_editor_url+"/upload.php?type=Images";

	// Set Editor default Height
	config.height = 300;

	// CODESNIPPET SETTING
	config.extraPlugins = 'codesnippet,simpleuploads,imgur';
  config.codeSnippet_theme = 'school_book';
  config.imgurClientId = '';
	// CKEDITOR PLUGINS LOADING
	//config.extraPlugins = 'pbckcode'; // add other plugins here (comma separated)
	// PBCKCODE CUSTOMIZATION
	/*
	config.pbckcode = {
		// An optional class to your pre tag.
		cls: 'line-numbers',

		// The syntax highlighter you will use in the output view
		highlighter: 'PRISM',

		// An array of the available modes for you plugin.
		// The key corresponds to the string shown in the select tag.
		// The value correspond to the loaded file for ACE Editor.
		modes: [['HTML', 'html'], ['CSS', 'css'], ['PHP', 'php'], ['JS', 'javascript']],

		// The theme of the ACE Editor of the plugin.
		theme: 'twilight',

		// Tab indentation (in spaces)
		tab_size: '4'
	};
	*/
};

 

config.js 에서 제가 사용하는 방법입니다.

 

    config.removeButtons = 'PasteText,PasteFromWord,Cut,Copy,Paste,Undo,Redo,Anchor,Blockquote,HorizontalRule,Format,Font,Image,Styles,SpecialChar,Templates';

    // Simplify the dialog windows.
    config.removeDialogTabs = 'image:advanced;link:advanced;link:upload';

에 image 추가로 기본 ckeditor 이미지 업로드 버튼 삭제

 

    // CODESNIPPET SETTING
    config.extraPlugins = 'codesnippet,simpleuploads,imgur';

사용하고자 하시는 플러그인이 다수라면 위처럼 , 로 구분하여 수정해주시면 됩니다.^^

2022.09
07
회원사진

ck에디터 codesnipet 적용시

head.sup.php head와 head 사이에 추가해야 할 사항

 

에디터의 경로와 디렉토리명은 같지 않기 때문에

URL은 에디터 경로에 맞게 변경해줘야 한다.

테마를 변경하고 싶으면 /codesnippet/lib/highlight/styles/에

있는 css를 넣어준다.

<script src="<?php echo G5_EDITOR_URL ?>/ckeditor/plugins/codesnippet/lib/highlight/highlight.pack.js"></script>
<link rel="stylesheet" href="<?php echo G5_EDITOR_URL ?>/ckeditor/plugins/codesnippet/lib/highlight/styles/monokai_sublime.css">
<script>hljs.initHighlightingOnLoad();</script>

 

2022.09
05
회원사진

제목 없는 게시판 만들기 그누보드나 테마 빌더의 게시판 모두 가능하다.

먼저 sir의 제목없는 게시판 스킨을 참고하여

 

sir 제목없는 게시판 글 링크

제목없는 게시판

 

그누보드를 사용한다면 

write.tail.skin.php 를 pc와 모바일의 게시판 디렉토리에 업로드 하면 되고

빌더는 디렉토리 구성에 따라 조금씩 틀리다

이윰빌더 시즌4를 사용한다면

 

사용하는 테마의 게시판 스킨의

write.skin.html.php 에 write.tail.skin.php의 내용을 하단 스크립트 부분에 넣어야 한다.

 

function changeTitle() {
	<?php
	$subject_limit = 70;
	$target_editor = $is_dhtml_editor ? $config['cf_editor'] : "none";
	?>
	if (wr_subject.value.trim() == "") {
		<?php
		if ($target_editor == "cheditor5") echo "changeSubject = ed_wr_content.outputBodyHTML();";
		else if ($target_editor == "smarteditor2") echo "changeSubject = oEditors.getById['wr_content'].getIR();";
		else if ($target_editor == "ckeditor4_eyoom") echo "changeSubject = CKEDITOR.instances.wr_content.getData();";
		else echo "changeSubject = wr_content.value;";
		?>
		btn_submit.insertAdjacentHTML("afterend", "<div id=entityDiv style=display:none></div>");
		entityDiv.innerHTML = changeSubject;
		changeSubject = entityDiv.innerText;
		reSubject = "";
		changeEnter = changeSubject.replace(/\n/gi, " ");
		noTag = changeEnter.replace(/(<([^>]+)>)/gi, " ").trim();
		for (var i in noTag) reSubject = reSubject + (noTag[i] == " " && noTag[i - 1] == " " ? "" : noTag[i]);
		wr_subject.value = reSubject.length <= <?php echo $subject_limit; ?> ? reSubject : reSubject.slice(0, <?php echo $subject_limit; ?>) + "...";
	}
}

스크립트 부분에 위처럼 삽입하고

 

ckeditor를 사용한다면

		else if ($target_editor == "ckeditor4_eyoom") echo "changeSubject = CKEDITOR.instances.wr_content.getData();";
		else echo "changeSubject = wr_content.value;";

사용하는 ckeditor 디렉토리명을 넣고 echo 부분도 위와 같이 바꾸어 준다.

 

여기까지만 하면 제목창이 보여도 내용의 글이 제목이 되어 버린다.

깔끔하게 제목장도 안보이게 하고 싶으면

 

    <section>
    <div class="row" style='display: none;'>
        <div class="col col-12 md-m-b-10">
            <div class="position-relative">
              <label for="wr_subject" class="label">
                  <strong class="sound_only"> 필수</strong>
              </label>
              <label class="input required-mark">
                  <input type="text" name="wr_subject" value="<?php echo $subject; ?>" id="wr_subject" required size="50" maxlength="255" placeholder="제목을 입력해 주세요.">
              </label>
                <?php if ($is_member) { //임시 저장된 글 기능 ?>
                <span class="autosave-btn">
                    <script src="<?php echo G5_URL; ?>/js/autosave.js"></script>
                    <button type="button" id="btn_autosave" class="btn-e btn-dark position-relative">임시 저장된 글 <span id="autosave_count" class="badge badge-red rounded"><?php echo $autosave_count; ?></span></button>
                    <div id="autosave_pop">
                        <div class="autosave_heading">
                            <strong>임시 저장된 글 목록</strong>
                            <span class="autosave_close"><i class="fas fa-times"></i></span>
                        </div>
                        <div class="clearfix"></div>
                        <ul></ul>
                        <div><span class="autosave_close btn-e btn-e-dark btn-e-sm">닫기</span></div>
                    </div>
                </span>
                <?php } ?>
            </div>
        </div>
    </div>
    </section>

 

제목창을 표시해주는

div class에 style='display: none;' 넣어주면 제목창은 깔끔하게 사라진다.

게시판 전체검색