Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. 라이센스 파일(license.json)을 resource폴더에 넣어줍니다.
  2. resource/synapeditor.config.js 파일을 수정 합니다.

    Code Block
    languagejs
    themeEmacs
    title/wordpress_plugin/resource/synapeditor.config.js
    linenumberstrue
    var synapEditorConfig = {
      "editor.license": "http://localhost/wordpress/wp-content/plugins/synapeditor/resource/license.json",
      "editor.import.api": "admin-ajax.php",
      "editor.import.param": {"action": "import_doc"},
      "editor.upload.image.api": "admin-ajax.php",
      "editor.upload.image.param": {"action": "upload_file"},
      "editor.upload.video.api": "admin-ajax.php",
      "editor.upload.video.param": {"action": "upload_file"},
      "editor.upload.file.api": "admin-ajax.php",
      "editor.upload.file.param": {"action": "upload_file"},
       ...
    }


  3. wordpress_plugin 폴더 전체를 복사하여 "\wordpress\wp-content\plugins\"에 넣어줍니다.

...

Code Block
languagephp
themeEmacs
titlewordpress_plugin/admin/synap-admin.php
linenumberstrue
<?php
/**
 * Created by synapeditor.
 */

if ( !current_user_can( 'manage_options' ) )  {
    wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}

?>

<div class="wrap">
    <h1>Synap Editor Configuration</h1>

    <form method="post" action="options.php">
        <?php settings_fields( 'synap-editor-conf' ); ?>
        <?php do_settings_sections( 'synap-editor-conf' ); ?>
        <label for="width">에디터 너비</label>
        <input id="width" name="width" type="text" value="<?php echo esc_attr( get_option('width') ); ?>"/>
        <br/>
        <label for="height">에디터 높이</label>
        <input id="height" name="height" type="text" value="<?php echo esc_attr( get_option('height') ); ?>"/>

        <hr/>
        <label for="default_lang">에디터 기본언어</label>
        <input id="default_lang" name="default_lang" type="text" value="<?php echo esc_attr( get_option('default_lang') ); ?>"/>
        <br/>
        <label for="lang">에디터 언어</label>
        <input id="lang" name="lang" type="text" value="<?php echo esc_attr( get_option('lang') ); ?>"/>
        <hr/>
        <fieldset>
            <legend>에디터 툴바</legend>

            <?php
                $options = get_option( 'toolbar' );
                $toolbars = [
                    ['bold', '굵게'], ['italic', '기울게'], ['underline', '밑줄'], ['strike', '취소선'],
                    ['superScript', '위첨자'], ['subScript', '아래첨자'], ['fontColor', '글자색'], ['fontBackgroundColor', '글자 배경색'],
                    ['align', '정렬'], ['copyRunStyle', '서식 복사'], ['pasteRunStyle', '서식 붙여넣기'], ['removeRunStyle', '서식 지우기'],
                    ['link', '링크'], ['image', '이미지'], ['backgroundImage', '배경이미지'], ['video', '비디오'],
                    ['file', '파일'], ['horizontalLine', '가로줄'], ['specialCharacter', '특수문자'], ['emoji', '이모지'],
                    ['insertDiv', '블럭 레이어'], ['bulletList', '글머리 기호'], ['numberedList', '글머리 번호'], ['multiList', '다단계 글머리']
                ];

                $idx = 0;
                foreach ($toolbars as $toolbar) {
                    echo "<input name='toolbar[$toolbar[0]]' type='checkbox' value='1'", checked( isset( $options[$toolbar[0]] ) ) ,"/> $toolbar[1] ";
                    if (++$idx % 4 == 0) {
                        echo "<br/>";
                    }
                }
            ?>
        </fieldset>


        <?php submit_button(); ?>
    </form>
</div>


Code Block
languagejs
themeEmacs
titlewordpress_plugin/resource/synapeditor.config.js
linenumberstrue
var synapEditorConfig = {
  "editor.license": "http://localhost/wordpress/wp-content/plugins/synapeditor/resource/license.json",
  "editor.import.api": "admin-ajax.php",
  "editor.import.param": {"action": "import_doc"},
  "editor.upload.image.api": "admin-ajax.php",
  "editor.upload.image.param": {"action": "upload_file"},
  "editor.upload.video.api": "admin-ajax.php",
  "editor.upload.video.param": {"action": "upload_file"},
  "editor.upload.file.api": "admin-ajax.php",
  "editor.upload.file.param": {"action": "upload_file"}
}