2,567 questions
0
votes
1
answer
54
views
Create clickable target in contenteditable div
I'm trying to change a variable when I click on specific text in a content editable div, trying to simulate a hyperlink.
When I console.log the target on Noteblock events and use an if statement to ...
0
votes
0
answers
28
views
Safari/Chrome: Caret not placed before/after non-editable elements in rich-text editors (Jodit)
I’m facing a caret-position issue in Safari when working with non-editable elements inside a rich-text editor (for example Jodit).
When an inline or block element inside the editor is marked as non-...
0
votes
1
answer
55
views
Apply contenteditable to selected columns in HTML Table
Is it possible to applay the contenteditable attribute to selected columns in an HTML table?
According to https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/col and https://...
1
vote
0
answers
52
views
Caret not positionning well when using word-spacing in contentEditable div on iPad
I would like to have more space between words in a contenteditable div. Word-spacing css property works very well on Chrome on Windows and Android, but on iPad the caret is often positionned in the ...
0
votes
0
answers
47
views
get how many backspaces with on single input event of type deleteContentBackward
We are making a complex text editor using a contentEditable DIV. On mobile, when virtual keyboard give a suggestion or autocorrects a word, a single input event is first called of type ...
0
votes
1
answer
111
views
Struggling with Multi-Line Input Field for Combined User and AI Text
I’m working on an input field that combines user input (userText) and AI-generated suggestions (aiText). The goal is to make them appear as part of the same sentence, even when the user hasn’t ...
-1
votes
1
answer
83
views
isssue detecting backspace from mobile keyboards in js
So i am using a <span> with contenteditable="true". onkeydown generates new elements with the key pressed as text. I use preventDefault() to not show the pressed character in the input ...
0
votes
1
answer
71
views
Caret doesn't follow text-indent after pressing enter
The JS code is there to remove remaining newlines when h1.textContent is empty, so that :empty::before gets applied. This is a simplified version of the code I'm working on (so inclusion of "...
4
votes
1
answer
87
views
How to make contenteditable respect the initial size of a table cell?
My table has 3 cells: the first two contain inputs, and the third one has my contenteditable. Each cell has a width of 33.333%. When I type text into an input and it overflows, everything works fine — ...
0
votes
0
answers
35
views
React contentEditable cursor position resets while typing in controlled component
I'm working on a text editor where users can edit individual words, and I'm running into an issue with the cursor position resetting while typing. Each time a character is typed, the cursor jumps to ...
0
votes
1
answer
45
views
Three Contenteditable Divs that connect as one larger text box with maxChars of 274
I'm building a tool to help me with multi-part tweets when I need to separate the character limitations into separate tweets. I want it built so that if I copy a large body of text or freely type into ...
1
vote
1
answer
95
views
Highlight the line where the caret is in a contenteditable element in JavaScript & Html
I am developing a text editor for the web frontend, and I want to highlight the line where the text caret is located.
Normally, it should be quite simple to implement: just by listening to the ...
1
vote
1
answer
62
views
Cursor in contenteditable LI does not go to EOL on click (Chrome)
I am using a content editable list. Currently I am not able to solve the following chrome problem (it works fine in FF at least).
When you click after the end of the following lines, the cursor is ...
0
votes
1
answer
327
views
How to toggle Tagify Inputs Between Editable and Non-Editable Modes
I know there are examples, but I don't seem to be smart enough to figure out what to do.
I'm working on a JavaScript application where users can create notes with tags. I'm using the Tagify library to ...
0
votes
1
answer
48
views
Contenteditable Div Expands Instead of Adding Scrollbars
I have a contenteditable div with the ID editor. I'm encountering an issue where the editor keeps expanding in height as I add content. I have overflow-y set to auto, but instead of adding scrollbars, ...
0
votes
1
answer
77
views
Contenteditable: Some problems with creating and focusing span
I've been trying to solve this issue for a few days now but I don't have any idea how I can fix it. I hope you can help me or give me some tips which lead me to the point to fix the issues.
I'm ...
0
votes
1
answer
37
views
How to debug `react-contenteditable` which expects a string but got composite `object`
I'm trying to follow the craft.js basic tutorial to create a Text element with editable content. The example uses the react-contenteditable npm package to achieve this, but when I use it in my project ...
1
vote
1
answer
129
views
How to put cursor in between br and non-contenteditable?
Here is the HTML
<div contenteditable="true" style="padding: 8px;">
hello world
<br>
<div contenteditable="false" style="display: inline-block;">hello world</div>
<...
0
votes
1
answer
190
views
Simple javascript functions to scroll next/previous H1 to top of screen - in an HTA application run with MSHTA.exe
I am a hobby programmer, and have made an HTA file, with some JavaScript and a single contentEditable <DIV>. Using minimal JavaScript I can make keyboard shortcuts to format, save, and exit.
I ...
0
votes
1
answer
89
views
Is there a way to easily add new lines in an contenteditable div?
I am building a texteditor and using a contenteditable div for it.
It all works peachy except when I want to lower a line of text by hitting return at the start of the row.
In my app I color code the ...
0
votes
1
answer
89
views
How to handle deletion of content editable false span within contentEditable div?
this is how my React component looks like -
<div id="test" class="content-editable" contenteditable="true">hi! <div>welcome to </div><div>...
0
votes
0
answers
31
views
get text from an editable div in html and move/show it in another html file
I am trying to get text that you type into a div with editable text to display on another html file, I'm trying to bring it from Format Test.html to display.html . Some context, I am making a little ...
0
votes
1
answer
100
views
Prevent line breaks after certain number of lines in a text area or contenteditable div
I want to create a text area or contenteditable div (preferably a text area) that has a max number of lines where, when hitting the max line, no new line breaks are added and all new text is hidden (...
0
votes
1
answer
280
views
Blazor ContentEditable data binding
I know that Blazor does not support data-binding for contenteditable div. What I have working is the following that allows text to be written and accessed through onInput.
<div role="textbox&...
1
vote
1
answer
125
views
How to a catch a 'keydown' event by an element which inherited attribute contenteditable?
For introduction I would like to explain what I try to achieve:
Inside the *div#content* I would like to detect keydown events AND get the element for which the keydown element is detected. For ...
0
votes
0
answers
235
views
How to get value from editableSelect() by jquery in asp.net c#
I am trying to get the id of selected list item (html-editableSelect), but in the place of select Id value I am getting undefined alert.
Here is my aspx code
<select id="cmb_year" runat=&...
0
votes
1
answer
185
views
How to programatically highlight text within a contenteditable div
I am trying to find a way to programatically select specific text within a contenteditable div and not having any luck.
For textarea and input fields, I do this easily as follows;
const el = ...
0
votes
1
answer
85
views
React/HTML Editable Div being unfocused after content changed
I am trying to create a text input that automatically wraps. The default input and textarea blocks did not work for the styling I wanted so I resorted to using a contenteditable div. Everything works ...
0
votes
1
answer
234
views
How to prevent creating new text nodes after 'Enter' press in contenteditable element?
Is it possible using some CSS properties
or HTML attributes or JS solution
prevent splitting text node?
I don't want to call div.normalize() after each 'Enter' press
And please don't suggest using ...
0
votes
2
answers
57
views
contentEditable - how to force to write after tag, not inside
I have div with contentEditable and when I add an element into it via JS, like: <span>text</span> I am not able to move cursor after - so when user input something it is going into the ...
0
votes
1
answer
182
views
Why does contenteditable="false" not work?
I have a C.R.U.D. app that builds many columns using PHP like this one below. This one is not meant to be editable by the user, only allowing a left click to display a dialogbox and a right click to ...
1
vote
1
answer
188
views
Configure HTML element to behave like text character
Is it possible to configure an HTML element (custom element or built-in) to be treated like a single text (non-whitespace) character -- that is, it has an implied <nobr> wrapped around itself ...
2
votes
2
answers
804
views
Insert new line in contenteditable on Ctrl+Enter
I would like to insert a new line in a contenteditable when the user press Ctrl+Enter.
Based on the following questions, I wrote the code below:
Insert newline on enter key in contenteditable div
How ...
0
votes
1
answer
94
views
Transform text to html based on regex and show it in input or ContentEditable
I'm currently working on implementing a feature in my React.js project where I want to transform specific patterns from the text typed by user, like ($anyText), into a formatted structure like anyText....
0
votes
1
answer
93
views
Issue with getBoundingClientRect in contenteditable div when caret is inside an empty child div
I have a contenteditable div with a selectionchange event that logs the new range's getBoundingClientRect. Everything works well until the caret is moved inside an empty div, like this:
<div ...
2
votes
0
answers
267
views
How can I fix this content editable section in a Next app where content is RTL though set to LTR?
I'm working on a rich text editor in React/NextJS where I use a contentEditable div. I have a function updateContent that sanitizes the HTML content of this div using DOMPurify and then updates the ...
0
votes
1
answer
187
views
Simulating Keypress in Div Element for Instagram DMs with JavaScript
I'm working on a JavaScript project where I need to simulate typing into the message box in Instagram Direct Messages. However, the message box is not a standard input or textarea element but a div ...
0
votes
1
answer
2k
views
How to get content from WebView in jetpack compose
I have editable webview. I'm using webview as rich text editor.
WebViewClient as AccompanistWebViewClient.
And on onPageFinished I have css injection to webview
view?.evaluateJavascript(js, null)
but ...
0
votes
1
answer
192
views
State management issue with react ul contenteditable
I'm trying to create a custom form field that displays and edits string array as an editable ul list - the field creates a bullet for every string item in the array.
The issue is when I try to manage ...
1
vote
2
answers
171
views
Doubleclick contenteditable element to focus (not as easy at it seems)
I'm trying to find a solution for this problem for a long time now, so I'm going to ask here now.
Start with a normal contenteditable div element, like this one:
<div contenteditable>Edit this ...
1
vote
1
answer
165
views
How to put new lines in p tag in contentEditable div
I have a contentEditable div, whenever I insert a new line by pressing enter or shift+enter the new line is a textNode in the div but I want the new line to be in p element.
I want a simple solution
I ...
-1
votes
1
answer
94
views
Cant set contentediable="false" with insertHTML in document.execCommand
i have a contentediable div. I build the possibility, to upload image from my computer directly inside the contentediable div. Everything until here works perfect. I wrapped the image inside another ...
0
votes
0
answers
55
views
Editing end of contenteditable when last child is not editable
I have a contenteditable div which can contain text and non-editable elements.
Normally you can click after the content and then start editing the content however if the last element in the div is non-...
0
votes
1
answer
192
views
How to reliably intercept (and cancel) all the input in contenteditable?
I need to catch all the input in my contenteditable element and process the input in the code. Basically, what I need is to prevent input event from changing data in element and to know what data was ...
2
votes
1
answer
120
views
Strange behavior of non-editable elements inside of contenteditable container in Chrome
I have the markup with non-editbale spans with user-select: none inside contenteditable div. Simplified version of it looks like this:
<div contenteditable="true">
some random text
...
2
votes
1
answer
391
views
Unable to Select Text Across Elements within Shadow DOM
I'm currently utilizing Custom Elements within a with the attribute contenteditable=true.
However, I've encountered an issue with the shadow DOM, as it seems to prevent me from selecting text across ...
0
votes
0
answers
44
views
contenteditable - pressing Enter how to get the code in a separate line
a contenteditable div having this html inside
<div class='dg'>lorem ipsum</div>
placing cursor at the end of line and pressing Enter gives the following html:
<div class='dg'>lorem ...
1
vote
2
answers
83
views
Why does contentedible div with truncation add whitespace in Chrome when constrained
So I have a setup like this:
<div style="width:130px; background-color:lime">
<div contentEditable style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
Hi ...
0
votes
2
answers
466
views
Unable to access attributes from `e.target` with a contentEditable element
I have an h1 element in my React app that I plan to use with a contentEditable attribute to allow users to edit it directly. The problem is within the useFormValues hook that I use to manage all my ...
0
votes
1
answer
74
views
How do I highlight a word starting with '<>' on first backspace and delete the same on a second backspace in a content editable div
const textareaHtml = `
<div class="textarea-item">
<div class="edit" role="textbox" contenteditable="true" id="${textareaId}">
&...