mirror of
https://github.com/discourse/discourse.git
synced 2025-09-04 08:47:37 +08:00
Set caret-clone position based on rtl class
This commit is contained in:
parent
b652791a20
commit
d0c467babc
2 changed files with 4 additions and 8 deletions
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]);
|
||||
clone = $("<div id='caret-clone'><p></p></div>").appendTo("body");
|
||||
clone = $("<div><p></p></div>").appendTo("body");
|
||||
p = clone.find("p");
|
||||
clone.width(textarea.width());
|
||||
clone.height(textarea.height());
|
||||
|
@ -54,6 +54,7 @@ $.fn.caretPosition = function(options) {
|
|||
return styles.getPropertyValue(prop);
|
||||
};
|
||||
|
||||
const isRTL = $('html').hasClass('rtl');
|
||||
clone.css({
|
||||
border: "1px solid black",
|
||||
padding: important("padding"),
|
||||
|
@ -62,7 +63,8 @@ $.fn.caretPosition = function(options) {
|
|||
"overflow-y": "auto",
|
||||
"word-wrap": "break-word",
|
||||
position: "absolute",
|
||||
left: "-7000px"
|
||||
left: isRTL ? "auto" : "-7000px",
|
||||
right: isRTL ? "-7000px" : "auto"
|
||||
});
|
||||
|
||||
p.css({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue