mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 19:02:46 +08:00
Set caret-clone position based on rtl class
This commit is contained in:
parent
b652791a20
commit
d0c467babc
|
@ -56,9 +56,3 @@ float: left !important;
|
||||||
.rtl .dashboard-right {
|
.rtl .dashboard-right {
|
||||||
float: left !important;
|
float: left !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Right and left will be flipped by the r2 gem
|
|
||||||
.rtl #caret-clone[style] {
|
|
||||||
right: auto !important;
|
|
||||||
left: -7000px !important;
|
|
||||||
}
|
|
||||||
|
|
6
vendor/assets/javascripts/caret_position.js
vendored
6
vendor/assets/javascripts/caret_position.js
vendored
|
@ -45,7 +45,7 @@ $.fn.caretPosition = function(options) {
|
||||||
};
|
};
|
||||||
|
|
||||||
styles = getStyles(textarea[0]);
|
styles = getStyles(textarea[0]);
|
||||||
clone = $("<div id='caret-clone'><p></p></div>").appendTo("body");
|
clone = $("<div><p></p></div>").appendTo("body");
|
||||||
p = clone.find("p");
|
p = clone.find("p");
|
||||||
clone.width(textarea.width());
|
clone.width(textarea.width());
|
||||||
clone.height(textarea.height());
|
clone.height(textarea.height());
|
||||||
|
@ -54,6 +54,7 @@ $.fn.caretPosition = function(options) {
|
||||||
return styles.getPropertyValue(prop);
|
return styles.getPropertyValue(prop);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isRTL = $('html').hasClass('rtl');
|
||||||
clone.css({
|
clone.css({
|
||||||
border: "1px solid black",
|
border: "1px solid black",
|
||||||
padding: important("padding"),
|
padding: important("padding"),
|
||||||
|
@ -62,7 +63,8 @@ $.fn.caretPosition = function(options) {
|
||||||
"overflow-y": "auto",
|
"overflow-y": "auto",
|
||||||
"word-wrap": "break-word",
|
"word-wrap": "break-word",
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
left: "-7000px"
|
left: isRTL ? "auto" : "-7000px",
|
||||||
|
right: isRTL ? "-7000px" : "auto"
|
||||||
});
|
});
|
||||||
|
|
||||||
p.css({
|
p.css({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user