mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Fix #494 add option to control auto-insertion of images in editor
This commit is contained in:
parent
a8a85bd7cb
commit
cd80bcb3a7
8 changed files with 40 additions and 5 deletions
|
|
@ -144,10 +144,12 @@
|
|||
if(result.error == 0) {
|
||||
if(/\.(jpe?g|png|gif)$/i.test(result.source_filename)) {
|
||||
temp_code += '<img src="' + result.download_url + '" alt="' + result.source_filename + '" editor_component="image_link" data-file-srl="' + result.file_srl + '" />';
|
||||
temp_code += "\r\n<p><br></p>\r\n";
|
||||
if (opt.autoinsertImage === 'paragraph') {
|
||||
_getCkeInstance(settings.formData.editor_sequence).insertHtml("<p>" + temp_code + "</p>\n", "unfiltered_html");
|
||||
} else if (opt.autoinsertImage === 'inline') {
|
||||
_getCkeInstance(settings.formData.editor_sequence).insertHtml(temp_code, "unfiltered_html");
|
||||
}
|
||||
}
|
||||
|
||||
_getCkeInstance(settings.formData.editor_sequence).insertHtml(temp_code, "unfiltered_html");
|
||||
} else if (result.message) {
|
||||
alert(result.message);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -184,6 +184,8 @@ class editorAdminController extends editor
|
|||
$config->content_paragraph_spacing = ctype_digit($config->content_paragraph_spacing) ? ($config->content_paragraph_spacing . '%') : $config->content_paragraph_spacing;
|
||||
$config->content_word_break = $configVars->content_word_break;
|
||||
$config->content_word_break = in_array($config->content_word_break, array('normal', 'keep-all', 'break-all', 'none')) ? $config->content_word_break : 'normal';
|
||||
$config->autoinsert_image = $configVars->autoinsert_image;
|
||||
$config->autoinsert_image = in_array($config->autoinsert_image, array('paragraph', 'inline', 'none')) ? $config->autoinsert_image : 'paragraph';
|
||||
|
||||
$oModuleController->insertModuleConfig('editor', $config);
|
||||
$this->setRedirectUrl(Context::get('error_return_url'));
|
||||
|
|
|
|||
|
|
@ -95,6 +95,10 @@ class editorModel extends editor
|
|||
{
|
||||
$editor_config->content_word_break = $editor_default_config->content_word_break;
|
||||
}
|
||||
if((!$editor_config->autoinsert_image && $editor_default_config->autoinsert_image) || $editor_config->default_editor_settings === 'Y')
|
||||
{
|
||||
$editor_config->autoinsert_image = $editor_default_config->autoinsert_image;
|
||||
}
|
||||
if((!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset) || $editor_config->default_editor_settings === 'Y')
|
||||
{
|
||||
$editor_config->sel_editor_colorset = $editor_default_config->sel_editor_colorset;
|
||||
|
|
@ -239,6 +243,7 @@ class editorModel extends editor
|
|||
Context::set('content_line_height', $option->content_line_height);
|
||||
Context::set('content_paragraph_spacing', $option->content_paragraph_spacing);
|
||||
Context::set('content_word_break', $option->content_word_break);
|
||||
Context::set('editor_autoinsert_image', $option->autoinsert_image);
|
||||
Context::set('editor_additional_css', $option->additional_css);
|
||||
|
||||
// Option setting to allow auto-save
|
||||
|
|
@ -430,6 +435,7 @@ class editorModel extends editor
|
|||
$config->content_line_height = $editor_config->content_line_height;
|
||||
$config->content_paragraph_spacing = $editor_config->content_paragraph_spacing;
|
||||
$config->content_word_break = $editor_config->content_word_break;
|
||||
$config->autoinsert_image = $editor_config->autoinsert_image;
|
||||
$config->sel_editor_colorset = $editor_config->sel_editor_colorset;
|
||||
$config->upload_file_grant = $editor_config->upload_file_grant;
|
||||
$config->enable_default_component_grant = $editor_config->enable_default_component_grant;
|
||||
|
|
@ -448,6 +454,7 @@ class editorModel extends editor
|
|||
$config->content_line_height = $editor_config->content_line_height;
|
||||
$config->content_paragraph_spacing = $editor_config->content_paragraph_spacing;
|
||||
$config->content_word_break = $editor_config->content_word_break;
|
||||
$config->autoinsert_image = $editor_config->autoinsert_image;
|
||||
$config->sel_editor_colorset = $editor_config->sel_comment_editor_colorset;
|
||||
$config->upload_file_grant = $editor_config->comment_upload_file_grant;
|
||||
$config->enable_default_component_grant = $editor_config->enable_comment_default_component_grant;
|
||||
|
|
@ -477,6 +484,7 @@ class editorModel extends editor
|
|||
$option->content_line_height = $config->content_line_height;
|
||||
$option->content_paragraph_spacing = $config->content_paragraph_spacing;
|
||||
$option->content_word_break = $config->content_word_break;
|
||||
$option->autoinsert_image = $config->autoinsert_image;
|
||||
$option->additional_css = $config->additional_css;
|
||||
$option->colorset = $config->sel_editor_colorset;
|
||||
// Permission check for file upload
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ $lang->word_break_normal = 'Wrap Asian scripts at character boundary and Latin s
|
|||
$lang->word_break_keep_all = 'Wrap at word boundary';
|
||||
$lang->word_break_break_all = 'Wrap at character boundary';
|
||||
$lang->word_break_none = 'Do not wrap long lines';
|
||||
$lang->guide_choose_autoinsert_image = 'Auto-insert images';
|
||||
$lang->autoinsert_image_paragraph = 'Automatically insert images into editor (after line break at cursor position)';
|
||||
$lang->autoinsert_image_inline = 'Automatically insert images into editor (directly at cursor position)';
|
||||
$lang->autoinsert_image_none = 'Do not auto-insert images into editor';
|
||||
$lang->about_unit_default_px = 'The unit is px unless otherwise specified.';
|
||||
$lang->about_unit_default_percent = 'The unit is % unless otherwise specified.';
|
||||
$lang->font_preview = 'The quick brown fox jumps over the lazy dog.
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ $lang->word_break_normal = '한글은 글자 단위로 줄바꿈, 영문은 단
|
|||
$lang->word_break_keep_all = '모든 언어를 단어 단위로 줄바꿈';
|
||||
$lang->word_break_break_all = '모든 언어를 글자 단위로 줄바꿈';
|
||||
$lang->word_break_none = '줄을 바꾸지 않음';
|
||||
$lang->guide_choose_autoinsert_image = '이미지 자동 삽입';
|
||||
$lang->autoinsert_image_paragraph = '이미지 첨부시 본문에 자동 삽입 (커서 위치에서 줄을 바꾸고 삽입)';
|
||||
$lang->autoinsert_image_inline = '이미지 첨부시 본문에 자동 삽입 (커서 위치에 직접 삽입)';
|
||||
$lang->autoinsert_image_none = '이미지 첨부시 본문에 자동 삽입하지 않음';
|
||||
$lang->about_unit_default_px = '단위를 지정하지 않을 경우 px 단위를 사용합니다.';
|
||||
$lang->about_unit_default_percent = '단위를 지정하지 않을 경우 % 단위를 사용합니다.';
|
||||
$lang->font_preview = 'The quick brown fox jumps over the lazy dog.
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
|
|||
settings.loadXeComponent = false;
|
||||
<!--@endif-->
|
||||
|
||||
<!--@if($module_type === 'comment' || $m)-->
|
||||
<!--@if($module_type === 'comment' || Rhymix\Framework\UA::isMobile())-->
|
||||
settings.ckeconfig.toolbarStartupExpanded = false;
|
||||
<!--@endif-->
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@
|
|||
// uploader
|
||||
var setting = {
|
||||
maxFileSize: {$logged_info->is_admin === 'Y' ? 0 : $file_config->allowed_filesize},
|
||||
maxChunkSize: {$file_config->allowed_chunk_size},
|
||||
maxChunkSize: {$file_config->allowed_chunk_size ?: 0},
|
||||
autoinsertImage: {json_encode($editor_autoinsert_image ?: 'paragraph')},
|
||||
singleFileUploads: true
|
||||
};
|
||||
$container = $('#xefu-container-{$editor_sequence}');
|
||||
|
|
|
|||
|
|
@ -158,6 +158,20 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->guide_choose_autoinsert_image}</label>
|
||||
<div class="x_controls">
|
||||
<label for="autoinsert_image_paragraph">
|
||||
<input type="radio" name="autoinsert_image" id="autoinsert_image_paragraph" value="paragraph" checked="checked"|cond="$editor_config->autoinsert_image == 'paragraph' || !$editor_config->autoinsert_image" /> {$lang->autoinsert_image_paragraph}
|
||||
</label>
|
||||
<label for="autoinsert_image_inline">
|
||||
<input type="radio" name="autoinsert_image" id="autoinsert_image_inline" value="inline" checked="checked"|cond="$editor_config->autoinsert_image == 'inline'" /> {$lang->autoinsert_image_inline}
|
||||
</label>
|
||||
<label for="autoinsert_image_none">
|
||||
<input type="radio" name="autoinsert_image" id="autoinsert_image_none" value="none" checked="checked"|cond="$editor_config->autoinsert_image == 'none'" /> {$lang->autoinsert_image_none}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_clearfix btnArea">
|
||||
<div class="x_pull-right">
|
||||
<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue