Skip to content

Commit

Permalink
IBX-2961: Fixed extensibility point for adding plugins in CKEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
dew326 authored and alongosz committed Jun 13, 2022
1 parent a36ff36 commit e88a5ee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/bundle/DependencyInjection/IbexaFieldTypeRichTextExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Ibexa\Bundle\FieldTypeRichText\DependencyInjection;

use Ibexa\Contracts\Core\Container\Encore\ConfigurationDumper as IbexaEncoreConfigurationDumper;
use Ibexa\Contracts\FieldTypeRichText\Configuration\Provider;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\FileLocator;
Expand All @@ -32,6 +33,12 @@ class IbexaFieldTypeRichTextExtension extends Extension implements PrependExtens

private const RICHTEXT_TEXT_TOOLBAR_NAME = 'text';

private const WEBPACK_CONFIG_NAMES = [
'ibexa.richtext.config.manager.js' => [
'ibexa.richtext.config.manager.js' => [],
],
];

public function getAlias()
{
return self::EXTENSION_NAME;
Expand Down Expand Up @@ -77,6 +84,10 @@ public function load(array $configs, ContainerBuilder $container)
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$this->registerRichTextConfiguration($config, $container);

(new IbexaEncoreConfigurationDumper($container))->dumpCustomConfiguration(
self::WEBPACK_CONFIG_NAMES
);
}

/**
Expand Down
8 changes: 8 additions & 0 deletions src/bundle/Resources/encore/ez.webpack.custom.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const Encore = require('@symfony/webpack-encore');
const path = require('path');
const { styles } = require(path.resolve('./public/bundles/ibexaadminuiassets/vendors/@ckeditor/ckeditor5-dev-utils'));
const ibexaConfigManager = require(path.resolve('./ibexa.webpack.config.manager.js'));
const configManagers = require(path.resolve('./var/encore/ibexa.richtext.config.manager.js'));

Encore.reset();
Encore.setOutputPath('public/assets/richtext/build').setPublicPath('/assets/richtext/build').enableSassLoader().disableSingleRuntimeChunk();
Expand Down Expand Up @@ -53,4 +55,10 @@ customConfig.module.rules.push({
customConfig.module.rules[1] = {};
customConfig.module.rules[2] = {};

configManagers.forEach((configManagerPath) => {
const configManager = require(path.resolve(configManagerPath));

configManager(customConfig, ibexaConfigManager);
});

module.exports = customConfig;

0 comments on commit e88a5ee

Please sign in to comment.