293 questions
1
vote
0
answers
131
views
Alternative for document.execCommand("insertText", false, text) [duplicate]
I am using document.execCommand("insertText", false, /* some text */) in a textarea to replace text while allowing Ctrl+Z undo to work; this is supported in every browser I have tested but 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
1
answer
123
views
How to toggle off document.execCommand("superscript") back to normal text
I am working on a custom text editor using a contenteditable div with basic formatting functionalities. I am using the command document.execCommand("superscript", false, undefined); to do ...
0
votes
1
answer
435
views
Exec command insertText isn't working as expected on facebook.com
This is a contenteditable element that you can create posts on facebook.com
All I want is inserting text into that contenteditable while keeping the new lines.
document.execCommand("insertText&...
1
vote
0
answers
90
views
Why are document.execCommand() and contenteditable div separating my formatted text into nodes?
good morning to all!
I have my component to which is performed in another component a document.execCommand(action) to a selected text.
The html of my component is extremely simple:
<template>
...
0
votes
0
answers
52
views
Log file is not showing when I copy URL and paste it on another Tab
I am trying to share the current log file from the browser. Here I have 2 buttons which does the same.
<button @click="addOpentabs">Generate Link</button>
This button generates ...
1
vote
1
answer
821
views
Unable to copy text using JavaScript function execCommand('copy')
I am trying to copy a string value to clipboard using execCommand('copy') in a function which is being called when clicked on copy button. Below is the function:
var s = 'some text';
function ...
0
votes
1
answer
309
views
Use document.execCommand() on a chrome extension with manifest_version 3
I am working on a Chrome extension that highlights text in the same was as CTRL+F and I found this code that highlights text.
However, upon trying to implement it, I've been running into some trouble ...
0
votes
0
answers
24
views
Replacement for document.execCommand for pasting plain text [duplicate]
I've read quite a few posts on here about how document.execCommand is being deprecated and that the Clipboard API should be used instead. However I can't figure out what to replace it with. I have a ...
0
votes
1
answer
1k
views
document.execCommand (copy) has been cancelled [duplicate]
I don't understand why my execCommand has been striked out or cancelled:
This is my code:
var $temp = $("<input>");
var $url = $(location).attr('href');
$('.play_all').on('click', ...
1
vote
1
answer
2k
views
Beginner - Why is execCommand() obsolete?
Not a coding question, and the question applies to a wider tag of XYZ becoming obsolete, but asking as there seems to be tons of comments on the web about how there are so many apps out there that use ...
0
votes
1
answer
279
views
How to provide hyperlinking for text selection in React
I am trying to build a WYSISYG editor, and I have an option to provide hyperlinking to a text selection. I have been scourging the internet but I am not able to find out why this isn't working sigh.
...
1
vote
2
answers
835
views
document.execCommand('removeFormat') failing on Chrome when trying to remove format set by document.execCommand('hiliteColor')
I'm adding a background to some selected text in a contenteditable element via document.execCommand('hiliteColor', false, '#d4ecff');.
If the selected text contains some formatting tags (<b></...
0
votes
1
answer
591
views
Combination of document.addEventListener and document.execCommand("copy") does not work in Safari
I have the following code, which works completely fine in Chrome/Edge/Firefox,
newest versions of course, but I expect even a few year old browsers of these will work just fine.
Now in Safari 15.3 (...
3
votes
2
answers
7k
views
Jquery select() and copy text to clipboard is not working
I am trying to copy text from table rows to my clipboard, however, it does not work. I have logged the text from the row in the console when it selected and it shows, however select() and document....
0
votes
0
answers
180
views
Problem with Document.execCommand("copy")
I am having a problem when copying values. I use Clipboard API but know Clipboard API only works with secure context (HTTPS), in my Beta it's only HTTP so Clipboard API doesn't work. So is there a way ...
1
vote
0
answers
317
views
On safari browser, paste content programmably will show system paste menu sometimes
When you want paste something in a contenteditable element by using javascript, there are two ways.
Using the deprecated method document.execCommand('paste')
Or using the new Clipboard API navigator....
-1
votes
2
answers
179
views
How to create the next paragraph after a list at root level in a content editable element?
In a contenteditable element in which a list has been inserted with document.execCommand, is it possible to create next paragraph at the root of the editable element and not within the container of ...
3
votes
0
answers
410
views
What alternative can be used for ExecCommand on ContentEditable?
So, I am trying to build a WYSIWYG editor and using execCommand("bold"), execCommand("italic") etc. While they work properly, the Docs says execCommand is deprecated and might ...
2
votes
0
answers
668
views
execCommand() deprecated, copy table solution
I had some trouble finding a solution to copying a full table as exexCommand is deprecated and the Clipboard API only takes a string.
I found a mix of different solutions which didn't quite make it ...
2
votes
1
answer
12k
views
"adb shell settings list global" doesn't work programatically in Android
I want to read global settings programatically in Android.
Using ADB on AndroidStudio, the list command works perfectly:
adb shell settings list global
and returns the list of settings:
...
...
1
vote
0
answers
533
views
How to create modal for wysiwyg for url and image in react
Recently I am trying to create a wysiwyg editor with react. I almost created basic functionality but now I am stuck with some functionality such as adding link, image, table etc.
I can add this ...
1
vote
1
answer
108
views
Angular: <ol> added by document.execCommand sees only css rules in styles.css but not in the component's css
I am creating rich text editor in angular and when I execute document.execCommand('insertOrderedList') I get <ol> item which is unaffected by my component's css, only css in styles.css (main css ...
0
votes
3
answers
2k
views
TinyMCE steals the focus when calling execCommand
I have a bunch of inputs on my HTML page, plus a textarea which is replaced by a TinyMCE editor. There are various scenarios where this page is loaded and every time one of the inputs must get the ...
2
votes
1
answer
1k
views
Weird behaviour with document.execCommand('insertHTML')
I'm trying to programmatically highlight all occurences of a search word by adding a CSS class like so :
const style = document.createElement('style');
style.setAttribute('type', 'text/css');
style....
0
votes
0
answers
730
views
Copy to clipboard using textarea and document.execCommand('copy) is a problem when MUI popovers are open
An MUI Menu (PopOver) is open with a MenuItem for 'Copy to Clipboard' Option. The MenuItem has an <IconButton>. The onClick handler for the IconButton invokes document.execCommand('copy').
The ...
0
votes
1
answer
272
views
My jquery execCommand isn't working as i want
I have this text editor which i created using jquery with execCommand and a div with contenteditable but some on it isn't working only the undo and redo is working. This is my code
<li data-role=&...
0
votes
1
answer
429
views
How do I keep an onInput event from being triggered when using document.execCommand()?
I have a div whose contents the user can edit via the contenteditable attribute. When the user types something in the div, a function is called. I am using the oninput event to trigger that function, ...
1
vote
0
answers
203
views
document.execCommand("copy") not working when using timeout
As mentioned in the title of the question, I am using window.setTimout in my application. Here is the detailed explanation. When a user clicks a button I call a function, passing the value that needs ...
0
votes
2
answers
2k
views
How do I select the last character of a string, using JavaScript?
I have a function that gets the last character of a string the user types in an input. But how do I select that single character, using execCommand()? The goal is to copy it into a different input.
I ...
0
votes
0
answers
103
views
Can't save into input buffer changes range.insertNode(node)
Use selection.addRange(range) for insert html near default text, but this action doesn't save into history of input, and when i use ctrl+z, undo previous action, not change(insertNode)
I need, that ...
1
vote
1
answer
941
views
How to make a bold button for an editable div in react.js
I would like to make an editor from scratch with a contenteditable div in react.js
The div is editable, but how can I add a button to make selected text bold?
I tried "document.execCommand('bold',...
-1
votes
1
answer
211
views
Can I delete first character when use execcommand function in JavaScript?
Can I delete first character using execCommand function in JavaScript?
So, I need to that:
"My string..."
document.execCommand('...');
"y string..."
I have code that;
$('#myDiv')....
0
votes
0
answers
81
views
Inserting SVG element in editable div
I have an editable div in my HTML and I am inserting an SVG element in the same.
The element is as follows:
<svg width="1.5em" height="1.5em"><use xlink:href="...
2
votes
1
answer
5k
views
How to check ssh.exec_command executed successfully or not? [duplicate]
I'm executing gcloud command inside the remote host.
However, when I try to execute any command using the ssh.exec_command, the command seems to get executed. But how can I make sure it executed ...
1
vote
0
answers
120
views
How to remember the selected text in content-editable and apply styles from the input?
lets say I have a div with content-editable = true. Now i want to color selected/highlighted text inside that div. I am using document.execCommand("foreColor", false, color) where color is ...
0
votes
0
answers
245
views
document.execCommand() fontSize
document.execCommand("fontSize", false, value);
i am getting the third parameter "value" from the user which is in "pixel".
but execCommand only allows the input between ...
1
vote
0
answers
93
views
How to stop execCommand from pushing formatting through selected elements?
I'm using a contenteditable div to set up a basic editor. The content includes some elements that are "atomic" -- they're placeholders that aren't themselves editable. However, when the user ...
0
votes
1
answer
347
views
codeBlock wrapped in <pre> inside contenteditable breaks on pressing Enter
In my custom-editor wrapping up the code in <pre> tags works fine. I would like to visually organize the pasted code for better readability. For that I need blank lines in between chunks of code....
0
votes
1
answer
125
views
execCommand doesn't work on selected text
Presumably, I know where's the problem but I have no idea how to fix it. I've got an editable div and <small> elements, clicking on which I want text (that was selected) to be styled. But the ...
1
vote
0
answers
154
views
Setting Forecolor of UnorderedList with execCommand
I am trying to make it so when I changed the colour of an editable <div> tag it changes all the text to that colour.
When I use the line document.execCommand('foreColor', false, 'blue'); to ...
0
votes
2
answers
654
views
Is there a way to change text style on the fly on the next inputted text via a drop down?
So I have made this webpage wherein it is a pseudo RTF editor that inserts data into the database. Insert into php the html in a div
I am having a problem when it comes to text styling the text typed ...
15
votes
2
answers
14k
views
Is there a replacement for document.execCommand? (or is it safe to use document.execCommand?)
I am building an amateur rich text editor with vanilla JavaScript and document.execCommand() is essential to enabling the core features of an text editor.
For example bold, italic and unordered list ...
1
vote
0
answers
974
views
document.ExecCommand insertHTML inserts span and weird behaviour in safari
When trying to use insertHTML
document.execCommand('insertHTML', false, `<b id="searchId${numberID}" style="background-color: ${color};" >${text}</b>`
Works fine in any browser except ...
0
votes
0
answers
144
views
how can i make a simple editor by contenteditable but without execommand
because execcommand is obsolete : https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand.
i do work on a knowledge network, we use a markup language just like markdown, but is more ...
0
votes
1
answer
253
views
IE Edge: Formatting Issue document.execCommand('inserttext', true, content)
Here is the JS fiddle for this problem:
https://jsfiddle.net/2ds5mor4/1/
Open JS fiddle in chrome and IE Edge.
Paste (ctrl+V) in text area and you will see the text which is not formatted in IE Edge ...
311
votes
12
answers
195k
views
execCommand() is now obsolete, what's the alternative?
I intended to use Document.execCommand() method along with contenteditable attribute to build my custom WYSIWYG editor. But when I checked the documentation for Document.execCommand(), I found that it'...
0
votes
3
answers
1k
views
Is there a way to remove italic style from <i> tag without effecting document.execCommand("italic")
I'd like to make text in <i> tag not appear italic in a contenteditable div.
However, as you can see in the code snippet below, if I add font-style:normal to italic style, document.execCommand('...
-1
votes
1
answer
1k
views
execCommand backColor and hilitecolor not working on chrome
I have got a contenteditable div element and a button as such
<button onClick="backColor();">Change BC</button>
<div contenteditable="true"></div>
inside the body of my index....
0
votes
1
answer
621
views
JavaScript Outdent text in contenteditable
I am trying to indent and outdent in a contenteditable div. The indenting works perfectly but the outdent execCommand isn't working. I have a last key buffer that works for other keyboard shortcuts ...