Default editor now is ckeditor
This commit is contained in:
parent
bd5c48c698
commit
877b33b265
3 changed files with 65 additions and 15 deletions
|
|
@ -31,6 +31,12 @@ class SlugifyField extends CharField {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
$value=\PhangoApp\PhaUtils\Utils::slugify($value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($value=='')
|
if($value=='')
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class TextHTMLField extends PhangoField {
|
||||||
|
|
||||||
//Delete Javascript tags and simple quotes.
|
//Delete Javascript tags and simple quotes.
|
||||||
|
|
||||||
$txt_without_tags=str_replace(' ', '', strip_tags($value, '<img>') );
|
/*$txt_without_tags=str_replace(' ', '', strip_tags($value, '<img>') );
|
||||||
|
|
||||||
$txt_without_tags=trim(str_replace(' ', '', $txt_without_tags));
|
$txt_without_tags=trim(str_replace(' ', '', $txt_without_tags));
|
||||||
|
|
||||||
|
|
@ -50,15 +50,15 @@ class TextHTMLField extends PhangoField {
|
||||||
if(Utils::$textbb_type=='')
|
if(Utils::$textbb_type=='')
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->value=Utils::unform_text($value);
|
$value=Utils::unform_text($value);
|
||||||
|
|
||||||
}
|
}*/
|
||||||
else
|
/*else
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->value=$value;
|
$this->value=$value;
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
$value=Utils::form_text_html($value, $this->allowedtags);
|
$value=Utils::form_text_html($value, $this->allowedtags);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,48 @@ use PhangoApp\PhaI18n\I18n;
|
||||||
|
|
||||||
class TextAreaEditor extends BaseForm {
|
class TextAreaEditor extends BaseForm {
|
||||||
|
|
||||||
|
public $load_image_url='';
|
||||||
|
|
||||||
|
public function __construct($name, $value, $load_image_url='')
|
||||||
|
{
|
||||||
|
|
||||||
|
parent::__construct($name, $value);
|
||||||
|
$this->load_image_url=$load_image_url;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function form()
|
public function form()
|
||||||
{
|
{
|
||||||
|
|
||||||
//PhangoVar::$arr_cache_jscript[]='tinymce_path.js';
|
//PhangoVar::$arr_cache_jscript[]='tinymce_path.js';
|
||||||
|
|
||||||
|
if(!isset(View::$header['ckeditor']))
|
||||||
|
{
|
||||||
|
|
||||||
|
View::$js[]='jquery.min.js';
|
||||||
|
View::$js[]='ckeditor/ckeditor.js';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<script>
|
||||||
|
$(document).ready( function () {
|
||||||
|
|
||||||
|
//CKEDITOR.replace('.tinymce_editor');
|
||||||
|
CKEDITOR.config.extraPlugins = 'justify';
|
||||||
|
CKEDITOR.config.extraPlugins = "imagebrowser",
|
||||||
|
CKEDITOR.config.imageBrowser_listUrl = "<?php echo $this->load_image_url; ?>"
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
View::$header['ckeditor']=ob_get_contents();
|
||||||
|
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if(!isset(View::$header['tinymce']))
|
if(!isset(View::$header['tinymce']))
|
||||||
{
|
{
|
||||||
View::$js[]='jquery.min.js';
|
View::$js[]='jquery.min.js';
|
||||||
|
|
@ -31,17 +69,23 @@ class TextAreaEditor extends BaseForm {
|
||||||
|
|
||||||
tinymce.init({
|
tinymce.init({
|
||||||
selector: "textarea.tinymce_editor",
|
selector: "textarea.tinymce_editor",
|
||||||
|
|
||||||
//theme: "modern",
|
//theme: "modern",
|
||||||
height: 300,
|
height: 300,
|
||||||
plugins: [
|
plugins: [
|
||||||
"advlist autolink link image lists charmap print preview hr anchor pagebreak",
|
"advlist autolink link image lists charmap print preview hr anchor pagebreak",
|
||||||
"searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
|
"searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
|
||||||
"table contextmenu directionality emoticons template paste textcolor"
|
"table contextmenu directionality emoticons template paste textcolor code"
|
||||||
],
|
],
|
||||||
|
|
||||||
|
relative_urls : false,
|
||||||
|
/
|
||||||
|
image_list: "<?php echo $this->load_image_url; ?>"
|
||||||
|
/*
|
||||||
file_browser_callback: function(field_name, url, type, win){
|
file_browser_callback: function(field_name, url, type, win){
|
||||||
var filebrowser = "<?php echo Routes::make_module_url('gallery', 'index'); ?>";
|
var filebrowser = "<?php echo $this->load_image_url; ?>";
|
||||||
tinymce.activeEditor.windowManager.open({
|
tinymce.activeEditor.windowManager.open({
|
||||||
title : "<?php echo I18n::lang('common', 'load_file', 'Load_image'); ?>",
|
title : "<?php echo I18n::lang('common', 'load_file', 'Load image'); ?>",
|
||||||
width : 520,
|
width : 520,
|
||||||
height : 400,
|
height : 400,
|
||||||
url : filebrowser
|
url : filebrowser
|
||||||
|
|
@ -50,9 +94,9 @@ class TextAreaEditor extends BaseForm {
|
||||||
input : field_name
|
input : field_name
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
});
|
/* });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -67,9 +111,9 @@ class TextAreaEditor extends BaseForm {
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
?>
|
?>
|
||||||
<p><textarea class="tinymce_editor" name="<?php echo $this->name; ?>"><?php echo $this->default_value; ?></textarea></p>
|
<p><textarea class="ckeditor" name="<?php echo $this->name; ?>"><?php echo $this->default_value; ?></textarea></p>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue