Add upload button to CKEditor image dialog

This commit is contained in:
Kijin Sung 2024-05-25 00:59:53 +09:00
parent 0c3879d0c8
commit 7af4f93175
3 changed files with 13 additions and 7 deletions

View file

@ -574,16 +574,20 @@
},
validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.image.urlMissing )
},
// Rhymix upload integration
{
type: 'button',
id: 'browse',
// v-align with the 'txtUrl' field.
// TODO: We need something better than a fixed size here.
id: 'rx_upload',
style: 'display:inline-block;margin-top:14px;',
align: 'center',
label: editor.lang.common.browseServer,
hidden: true,
filebrowser: 'info:txtUrl'
label: editor.lang.image.upload,
hidden: !editor.config.rx_allow_upload,
onClick: function() {
const editor_container = _getCkeContainer(editor.config.xe_editor_sequence);
const upload_container = editor_container.nextAll('.xefu-container').first();
upload_container.find('input[type=file]').first().trigger('click');
this.getDialog().hide();
}
} ]
} ]
},

View file

@ -11,6 +11,7 @@ $ckconfig->toolbar = $editor_toolbar ?? 'default';
$ckconfig->hide_toolbar = $editor_toolbar_hide ?? false;
$ckconfig->focus = $editor_focus ?? false;
$ckconfig->ios_patch = (bool)preg_match('/i(Phone|Pad|Pod)/', $_SERVER['HTTP_USER_AGENT'] ?? '');
$ckconfig->allow_upload = $allow_fileupload ?? false;
// Plugin configuration
$ckconfig->add_plugins = $editor_additional_plugins ?: [];

View file

@ -52,7 +52,8 @@ $(function() {
language: config.language,
iframe_attributes: {},
versionCheck: false,
xe_editor_sequence: editor_sequence
rx_allow_upload: config.allow_upload,
xe_editor_sequence: editor_sequence,
},
loadXeComponent: true,
enableToolbar: true