[IMP] website: remove animate scrolling option for table of content
Part of https://github.com/odoo/odoo/pull/53930 task-2157252
This commit is contained in:
@@ -11,7 +11,6 @@ options.registry.TableOfContent = options.Class.extend({
|
||||
this.targetedElements = 'h1, h2';
|
||||
const $headings = this.$target.find(this.targetedElements);
|
||||
if ($headings.length > 0) {
|
||||
this.isAnimateScrolling = this.$target.find(this.targetedElements)[0].dataset.anchor === 'true' ? true : false;
|
||||
this._generateNav();
|
||||
}
|
||||
// Generate the navbar if the content changes
|
||||
@@ -28,22 +27,6 @@ options.registry.TableOfContent = options.Class.extend({
|
||||
this._generateNav();
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Options
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Animate (or not) scrolling.
|
||||
*
|
||||
* @see this.selectClass for parameters
|
||||
*/
|
||||
animateScrolling: function (previewMode, widgetValue, params) {
|
||||
const $headings = this.$target.find(this.targetedElements);
|
||||
const anchorValue = widgetValue ? 'true' : '0';
|
||||
_.each($headings, el => el.dataset.anchor = anchorValue);
|
||||
this.isAnimateScrolling = !!widgetValue;
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -63,26 +46,10 @@ options.registry.TableOfContent = options.Class.extend({
|
||||
.text($el.text())
|
||||
.appendTo($nav);
|
||||
$el.attr('id', id);
|
||||
$el[0].dataset.anchor = this.isAnimateScrolling === true ? 'true' : '0';
|
||||
$el[0].dataset.anchor = 'true';
|
||||
});
|
||||
$nav.find('a:first').addClass('active');
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
_computeWidgetState: function (methodName, params) {
|
||||
switch (methodName) {
|
||||
case 'animateScrolling': {
|
||||
const $headings = this.$target.find(this.targetedElements);
|
||||
if ($headings.length > 0) {
|
||||
return $headings[0].dataset.anchor === 'true' ? 'true' : '0';
|
||||
} else {
|
||||
return 'true';
|
||||
}
|
||||
}
|
||||
}
|
||||
return this._super(...arguments);
|
||||
},
|
||||
});
|
||||
|
||||
options.registry.TableOfContentNavbar = options.Class.extend({
|
||||
|
||||
@@ -50,9 +50,7 @@
|
||||
|
||||
<template id="s_table_of_content_options" inherit_id="website.snippet_options">
|
||||
<xpath expr="." position="inside">
|
||||
<div data-js="TableOfContent" data-selector=".s_table_of_content">
|
||||
<we-checkbox string="Animate Scrolling" data-animate-scrolling="true" data-no-preview="true"/>
|
||||
</div>
|
||||
<div data-js="TableOfContent" data-selector=".s_table_of_content"/>
|
||||
<div data-js="TableOfContentNavbar" data-selector=".s_table_of_content_navbar_wrap">
|
||||
<we-button-group string="Position">
|
||||
<we-button title="Left" data-navbar-position="left"><i class="fa fa-fw fa-long-arrow-left"/></we-button>
|
||||
|
||||
Reference in New Issue
Block a user