Merge branch 'develop' into next

This commit is contained in:
Kijin Sung 2020-07-09 14:51:36 +09:00
commit d4c449c2a6
22 changed files with 771 additions and 343 deletions

View file

@ -13,7 +13,6 @@ jobs:
services: services:
- mysql - mysql
before_script: before_script:
- npm install grunt grunt-cli grunt-contrib-jshint grunt-contrib-csslint grunt-phplint --save-dev
- mysql -u root -e "CREATE DATABASE rhymix CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci" - mysql -u root -e "CREATE DATABASE rhymix CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci"
- mysql -u root -e "GRANT ALL PRIVILEGES ON rhymix.* TO travis@localhost" - mysql -u root -e "GRANT ALL PRIVILEGES ON rhymix.* TO travis@localhost"
- mysql -u root -e "SET PASSWORD FOR travis@localhost = PASSWORD('travis'); FLUSH PRIVILEGES" - mysql -u root -e "SET PASSWORD FOR travis@localhost = PASSWORD('travis'); FLUSH PRIVILEGES"
@ -21,7 +20,7 @@ before_script:
- wget https://codeception.com/releases/2.3.9/codecept.phar - wget https://codeception.com/releases/2.3.9/codecept.phar
- php -S localhost:8000 & - php -S localhost:8000 &
script: script:
- grunt lint - if find . -name "*.php" ! -path "./vendor/*" -print0 | xargs -0 -n 1 -P 8 php -l | grep -v "No syntax errors detected"; then exit 1; fi
- php codecept.phar build - php codecept.phar build
- php codecept.phar run --debug --fail-fast --env travis - php codecept.phar run --debug --fail-fast --env travis
notifications: notifications:

View file

@ -1,87 +0,0 @@
module.exports = function(grunt) {
"use strict";
grunt.file.defaultEncoding = 'utf8';
grunt.initConfig({
jshint: {
files: [
'Gruntfile.js',
'common/js/*.js',
'modules/admin/tpl/js/*.js',
'modules/board/tpl/js/*.js',
'modules/board/skins/*/*.js',
'modules/editor/tpl/js/*.js',
'modules/menu/tpl/js/*.js',
'modules/widget/tpl/js/*.js',
],
options : {
ignores : [
'**/jquery*.js',
'**/swfupload.js',
'**/**.min.js',
'**/*-packed.js',
'**/*.compressed.js',
'**/jquery-*.js',
'**/jquery.*.js',
'common/js/html5.js',
'common/js/x.js',
'common/js/xe.js',
'common/js/xml2json.js',
'common/js/modernizr.js',
'vendor/**',
'tests/**',
]
}
},
csslint: {
'common-css': {
options: {
import : 2,
'adjoining-classes' : false,
'box-model' : false,
'box-sizing' : false,
'font-sizes' : false,
'duplicate-background-images' : false,
'order-alphabetical' : false,
'ids' : false,
'important' : false,
'overqualified-elements' : false,
'qualified-headings' : false,
'star-property-hack' : false,
'underscore-property-hack' : false,
},
src: [
'common/css/*.css',
'!common/css/bootstrap.css',
'!common/css/bootstrap-responsive.css',
'!**/*.min.css',
'!vendor/**',
'!tests/**',
]
}
},
phplint: {
default : {
options: {
phpCmd: "php",
},
src: [
"**/*.php",
"!files/**",
"!tests/**",
"!tools/**",
"!common/libraries/**",
"!vendor/**",
"!tests/_output/**"
],
},
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-phplint');
grunt.registerTask('lint', ['jshint', 'csslint', 'phplint']);
};

View file

@ -3,22 +3,124 @@
* *
* https://github.com/rhymix/rhymix/issues/932 * https://github.com/rhymix/rhymix/issues/932
*/ */
CKEDITOR.plugins.add( 'ios_enterkey', CKEDITOR.plugins.add( 'ios_enterkey', {
{ icons: 'ios_enterkey',
icons: 'ios_enterkey', init: function(editor) {
init: function(editor) editor.setKeystroke( [
{ [ 13, '' ],
editor.on('contentDom', function() [ CKEDITOR.SHIFT + 13, '' ]
{ ] );
var editable = editor.editable();
editable.attachListener(editable, 'keyup', function(e) editor.on('contentDom', function() {
{ var selection;
if(e.data.getKey() === 13) var bookmarks;
{ var range;
$(editor.document.$).find('.cke_wysiwyg_div').blur(); var data;
$(editor.document.$).find('.cke_wysiwyg_div').focus(); var shift = false;
}
}); var editable = editor.editable();
}); editable.attachListener(editable, 'keyup', function(e) {
}
if(e.data.getKey() === 13) {
var eventData = {
dataValue: data
};
editor.fire( 'afterSetData', eventData );
range.moveToBookmark(bookmarks[0]);
range.collapse( true );
range.select();
if(shift) {
shiftEnter(editor);
} else {
enter(editor);
}
shift = false;
}
});
editable.attachListener(editable, 'keydown', function(e) {
if(e.data.getKey() === 13) {
selection = editor.getSelection();
bookmarks = selection.createBookmarks(true);
data = editor.getData();
range = selection.getRanges()[0];
if(e.data.$.shiftKey) shift = true;
}
});
});
plugin = CKEDITOR.plugins.enterkey;
enterBr = plugin.enterBr;
enterBlock = plugin.enterBlock;
headerTagRegex = /^h[1-6]$/;
function shiftEnter( editor ) {
// On SHIFT+ENTER:
// 1. We want to enforce the mode to be respected, instead
// of cloning the current block. (https://dev.ckeditor.com/ticket/77)
return enter( editor, editor.activeShiftEnterMode, 1 );
}
function enter( editor, mode, forceMode ) {
forceMode = editor.config.forceEnterMode || forceMode;
// Only effective within document.
if ( editor.mode != 'wysiwyg' )
return;
if ( !mode )
mode = editor.activeEnterMode;
// TODO this should be handled by setting editor.activeEnterMode on selection change.
// Check path block specialities:
// 1. Cannot be a un-splittable element, e.g. table caption;
var path = editor.elementPath();
if ( path && !path.isContextFor( 'p' ) ) {
mode = CKEDITOR.ENTER_BR;
forceMode = 1;
}
editor.fire( 'saveSnapshot' ); // Save undo step.
if ( mode == CKEDITOR.ENTER_BR )
enterBr( editor, mode, null, forceMode );
else
enterBlock( editor, mode, null, forceMode );
editor.fire( 'saveSnapshot' );
}
function getRange( editor ) {
// Get the selection ranges.
var ranges = editor.getSelection().getRanges( true );
// Delete the contents of all ranges except the first one.
for ( var i = ranges.length - 1; i > 0; i-- ) {
ranges[ i ].deleteContents();
}
// Return the first range.
return ranges[ 0 ];
}
function replaceRangeWithClosestEditableRoot( range ) {
var closestEditable = range.startContainer.getAscendant( function( node ) {
return node.type == CKEDITOR.NODE_ELEMENT && node.getAttribute( 'contenteditable' ) == 'true';
}, true );
if ( range.root.equals( closestEditable ) ) {
return range;
} else {
var newRange = new CKEDITOR.dom.range( closestEditable );
newRange.moveToRange( range );
return newRange;
}
}
}
}); });

View file

@ -147,21 +147,25 @@ class editorAdminController extends editor
$config = new stdClass; $config = new stdClass;
$config->editor_skin = $configVars->editor_skin; $config->editor_skin = $configVars->editor_skin;
$config->editor_colorset = $configVars->editor_colorset;
$config->editor_height = $configVars->editor_height; $config->editor_height = $configVars->editor_height;
$config->mobile_editor_height = $configVars->mobile_editor_height;
$config->editor_toolbar = $configVars->editor_toolbar; $config->editor_toolbar = $configVars->editor_toolbar;
$config->editor_toolbar_hide = $configVars->editor_toolbar_hide === 'Y' ? 'Y' : 'N'; $config->editor_toolbar_hide = $configVars->editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->mobile_editor_skin = $configVars->mobile_editor_skin;
$config->mobile_editor_colorset = $configVars->mobile_editor_colorset;
$config->mobile_editor_height = $configVars->mobile_editor_height;
$config->mobile_editor_toolbar = $configVars->mobile_editor_toolbar; $config->mobile_editor_toolbar = $configVars->mobile_editor_toolbar;
$config->mobile_editor_toolbar_hide = $configVars->mobile_editor_toolbar_hide === 'Y' ? 'Y' : 'N'; $config->mobile_editor_toolbar_hide = $configVars->mobile_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->comment_editor_skin = $configVars->comment_editor_skin; $config->comment_editor_skin = $configVars->comment_editor_skin;
$config->comment_editor_colorset = $configVars->comment_editor_colorset;
$config->comment_editor_height = $configVars->comment_editor_height; $config->comment_editor_height = $configVars->comment_editor_height;
$config->mobile_comment_editor_height = $configVars->mobile_comment_editor_height;
$config->comment_editor_toolbar = $configVars->comment_editor_toolbar; $config->comment_editor_toolbar = $configVars->comment_editor_toolbar;
$config->comment_editor_toolbar_hide = $configVars->comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N'; $config->comment_editor_toolbar_hide = $configVars->comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->mobile_comment_editor_skin = $configVars->mobile_comment_editor_skin;
$config->mobile_comment_editor_colorset = $configVars->mobile_comment_editor_colorset;
$config->mobile_comment_editor_height = $configVars->mobile_comment_editor_height;
$config->mobile_comment_editor_toolbar = $configVars->mobile_comment_editor_toolbar; $config->mobile_comment_editor_toolbar = $configVars->mobile_comment_editor_toolbar;
$config->mobile_comment_editor_toolbar_hide = $configVars->mobile_comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N'; $config->mobile_comment_editor_toolbar_hide = $configVars->mobile_comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->sel_editor_colorset = $configVars->sel_editor_colorset;
$config->sel_comment_editor_colorset = $configVars->sel_comment_editor_colorset;
if ($configVars->font_defined === 'Y') if ($configVars->font_defined === 'Y')
{ {

View file

@ -20,16 +20,11 @@ class editorAdminView extends editor
*/ */
function dispEditorAdminIndex() function dispEditorAdminIndex()
{ {
$component_count = 0; // Get module config
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
// Get a type of component
$oEditorModel = getModel('editor'); $oEditorModel = getModel('editor');
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
$editor_config = $oModuleModel->getModuleConfig('editor'); $editor_config = $oModuleModel->getModuleConfig('editor');
if (!is_object($editor_config))
if(!$editor_config)
{ {
$editor_config = new stdClass(); $editor_config = new stdClass();
} }
@ -43,35 +38,53 @@ class editorAdminView extends editor
} }
} }
$component_list = $oEditorModel->getComponentList(false, $site_srl, true); // Get skin info
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins'); $editor_skin_list = array();
$editor_skin_list = array_filter($editor_skin_list, function($name) { return !starts_with('xpresseditor', $name) && !starts_with('dreditor', $name); }); $skin_dir_list = FileHandler::readDir($this->module_path . 'skins');
foreach ($skin_dir_list as $skin)
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin); {
$comment_skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->comment_editor_skin); if (starts_with('xpresseditor', $skin) || starts_with('dreditor', $skin))
{
// Get install info, update info, count continue;
$oAutoinstallModel = getModel('autoinstall'); }
foreach($component_list as $component_name => $xml_info)
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin);
foreach ($skin_info->colorset ?: [] as $colorset)
{
unset($colorset->screenshot);
}
$editor_skin_list[$skin] = $skin_info;
}
// Get editor component info
$oAutoinstallModel = getModel('autoinstall');
$component_list = $oEditorModel->getComponentList(false, 0, true);
$component_count = count($component_list);
$targetpackages = array();
foreach ($component_list as $xml_info)
{ {
$component_count++;
$xml_info->path = './modules/editor/components/'.$xml_info->component_name; $xml_info->path = './modules/editor/components/'.$xml_info->component_name;
$xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path); $xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path);
$xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path); $xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path);
if($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0; if ($xml_info->package_srl)
{
$targetpackages[$xml_info->package_srl] = 0;
}
} }
if (count($targetpackages))
if(is_array($targetpackages)) $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages));
foreach($component_list as $component_name => $xml_info)
{ {
if($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update; $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages));
}
foreach ($component_list as $xml_info)
{
if ($packages[$xml_info->package_srl])
{
$xml_info->need_update = $packages[$xml_info->package_srl]->need_update;
}
} }
Context::set('editor_config', $editor_config); Context::set('editor_config', $editor_config);
Context::set('editor_skin_list', $editor_skin_list); Context::set('editor_skin_list', $editor_skin_list);
Context::set('editor_colorset_list', $skin_info->colorset);
Context::set('comment_editor_colorset_list', $comment_skin_info->colorset);
Context::set('component_list', $component_list); Context::set('component_list', $component_list);
Context::set('component_count', $component_count); Context::set('component_count', $component_count);

