update
This commit is contained in:
90
core/plugins/Smarty/function.insertCkEditor.php
Normal file
90
core/plugins/Smarty/function.insertCkEditor.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* @author makl
|
||||
*/
|
||||
|
||||
include_once(dirname(__FILE__) . '/function.formField.php');
|
||||
|
||||
//Via PHP
|
||||
function smarty_function_insertCkEditor($params, &$smarty) {
|
||||
$value = "";
|
||||
|
||||
|
||||
if (isset($params['width'])) {
|
||||
$width = $params['width'];
|
||||
}
|
||||
|
||||
if (isset($params['height'])) {
|
||||
$height = $params['height'];
|
||||
}
|
||||
|
||||
if (isset($params['value']) && is_string($params['value'])) {
|
||||
$value = $params['value'];
|
||||
}
|
||||
if (isset($params['name']) && is_string($params['name'])) {
|
||||
$name = $params['name'];
|
||||
}
|
||||
if (isset($params['toolbar']) && is_string($params['toolbar'])) {
|
||||
$toolbar = $params['toolbar'];
|
||||
} else {
|
||||
$toolbar = 'default';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$pathStatic = URL_STATIC_CONTENT;
|
||||
|
||||
//$string[strlen(PATH_STATIC_CONTENT)-1] = NULL;
|
||||
//$var = substr(PATH_STATIC_CONTENT,0,strlen(PATH_STATIC_CONTENT)-1);
|
||||
//Utils::ArrayDisplay($var);
|
||||
$configPatch = $pathStatic."/../Admin/plugins/ckeditor/config.js";
|
||||
if ($toolbar == 'basic') {
|
||||
$configPatch = $pathStatic."/../Admin/plugins/ckeditor/config_panel_makl.js";
|
||||
}
|
||||
|
||||
|
||||
$_SESSION['freekam_path'] = PATH_STATIC_CONTENT;
|
||||
$ckEditor = "
|
||||
<textarea name=\"".$name."\" id=\"".$name."\" width=\"".$width."\" height=\"".$height."\">
|
||||
".$value."
|
||||
</textarea>
|
||||
|
||||
<script>
|
||||
|
||||
var roxyFileman = '".$pathStatic."/../Admin/plugins/ckeditor/plugins/fileman/dev.html';
|
||||
|
||||
CKEDITOR.replace( '".$name."',{
|
||||
filebrowserBrowseUrl:roxyFileman,
|
||||
filebrowserImageBrowseUrl:roxyFileman+'?type=image',
|
||||
removeDialogTabs: 'link:upload;image:upload',
|
||||
height: ".$height.",
|
||||
width: ".$width.",
|
||||
contentsCss: '".$pathStatic."/css/Strona/CKStyle.css',
|
||||
allowedContent: true,
|
||||
customConfig: '".$configPatch."',
|
||||
forcePasteAsPlainText: true,
|
||||
pasteFilter: 'plain-text'
|
||||
});
|
||||
|
||||
CKEDITOR.on('instanceReady', function(event) {
|
||||
event.editor.on('beforeCommandExec', function(event) {
|
||||
// Show the paste dialog for the paste buttons and right-click paste
|
||||
if (event.data.name === 'paste') {
|
||||
event.editor._.forcePasteDialog = true;
|
||||
}
|
||||
// Don't show the paste dialog for Ctrl+Shift+V
|
||||
if (event.data.name === 'pastetext' && event.data.commandData.from === 'keystrokeHandler') {
|
||||
event.cancel();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
";
|
||||
return $ckEditor;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user