-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-29802: Inline custom tags support
- Loading branch information
Showing
22 changed files
with
849 additions
and
577 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/bundle/Resources/public/js/alloyeditor/src/buttons/ez-btn-inlinecustomtag-edit.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import PropTypes from 'prop-types'; | ||
import EzBtnCustomTagEdit from './ez-btn-customtag-edit'; | ||
|
||
export default class EzBtnInlineCustomTagEdit extends EzBtnCustomTagEdit { | ||
getUpdateBtnName() { | ||
return `ezBtn${this.customTagName.charAt(0).toUpperCase() + this.customTagName.slice(1)}Update`; | ||
} | ||
} | ||
|
||
eZ.addConfig('ezAlloyEditor.ezBtnInlineCustomTagEdit', EzBtnInlineCustomTagEdit); | ||
|
||
EzBtnInlineCustomTagEdit.propTypes = { | ||
editor: PropTypes.object.isRequired, | ||
label: PropTypes.string.isRequired, | ||
tabIndex: PropTypes.number.isRequired, | ||
}; |
51 changes: 51 additions & 0 deletions
51
src/bundle/Resources/public/js/alloyeditor/src/buttons/ez-btn-inlinecustomtag-update.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import PropTypes from 'prop-types'; | ||
import EzBtnCustomTagUpdate from './ez-btn-customtag-update'; | ||
|
||
export default class EzBtnInlineCustomTagUpdate extends EzBtnCustomTagUpdate { | ||
/** | ||
* Creates the custom tag in AlloyEditor. | ||
* | ||
* @method saveCustomTag | ||
*/ | ||
saveCustomTag() { | ||
const { createNewTag, editor } = this.props; | ||
const nativeEditor = editor.get('nativeEditor'); | ||
const selection = nativeEditor.getSelectedHtml(); | ||
|
||
nativeEditor.unlockSelection(true); | ||
|
||
if (createNewTag) { | ||
this.execCommand(); | ||
} | ||
|
||
const widget = this.getWidget() || this.widget; | ||
const configValues = Object.assign({}, this.state.values); | ||
|
||
widget.setFocused(true); | ||
|
||
if (createNewTag) { | ||
widget.setName(this.customTagName); | ||
widget.setWidgetContent(selection.getHtml()); | ||
widget.renderIcon(); | ||
} | ||
|
||
widget.clearConfig(); | ||
|
||
Object.keys(this.attributes).forEach((key) => { | ||
widget.setConfig(key, configValues[key].value); | ||
}); | ||
} | ||
} | ||
|
||
eZ.addConfig('ezAlloyEditor.ezBtnInlineCustomTagUpdate', EzBtnInlineCustomTagUpdate); | ||
|
||
EzBtnInlineCustomTagUpdate.defaultProps = { | ||
command: 'ezinlinecustomtag', | ||
modifiesSelection: true, | ||
}; | ||
|
||
EzBtnInlineCustomTagUpdate.propTypes = { | ||
editor: PropTypes.object.isRequired, | ||
label: PropTypes.string.isRequired, | ||
tabIndex: PropTypes.number.isRequired, | ||
}; |
16 changes: 16 additions & 0 deletions
16
src/bundle/Resources/public/js/alloyeditor/src/buttons/ez-btn-inlinecustomtag.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import PropTypes from 'prop-types'; | ||
import EzBtnCustomTag from './ez-btn-customtag'; | ||
|
||
export default class EzBtnInlineCustomTag extends EzBtnCustomTag { | ||
getUpdateBtnName() { | ||
return `ezBtn${this.customTagName.charAt(0).toUpperCase() + this.customTagName.slice(1)}Update`; | ||
} | ||
} | ||
|
||
eZ.addConfig('ezAlloyEditor.ezBtnInlineCustomTag', EzBtnInlineCustomTag); | ||
|
||
EzBtnInlineCustomTag.propTypes = { | ||
editor: PropTypes.object.isRequired, | ||
label: PropTypes.string.isRequired, | ||
tabIndex: PropTypes.number.isRequired, | ||
}; |
Oops, something went wrong.