Skip to content

Commit

Permalink
EZP-30393: Moved all Online Editor front-end code to the RichText Bun…
Browse files Browse the repository at this point in the history
…dle (ezsystems#46)
  • Loading branch information
dew326 authored and lserwatka committed Aug 28, 2019
1 parent c4a9dd4 commit 885a744
Show file tree
Hide file tree
Showing 139 changed files with 11,165 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"plugins": ["react"],
"extends": ["eslint:recommended", "plugin:react/recommended"],
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"rules": {
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"constructor-super": "warn",
"valid-typeof": "warn",
"no-extra-semi": "error",
"no-extra-boolean-cast": "off",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"jsx-quotes": ["error", "prefer-double"],
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
"eqeqeq": ["error", "always"],
"indent": ["error", 4]
}
}
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 140,
"tabWidth": 4,
"semi": true,
"bracketSpacing": true,
"jsxBracketSameLine": true,
"arrowParens": "always",
"singleQuote": true,
"trailingComma": "es5"
}
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"symfony/options-resolver": "^4.3",
"symfony/validator": "^4.3",
"symfony/cache": "^4.3",
"symfony/translation": "^4.3",
"symfony/translation-contracts": "^1.1.2",
"twig/twig": "^2.11",
"ezsystems/doctrine-dbal-schema": "^1.0@dev",
"ezsystems/ezpublish-kernel": "^8.0@dev",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace EzSystems\EzPlatformRichTextBundle\DependencyInjection;

use EzSystems\EzPlatformRichText\SPI\Configuration\Provider;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Resource\FileResource;
Expand All @@ -25,6 +26,7 @@ class EzPlatformRichTextExtension extends Extension implements PrependExtensionI
const RICHTEXT_CUSTOM_STYLES_PARAMETER = 'ezplatform.ezrichtext.custom_styles';
const RICHTEXT_CUSTOM_TAGS_PARAMETER = 'ezplatform.ezrichtext.custom_tags';
const RICHTEXT_ALLOY_EDITOR_PARAMETER = 'ezplatform.ezrichtext.alloy_editor';
public const RICHTEXT_CONFIGURATION_PROVIDER_TAG = 'ezplatform.ezrichtext.configuration.provider';

public function getAlias()
{
Expand Down Expand Up @@ -52,6 +54,10 @@ public function load(array $configs, ContainerBuilder $container)
$ezLoader->load('storage_engines/legacy/external_storage_gateways.yaml');
$ezLoader->load('storage_engines/legacy/field_value_converters.yaml');

$container
->registerForAutoconfiguration(Provider::class)
->addTag(static::RICHTEXT_CONFIGURATION_PROVIDER_TAG);

$loader = new Loader\YamlFileLoader(
$container,
new FileLocator(__DIR__ . '/../Resources/config')
Expand All @@ -61,6 +67,8 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('templating.yaml');
$loader->load('form.yaml');
$loader->load('translation.yaml');
$loader->load('configuration.yaml');
$loader->load('api.yaml');

$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
Expand Down
8 changes: 8 additions & 0 deletions src/bundle/Resources/config/api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
_defaults:
autoconfigure: true
autowire: true
public: false

EzSystems\EzPlatformRichText\API\Configuration\ProviderService:
alias: EzSystems\EzPlatformRichText\Configuration\AggregateProvider
28 changes: 28 additions & 0 deletions src/bundle/Resources/config/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
imports:
- { resource: ui/mappers.yaml }

parameters:
# set via compiler pass
ezplatform.ezrichtext.alloy_editor: []

services:
_defaults:
autowire: true
autoconfigure: true
public: false

EzSystems\EzPlatformRichText\Configuration\Provider\CustomStyle:
arguments:
$customStyleConfigurationMapper: '@EzSystems\EzPlatformRichText\Configuration\UI\Mapper\CustomStyle'

EzSystems\EzPlatformRichText\Configuration\Provider\CustomTag:
arguments:
$customTagConfigurationMapper: '@EzSystems\EzPlatformRichText\Configuration\UI\Mapper\CustomTag'

EzSystems\EzPlatformRichText\Configuration\Provider\AlloyEditor:
arguments:
$alloyEditorConfiguration: '%ezplatform.ezrichtext.alloy_editor%'

EzSystems\EzPlatformRichText\Configuration\AggregateProvider:
arguments:
$providers: !tagged ezplatform.ezrichtext.configuration.provider
2 changes: 2 additions & 0 deletions src/bundle/Resources/config/templating.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ services:
$richTextEditConverter: '@ezrichtext.converter.edit.xhtml5'

EzSystems\EzPlatformRichTextBundle\Templating\Twig\Extension\YoutubeIdExtractorExtension: ~

EzSystems\EzPlatformRichTextBundle\Templating\Twig\Extension\RichTextConfigurationExtension: ~
41 changes: 41 additions & 0 deletions src/bundle/Resources/config/ui/mappers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
parameters:
ezrichtext.custom_tags.translation_domain: 'custom_tags'
ezrichtext.custom_styles.translation_domain: 'custom_styles'
ezrichtext.online_editor.translation_domain: 'online_editor'

services:
_defaults:
autowire: true
public: false

# RichText Custom Tags UI config attribute type mappers
EzSystems\EzPlatformRichText\Configuration\UI\Mapper\CustomTag\CommonAttributeMapper:
tags:
- { name: ezrichtext.configuration.custom_tag.mapper, priority: 0 }

EzSystems\EzPlatformRichText\Configuration\UI\Mapper\CustomTag\ChoiceAttributeMapper:
parent: EzSystems\EzPlatformRichText\Configuration\UI\Mapper\CustomTag\CommonAttributeMapper
autowire: true
public: false
tags:
- { name: ezrichtext.configuration.custom_tag.mapper, priority: 10 }

# RichText Custom Tags UI config mapper
EzSystems\EzPlatformRichText\Configuration\UI\Mapper\CustomTag:
arguments:
$customTagsConfiguration: '%ezplatform.ezrichtext.custom_tags%'
$translationDomain: '%ezrichtext.custom_tags.translation_domain%'
$customTagAttributeMappers: !tagged ezrichtext.configuration.custom_tag.mapper

# RichText Custom Styles UI config mapper
EzSystems\EzPlatformRichText\Configuration\UI\Mapper\CustomStyle:
arguments:
$customStylesConfiguration: '%ezplatform.ezrichtext.custom_styles%'
$translationDomain: '%ezrichtext.custom_styles.translation_domain%'

EzSystems\EzPlatformRichText\Configuration\UI\Mapper\OnlineEditorConfigMapper:
alias: EzSystems\EzPlatformRichText\Configuration\UI\Mapper\OnlineEditor

EzSystems\EzPlatformRichText\Configuration\UI\Mapper\OnlineEditor:
arguments:
$translationDomain: '%ezrichtext.online_editor.translation_domain%'
83 changes: 83 additions & 0 deletions src/bundle/Resources/encore/ez.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
const path = require('path');

module.exports = (Encore) => {
Encore.addEntry('ezplatform-richtext-onlineeditor-js', [
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-anchor.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-anchoredit.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-paragraph.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-heading.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-movedown.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-moveup.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-blocktextaligncenter.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-blocktextalignjustify.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-blocktextalignleft.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-blocktextalignright.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-removeblock.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-unorderedlist.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-orderedlist.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-table.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-tablecell.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-tablerow.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-tablecolumn.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-tableremove.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-bold.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-italic.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-underline.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-subscript.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-superscript.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-quote.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-strike.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-link.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-linkedit.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-image.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-imageupdate.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-imagevariation.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-imagelink.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-imagelinkedit.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-embed.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-embedinline.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-embedupdate.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-embedaligncenter.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-embedalignleft.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-embedalignright.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-customtag.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-customtag-edit.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-customtag-update.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-inlinecustomtag.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-inlinecustomtag-edit.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-inlinecustomtag-update.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-attributes-edit.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/buttons/ez-btn-attributes-update.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/ez-add.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/plugins/ez-add-content.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/plugins/ez-move-element.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/plugins/ez-caret.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/plugins/ez-remove-block.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/plugins/ez-embed.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/plugins/ez-focus-block.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/plugins/ez-custom-tag.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/plugins/ez-elements-path.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-paragraph.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-formatted.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-text.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-list-ordered.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-list-unordered.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-list-item.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-table.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-table-row.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-table-cell.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-link.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-heading.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-embed.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-embed-inline.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-image.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-image-link.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-custom-tag.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-inline-custom-tag.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/toolbars/config/ez-custom-style.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/core/table.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/core/ez-custom-tags.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/core/ez-attributes.js'),
path.resolve(__dirname, '../public/js/OnlineEditor/core/base-richtext.js'),
]).addStyleEntry('ezplatform-richtext-onlineeditor-css', [path.resolve(__dirname, '../public/scss/alloyeditor.scss')]);
};
Binary file not shown.
Loading

0 comments on commit 885a744

Please sign in to comment.