Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export default class EzBtnEmbed extends EzEmbedDiscoverContentButton {
* @return {Boolean} True if the command is disabled, false otherwise.
*/
isDisabled() {
console.warn('[DEPRECATED] EzBtnEmbed.isDisabled method is deprecated');
console.warn('[DEPRECATED] it will be removed from ezplatform-admin-ui 2.0');
return !this.props.editor.get('nativeEditor').ezembed.canBeAdded();
}

Expand Down Expand Up @@ -55,13 +57,11 @@ export default class EzBtnEmbed extends EzEmbedDiscoverContentButton {
*/
render() {
const css = 'ae-button ez-btn-ae ez-btn-ae--embed ' + this.getStateClasses();
const disabled = this.isDisabled();
const label = Translator.trans(/*@Desc("Embed")*/ 'embed_btn.label', {}, 'alloy_editor');

return (
<button
className={css}
disabled={disabled}
onClick={this.chooseContent.bind(this)}
tabIndex={this.props.tabIndex}
title={label}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export default class EzBtnImage extends EzEmbedImageButton {
* @return {Boolean} True if the command is disabled, false otherwise.
*/
isDisabled() {
console.warn('[DEPRECATED] EzBtnImage.isDisabled method is deprecated');
console.warn('[DEPRECATED] it will be removed from ezplatform-admin-ui 2.0');
return !this.props.editor.get('nativeEditor').ezembed.canBeAdded();
}

Expand Down Expand Up @@ -56,14 +58,12 @@ export default class EzBtnImage extends EzEmbedImageButton {
* @return {Object} The content which should be rendered.
*/
render() {
const css = 'ae-button ez-btn-ae ez-btn-ae--image ' + this.getStateClasses(),
disabled = this.isDisabled();
const css = 'ae-button ez-btn-ae ez-btn-ae--image ' + this.getStateClasses();
const label = Translator.trans(/*@Desc("Image")*/ 'image_btn.label', {}, 'alloy_editor');

return (
<button
className={css}
disabled={disabled}
onClick={this.chooseContent.bind(this)}
tabIndex={this.props.tabIndex}
title={label}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const ZERO_WIDTH_SPACE = '&#8203;';
init: function(editor) {
editor.ezembed = {
canBeAdded: () => {
const path = editor.elementPath();

return !path || path.contains('table', true) === null;
console.warn('[DEPRECATED] canBeAdded method is deprecated');
console.warn('[DEPRECATED] it will be removed from ezplatform-admin-ui 2.0');
return true;
Copy link
Member

Choose a reason for hiding this comment

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

This method is not needed anymore so we can remove it in 3.0 for BC we need to keep it in 2.5.x.
Please add the deprecation information:

console.warn('[DEPRECATED] canBeAdded method is deprecated');
console.warn('[DEPRECATED] it will be removed from ezplatform-admin-ui 2.0');

The usage of this method can be safely removed from our buttons:
https://github.com/ezsystems/ezplatform-admin-ui/blob/master/src/bundle/Resources/public/js/alloyeditor/src/buttons/ez-btn-image.js#L60 and https://github.com/ezsystems/ezplatform-admin-ui/blob/master/src/bundle/Resources/public/js/alloyeditor/src/buttons/ez-btn-embed.js#L58
Please remove the disable state and the method isDisabled

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All requested changes are done. Also a deprecation warning for EzBtnImage.isDisabled and EzBtnEmbed.isDisabled was added: 8b3687b

},
};

Expand Down