Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaƫl Poupard <gael.poupard@orange.com>2020-06-26 17:06:20 +0300
committerXhmikosR <xhmikosr@gmail.com>2020-12-04 08:52:03 +0300
commit9488978fb55286ba83e8193a871d1ff9815045b9 (patch)
treeabb461d46722f107e54156709c88cf37ed9e24a6 /js/src/tooltip.js
parent71ecc3323fb60ea05456470d10d17b614fe6dc04 (diff)
feat(RTL): implement RTL
Using RTLCSS directives, renaming things to use logical names and following best practices.
Diffstat (limited to 'js/src/tooltip.js')
-rw-r--r--js/src/tooltip.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index 25599bb42f..17148ed9a6 100644
--- a/js/src/tooltip.js
+++ b/js/src/tooltip.js
@@ -14,6 +14,7 @@ import {
getTransitionDurationFromElement,
getUID,
isElement,
+ isRTL,
noop,
typeCheckConfig
} from './util/index'
@@ -64,9 +65,9 @@ const DefaultType = {
const AttachmentMap = {
AUTO: 'auto',
TOP: 'top',
- RIGHT: 'right',
+ RIGHT: isRTL ? 'left' : 'right',
BOTTOM: 'bottom',
- LEFT: 'left'
+ LEFT: isRTL ? 'right' : 'left'
}
const Default = {
@@ -453,6 +454,18 @@ class Tooltip extends BaseComponent {
return title
}
+ updateAttachment(attachment) {
+ if (attachment === 'right') {
+ return 'end'
+ }
+
+ if (attachment === 'left') {
+ return 'start'
+ }
+
+ return attachment
+ }
+
// Private
_getPopperConfig(attachment) {
@@ -485,7 +498,7 @@ class Tooltip extends BaseComponent {
}
_addAttachmentClass(attachment) {
- this.getTipElement().classList.add(`${CLASS_PREFIX}-${attachment}`)
+ this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`)
}
_getOffset() {