Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

EZP-25626: Add React.js to PlatformUI app and reuse it in Alloy Editor #534

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion Resources/config/yui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ system:
ez-capi:
requires: ['capi']
path: %ez_platformui.public_dir%/js/external/ez-capi.js
react:
path: %ez_platformui.external_assets_public_dir%/vendors/react/react.js
react-dom:
path: %ez_platformui.external_assets_public_dir%/vendors/react/react-dom.js
ez-react:
requires: ['react', 'react-dom']
path: %ez_platformui.public_dir%/js/external/ez-react.js
alloyeditor:
path: %ez_platformui.external_assets_public_dir%/vendors/alloy-editor/dist/alloy-editor/alloy-editor-all.js
requires: ['ez-react']
path: %ez_platformui.external_assets_public_dir%/vendors/alloy-editor/dist/alloy-editor/alloy-editor-no-react.js
ez-alloyeditor:
requires: ['alloyeditor']
path: %ez_platformui.public_dir%/js/external/ez-alloyeditor.js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ YUI.add('ez-alloyeditor-toolbar-config-block-base', function (Y) {
*/
Y.namespace('eZ.AlloyEditorToolbarConfig');

var ReactDOM = Y.eZ.AlloyEditor.ReactDOM;
var ReactDOM = Y.eZ.ReactDOM;

function outlineTotalWidth(block) {
return (
Expand Down
2 changes: 0 additions & 2 deletions Resources/public/js/external/ez-alloyeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ YUI.add('ez-alloyeditor', function (Y) {
Y.namespace('eZ');

Y.eZ.AlloyEditor = AlloyEditor;
Y.eZ.React = Y.eZ.AlloyEditor.React;
Y.eZ.ReactDOM = Y.eZ.AlloyEditor.ReactDOM;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

removing those lines is BC break, so we need to keep the definition of Y.eZ.React and Y.eZ.ReactDOM somehow.

Copy link
Contributor

Choose a reason for hiding this comment

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

but we can deprecate and remove in v2 if needed

13 changes: 13 additions & 0 deletions Resources/public/js/external/ez-react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (C) eZ Systems AS. All rights reserved.
* For full copyright and license information view LICENSE file distributed with this source code.
*/
/* global React, ReactDOM */
YUI.add('ez-react', function (Y) {
"use strict";

Y.namespace('eZ');

Y.eZ.React = React;
Y.eZ.ReactDOM = ReactDOM;
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-blockremove-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand All @@ -32,8 +34,12 @@
requires: ['ez-alloyeditor'],
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-blockremove-tests', function (Y) {
Y.Test.Runner.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-blocktextaligncenter-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand Down Expand Up @@ -36,8 +38,12 @@
requires: ['ez-alloyeditor'],
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-blocktextaligncenter-tests', function (Y) {
Y.Test.Runner.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-blocktextalignjustify-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand Down Expand Up @@ -36,8 +38,12 @@
requires: ['ez-alloyeditor'],
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-blocktextalignjustify-tests', function (Y) {
Y.Test.Runner.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-blocktextalignleft-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand Down Expand Up @@ -36,8 +38,12 @@
requires: ['ez-alloyeditor'],
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-blocktextalignleft-tests', function (Y) {
Y.Test.Runner.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-blocktextalignright-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand Down Expand Up @@ -36,8 +38,12 @@
requires: ['ez-alloyeditor'],
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-blocktextalignright-tests', function (Y) {
Y.Test.Runner.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-embed-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand Down Expand Up @@ -44,8 +46,12 @@
fullpath: "../../../../Resources/public/js/alloyeditor/plugins/embed.js",
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-embed-tests', function (Y) {
Y.Test.Runner.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-embedcenter-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand Down Expand Up @@ -40,8 +42,12 @@
requires: ['ez-alloyeditor'],
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-embedcenter-tests', function (Y) {
Y.Test.Runner.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-embedhref-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand Down Expand Up @@ -46,8 +48,12 @@
fullpath: "../../../../Resources/public/js/alloyeditor/plugins/embed.js",
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-embedhref-tests', function (Y) {
Y.Test.Runner.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-embedleft-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand Down Expand Up @@ -40,8 +42,12 @@
requires: ['ez-alloyeditor'],
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-embedleft-tests', function (Y) {
Y.Test.Runner.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-embedright-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand Down Expand Up @@ -40,8 +42,12 @@
requires: ['ez-alloyeditor'],
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-embedright-tests', function (Y) {
Y.Test.Runner.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-heading-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand All @@ -32,8 +34,12 @@
requires: ['ez-alloyeditor'],
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-heading-tests', function (Y) {
Y.Test.Runner.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<div class="container"></div>
<script type="text/javascript" src="../../assets/function.bind.polyfill.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/yui3/build/yui/yui.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-all.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/react/react-dom.js"></script>
<script type="text/javascript" src="../../../../Resources/public/vendors/alloyeditor/dist/alloy-editor/alloy-editor-no-react.js"></script>
<script type="text/javascript" src="./assets/ez-alloyeditor-button-image-tests.js"></script>
<script>
var filter = (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
Expand Down Expand Up @@ -48,8 +50,12 @@
fullpath: "../../../../Resources/public/js/alloyeditor/plugins/embed.js",
},
"ez-alloyeditor": {
requires: ["ez-react"],
fullpath: "../../../../Resources/public/js/external/ez-alloyeditor.js",
},
"ez-react": {
fullpath: "../../../../Resources/public/js/external/ez-react.js",
},
}
}).use('ez-alloyeditor-button-image-tests', function (Y) {
Y.Test.Runner.run();
Expand Down