Add fullpage option to richeditor

This commit is contained in:
Sam Georges 2014-06-06 21:36:55 +10:00
parent 4550f947f9
commit 9a923e3b98
2 changed files with 17 additions and 5 deletions

View File

@ -25,6 +25,8 @@
}
RichEditor.DEFAULTS = {
stylesheet: null,
fullpage: false
}
RichEditor.prototype.init = function (){
@ -40,12 +42,21 @@
/*
* Initialize Redactor editor
*/
this.$textarea.redactor({
iframe: true,
css: this.options.iframeCss,
var redactorOptions = {
focusCallback: function() { self.$el.addClass('editor-focus') },
blurCallback: function() { self.$el.removeClass('editor-focus') }
});
}
if (this.options.stylesheet) {
redactorOptions.iframe = true
redactorOptions.css = this.options.stylesheet
}
if (this.options.fullpage) {
redactorOptions.fullpage = true
}
this.$textarea.redactor(redactorOptions)
}
// RICHEDITOR PLUGIN DEFINITION

View File

@ -4,7 +4,8 @@
<div
id="<?= $this->getId() ?>"
class="field-richeditor size-<?= $size ?> <?= $stretch?'layout-item stretch':'' ?>"
data-iframe-css="<?= URL::to('/modules/backend/formwidgets/richeditor/assets/css/iframe.css') ?>"
data-stylesheet="<?= URL::to('/modules/backend/formwidgets/richeditor/assets/css/iframe.css') ?>"
<?php if ($fullPage): ?>data-fullpage="true"<?php endif ?>
data-control="richeditor">
<textarea name="<?= $name ?>" id="<?= $this->getId('textarea') ?>"><?= e($value) ?></textarea>
</div>