selection

after range.setStart new characters appear in previous node

浪子不回头ぞ 提交于 2021-02-08 08:21:26
问题 this happens in chrome (71.0.3578.80 on windows): on range.setStart the caret moves to the reference node, but after typing the new characters appear in the node before, when offset is 0. the expected behaviour would be, that the characters appear in the reference node of range.setStart. see here: http://jsfiddle.net/pgrds9qv/ function setCaret() { var el = document.getElementById("editable"); var range = document.createRange(); var sel = window.getSelection(); range.setStart(el.childNodes[2]

Elm - textarea selection range disappearing

大城市里の小女人 提交于 2021-02-07 14:32:21
问题 I implemented a <textarea> in Elm such that tabs indent and unindent instead of change focus to another HTML element. Works great except that unindenting sometimes causes the selection to disappear! If I'm selecting the 5th character to the 12th character, I press shift - tab , then it removes 2 tab characters, but it also makes the selection change to a cursor at position 10. The selection range should remain the same.. I have an SSCCE at Ellie: https://ellie-app.com/3x2qQdLqpHga1/2 Here are

Elm - textarea selection range disappearing

 ̄綄美尐妖づ 提交于 2021-02-07 14:31:33
问题 I implemented a <textarea> in Elm such that tabs indent and unindent instead of change focus to another HTML element. Works great except that unindenting sometimes causes the selection to disappear! If I'm selecting the 5th character to the 12th character, I press shift - tab , then it removes 2 tab characters, but it also makes the selection change to a cursor at position 10. The selection range should remain the same.. I have an SSCCE at Ellie: https://ellie-app.com/3x2qQdLqpHga1/2 Here are

create URL with anchor to text selection

空扰寡人 提交于 2021-02-07 08:26:53
问题 I would like to create a URL pointing to a web service I write, http://mycoolthing.com , together with an #-anchor that refers to a text selection on that page. Is is possible in HTML/JS to create an anchor that refers to a Selection or a RangeObject? 回答1: chromium based browsers now support Scroll To Text Fragment https://chromestatus.com/feature/4733392803332096#:~:text=This%20feature%20allows%20a%20user,and%20scrolls%20it%20into%20view. 回答2: As I mentioned in a comment, here is an option

create URL with anchor to text selection

人走茶凉 提交于 2021-02-07 08:25:13
问题 I would like to create a URL pointing to a web service I write, http://mycoolthing.com , together with an #-anchor that refers to a text selection on that page. Is is possible in HTML/JS to create an anchor that refers to a Selection or a RangeObject? 回答1: chromium based browsers now support Scroll To Text Fragment https://chromestatus.com/feature/4733392803332096#:~:text=This%20feature%20allows%20a%20user,and%20scrolls%20it%20into%20view. 回答2: As I mentioned in a comment, here is an option

create URL with anchor to text selection

孤者浪人 提交于 2021-02-07 08:25:03
问题 I would like to create a URL pointing to a web service I write, http://mycoolthing.com , together with an #-anchor that refers to a text selection on that page. Is is possible in HTML/JS to create an anchor that refers to a Selection or a RangeObject? 回答1: chromium based browsers now support Scroll To Text Fragment https://chromestatus.com/feature/4733392803332096#:~:text=This%20feature%20allows%20a%20user,and%20scrolls%20it%20into%20view. 回答2: As I mentioned in a comment, here is an option

wpf richtextbox selection with regex

你离开我真会死。 提交于 2021-01-29 08:37:39
问题 i want to color the matched text of a file. first,i load the file text into FileItem.Content ,then use regex to get the matches,and next put the Content into a richtextbox and use the matches to set the caret position and color the text . and the code to fill richtextbox RtbCodes.Document.Blocks.Clear(); RtbCodes.Document.Blocks.Add(new Paragraph(new Run(item.Content))); foreach (Match m in item.Matches) { TextPointer start1 = RtbCodes.Document.ContentStart.GetPositionAtOffset(m.Index,

How to copy markup - not just plain text - to the clipboard using legacy free JavaScript

笑着哭i 提交于 2021-01-28 06:12:00
问题 The complete content of a <div> <div id="myElement"> Mary had a little <b>lamb</b>, its <i>fleece</i> was white as snow. Everywhere that mary went, the lamb was sure to go. </div> should be copied to the clipboard using this code const copyAll = document.querySelector("myElement"); window.getSelection().selectAllChildren(copyAll); document.execCommand("Copy"); window.getSelection().removeAllRanges(); (For the execCommand to work, the call must be executed via an event listener) But only the

On an Altair plot, can you change the location that a selection (e.g. dropdown, radio button) is displayed?

不问归期 提交于 2021-01-27 20:11:23
问题 Plotting in Python using Altair: I have 2 charts plotted side-by-side and the right-hand plot includes a drop-down selection menu. By default, the drop-down menu displays on the bottom left of the plot. I would like to move the menu underneath the right-hand plot that it is linked to. I don't see anything in the documentation for selection_single or add_selection that relates to the location of the menu. I'm using the | method to concatenate the plots horizontally. Simplified example: Code to

Date selection not happening with a click in chartjs in the context of vuejs

青春壹個敷衍的年華 提交于 2021-01-25 08:09:20
问题 I have used chartjs in order to display chart, and I am using API to fetch my data and same is fed to the chart. Here is my Chart_from_API.vue <template> <div class="chart-container" style="position: relative; height: 25vh; width:100%;"> <div id="range-selector"> <input type="button" id="1m" @click="selectPeriod" class="period ui-button" value="1m" /> <input type="button" id="3m" @click="selectPeriod" class="period ui-button" value="3m" /> <input type="button" id="6m" @click="selectPeriod"