Skip to content
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

EZP-30393: Moved all Online Editor front-end code to the RichText Bundle #46

Merged
merged 25 commits into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1bc876e
Moved all Online Editor front-end code from AdminUI
dew326 Jun 13, 2019
dabf235
Implemented UI configuration mappers
alongosz Aug 19, 2019
46f4553
Implemented API ProviderService and SPI config Provider interfaces
alongosz Aug 19, 2019
d12e4f2
Implemented config providers for AlloyEditor, CustomStyle, and CustomTag
alongosz Aug 19, 2019
530a3f1
Implemented RichText configuration Provider Service
alongosz Aug 19, 2019
09d13e4
Configured DIC for Configuration Provider Service and dependencies
alongosz Aug 19, 2019
17c9224
Implemented Twig extension exposing RichText configuration
alongosz Aug 19, 2019
9b6a6ba
Replaced eZ.adminUiConfig references with eZ.richText
alongosz Aug 20, 2019
17666db
Implemented unit tests for Custom Tags and Styles mappers
alongosz Aug 20, 2019
bd8c2a6
Added required Translator dependencies to composer.json
alongosz Aug 20, 2019
5d360b2
Moved fix for JS error with missing element path #1043
dew326 Aug 20, 2019
cf8d087
Moved fix for removed content in embed
dew326 Aug 21, 2019
4dc9b6d
fixup! Implemented UI configuration mappers
alongosz Aug 22, 2019
7458d31
fixup! Implemented Twig extension exposing RichText configuration
alongosz Aug 22, 2019
31ecd7d
fixup! Implemented config providers for AlloyEditor, CustomStyle, and…
alongosz Aug 22, 2019
bddd421
fixup! Implemented unit tests for Custom Tags and Styles mappers
alongosz Aug 22, 2019
6acd3d1
Changed reporting deprecation of ezrichtext.alloy_editor.extra_button
alongosz Aug 22, 2019
00f9278
Added unit test coverage for Configuration\AggregateProvider
alongosz Aug 22, 2019
47a66d6
Added unit test coverage for Configuration\Provider\AlloyEditor
alongosz Aug 22, 2019
d8cb3e0
Refactored Custom Style and Tag config mappers to use common interface
alongosz Aug 22, 2019
99bf08e
Added unit test coverage for Custom Template configuration providers
alongosz Aug 22, 2019
45b1cba
fixup! Configured DIC for Configuration Provider Service and dependen…
alongosz Aug 26, 2019
b333cb1
fixup! Refactored Custom Style and Tag config mappers to use common i…
alongosz Aug 26, 2019
7f25704
fixup! fixup! Implemented Twig extension exposing RichText configuration
alongosz Aug 26, 2019
f3a1427
Moved alloyEditor config to richText namespace
dew326 Aug 27, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
alongosz marked this conversation as resolved.
Show resolved Hide resolved
"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 = 'ezrichtext.configuration.provider';
alongosz marked this conversation as resolved.
Show resolved Hide resolved

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
31 changes: 31 additions & 0 deletions src/bundle/Resources/config/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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\:
alongosz marked this conversation as resolved.
Show resolved Hide resolved
resource: '../../../lib/Configuration/Provider/*'

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 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
alongosz marked this conversation as resolved.
Show resolved Hide resolved
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