Example #1
0
		block.on('destroy.input', e =>
		{
			if(this.getSelectedBlocks().length > 1)
			{
				if(confirm(Craft.t("Are you sure you want to delete the selected blocks?")))
				{
					this._blockBatch(block, b => this.removeBlock(b))
				}
			}
			else
			{
				this.removeBlock(block)
			}
		})
Example #2
0
		this.trigger('addItem', {
			item: item,
			index: index
		})
	},

	removeItem(item, showConfirm)
	{
		showConfirm = (typeof showConfirm === 'boolean' ? showConfirm : false)

		if(showConfirm)
		{
			const message = Craft.t('Are you sure you want to delete this {type}?', {type:
				item instanceof BlockType ? 'block type' :
				item instanceof Group ? 'group' :
				'item'
			})

			if(confirm(message))
			{
				this.removeItem(item, false)
			}
		}
		else
		{
			const settings = item.getSettings()

			this._itemSort.removeItems(item.$container);

			item.$container.remove()
Example #3
0
Twig.extendFilter('t', function(label, placeholders)
{
	return Craft.t(label, placeholders)
})