Skip to content

Conversation

@puneet0191
Copy link

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.

```
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
Copy link
Contributor

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"
Copy link
Contributor

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
'toolbarButtons' => ['fullscreen', 'bold', 'italic', 'underline', '|', 'paragraphFormat', 'insertImage'],
'imageUploadParam' => 'file',
'imageUploadURL' => \yii\helpers\Url::to(['site/upload/'])
'imageUploadParam' => 'file'
Copy link
Contributor

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"
Copy link
Contributor

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;
Copy link
Contributor

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I understand this change, do you want something like this?

image

Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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?

Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants