apostrophe-blocks
Advanced tools
Comparing version 0.5.46 to 0.5.47
{ | ||
"name": "apostrophe-blocks", | ||
"version": "0.5.46", | ||
"version": "0.5.47", | ||
"description": "Allows a column of content to be broken up into blocks with independent templates, allowing for sub-columns to alternate with a full width column for instance. Blocks can be added and removed freely.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
function AposBlocks() { | ||
var self = this; | ||
$(function() { | ||
// body event handlers must not be inside enable where | ||
// they would get added over and over for each new $el, | ||
// resulting in unexpected behavior. There is only one body. | ||
// -Tom | ||
$('body').on('aposCloseMenus', function() { | ||
$('[data-content-blocks-menu-options]').toggleClass('open', false); | ||
$('[data-content-block-menu-options]').toggleClass('open', false); | ||
$('.apos-block-group-controls').toggleClass('open', false); | ||
$('[data-content-blocks-menu]').toggleClass('open', false); | ||
}); | ||
// listen for editor modifier keys | ||
var modifierOn = false; | ||
$('body').on('keydown', function(e) { | ||
if (e.keyCode === 16) { | ||
$('[data-move-block]').each(function() { | ||
var $self = $(this); | ||
if ($self.attr('data-move-block') === 'up') { | ||
$self.children('i').toggleClass('icon-double-angle-up'); | ||
$self.attr('data-move-block', 'top'); | ||
} else if ($self.attr('data-move-block') === 'down') { | ||
$self.children('i').toggleClass('icon-double-angle-down'); | ||
$self.attr('data-move-block', 'bottom'); | ||
} | ||
modifierOn = true; | ||
}); | ||
} | ||
}); | ||
$('body').on('keyup', function(e) { | ||
if (modifierOn === true) { | ||
$('[data-move-block]').each(function() { | ||
var $self = $(this); | ||
$self.children('i').removeClass('icon-double-angle-up'); | ||
$self.children('i').removeClass('icon-double-angle-down'); | ||
if ($self.attr('data-move-block') === 'top') { | ||
$self.attr('data-move-block', 'up'); | ||
} else if ($self.attr('data-move-block') === 'bottom') { | ||
$self.attr('data-move-block', 'down'); | ||
} | ||
modifierOn = false; | ||
}); | ||
} | ||
}); | ||
}); | ||
self.enable = function($el) { | ||
@@ -82,8 +130,2 @@ if ($el.data('aposBlocksEnabled')) { | ||
// DROPDOWN TOGGLE | ||
$('body').on('aposCloseMenus', function() { | ||
$('[data-content-block-menu-options]').toggleClass('open', false); | ||
$('.apos-block-controls').toggleClass('open', false); | ||
}); | ||
$el.on('click', '[data-content-block-menu-toggle]', function() { | ||
@@ -119,36 +161,2 @@ var opened; | ||
// listen for editor modifier keys | ||
var modifierOn = false; | ||
$('body').on('keydown', function(e) { | ||
if (e.keyCode === 16) { | ||
$('[data-move-block]').each(function() { | ||
$self = $(this); | ||
if ($self.attr('data-move-block') === 'up') { | ||
$self.children('i').toggleClass('icon-double-angle-up'); | ||
$self.attr('data-move-block', 'top'); | ||
} else if ($self.attr('data-move-block') === 'down') { | ||
$self.children('i').toggleClass('icon-double-angle-down'); | ||
$self.attr('data-move-block', 'bottom'); | ||
} | ||
modifierOn = true; | ||
}); | ||
} | ||
}); | ||
$('body').on('keyup', function(e) { | ||
if (modifierOn === true) { | ||
$('[data-move-block]').each(function() { | ||
$self = $(this); | ||
$self.children('i').removeClass('icon-double-angle-up'); | ||
$self.children('i').removeClass('icon-double-angle-down'); | ||
if ($self.attr('data-move-block') === 'top') { | ||
$self.attr('data-move-block', 'up'); | ||
} else if ($self.attr('data-move-block') === 'bottom') { | ||
$self.attr('data-move-block', 'down'); | ||
} | ||
modifierOn = false; | ||
}); | ||
} | ||
}); | ||
$el.on('click', '[data-switch-block]', function() { | ||
@@ -172,3 +180,3 @@ $('body').trigger('aposCloseMenus'); | ||
if (!opened) { | ||
$(this).closest('.apos-block-group-controls').toggleClass('open'); | ||
$(this).closest('.apos-block-group-controls').toggleClass('open', true); | ||
$(this).next('[data-content-blocks-menu-options]').toggleClass('open', true); | ||
@@ -181,8 +189,2 @@ } | ||
}); | ||
$('body').on('aposCloseMenus', function() { | ||
$('[data-content-blocks-menu-options]').toggleClass('open', false); | ||
$('.apos-block-group-controls').toggleClass('open', false); | ||
$('[data-content-blocks-menu]').toggleClass('open', false); | ||
}); | ||
}; | ||
@@ -227,3 +229,3 @@ | ||
// return; | ||
} | ||
}; | ||
@@ -230,0 +232,0 @@ self.auto = function() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27132
495