View file

@ -23,21 +23,25 @@ class editor extends ModuleObject
*/ */
public $default_editor_config = array( public $default_editor_config = array(
'editor_skin' => 'ckeditor', 'editor_skin' => 'ckeditor',
'editor_colorset' => 'moono-lisa',
'editor_height' => 300, 'editor_height' => 300,
'editor_toolbar' => 'default', 'editor_toolbar' => 'default',
'editor_toolbar_hide' => 'N', 'editor_toolbar_hide' => 'N',
'mobile_editor_skin' => 'simpleeditor',
'mobile_editor_colorset' => 'light',
'mobile_editor_height' => 200, 'mobile_editor_height' => 200,
'mobile_editor_toolbar' => 'simple', 'mobile_editor_toolbar' => 'simple',
'mobile_editor_toolbar_hide' => 'Y', 'mobile_editor_toolbar_hide' => 'Y',
'sel_editor_colorset' => 'moono-lisa',
'comment_editor_skin' => 'ckeditor', 'comment_editor_skin' => 'ckeditor',
'comment_editor_colorset' => 'moono-lisa',
'comment_editor_height' => 100, 'comment_editor_height' => 100,
'comment_editor_toolbar' => 'simple', 'comment_editor_toolbar' => 'simple',
'comment_editor_toolbar_hide' => 'N', 'comment_editor_toolbar_hide' => 'N',
'mobile_comment_editor_skin' => 'simpleeditor',
'mobile_comment_editor_colorset' => 'light',
'mobile_comment_editor_height' => 100, 'mobile_comment_editor_height' => 100,
'mobile_comment_editor_toolbar' => 'simple', 'mobile_comment_editor_toolbar' => 'simple',
'mobile_comment_editor_toolbar_hide' => 'Y', 'mobile_comment_editor_toolbar_hide' => 'Y',
'sel_comment_editor_colorset' => 'moono-lisa',
'content_font' => '', 'content_font' => '',
'content_font_size' => '13px', 'content_font_size' => '13px',
'content_line_height' => '160%', 'content_line_height' => '160%',

View file

@ -85,8 +85,11 @@ class editorController extends editor
*/ */
function procEditorInsertModuleConfig() function procEditorInsertModuleConfig()
{ {
// Get request vars
$vars = Context::getRequestVars();
// To configure many of modules at once // To configure many of modules at once
$target_module_srl = Context::get('target_module_srl'); $target_module_srl = $vars->target_module_srl;
$target_module_srl = array_map('trim', explode(',', $target_module_srl)); $target_module_srl = array_map('trim', explode(',', $target_module_srl));
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
$module_srl = array(); $module_srl = array();
@ -110,56 +113,85 @@ class editorController extends editor
$module_srl[] = $srl; $module_srl[] = $srl;
} }
$editor_config = new stdClass; // Apply default settings?
$editor_config->default_editor_settings = Context::get('default_editor_settings'); $config = new stdClass;
if($editor_config->default_editor_settings !== 'Y') $editor_config->default_editor_settings = 'N'; $config->default_editor_settings = $vars->default_editor_settings;
$editor_config->editor_skin = Context::get('editor_skin'); if ($config->default_editor_settings !== 'Y')
$editor_config->comment_editor_skin = Context::get('comment_editor_skin');
$editor_config->content_font = Context::get('content_font');
if($editor_config->content_font)
{ {
$font_list = array(); $config->default_editor_settings = 'N';
$fonts = explode(',',$editor_config->content_font);
for($i=0,$c=count($fonts);$i<$c;$i++)
{
$font = trim(str_replace(array('"','\''),'',$fonts[$i]));
if(!$font) continue;
$font_list[] = $font;
}
if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"';
} }
$editor_config->content_font_size = Context::get('content_font_size');
$editor_config->sel_editor_colorset = Context::get('sel_editor_colorset');
$editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset');
$grants = array('enable_html_grant','enable_comment_html_grant','upload_file_grant','comment_upload_file_grant','enable_default_component_grant','enable_comment_default_component_grant','enable_component_grant','enable_comment_component_grant'); // Apply module-specific editor settings.
$config->editor_skin = $vars->editor_skin;
$config->editor_colorset = $vars->editor_colorset;
$config->editor_height = $vars->editor_height;
$config->editor_toolbar = $vars->editor_toolbar;
$config->editor_toolbar_hide = $vars->editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->mobile_editor_skin = $vars->mobile_editor_skin;
$config->mobile_editor_colorset = $vars->mobile_editor_colorset;
$config->mobile_editor_height = $vars->mobile_editor_height;
$config->mobile_editor_toolbar = $vars->mobile_editor_toolbar;
$config->mobile_editor_toolbar_hide = $vars->mobile_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->comment_editor_skin = $vars->comment_editor_skin;
$config->comment_editor_colorset = $vars->comment_editor_colorset;
$config->comment_editor_height = $vars->comment_editor_height;
$config->comment_editor_toolbar = $vars->comment_editor_toolbar;
$config->comment_editor_toolbar_hide = $vars->comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->mobile_comment_editor_skin = $vars->mobile_comment_editor_skin;
$config->mobile_comment_editor_colorset = $vars->mobile_comment_editor_colorset;
$config->mobile_comment_editor_height = $vars->mobile_comment_editor_height;
$config->mobile_comment_editor_toolbar = $vars->mobile_comment_editor_toolbar;
$config->mobile_comment_editor_toolbar_hide = $vars->mobile_comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
if ($vars->font_defined === 'Y')
{
$config->font_defined = 'Y';
$config->content_font = $vars->content_font_defined;
}
else
{
$config->font_defined = $vars->font_defined = 'N';
$config->content_font = $vars->content_font;
}
$config->content_font_size = trim($vars->content_font_size);
$config->enable_autosave = $vars->enable_autosave ?: 'Y';
$config->allow_html = $vars->allow_html ?: 'Y';
// Apply module-specific permissions.
$grants = array(
'enable_html_grant',
'enable_comment_html_grant',
'upload_file_grant',
'comment_upload_file_grant',
'enable_default_component_grant',
'enable_comment_default_component_grant',
'enable_component_grant',
'enable_comment_component_grant',
);
foreach($grants as $key) foreach($grants as $key)
{ {
$grant = Context::get($key); $grant = Context::get($key);
if(!$grant) if(!$grant)
{ {
$editor_config->{$key} = array(); $config->{$key} = array();
} }
else if(is_array($grant)) else if(is_array($grant))
{ {
$editor_config->{$key} = $grant; $config->{$key} = $grant;
} }
else else
{ {
$editor_config->{$key} = explode('|@|', $grant); $config->{$key} = explode('|@|', $grant);
} }
} }
$editor_config->editor_height = (int)Context::get('editor_height'); // Save settings.
$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
$editor_config->enable_autosave = Context::get('enable_autosave') ?: 'Y';
$editor_config->allow_html = Context::get('allow_html') ?: 'Y';
$oModuleController = getController('module'); $oModuleController = getController('module');
foreach ($module_srl as $srl) foreach ($module_srl as $srl)
{ {
$oModuleController->insertModulePartConfig('editor', $srl, $editor_config); $oModuleController->insertModulePartConfig('editor', $srl, $config);
} }
$this->setError(-1); $this->setError(-1);

View file

@ -53,7 +53,7 @@ class editorModel extends editor
if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array(); if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
// Load the default config for editor module. // Load the default config for editor module.
$editor_default_config = $oModuleModel->getModuleConfig('editor'); $editor_default_config = $oModuleModel->getModuleConfig('editor') ?: new stdClass;
// Check whether we should use the default config. // Check whether we should use the default config.
if($editor_config->default_editor_settings !== 'Y' && $editor_default_config->editor_skin && $editor_config->editor_skin && $editor_default_config->editor_skin !== $editor_config->editor_skin) if($editor_config->default_editor_settings !== 'Y' && $editor_default_config->editor_skin && $editor_config->editor_skin && $editor_default_config->editor_skin !== $editor_config->editor_skin)
@ -122,21 +122,25 @@ class editorModel extends editor
{ {
$option->editor_skin = $this->default_editor_config['editor_skin']; $option->editor_skin = $this->default_editor_config['editor_skin'];
} }
if (!$option->sel_editor_colorset) if (!$option->editor_colorset)
{ {
$option->sel_editor_colorset = $option->colorset ?: $this->default_editor_config['sel_editor_colorset']; $option->editor_colorset = $option->colorset ?: ($option->sel_editor_colorset ?: $this->default_editor_config['editor_colorset']);
} }
if (!$option->editor_height) if (!$option->editor_height)
{ {
$option->editor_height = $option->height ?: $this->default_editor_config['editor_height']; $option->editor_height = $option->height ?: $this->default_editor_config['editor_height'];
} }
if ($option->editor_skin === 'ckeditor' && preg_match('/^(?:white|black)(_text_(?:use|no)html)?$/', $option->sel_editor_colorset)) if ($option->editor_skin === 'ckeditor' && !in_array($option->editor_colorset, array('moono', 'moono-dark', 'moono-lisa')))
{ {
$option->sel_editor_colorset = 'moono-lisa'; $option->editor_colorset = 'moono-lisa';
}
if ($option->editor_skin === 'simpleeditor' && !in_array($option->editor_colorset, array('light', 'dark')))
{
$option->editor_colorset = 'light';
} }
Context::set('skin', $option->editor_skin); Context::set('skin', $option->editor_skin);
Context::set('editor_path', $this->module_path . 'skins/' . $option->editor_skin . '/'); Context::set('editor_path', $this->module_path . 'skins/' . $option->editor_skin . '/');
Context::set('colorset', $option->sel_editor_colorset); Context::set('colorset', $option->editor_colorset);
Context::set('editor_height', $option->editor_height); Context::set('editor_height', $option->editor_height);
Context::set('editor_toolbar', $option->editor_toolbar); Context::set('editor_toolbar', $option->editor_toolbar);
Context::set('editor_toolbar_hide', toBool($option->editor_toolbar_hide)); Context::set('editor_toolbar_hide', toBool($option->editor_toolbar_hide));
@ -269,6 +273,8 @@ class editorModel extends editor
} }
if ($is_mobile) if ($is_mobile)
{ {
$option->editor_skin = $option->mobile_editor_skin ?: $option->editor_skin;
$option->editor_colorset = $option->mobile_editor_colorset ?: ($option->editor_colorset ?: $option->sel_editor_colorset);
$option->editor_height = $option->mobile_editor_height; $option->editor_height = $option->mobile_editor_height;
$option->editor_toolbar = $option->mobile_editor_toolbar; $option->editor_toolbar = $option->mobile_editor_toolbar;
$option->editor_toolbar_hide = $option->mobile_editor_toolbar_hide; $option->editor_toolbar_hide = $option->mobile_editor_toolbar_hide;
@ -281,18 +287,20 @@ class editorModel extends editor
{ {
$option->$key = $val; $option->$key = $val;
} }
$option->editor_skin = $option->comment_editor_skin; $option->editor_skin = $option->comment_editor_skin ?: $option->editor_skin;
$option->sel_editor_colorset = $option->sel_comment_editor_colorset; $option->editor_colorset = $option->comment_editor_colorset ?: ($option->editor_colorset ?: $option->sel_editor_colorset);
$option->upload_file_grant = $option->comment_upload_file_grant;
$option->enable_default_component_grant = $option->enable_comment_default_component_grant;
$option->enable_component_grant = $option->enable_comment_component_grant;
$option->enable_html_grant = $option->enable_comment_html_grant;
$option->editor_height = $option->comment_editor_height; $option->editor_height = $option->comment_editor_height;
$option->editor_toolbar = $option->comment_editor_toolbar; $option->editor_toolbar = $option->comment_editor_toolbar;
$option->editor_toolbar_hide = $option->comment_editor_toolbar_hide; $option->editor_toolbar_hide = $option->comment_editor_toolbar_hide;
$option->enable_autosave = 'N'; $option->enable_autosave = 'N';
$option->upload_file_grant = $option->comment_upload_file_grant;
$option->enable_default_component_grant = $option->enable_comment_default_component_grant;
$option->enable_component_grant = $option->enable_comment_component_grant;
$option->enable_html_grant = $option->enable_comment_html_grant;
if ($is_mobile) if ($is_mobile)
{ {
$option->editor_skin = $option->mobile_comment_editor_skin ?: ($option->comment_editor_skin ?: $option->editor_skin);
$option->editor_colorset = $option->mobile_comment_editor_colorset ?: ($option->comment_editor_colorset ?: ($option->editor_colorset ?: $option->sel_editor_colorset));
$option->editor_height = $option->mobile_comment_editor_height; $option->editor_height = $option->mobile_comment_editor_height;
$option->editor_toolbar = $option->mobile_comment_editor_toolbar; $option->editor_toolbar = $option->mobile_comment_editor_toolbar;
$option->editor_toolbar_hide = $option->mobile_comment_editor_toolbar_hide; $option->editor_toolbar_hide = $option->mobile_comment_editor_toolbar_hide;

View file

@ -123,23 +123,46 @@ class editorView extends editor
$current_module_srl = $current_module_info->module_srl; $current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new BaseObject(); if(!$current_module_srl) return new BaseObject();
} }
// Get editors settings // Get editors settings
$oModuleModel = getModel('module');
$oEditorModel = getModel('editor'); $oEditorModel = getModel('editor');
$editor_config = $oEditorModel->getEditorConfig($current_module_srl); $editor_config = $oEditorModel->getEditorConfig($current_module_srl);
if (!is_object($editor_config))
{
$editor_config = new stdClass();
}
// Use default config for missing values.
foreach ($this->default_editor_config as $key => $val)
{
if (!isset($editor_config->$key))
{
$editor_config->$key = $val;
}
}
// Get skin info
$editor_skin_list = array();
$skin_dir_list = FileHandler::readDir($this->module_path . 'skins');
foreach ($skin_dir_list as $skin)
{
if (starts_with('xpresseditor', $skin) || starts_with('dreditor', $skin))
{
continue;
}
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin);
foreach ($skin_info->colorset ?: [] as $colorset)
{
unset($colorset->screenshot);
}
$editor_skin_list[$skin] = $skin_info;
}
Context::set('editor_config', $editor_config); Context::set('editor_config', $editor_config);
$oModuleModel = getModel('module');
// Get a list of editor skin
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
$editor_skin_list = array_filter($editor_skin_list, function($name) { return !starts_with('xpresseditor', $name) && !starts_with('dreditor', $name); });
Context::set('editor_skin_list', $editor_skin_list); Context::set('editor_skin_list', $editor_skin_list);
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
Context::set('editor_colorset_list', $skin_info->colorset);
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->comment_editor_skin);
Context::set('editor_comment_colorset_list', $skin_info->colorset);
// Get a group list // Get a group list
$oMemberModel = getModel('member'); $oMemberModel = getModel('member');
$site_module_info = Context::get('site_module_info'); $site_module_info = Context::get('site_module_info');

View file

@ -2,13 +2,13 @@
$lang->editor_component = 'Editor Component'; $lang->editor_component = 'Editor Component';
$lang->main_editor = 'Main Editor'; $lang->main_editor = 'Main Editor';
$lang->comment_editor = 'Comment Editor'; $lang->comment_editor = 'Comment Editor';
$lang->guide_editor_skin = 'Editor Skin';
$lang->guide_editor_height = 'Height';
$lang->guide_editor_toolbar = 'Toolbar';
$lang->editor_toolbar_default = 'Default';
$lang->editor_toolbar_simple = 'Simple';
$lang->editor_toolbar_hide = 'Hidden';
$lang->editor_common_settings = 'Common Settings'; $lang->editor_common_settings = 'Common Settings';
$lang->guide_choose_main_editor = 'Main editor';
$lang->guide_set_height_main_editor = 'Main editor height';
$lang->guide_set_main_editor_toolbar = 'Main editor toolbar';
$lang->guide_choose_comment_editor = 'Comment editor';
$lang->guide_set_height_comment_editor = 'Comment editor height';
$lang->guide_set_comment_editor_toolbar = 'Comment editor toolbar';
$lang->guide_additional_css = 'Additional CSS Files'; $lang->guide_additional_css = 'Additional CSS Files';
$lang->about_additional_css = 'To load additional CSS files inside the editor, such as web fonts, please enter one URL per line.'; $lang->about_additional_css = 'To load additional CSS files inside the editor, such as web fonts, please enter one URL per line.';
$lang->guide_additional_mobile_css = 'Additional CSS Files for Mobile'; $lang->guide_additional_mobile_css = 'Additional CSS Files for Mobile';

