Removing a component now removes the standard {% component %} tag

This commit is contained in:
Sam Georges 2014-05-24 16:48:36 +10:00
parent 82f586c0d1
commit bd5e169ac1
2 changed files with 19 additions and 4 deletions

View File

@ -1,6 +1,6 @@
* **Build 91** (2014-05-24)
* **Build 92** (2014-05-24)
- Components can now be dragged from the side navigation directly on to the page.
- Asset maker functions (addJs, addCss, addRss) now use an optional build code, either *core* or a plugin code. This is converted to a version number to ensure updates are not affected by cached assets.
- Asset maker methods (addJs, addCss, addRss) now use an optional build code, either *core* or a plugin code. This is converted to a version number to ensure updates are not affected by cached assets.
* **Build 90** (2014-05-23)
- Class `CmsPropertyHelper` has been deprecated, will be removed year > 2014.

View File

@ -464,9 +464,24 @@
* Listen for the click event on the components' remove link
*/
$(document).on('click', '#cms-master-tabs > div.tab-content > .tab-pane.active .control-componentlist a.remove', function(e) {
var pane = $(this).closest('.tab-pane')
$(this).trigger('change')
$(this).closest('div.layout-cell').remove()
var pane = $(this).closest('.tab-pane'),
component = $(this).closest('div.layout-cell')
/*
* Remove any {% component %} tags in the editor for this component
*/
var editor = $('[data-control=codeeditor]', pane)
if (editor.length) {
var alias = $('input[name="component_aliases[]"]', component).val(),
codeEditor = editor.codeEditor('getEditorObject')
codeEditor.replace('', {
needle: "{% component '" + alias + "' %}"
})
}
component.remove()
$(window).trigger('oc.updateUi')
updateComponentListClass(pane)