Skip to content
Snippets Groups Projects

Issue #3204015: Replace Toolbar BackboneJS usage with VanillaJS equivalent

1 file
+ 10
9
Compare changes
  • Side-by-side
  • Inline
@@ -5,7 +5,6 @@
(function ($, Drupal, drupalSettings, Backbone) {
Drupal.toolbar.ToolbarVisualView = Backbone.View.extend(
/** @lends Drupal.toolbar.ToolbarVisualView# */ {
/**
* Event map for the `ToolbarVisualView`.
@@ -16,7 +15,7 @@
events() {
// Prevents delay and simulated mouse events.
const touchEndToClick = function (event) {
console.log("backbone: touchEndToClick in ToolbarVisualView.es6");
console.log('backbone: touchEndToClick in ToolbarVisualView.es6');
event.preventDefault();
event.target.click();
};
@@ -76,7 +75,7 @@
* @augments Backbone.View
*/
updateToolbarHeight() {
console.log("backbone: updateToolbarHeight() in ToolbarVisualView.es6");
console.log('backbone: updateToolbarHeight() in ToolbarVisualView.es6');
const toolbarTabOuterHeight =
$('#toolbar-bar').find('.toolbar-tab').outerHeight() || 0;
const toolbarTrayHorizontalOuterHeight =
@@ -100,7 +99,7 @@
// to ensure this recalculation happens after changes to visual elements
// have processed.
triggerDisplace() {
console.log("backbone: triggerDisplace() in ToolbarVisualView.es6");
console.log('backbone: triggerDisplace() in ToolbarVisualView.es6');
_.defer(() => {
Drupal.displace(true);
});
@@ -149,7 +148,7 @@
* The event triggered.
*/
onTabClick(event) {
console.log("backbone: onTabClick()");
console.log('backbone: onTabClick()');
// If this tab has a tray associated with it, it is considered an
// activatable tab.
if (event.currentTarget.hasAttribute('data-toolbar-tray')) {
@@ -174,7 +173,7 @@
* The event triggered.
*/
onOrientationToggleClick(event) {
console.log("backbone: onOrientationToggleClick()");
console.log('backbone: onOrientationToggleClick()');
const orientation = this.model.get('orientation');
// Determine the toggle-to orientation.
const antiOrientation =
@@ -206,7 +205,7 @@
* Updates the display of the tabs: toggles a tab and the associated tray.
*/
updateTabs() {
console.log("backbone: updateTabs() in ToolbarVisualView.es6");
console.log('backbone: updateTabs() in ToolbarVisualView.es6');
const $tab = $(this.model.get('activeTab'));
// Deactivate the previous tab.
$(this.model.previous('activeTab'))
@@ -252,7 +251,7 @@
* Update the attributes of the toolbar bar element.
*/
updateBarAttributes() {
console.log("backbone: updateBarAttributes() in ToolbarVisualView.es6");
console.log('backbone: updateBarAttributes() in ToolbarVisualView.es6');
const isOriented = this.model.get('isOriented');
if (isOriented) {
this.$el.find('.toolbar-bar').attr('data-offset-top', '');
@@ -268,7 +267,9 @@
* Updates the orientation of the active tray if necessary.
*/
updateTrayOrientation() {
console.log('backbone: updateTrayOrientation() in ToolbarVisualView.es6');
console.log(
'backbone: updateTrayOrientation() in ToolbarVisualView.es6'
);
const orientation = this.model.get('orientation');
// The antiOrientation is used to render the view of action buttons like
Loading