mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-02 16:52:16 +09:00
Move editor frame function to editorView::dispEditorFrame
This commit is contained in:
parent
488181eaae
commit
7d5b78b269
6 changed files with 35 additions and 36 deletions
|
|
@ -3,6 +3,7 @@
|
|||
<grants />
|
||||
<actions>
|
||||
<action name="dispEditorComponentInfo" type="view" />
|
||||
<action name="dispEditorFrame" type="view" />
|
||||
<action name="dispEditorPopup" type="view" />
|
||||
<action name="dispEditorPreview" type="view" />
|
||||
<action name="dispEditorSkinColorset" type="view" permission="all-managers" />
|
||||
|
|
|
|||
|
|
@ -15,6 +15,39 @@ class editorView extends editor
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display editor in an iframe
|
||||
*/
|
||||
function dispEditorFrame()
|
||||
{
|
||||
// Check parent input ID
|
||||
$parent_input_id = Context::get('parent_input_id');
|
||||
Context::addBodyClass('disable_debug_panel');
|
||||
|
||||
// Load editor
|
||||
$oEditorModel = getModel('editor');
|
||||
$option = $oEditorModel->getEditorConfig();
|
||||
$option->editor_skin = 'ckeditor';
|
||||
$option->content_style = 'ckeditor_light';
|
||||
$option->sel_editor_colorset = 'moono-lisa';
|
||||
$option->primary_key_name = 'primary_key';
|
||||
$option->content_key_name = 'content';
|
||||
$option->allow_fileupload = FALSE;
|
||||
$option->enable_autosave = FALSE;
|
||||
$option->enable_default_component = TRUE;
|
||||
$option->enable_component = FALSE;
|
||||
$option->height = 300;
|
||||
$option->editor_focus = 'Y';
|
||||
$editor = $oEditorModel->getEditor(0, $option);
|
||||
Context::set('editor', $editor);
|
||||
|
||||
// Set template
|
||||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile("default_layout");
|
||||
$this->setTemplatePath($this->module_path . 'tpl');
|
||||
$this->setTemplateFile('editor_frame');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Action to get a request to display compoenet pop-up
|
||||
*/
|
||||
|
|
|
|||
32
modules/editor/tpl/editor_frame.html
Normal file
32
modules/editor/tpl/editor_frame.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<script>
|
||||
$(function() {
|
||||
var editor;
|
||||
var parent = window.opener ? window.opener : window.parent;
|
||||
var parent_input = $("#{$parent_input_id}", parent.document);
|
||||
var parent_iframe = parent_input.siblings("iframe.editor_iframe");
|
||||
CKEDITOR.on('instanceReady', function(evt) {
|
||||
editor = evt.editor;
|
||||
editor.setData(parent_input.val());
|
||||
editor.on("resize", function(evt){
|
||||
var height = evt.data.outerHeight;
|
||||
parent_iframe.height(height);
|
||||
});
|
||||
editor.on("change", function() {
|
||||
var content = editor.getData();
|
||||
parent_input.val(content);
|
||||
});
|
||||
parent_iframe.height($(".cke_chrome").parent().height());
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
body { margin: 0; }
|
||||
.wfsr { display: none; }
|
||||
</style>
|
||||
|
||||
<form>
|
||||
<input type="hidden" name="primary_key" id="primary_key" value="" />
|
||||
<input type="hidden" name="content" id="content" value="" />
|
||||
{$editor}
|
||||
</form>
|
||||
Loading…
Add table
Add a link
Reference in a new issue