Nooku Components is an open source project powered by Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

nooku-components

Commit 1515

User picture
  • Author: stiandidriksen
  • 2012-02-24 08:09 (about 2 years ago)

re #65 now possible to not load CodeMirror

Files Affected

 
15141515
3
/**
3
/**
4
 * @TODO clean up docs
4
 * @TODO clean up docs
5
 *
5
 *
6
 * Usage example:
6
 * Usage example for how to load just TinyMCE:
7
 * <?= @service('com://admin/editors.view.editor.html')->name('text')->data($article->text)->display() ?>
7
 * <?= @service('com://admin/editors.view.editor.html', array('editors' => false))->name('text')->data($article->text)->display() ?>
8
 */
8
 */
9
 
9
 
10
class ComEditorsViewEditorHtml extends ComDefaultViewHtml
10
class ComEditorsViewEditorHtml extends ComDefaultViewHtml
...
 
...
 
19
            $this->_settings = $config->settings;
19
            $this->_settings = $config->settings;
20
        }
20
        }
21
 
21
 
22
        if ($config->editors) {
22
        if (isset($config->editors)) {
23
            $this->_editors = $config->editors;
23
            $this->_editors = $config->editors;
24
        }
24
        }
25
    }
25
    }
...
 
...
 
80
            'layout'   => 'default',
80
            'layout'   => 'default',
81
            //@TODO this is because KControllerResource sets this and we have no controller yet
81
            //@TODO this is because KControllerResource sets this and we have no controller yet
82
            'media_url' => KRequest::root().'/media',
82
            'media_url' => KRequest::root().'/media',
 
 
83
            //Multiple editors
 
 
84
            'editors'   => true,
83
 
85
 
84
            'editors'   => array('tinymce', 'codemirror'),
 
 
85
 
 
 
86
            'settings' => $settings
86
            'settings' => $settings
87
        ));
87
        ));
88
 
88
 
...
 
...
 
96
                'html'        => JText::_('HTML'),
96
                'html'        => JText::_('HTML'),
97
                'visual'    => JText::_('Visual')
97
                'visual'    => JText::_('Visual')
98
            ),
98
            ),
 
 
99
            'codemirror' => (bool) $this->_editors,
99
            'toggle' => $this->toggle
100
            'toggle' => $this->toggle
100
        );
101
        );
101
 
102
 
102
        $this->assign('options' , $options);
103
        $this->assign('options' , $options);
103
        $this->assign('settings', KConfig::unbox($this->_settings));
104
        $this->assign('settings', KConfig::unbox($this->_settings));
104
        $this->assign('editors', KConfig::unbox($this->_editors));
105
        $this->assign('editors', $this->_editors);
105
 
106
 
106
        return parent::display();
107
        return parent::display();
107
    }
108
    }
15141515
1
<style src="media://com_editors/codemirror/css/docs.css" />
1
<style src="media://com_editors/codemirror/css/docs.css" />
2
 
2
<?= var_export( $editors) ?>
3
<?= @template('default_script') ?>
3
<?= @template('default_script') ?>
4
<textarea id="<?= $name ?>" name="<?= $name ?>" cols="75" rows"25" class="editable"><?=
$data ?></textarea>
4
<textarea id="<?= $name ?>" name="<?= $name ?>" cols="75" rows"25" class="editable"><?=
$data ?></textarea>