Last active
February 18, 2016 11:06
-
-
Save alnutile/10678198 to your computer and use it in GitHub Desktop.
CKEditor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.editorOptions = { | |
language: 'en', | |
'skin': 'moono', | |
'extraPlugins': "imagebrowser,mediaembed", | |
imageBrowser_listUrl: '/api/v1/ckeditor/gallery', | |
filebrowserBrowseUrl: '/api/v1/ckeditor/files', | |
filebrowserImageUploadUrl: '/api/v1/ckeditor/images', | |
filebrowserUploadUrl: '/api/v1/ckeditor/files', | |
toolbarLocation: 'bottom', | |
toolbar: 'full', | |
toolbar_full: [ | |
{ name: 'basicstyles', | |
items: [ 'Bold', 'Italic', 'Strike', 'Underline' ] }, | |
{ name: 'paragraph', items: [ 'BulletedList', 'NumberedList', 'Blockquote' ] }, | |
{ name: 'editing', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] }, | |
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] }, | |
{ name: 'tools', items: [ 'SpellChecker', 'Maximize' ] }, | |
{ name: 'clipboard', items: [ 'Undo', 'Redo' ] }, | |
{ name: 'styles', items: [ 'Format', 'FontSize', 'TextColor', 'PasteText', 'PasteFromWord', 'RemoveFormat' ] }, | |
{ name: 'insert', items: [ 'Image', 'Table', 'SpecialChar', 'MediaEmbed' ] },'/', | |
] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rel = '/assets/img/wysiwyg'; | |
$dir = public_path() . '/assets/img/wysiwyg'; | |
$iterator = $this->finder->in($dir)->name('*.png')->name('*.jpg'); | |
$files = []; | |
$count = 0; | |
foreach($iterator as $file) { | |
$files[$count]['thumb'] = $rel . '/' . $file->getFilename(); | |
$files[$count]['image'] = $rel . '/' . $file->getFilename(); | |
$files[$count]['title'] = $file->getFilename(); | |
$count ++; | |
} | |
return Response::json($files); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rel = '/assets/files/wysiwyg'; | |
$dir = public_path() . $rel; | |
$_FILES['upload']['type'] = strtolower($_FILES['upload']['type']); | |
if ($_FILES['upload']['type'] == 'application/pdf' | |
|| $_FILES['upload']['type'] == 'image/jpg' | |
|| $_FILES['upload']['type'] == 'image/gif' | |
|| $_FILES['upload']['type'] == 'image/jpeg' | |
|| $_FILES['upload']['type'] == 'application/doc') | |
{ | |
$tmp = $_FILES['upload']['tmp_name']; | |
$dest = $dir . '/' . $_FILES['upload']['name']; | |
$this->filesystem->copy($tmp, $dest, $override = TRUE); | |
$file = '/assets/files/wysiwyg/'.$_FILES['upload']['name']; | |
} | |
$funcNum = $_GET['CKEditorFuncNum']; | |
$message = "File uploaded"; | |
$script = "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction(\"$funcNum\", \"$file\", \"$message\");</script>"; | |
return $script; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment