Closed sergeynilov closed 2 years ago
Hello, these classes are being resolved from the Larave container. So you can simply create your class, and extend your class from your respective editor class, then bind in the service provider. For example, to extend AssetRepository create a new file "app/Vendor/Editor/AssetRepository.php" (you can place it anywhere in your project )
<?php
namespace App\Vendor\Editor;
use Dotlogics\Grapesjs\App\Repositories\AssetRepository as BaseAssetRepository;
class AssetRepository extends BaseAssetRepository
{
//Override any method you want from the parent class
}
Then in the boot method of your AppServiceProvider
bind your new class
use App\Vendor\Editor\AssetRepository;
use Dotlogics\Grapesjs\App\Repositories\AssetRepository as BaseAssetRepository;
/**
* Bootstrap your package's services.
*
* @return void
*/
public function boot()
{
$this->app->bind(BaseAssetRepository::class, AssetRepository::class);
}
Hopefully it resolved your problem.
Thanks for your feedback! It was usefull and I found how to manage server part on laravel. But I need to add additive parameter to url laravel-grapesjs.assets.upload_url from client side.
Any hint where on client side url above is fetched ?
I need to edit public/vendor/laravel-grapesjs/assets/editor.js file anyway - I can not do it in another way. All images has category and editors page has selection category input. I need to add selected category id to this assets.upload_url ...
@sergeynilov There are multiple ways to override upload URL.
laravel-grapesjs.assets.upload_url
getUploadUrl
in AssetRepository
-- This method sends the upload URL to the editor. You can override that method.
Hello, Working with "jd-dotlogics/laravel-grapesjs": "^3" I need to extend data returned from server's requests. I found that server's requests are implemented in /vendor/jd-dotlogics/laravel-grapesjs/src/App/Repositories/AssetRepository.php /vendor/jd-dotlogics/laravel-grapesjs/src/App/Editor/AssetManager.php files. I can not edit these files, as any file any “/vendor” subdirectory would be overwritten by composer. If there is a way to use copied under project directories these files and use them, modifying where I need it ?
Thanks!