caret

In ContentEditable, how can I get a reference to the element immediately preceding the caret?

青春壹個敷衍的年華 提交于 2020-01-03 02:01:31
问题 I am trying to write a function that will, on keyup , give me a reference to the element immediately preceding the caret in a contentEditable div. If the caret is in a text node then the function should return null . If the caret is at the start of the contentEditable then the function should return null . But if the caret is at the start of a text node, and this text node is immediately preceded by an element such as a Span, then the function should return a reference to this element. And,

Set caret position in contenteditable div layer in Chrome/webkit

本秂侑毒 提交于 2020-01-03 01:40:35
问题 I'm trying to set the caret position in a contenteditable div layer, and after a bit of searching the web and experimenting I got it to work in firefox using this: function set(element,position){ element.focus(); var range= window.getSelection().getRangeAt(0); range.setStart(element.firstChild,position); range.setEnd(element.firstChild,position); } [...] set(document.getElementById("test"),3); But in Chrome/webkit it selects all of the content in the div. Is this a bug with webkit or am I

WPF PasswordBox Caret

白昼怎懂夜的黑 提交于 2020-01-02 05:20:28
问题 Is there a way to hide or move the PasswordBox's caret? 回答1: In .NET 3.5 SP1 or previous, there is no clean way to specify the color of a WPF TextBox/PasswordBox caret. However, there is a way to specify (or in this case remove) that caret from view (via a hack). The caret color is the inverse color of the TextBox/PasswordBox's background color. THus, you can make the background color "transparent black", which will fool the system into using a white caret (which is not visible). The code is

How to change the bootstrap caret pointing position?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-31 04:15:12
问题 Within bootstrap the caret is always pointing down. I would like it to point to the right when when the menu is closed. See demo. Demo: http://jsfiddle.net/Maty2/ HTML <div class="functionbox funtog"> <a class="btn dropdown-toggle fleft" data-toggle="collapse" data-target="#demo-1" href="#"><span class="caret"></span></a> <h3>Recent</h3> </div> <div id="demo-1" class="collapse in"> <div class="whitebox"> <div id="myprojs">Hide this</div> </div> </div> ​ CSS .whitebox { padding: 20px; border

Get caret XY coordinates in text area [duplicate]

偶尔善良 提交于 2019-12-30 03:34:09
问题 This question already has answers here : How do I get the (x, y) pixel coordinates of the caret in text boxes? (3 answers) Closed 5 years ago . Is there any good JQuery/JS solution to get the absolute position of a caret in text area (given in X/Y coordinates OR top/left coordinates). The native Event object of keyDown JQuery function gives the x/y coordinates of the cursor and I want something similar the works on the working caret. My goal is to add a floating HTML element the will be

Hide input caret of TextField in JavaFX8

陌路散爱 提交于 2019-12-28 06:59:14
问题 I would like to hide the input caret of a TextField in JavaFX8. I already tried to set the text fill to white (my TextField has a white background), but then my user input also disappears. The problem is that the textfield still needs focus, so I also thought of some EventHandler which listens to user input, and focusses on the textfield when a key is pressed, but then I would miss the first key typed. Anyone that knows how to do this? Or is it not possible in JavaFX8? 回答1: Update for Java

UITextView scrolling caret to visible text on Device Rotation in Swift 3

99封情书 提交于 2019-12-25 05:20:16
问题 this scrollToCaretInTextView function was working in Swift 2, but on converting to Swift 3, it has an error message that I can't find a solution to. Here is the code: @IBOutlet weak var emailBody: UITextView! override func didRotate(from fromInterfaceOrientation: UIInterfaceOrientation) { scrollToCaretInTextView(textView: emailBody, animated: true) } func scrollToCaretInTextView(textView:UITextView, animated:Bool) { var rect = emailBody.caretRectForPosition((textView.selectedTextRange?.end)!)

jQuery get textarea cursor/caret X,Y position and show a DIV underneath

一笑奈何 提交于 2019-12-24 09:22:52
问题 I am trying to implement something like the "Change/Remove Link" in Gmail/Google Docs richtext WYSIWYG edtior, when you type a URL, a div shows underneath it says "Goto Link, Change, Remote" How could I write something like that using jQuery? How to get row and column of cursor? how can I calculate font width and height (especially non-fixed width font with some Bold/Italic style) How to make sure the DIV appears at the start of a word? Thank you in advance! 回答1: Answer: http://jsfiddle.net

How to hide caret in Delphi TEdit?

一世执手 提交于 2019-12-23 16:08:29
问题 I want to remove the caret from a TEdit control in Delphi. I have made the component Enabled := False but the caret still appears. My question is how to remove the caret from a disabled TEdit control? 回答1: I assume that you mean TEdit control. The solution is HideCaret function, the only problem is where to call it. The 2 event handlers below worked fine for me: procedure TForm18.Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin HideCaret(Edit1.Handle); end; procedure

WPF TextBox Caret Disappearing

一笑奈何 提交于 2019-12-23 10:52:31
问题 I'm developing a WPF application that has TextBox components. I'm having a problem with the caret of the text boxes. It seems that, depending on the location of the TextBox itself, the caret disappears on certain specific locations Caret showing: Caret disappears: Caret returns: The TextBox style is very simple: <Style TargetType="{x:Type TextBox}" x:Key="FormTextBox"> <Setter Property="Width" Value="464"/> <Setter Property="Height" Value="74"/> <Setter Property="HorizontalAlignment" Value=