contenteditable

Contenteditable DIV is not working properly with angular two way binding in firefox

南笙酒味 提交于 2019-12-31 02:43:09
问题 I have made my div contenteditable div and it also opens ngx-popover on keyup and populate search results into popover on basis of searchText so I need two way binding as well as content editable further I need div rather than input: <span> <div id="contenteditablediv" contenteditable="true" (keyup)="triggerUserSearch()" type="text" [popover]="searchTemplate" placement="bottom" triggers="keyup click" [textContent]="searchText" (input)="searchText=$event.target.textContent" [outsideClick]=

Save / restore selection on contentEditable AFTER modifying innerHTML

帅比萌擦擦* 提交于 2019-12-30 18:29:18
问题 I know getting / setting cursor position in a contentEditable is damn near impossible. I don't care about knowing this information. I need to be able to save current selection, modify innerHTML of the div, and then restore the selection. I've bee experimenting with the answer provided at contenteditable selected text save and restore . It works after typing in the div, but not after programmatically modifying the innerHTML of the div. Instead, when I call restoreSelection, the caret simply

Avoid createElement function if it's inside a <LI> element (contentEditable)

浪子不回头ぞ 提交于 2019-12-30 07:46:47
问题 I'm using this function in order to replace <DIV>New Divs</DIV> with <BR> in break lines on contentEditable divs using Safari and Chrome: $("#form_description").live("keypress", function(e){ if (e.which == 13) { if (window.getSelection) { var selection = window.getSelection(), range = selection.getRangeAt(0), br = document.createElement("br"); range.deleteContents(); range.insertNode(br); range.setStartAfter(br); range.setEndAfter(br); range.collapse(false); selection.removeAllRanges();

HTML5 contentEditable with jQuery

孤人 提交于 2019-12-30 05:55:48
问题 I have some elements that need to have the text inside editable, for this I am using the HTML 5 attribute contentEditable. I can't seem to do use jQuery for this using multiple selectors. What I want to do is have every tag inside a container div be editable. Here's an example of what it would look like if it worked with jQuery: $("#container <all tags here>").contentEditable = "true"; I dont know how to make it select all tags but you get the point. So all span, div, tables, bold, etc should

HTML5 contentEditable with jQuery

可紊 提交于 2019-12-30 05:55:46
问题 I have some elements that need to have the text inside editable, for this I am using the HTML 5 attribute contentEditable. I can't seem to do use jQuery for this using multiple selectors. What I want to do is have every tag inside a container div be editable. Here's an example of what it would look like if it worked with jQuery: $("#container <all tags here>").contentEditable = "true"; I dont know how to make it select all tags but you get the point. So all span, div, tables, bold, etc should

Problem detecting Newlines in JavaScript Range Object

孤者浪人 提交于 2019-12-30 05:49:07
问题 I have some javascript that manipulates html based on what the user has selected. For real browsers the methods I'm using leverage the "Range" object, obtained as such: var sel = window.getSelection(); var range = sel.getRangeAt(0); var content = range.toString(); The content variable contains all the selected text, which works fine. However I'm finding that I cannot detect the newlines in the resulting string. For example: Selected text is: abc def ghi range.toString() evaluates to

Consolidate stacked DOM formatting elements - contenteditable DIV

≡放荡痞女 提交于 2019-12-30 05:27:12
问题 I have a contenteditable DIV which is linked/synced-back to a textarea. The contenteditable DIV is a free-for-all sandbox which will create formatting elements etc as they are being invoked. However this does result often in messy stacked elements. I would like to be able to clean up the code before the textarea form is sent to the server. It is possible to end up with something like the following: <div> <b> <i> Hel </i> <i> l </i> </b> <i> <b> o World! </b> </i> </div> Which would ideally be

Definition of ExecCommand function for bold?

谁都会走 提交于 2019-12-30 05:16:12
问题 ExecCommand offers a way to bold text inside iFrame, make it italic, underline it etc. But it's missing an option to create <cite> or <strong> or <em> (there is formatBlock but only for block elements and not inline ones). I'd like to use ExecCommand function for creating <cite> - is there any way to achieve this? And obviously I want to maintain flawless parsing like in case of bold and not something like surroundContents which will fail when you use it twice on the same selection. I'm

Content Editable cursor position to be in editable div when popup of text editor occur

雨燕双飞 提交于 2019-12-29 09:14:06
问题 I'm trying to build a jquery content editable code where a user identifies the editable div while hovering the mouse, once it clicks on that div the content becomes editable and buttons pops up for selecting type of edit. Now when I click the button a text editor pop up and formats the text, once I click the button the cursor or pointer it comes out of the editable div. I'm using jquery to make the content editable Here's my code. $(function() { var mouseX; var mouseY; var modal = false; $

spellcheck=false on contentEditable elements

為{幸葍}努か 提交于 2019-12-29 06:36:47
问题 For normal input elements you can turn off the spell checking by using a HTML attribute (at least under FF). The same spellcheck="false" does not seem to work on a contentEditable element. Is there another solution for contentEditable elements? 回答1: I'm not sure if this is what you're getting at, but I was having what sounds like a similar problem with removing the spellcheck underline from contentEditable elements. The problem is, when you set the spellcheck attribute to false, any words