caret

How to hide a caret in IE? (JavaScript)

邮差的信 提交于 2019-12-05 08:32:15
While displaying a pop-up window above a wysiwyg editor, the caret (cursor in text area) is still visible under the pop-up window. Any ideas? First idea coming to my mind is to blur() the textarea or put the focus elsewhere. Of course, I suppose the WYSIWYG editor uses a simple textarea, not a more complex DHTML component. 来源: https://stackoverflow.com/questions/293657/how-to-hide-a-caret-in-ie-javascript

Hide QLineEdit blinking cursor

梦想的初衷 提交于 2019-12-05 06:37:42
I am working on QT v5.2 I need to hide the blinking cursor (caret) of QLineEdit permanently. But at the same time, I want the QLineEdit to be editable (so readOnly and/or setting editable false is not an option for me). I am already changing the Background color of the QLineEdit when it is in focus, so I will know which QLineEdit widget is getting edited. For my requirement, cursor (the blinking text cursor) display should not be there. I have tried styleSheets , but I can't get the cursor hidden ( {color:transparent; text-shadow:0px 0px 0px black;} ) Can someone please let me know how can I

Set Cursor position after nested contentEditable

99封情书 提交于 2019-12-05 05:47:43
I've got this markup <div contentEditable="true"> Some other editable content <div class="field" contentEditable="false"> <span class="label">This is the label</span> <span class="value" contentEditable="true">This is where the caret is</span> </div> <!-- This is where I want the Caret --> </div> The caret is currently in the .field span. I need to move it back out after the .field in the parent contentEditable . How can this be accomplished via javascript (with the use of jQuery if needed) ? It will be trying to trigger it on a keydown event when the caret is in the .value span as shown.

Caret index position cross browser?

前提是你 提交于 2019-12-05 04:07:19
问题 I'm making a WYSIWYG editor, and I need to know how to get caret position working. It appears that there's no obvious way of doing it cross-platform. I just need the syntax. Please don't point me towards the Mozilla developer page; I didn't find it particularly useful. I'm using a content editable div. source that i looked at 回答1: try this function doGetCaretPosition (oField) { // Initialize var iCaretPos = 0; // IE Support if (document.selection) { // Set focus on the element oField.focus ()

how to get the caret position of a contenteditable div which contains images

ぃ、小莉子 提交于 2019-12-05 00:11:11
问题 I have this contentedittable div <div contenteditable="true" id="text">minubyv<img src="images/smiley/Emoji Smiley-01.png" class="emojiText" />iubyvt</div> Here is an image description of the code output so I want to get the caret position of the div and lets assume that the cursor is after the last character. And this is my code for getting the caret position function getCaretPosition(editableDiv) { var caretPos = 0, sel, range; if (window.getSelection) { sel = window.getSelection(); if (sel

Javascript: how to get line/col caret position in textarea?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 19:21:47
I can not find the solution. I've tried to assume that count of \n symbols is the same with lines count, but sometimes this method works incorrectly (e.g. after paste text from clipboard) i've tried different jQuery plugins, but still unsuccessfully. any idea? Sélim Achour Why not just do this: Take the text content only up to selectionStart then make it an array by splitting at eol p = $('#Form_config').val().substr(0, $('#Form_config')[0].selectionStart).split("\n"); // line is the number of lines line = p.length; // col is the length of the last line col = p[p.length-1].length; The

WPF RichTextBox - get whole word at current caret position

社会主义新天地 提交于 2019-12-04 17:13:58
I enabled spelling on my WPF richtextbox and I want to get the misspelled word at current caret position before the context menu with spelling suggestions is displayed. Subhash Lama The new way void richTextBox1_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Back) { TextPointer start = richTextBox1.CaretPosition; string text1 = start.GetTextInRun(LogicalDirection.Backward); TextPointer end = start.GetNextContextPosition(LogicalDirection.Backward); string text2 = end.GetTextInRun(LogicalDirection.Backward); richTextBox1.Selection.Select(start, end); richTextBox1.Selection

TextBox CaretIndex property in ViewModel

笑着哭i 提交于 2019-12-04 16:54:41
Is it possible to get/set the value of CaretIndex property of a TextBox control in viewmodel in wpf via Binding defined in view? Thanks You can not bind the property CaretIndex since it is not a DependencyProperty . It is a CLR property that does not accept binding. The issue here is how to get the CaretIndex of the TextBox control via the view model. If you intent to get it directly by binding to the view model its impossible. As I posted in the previous answer its a CLR property and not a dependency property. What can we do? The best solution for that is to follow the steps: Define attached

contentEditable javascript caret placement in div

对着背影说爱祢 提交于 2019-12-04 15:48:39
问题 I have a contentEditable div. Let's say the user clicks a button that inserts HTML into the editable area. So, they click a button and the following is added to the innerHTML of the contentEditable div: <div id="outside"><div id="inside"></div></div> How do I automatically place the cursor (ie caret) IN the "inside" div? Worse. How can this work in IE and FF? 回答1: For IE: var range= document.body.createTextRange(); range.moveToElementText(document.getElementById('inside')); range.select();

Contenteditable - extract text from caret to end of element

泄露秘密 提交于 2019-12-04 14:11:03
after skimming all possible questions and answers, i'll try it this way. I'm programming an RTE, but didn't manage to successfully extract text in a contenteditable element. The reason for this is, that each browser handles nodes and keypress (#13) events in a slightly different way (as ex.g. one creates 'br', the other 'div', 'p', etc.) To keep this all consistent, I'm writing a cross-browser editor which kills all default action with e.preventDefault(); Following scenario: 1) User hits the #13 key (check) 2) Caret position detected (check) 3) create new p(aragraph) after the element the