-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yii2 Froala Plugin, Update in accordance with Froala PHP SDK #20
base: master
Are you sure you want to change the base?
Conversation
|
||
Either run | ||
|
||
``` | ||
php composer.phar require --prefer-dist froala/yii2-froala-editor | ||
php composer.phar require --prefer-dist froala/wysiwyg-editor-php-sdk | ||
php composer.phar require --prefer-dist bower-asset/froala-wysiwyg-editor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a composer package as well: https://packagist.org/packages/froala/wysiwyg-editor.
"froala/yii2-froala-editor": "^2.6.0" | ||
"froala/yii2-froala-editor": "^2.6.0", | ||
"froala/wysiwyg-editor-php-sdk" : "*", | ||
"bower-asset/froala-wysiwyg-editor": "^2.6.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, there is a compose package: https://packagist.org/packages/froala/wysiwyg-editor.
README.md
Outdated
@@ -132,8 +93,7 @@ For the view: | |||
'theme' => 'royal',//optional: dark, red, gray, royal | |||
'language' => 'en_gb' , | |||
'toolbarButtons' => ['fullscreen', 'bold', 'italic', 'underline', '|', 'paragraphFormat', 'insertImage'], | |||
'imageUploadParam' => 'file', | |||
'imageUploadURL' => \yii\helpers\Url::to(['site/upload/']) | |||
'imageUploadParam' => 'file' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be required.
composer.json
Outdated
"rmrevin/yii2-fontawesome": "^2.0" | ||
"rmrevin/yii2-fontawesome": "^2.0", | ||
"froala/wysiwyg-editor-php-sdk": "*", | ||
"bower-asset/froala-wysiwyg-editor": "^2.6.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the composer package.
src/Module.php
Outdated
@@ -0,0 +1,13 @@ | |||
<?php | |||
|
|||
namespace froala\froalaeditor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's user Froala\Editor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it would be better to use Froala\Editor
instead of froala\froalaeditor
.
{ | ||
// Store the image. | ||
try { | ||
$uploadFolder = $this->module->uploadFolder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use 4 spaces indentation.
class DefaultController extends Controller | ||
{ | ||
// Without false it will give "Bad Request (#400) Unable to verify your data submission." | ||
public $enableCsrfValidation = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we set CSRF and pass it along with imageUploadParams
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or through the requestHeaders
option?
Changed namespace froala/froalaeditor to Froala/Editor
This PR focuses on changes that would add a default controller to the plugin so we can perform actions like imageUploadURL by using Froala's PHP SDK, load it through the yii routes, unlike before where we had to write a custom Controller uploadAction and Model changes, all we need is to setup a module configuration inside web.php config array and then the upload folder path could be fetched from that.