View file

@ -3,12 +3,9 @@ $lang->editor_now = '현재 설정 상태';
$lang->editor_component = '에디터 컴포넌트'; $lang->editor_component = '에디터 컴포넌트';
$lang->main_editor = '본문 에디터'; $lang->main_editor = '본문 에디터';
$lang->comment_editor = '댓글 에디터'; $lang->comment_editor = '댓글 에디터';
$lang->guide_choose_main_editor = '본문 에디터'; $lang->guide_editor_skin = '에디터 스킨';
$lang->guide_set_height_main_editor = '본문 에디터 높이'; $lang->guide_editor_height = '높이';
$lang->guide_set_main_editor_toolbar = '본문 에디터 도구상자'; $lang->guide_editor_toolbar = '도구상자';
$lang->guide_choose_comment_editor = '댓글 에디터';
$lang->guide_set_height_comment_editor = '댓글 에디터 높이';
$lang->guide_set_comment_editor_toolbar = '댓글 에디터 도구상자';
$lang->editor_toolbar_default = '기본'; $lang->editor_toolbar_default = '기본';
$lang->editor_toolbar_simple = '간단'; $lang->editor_toolbar_simple = '간단';
$lang->editor_toolbar_hide = '숨김'; $lang->editor_toolbar_hide = '숨김';

View file

@ -155,6 +155,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
// https://github.com/rhymix/rhymix/issues/932 // https://github.com/rhymix/rhymix/issues/932
if (CKEDITOR.env.iOS) { if (CKEDITOR.env.iOS) {
settings.ckeconfig.extraPlugins = (settings.ckeconfig.extraPlugins ? (settings.ckeconfig.extraPlugins + ',') : '') + 'divarea,ios_enterkey'; settings.ckeconfig.extraPlugins = (settings.ckeconfig.extraPlugins ? (settings.ckeconfig.extraPlugins + ',') : '') + 'divarea,ios_enterkey';
settings.ckeconfig.removePlugins = (settings.ckeconfig.removePlugins ? (settings.ckeconfig.removePlugins + ',') : '') + 'enterkey';
settings.loadXeComponent = false; settings.loadXeComponent = false;
var additional_styles = '.cke_wysiwyg_div { padding: 8px !important; }'; var additional_styles = '.cke_wysiwyg_div { padding: 8px !important; }';
$('head').append('<st' + 'yle>' + additional_styles + css_content.replace(/\.xe_content\.editable/g, '.cke_wysiwyg_div') + '</st' + 'yle>'); $('head').append('<st' + 'yle>' + additional_styles + css_content.replace(/\.xe_content\.editable/g, '.cke_wysiwyg_div') + '</st' + 'yle>');

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<skin version="0.2"> <skin version="0.2">
<title xml:lang="ko">CKEditor 스킨</title> <title xml:lang="ko">CKEditor</title>
<description xml:lang="ko">CKEditor</description> <description xml:lang="ko">CKEditor</description>
<version>1.0.0</version> <version>1.0.0</version>
<date>2015-02-24</date> <date>2015-02-24</date>

View file

@ -0,0 +1,29 @@
.rx_simpleeditor {
width: 100%;
min-height: 60px;
box-sizing: border-box;
outline: 0 solid transparent;
resize: vertical;
overflow-y: auto;
&.light {
border: 1px solid #c4c4c4;
background: #fff;
padding: 10px;
}
&.dark {
border-color: #111;
background: #333;
color: #fff;
}
iframe {
max-width: 100%;
padding: 5px 0;
}
img {
max-width: 50%;
padding: 5px 0;
}
img.thumbnail {
max-width: 160px;
}
}

View file

@ -0,0 +1,16 @@
<load target="../../tpl/js/editor_common.js" />
<load target="css/simpleeditor.less" />
<load target="js/simpleeditor.js" />
<load target="js/interface.js" />
<div id="simpleeditor_wrapper_{$editor_sequence}" class="rx_simpleeditor_wrapper">
<div id="simpleeditor_instance_{$editor_sequence}" class="rx_simpleeditor {$colorset} rhymix_content" contenteditable="true"
data-editor-sequence="{$editor_sequence}"
data-editor-primary-key-name="{$editor_primary_key_name}"
data-editor-content-key-name="{$editor_content_key_name}"
data-editor-height="{$editor_height}">
</div>
<!--@if($allow_fileupload)-->
<include target="../ckeditor/file_upload.html" />
<!--@endif-->
</div>

View file

@ -0,0 +1,16 @@
function _getSimpleEditorInstance(editor_sequence) {
return jQuery('#simpleeditor_instance_' + editor_sequence);
}
function editorGetContent(editor_sequence) {
return _getSimpleEditorInstance(editor_sequence).html().escape();
}
function editorReplaceHTML(iframe_obj, content) {
var editor_sequence = parseInt(iframe_obj.id.replace(/^.*_/, ''), 10);
_getSimpleEditorInstance(editor_sequence).html(content);
}
function editorGetIFrame(editor_sequence) {
return _getSimpleEditorInstance(editor_sequence).get(0);
}

View file

@ -0,0 +1,155 @@
"use strict";
(function($) {
// Save the cursor position.
var ranges = [];
var saveSelection = function() {
var sel = window.getSelection();
ranges = [];
if (sel.getRangeAt && sel.rangeCount) {
for (let i = 0; i < sel.rangeCount; i++) {
ranges.push(sel.getRangeAt(i));
}
}
};
// Insert content at cursor position.
var insertContent = function(instance, content) {
if (content.match(/<(audio|video)\b[^>]+>(<\/p>)?/)) {
content = content + '<p><br></p>';
}
if (ranges.length) {
var range = ranges[0];
range.collapse(false);
ranges = [];
} else {
var range = document.createRange();
range.selectNodeContents(instance.get(0));
range.collapse(false);
}
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
if (String(navigator.userAgent).match(/Trident\/7/)) {
range.insertNode(range.createContextualFragment(content));
range.collapse(false);
} else {
document.execCommand('insertHTML', false, content);
}
};
// Simplify HTML content by removing unnecessary tags.
var simplifyContent = function(str) {
str = String(str);
str = str.replace(/<!--(.*?)-->/gs, '');
str = str.replace(/<\/?(\?xml|meta|link|font|span|style|script|noscript|frame|noframes|(?:st1|o):[a-z0-9]+)\b[^>]*?>/ig, '');
str = str.replace(/(id|class|style|on(?:[a-z0-9]+)|Mso(?:[a-z0-9]+))="[^"]*"/ig, '');
str = str.replace(/(<\/?)div(\W)/g, '$1p$2');
return str;
};
// Convert YouTube links.
var convertYouTube = function(str) {
var regexp = /https?:\/\/(www\.youtube(?:-nocookie)?\.com\/(?:watch\?v=|v\/|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]+)\S*/g;
var embed = '<iframe width="560" height="315" src="https://www.youtube.com/embed/$2" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><p></p>';
return String(str).replace(regexp, embed);
};
// Page load event handler.
$(function() {
$('.rx_simpleeditor').each(function() {
// Load editor info.
var editor = $(this);
var editor_sequence = editor.data('editor-sequence');
var content_key = editor.data('editor-content-key-name');
var primary_key = editor.data('editor-primary-key-name');
var insert_form = editor.closest('form');
var content_input = insert_form.find('input,textarea').filter('[name=' + content_key + ']');
var editor_height = editor.data('editor-height');
if (editor_height) {
editor.css('height', editor_height + 'px');
}
// Set editor sequence and other info to the form.
insert_form[0].setAttribute('editor_sequence', editor_sequence);
editorRelKeys[editor_sequence] = {};
editorRelKeys[editor_sequence].primary = insert_form.find("input[name='" + primary_key + "']");
editorRelKeys[editor_sequence].content = content_input;
editorRelKeys[editor_sequence].func = editorGetContent;
// Force <p> as paragraph separator.
document.execCommand('defaultParagraphSeparator', false, 'p');
// Capture some simple keyboard shortcuts.
editor.on('keydown', function(event) {
if (!event.ctrlKey) {
return;
}
var char = String.fromCharCode(event.which).toLowerCase();
if (char === 'b') {
document.execCommand('bold');
event.preventDefault();
}
if (char === 'i') {
document.execCommand('italic');
event.preventDefault();
}
if (char === 'u') {
document.execCommand('underline');
event.preventDefault();
}
});
// Save cursor position on moseup & keyup.
editor.on('mouseup keyup', function() {
saveSelection();
});
// Clean up pasted content.
editor.on('paste', function(event) {
var clipboard_data = (event.clipboardData || window.clipboardData || event.originalEvent.clipboardData);
if (typeof clipboard_data !== 'undefined') {
var content = clipboard_data.getData('text/html');
if (content === '') {
content = clipboard_data.getData('text');
}
} else {
return;
}
content = convertYouTube(simplifyContent(content));
insertContent(editor, content);
event.preventDefault();
});
// Load existing content.
if (content_input.size()) {
editor.html(content_input.val());
}
// Copy edited content to the actual input element.
editor.on('input blur mouseup keyup', function() {
var content = simplifyContent(editor.html());
content_input.val(content);
});
});
});
// Simulate CKEditor for file upload integration.
window._getCkeInstance = function(editor_sequence) {
var instance = $('#simpleeditor_instance_' + editor_sequence);
return {
getData: function() {
return String(instance.html());
},
setData: function(content) {
instance.html(content);
},
insertHtml: function(content) {
insertContent(instance, content);
}
};
};
})(jQuery);

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<skin version="0.2">
<title xml:lang="ko">SimpleEditor</title>
<description xml:lang="ko">SimpleEditor</description>
<version>1.0.0</version>
<date>2020-07-07</date>
<colorset>
<color name="light">
<title xml:lang="ko">Light</title>
</color>
<color name="dark">
<title xml:lang="ko">Dark</title>
</color>
</colorset>
</skin>

View file

@ -35,39 +35,59 @@
<h1>{$lang->main_editor}</h1> <h1>{$lang->main_editor}</h1>
<div class="x_control-group"> <div class="x_control-group">
<label for="change_lang_type" class="x_control-label">{$lang->guide_choose_main_editor}</label> <label for="change_lang_type" class="x_control-label">{$lang->pc}</label>
<div class="x_controls"> <div class="x_controls">
<!--@foreach($editor_skin_list as $editor)--> <p>
<label class="x_inline" id="label_doc_{$editor}"> <select name="editor_skin" class="editor_skin_selector">
<input type="radio" name="editor_skin" value="{$editor}" id="doc_{$editor}" onClick="getEditorSkinColorList(this.value, null, 'document','label_doc_{$editor}')" checked="checked"|cond="$editor==$editor_config->editor_skin" /> {$editor} <!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
</label> <option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->editor_skin">{$skin_info->title}</option>
<label class="x_inline"> <!--@endforeach-->
<select name="sel_editor_colorset" style="display:none"|cond="$editor!=$editor_config->editor_skin">
<option value="{$val->name}" selected="selected"|cond="$editor_config->sel_editor_colorset == $val->name" cond="$editor==$editor_config->editor_skin" loop="$editor_colorset_list=>$key,$val">{$val->title}</option>
</select> </select>
</label> <select name="editor_colorset" class="editor_colorset_selector">
<br /> <!--@foreach($editor_skin_list[$editor_config->editor_skin]->colorset ?: [] as $colorset)-->
<!--@end--> <option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->editor_colorset">{$colorset->title}</option>
</div> <!--@endforeach-->
</div> </select>
<div class="x_control-group"> </p>
<label for="editor_height" class="x_control-label">{$lang->guide_set_height_main_editor}</label> <p>
<div class="x_controls"> <span class="editor_type">{$lang->guide_editor_height}</span>
<p><span class="editor_type">{$lang->pc}</span> <input type="number" name="editor_height" id="editor_height" value="{$editor_config->editor_height}" /> px</p> <input type="number" name="editor_height" value="{$editor_config->editor_height}" /> px
<p><span class="editor_type">{$lang->mobile}</span> <input type="number" name="mobile_editor_height" id="mobile_editor_height" value="{$editor_config->mobile_editor_height}" /> px</p> </p>
</div> <p>
</div> <span class="editor_type">{$lang->guide_editor_toolbar}</span>
<div class="x_control-group"> <select name="editor_toolbar" style="min-width:104px">
<label for="editor_height" class="x_control-label">{$lang->guide_set_main_editor_toolbar}</label> <option value="default" selected="selected"|cond="!$editor_config->editor_toolbar || $editor_config->editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<div class="x_controls"> <option value="default" selected="selected"|cond="$editor_config->editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
<p><span class="editor_type">{$lang->pc}</span> </select> &nbsp;
<label class="x_inline"><input type="radio" name="editor_toolbar" value="default" checked="checked"|cond="!$editor_config->editor_toolbar || $editor_config->editor_toolbar === 'default'"> {$lang->editor_toolbar_default}</label>
<label class="x_inline"><input type="radio" name="editor_toolbar" value="simple" checked="checked"|cond="$editor_config->editor_toolbar === 'simple'"> {$lang->editor_toolbar_simple}</label>
<label class="x_inline"><input type="checkbox" name="editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label> <label class="x_inline"><input type="checkbox" name="editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p> </p>
<p><span class="editor_type">{$lang->mobile}</span> </div>
<label class="x_inline"><input type="radio" name="mobile_editor_toolbar" value="default" checked="checked"|cond="!$editor_config->mobile_editor_toolbar || $editor_config->mobile_editor_toolbar === 'default'"> {$lang->editor_toolbar_default}</label> </div>
<label class="x_inline"><input type="radio" name="mobile_editor_toolbar" value="simple" checked="checked"|cond="$editor_config->mobile_editor_toolbar === 'simple'"> {$lang->editor_toolbar_simple}</label> <div class="x_control-group">
<label for="editor_height" class="x_control-label">{$lang->mobile}</label>
<div class="x_controls">
<p>
<select name="mobile_editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->mobile_editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
<select name="mobile_editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->mobile_editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->mobile_editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="mobile_editor_height" value="{$editor_config->mobile_editor_height}" /> px</p>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="mobile_editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->mobile_editor_toolbar || $editor_config->mobile_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->mobile_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="mobile_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->mobile_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label> <label class="x_inline"><input type="checkbox" name="mobile_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->mobile_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p> </p>
</div> </div>
@ -76,40 +96,59 @@
<h1>{$lang->comment_editor}</h1> <h1>{$lang->comment_editor}</h1>
<div class="x_control-group"> <div class="x_control-group">
<label for="sel_comment_editor_colorset" class="x_control-label">{$lang->guide_choose_comment_editor}</label> <label for="change_lang_type" class="x_control-label">{$lang->pc}</label>
<div class="x_controls"> <div class="x_controls">
<!--@foreach($editor_skin_list as $editor)--> <p>
<label class="x_inline" id="label_com_{$editor}"> <select name="comment_editor_skin" class="editor_skin_selector">
<input type="radio" name="comment_editor_skin" value="{$editor}" id="com_{$editor}" onclick="getEditorSkinColorList(this.value, null, 'reply','label_com_{$editor}')" checked="checked"|cond="$editor == $editor_config->comment_editor_skin" /> {$editor} <!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
</label> <option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->comment_editor_skin">{$skin_info->title}</option>
<label class="x_inline"> <!--@endforeach-->
<select name="sel_comment_editor_colorset" style="display:none"|cond="$editor!=$editor_config->comment_editor_skin">
<option value="{$val->name}" selected="selected"|cond="$editor_config->sel_comment_editor_colorset == $val->name" cond="$editor==$editor_config->comment_editor_skin" loop="$comment_editor_colorset_list=>$key,$val">{$val->title}</option>
</select> </select>
</label> <select name="comment_editor_colorset" class="editor_colorset_selector">
<br /> <!--@foreach($editor_skin_list[$editor_config->editor_skin]->colorset ?: [] as $colorset)-->
<!--@end--> <option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->comment_editor_colorset">{$colorset->title}</option>
</div> <!--@endforeach-->
</div> </select>
</p>
<div class="x_control-group"> <p>
<label for="comment_editor_height" class="x_control-label">{$lang->guide_set_height_comment_editor}</label> <span class="editor_type">{$lang->guide_editor_height}</span>
<div class="x_controls"> <input type="number" name="comment_editor_height" value="{$editor_config->comment_editor_height}" /> px
<p><span class="editor_type">{$lang->pc}</span> <input type="number" name="comment_editor_height" id="comment_editor_height" value="{$editor_config->comment_editor_height}" /> px</p> </p>
<p><span class="editor_type">{$lang->mobile}</span> <input type="number" name="mobile_comment_editor_height" id="mobile_comment_editor_height" value="{$editor_config->mobile_comment_editor_height}" /> px &nbsp;</p> <p>
</div> <span class="editor_type">{$lang->guide_editor_toolbar}</span>
</div> <select name="editor_toolbar" style="min-width:104px">
<div class="x_control-group"> <option value="default" selected="selected"|cond="!$editor_config->comment_editor_toolbar || $editor_config->comment_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<label for="editor_height" class="x_control-label">{$lang->guide_set_comment_editor_toolbar}</label> <option value="default" selected="selected"|cond="$editor_config->comment_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
<div class="x_controls"> </select> &nbsp;
<p><span class="editor_type">{$lang->pc}</span>
<label class="x_inline"><input type="radio" name="comment_editor_toolbar" value="default" checked="checked"|cond="!$editor_config->comment_editor_toolbar || $editor_config->comment_editor_toolbar === 'default'"> {$lang->editor_toolbar_default}</label>
<label class="x_inline"><input type="radio" name="comment_editor_toolbar" value="simple" checked="checked"|cond="$editor_config->comment_editor_toolbar === 'simple'"> {$lang->editor_toolbar_simple}</label>
<label class="x_inline"><input type="checkbox" name="comment_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->comment_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label> <label class="x_inline"><input type="checkbox" name="comment_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->comment_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p> </p>
<p><span class="editor_type">{$lang->mobile}</span> </div>
<label class="x_inline"><input type="radio" name="mobile_comment_editor_toolbar" value="default" checked="checked"|cond="!$editor_config->mobile_comment_editor_toolbar || $editor_config->mobile_comment_editor_toolbar === 'default'"> {$lang->editor_toolbar_default}</label> </div>
<label class="x_inline"><input type="radio" name="mobile_comment_editor_toolbar" value="simple" checked="checked"|cond="$editor_config->mobile_comment_editor_toolbar === 'simple'"> {$lang->editor_toolbar_simple}</label> <div class="x_control-group">
<label for="editor_height" class="x_control-label">{$lang->mobile}</label>
<div class="x_controls">
<p>
<select name="mobile_comment_editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->mobile_comment_editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
<select name="mobile_comment_editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->mobile_editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->mobile_comment_editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="mobile_comment_editor_height" value="{$editor_config->mobile_comment_editor_height}" /> px</p>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="mobile_comment_editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->mobile_comment_editor_toolbar || $editor_config->mobile_comment_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->mobile_comment_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="mobile_comment_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->mobile_comment_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label> <label class="x_inline"><input type="checkbox" name="mobile_comment_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->mobile_comment_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p> </p>
</div> </div>
@ -120,10 +159,10 @@
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label">{$lang->guide_choose_font_body}</label> <label class="x_control-label">{$lang->guide_choose_font_body}</label>
<div class="x_controls"> <div class="x_controls">
<label style="font-family:''" class="fontSelector"> <label class="x_inline fontSelector">
<input type="radio" name="content_font" id="font_noFont" value="" checked="checked"|cond="!$editor_config->content_font && $editor_config->font_defined != 'Y'" /> none (inherit) <input type="radio" name="content_font" id="font_noFont" value="" checked="checked"|cond="!$editor_config->content_font && $editor_config->font_defined != 'Y'" /> none (inherit)
</label> </label>
<label style="display:inline-block;margin-right:16px;font-family:{$detail}" class="fontSelector" loop="$lang->edit->fontlist=>$name,$detail"> <label style="font-family:{$detail}" class="x_inline fontSelector" loop="$lang->edit->fontlist=>$name,$detail">
{@ $fontname_simplified = trim(array_first(explode(',', $detail)), "'\" ")} {@ $fontname_simplified = trim(array_first(explode(',', $detail)), "'\" ")}
<input type="radio" name="content_font" id="font_{$name}" value="{$detail}" checked="checked"|cond="$editor_config->content_font == $detail && $editor_config->font_defined != 'Y'" /> {$fontname_simplified} <input type="radio" name="content_font" id="font_{$name}" value="{$detail}" checked="checked"|cond="$editor_config->content_font == $detail && $editor_config->font_defined != 'Y'" /> {$fontname_simplified}
</label> </label>

View file

@ -1,3 +1,7 @@
tr.editor_skin td p {
margin-bottom: 6px;
}
.editor_type { .editor_type {
display: inline-block; display: inline-block;
min-width: 60px; min-width: 60px;

View file

@ -1,6 +1,6 @@
<!--%import("filter/insert_editor_module_config.xml")--> <load target="css/editor_module_config.css" />
<load target="js/editor_module_config.js" /> <load target="js/editor_module_config.js" />
<form action="./" method="post" class="section"> <form action="./" method="post" class="section">
<input type="hidden" name="act" value="procEditorInsertModuleConfig" /> <input type="hidden" name="act" value="procEditorInsertModuleConfig" />
<input type="hidden" name="module" value="editor" /> <input type="hidden" name="module" value="editor" />
@ -27,45 +27,137 @@
</td> </td>
</tr> </tr>
<tr class="editor_skin"> <tr class="editor_skin">
<th scope="row" style="text-align:right">{$lang->editor_skin}</th> <th scope="row" style="text-align:right">{$lang->pc}</th>
<td> <td>
<select name="editor_skin" onchange="getEditorSkinColorList(this.value, null, 'document')"> <p>
<option loop="$editor_skin_list => $editor" value="{$editor}" selected="selected"|cond="$editor==$editor_config->editor_skin">{$editor}</option> <select name="editor_skin" class="editor_skin_selector">
</select> <!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<br/> <option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->editor_skin">{$skin_info->title}</option>
<select name="sel_editor_colorset" id="sel_editor_colorset" data-display="none"|cond="!count($editor_colorset_list)"> <!--@endforeach-->
<option loop="$editor_colorset_list => $key, $val" value="{$val->name}" selected="selected"|cond="$editor_config->sel_editor_colorset == $val->name">{$val->title}</option> </select>
</select> <select name="editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="editor_height" value="{$editor_config->editor_height}" /> px
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->editor_toolbar || $editor_config->editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
</td> </td>
<td> <td>
<select name="comment_editor_skin" onchange="getEditorSkinColorList(this.value, null, 'comment')"> <p>
<option loop="$editor_skin_list => $editor" value="{$editor}" selected="selected"|cond="$editor==$editor_config->comment_editor_skin">{$editor}</option> <select name="comment_editor_skin" class="editor_skin_selector">
</select> <!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<br/> <option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->comment_editor_skin">{$skin_info->title}</option>
<select name="sel_comment_editor_colorset" id="sel_comment_editor_colorset" data-display="none"|cond="!count($editor_comment_colorset_list)"> <!--@endforeach-->
<option loop="$editor_comment_colorset_list => $key, $val" value="{$val->name}" selected="selected"|cond="$editor_config->sel_comment_editor_colorset == $val->name">{$val->title}</option> </select>
</select> <select name="comment_editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->comment_editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="comment_editor_height" value="{$editor_config->comment_editor_height}" /> px
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->comment_editor_toolbar || $editor_config->comment_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->comment_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="comment_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->comment_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
</td> </td>
</tr> </tr>
<tr class="editor_skin"> <tr class="editor_skin">
<th scope="row" style="text-align:right">{$lang->editor_height}</th> <th scope="row" style="text-align:right">{$lang->mobile}</th>
<td> <td>
<input type="number" min="0" name="editor_height" value="{$editor_config->editor_height}" /> px <p>
<select name="mobile_editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->mobile_editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
<select name="mobile_editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->mobile_editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->mobile_editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="mobile_editor_height" value="{$editor_config->mobile_editor_height}" /> px</p>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="mobile_editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->mobile_editor_toolbar || $editor_config->mobile_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->mobile_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="mobile_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->mobile_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
</td> </td>
<td> <td>
<input type="number" min="0" name="comment_editor_height" value="{$editor_config->comment_editor_height}" /> px <p>
<select name="mobile_comment_editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->mobile_comment_editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
<select name="mobile_comment_editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->mobile_editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->mobile_comment_editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="mobile_comment_editor_height" value="{$editor_config->mobile_comment_editor_height}" /> px</p>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="mobile_comment_editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->mobile_comment_editor_toolbar || $editor_config->mobile_comment_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->mobile_comment_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="mobile_comment_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->mobile_comment_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
</td> </td>
</tr> </tr>
<tr class="editor_skin"> <tr class="editor_skin">
<th scope="row" style="text-align:right"><label for="content_font">{$lang->content_font}</label></th> <th scope="row" style="text-align:right"><label for="content_font">{$lang->content_font}</label></th>
<td colspan="2"> <td colspan="2">
<input type="text" name="content_font" id="content_font" value="{str_replace(array('"','\''),'',$editor_config->content_font)}" placeholder="Ex) Tahoma, Geneva, sans-serif" /> <label class="x_inline fontSelector">
{$lang->about_content_font} <input type="radio" name="content_font" id="font_noFont" value="" checked="checked"|cond="!$editor_config->content_font && $editor_config->font_defined != 'Y'" /> none (inherit)
</label>
<label style="font-family:{$detail}" class="x_inline fontSelector" loop="$lang->edit->fontlist=>$name,$detail">
{@ $fontname_simplified = trim(array_first(explode(',', $detail)), "'\" ")}
<input type="radio" name="content_font" id="font_{$name}" value="{$detail}" checked="checked"|cond="$editor_config->content_font == $detail && $editor_config->font_defined != 'Y'" /> {$fontname_simplified}
</label>
<label>
<input type="radio" class="fontSelector" name="font_defined" id="font_defined" value="Y" checked="checked"|cond="$editor_config->font_defined== 'Y'" /> {$lang->by_you} :
<input type="text" name="content_font_defined" value="{$editor_config->content_font}"|cond="$editor_config->font_defined == 'Y'" />
</label>
</td> </td>
</tr> </tr>
<tr class="editor_skin"> <tr class="editor_skin">
<th scope="row" style="text-align:right"><label for="content_font_size">{$lang->content_font_size}</label></th> <th scope="row" style="text-align:right"><label for="content_font_size">{$lang->content_font_size}</label></th>
<td colspan="2"><input type="text" name="content_font_size" id="content_font_size" value="{$editor_config->content_font_size}" style="width:50px" /> {$lang->about_content_font_size}</td> <td colspan="2">
<input type="text" id="font_size" name="content_font_size" value="{$editor_config->content_font_size ?: 13}" />
<p class="x_help-inline">{$lang->about_unit_default_px}</p>
</td>
</tr> </tr>
<tr class="editor_skin"> <tr class="editor_skin">
<th scope="row" style="text-align:right">{$lang->enable_autosave}</th> <th scope="row" style="text-align:right">{$lang->enable_autosave}</th>

View file

@ -1,55 +1,21 @@
function getEditorSkinColorList(skin_name,selected_colorset,type,testid){ "use strict";
if(skin_name.length>0){
type = type || 'document';
var response_tags = new Array('error','message','colorset');
exec_xml('editor','dispEditorSkinColorset',{skin:skin_name},resultGetEditorSkinColorList,response_tags,{'selected_colorset':selected_colorset,'type':type,'testid':testid});
}
}
function resultGetEditorSkinColorList(ret_obj,response_tags, params) { (function($) {
var selectbox = null; $(function() {
jQuery(function($){ $('.editor_skin_selector').on('change', function() {
if(params.testid){ var colorset_selector = $(this).siblings('.editor_colorset_selector').empty();
selectbox = $("#"+params.testid).next('label').children('select'); var colorset_list = $(this).find('option:selected').data('colorsets');
} else { if (colorset_list && colorset_list.length) {
selectbox = (params.type == 'document') ? $('select[name=sel_editor_colorset]') : $('select[name=sel_comment_editor_colorset]'); $.each(colorset_list, function(i, colorset) {
} var option = $('<option></option>');
selectbox.html(''); option.attr('value', colorset.name);
option.text(colorset.title);
if(params.type == 'document'){ option.appendTo(colorset_selector);
$("select[name=sel_editor_colorset]").hide() if (colorset.title.indexOf('L') > -1) {
.removeAttr('name'); option.attr('selected', 'selected');
selectbox.attr('name','sel_editor_colorset'); }
} else { });
$("select[name=sel_comment_editor_colorset]").hide()
.removeAttr('name');
selectbox.attr('name','sel_comment_editor_colorset');
}
/* jshint -W041 */
if(ret_obj.error == 0 && ret_obj.colorset){
var it = [];
var items = ret_obj.colorset.item;
if(typeof(items[0]) == 'undefined'){
it[0] = items;
} else {
it = items;
} }
});
var selectAttr = "";
for(var i=0;i<it.length;i++){
var $options = $('<option value="'+it[i].name+'" >'+it[i].title+'</option>');
if(params.selected_colorset == it[i].name){
$options.attr('selected', 'selected');
}
selectbox.append($options);
}
selectbox.show();
} else {
selectbox.hide();
selectbox.html('');
}
}); });
} })(jQuery);