I want users to be able to select text content so that they can copy it and paste it elsewhere, but it seems that text selection has been disabled. Users can select text that is in an input or a textarea, but I want them to be able to select even regular content text. Is there a way to enable text selection?
I tried this solution: ionic 2: How to make text selectable?. It doesn't work.
Is it possible to make Ionic 4 text selectable and how?
You can try the solution in this post https://github.com/ionic-team/ionic/issues/17753
I also know there is a clipboard management plugin but I never used it:
https://ionicframework.com/docs/enterprise/clipboard
Related
I'm currently using Tampermonkey to inject JavaScript into specific web pages.
For my job, I have to constantly fill in numerous text boxes on the same web page with the same exact information. So instead of manually copying and pasting everything to each separate text box, I'd like to be able to synchronize my input on one text box with another. So as an example, theoretically, I could type "dog" into the first box, and the word "dog" would appear in the second box automatically. Is this possible in Tampermonkey via JavaScript?
I'm assuming <input type="text"> and/or an element ID or name could be used to link the interaction of two elements on a specific page?
I'm not exactly sure where to get started here, so any and all advice would be deeply appreciated.
To synchronize all text boxes on the page, you could do something like this:
document.addEventListener("input",function(e) {
if (e.target.matches("input[type=text]")) {
document.querySelectorAll("input[type=text]").forEach(function(a) {
a.value = e.target.value;
});
}
});
Consider an editable Textarea. I have selected only 2 lines out of 5 lines & copied the some text using my button and I want to paste the text when paste button is clicked.
I tried using document.execCommand('paste'). Which is not working due to security issues in browsers.
How to implement paste using a button in javascript/Jquery or any front end library. Copy is working fine but paste using a button is not at all working.
Many cameup with solutions explaining pasting of all the content in textarea
Remember that I need the text which got copied not the entire textarea
A quick search and I stumbled upon this post
You could try using a button that runs window.clipboardData.getData('Text') and use the output to put in your textArea.
I'm working on a wysiwyg editor for my blog application on my website.
I've already written some basic editor commands like bolding, italic style and that stuff...
Now the problem is, when I wan't to do a command which needs additional information like a hyperlink.
I got a div with contentEditable on true and a textbox where I can put in the URL for the hyperlink.
I looked up in this forum and other places but I didn't find any possible solution on how to select text in the editable div, then put the desired url for the hyperlink in the textbox and finally click on a div button to call the document.execCommand("CreateLink", null, $URL); function in javascript.
Is there a possibility to select the text, then on focusing the textbox, save the position of the start and end of the selection and on clicking the button select the text again, with the saved range positions to affect the hyperlink?
I have to make a page with a huge table of data, and it has to be editable.
The problem is, some of the fields are supposed to be very long (hundreds of characters), and I need some sort of way to enter this text without disrupting the table's layout, but showing the users the entire text while they're typing.
A good solution would be something that looks just like a vanilla 1-line text box which, when clicked, slides out, pretty much like a <select>, lets the user type in all the text he wants, and then shrinks back to text box size when the user clicks away.
I'm sure there must be something like that for jQuery, but I just can't find it.
Here's how it should act:
Here's what I figured out playing around with some javascript
http://jsfiddle.net/bsWy6/
You can mess with the styling until it is exactly what you want. I think it's pretty close to what you're looking for though.
I am assuming you are populating your table from a database? If that's true, I would use php to generate the id's so that you don't have to type them for every single row, since your functions need to know the exact cell it's working with. If you want help with that code too, just let me know and I'll post it up here. I'm just not sure if you've done anything with php, so I don't want to go into all of it if you don't want it.
Good luck!
I think NicEditor will fit the need. See their inline editing demo.
For each cell, make two fields:
<td id="td-1-2">
<p id="p-1-2">Some text to...</p>
<textarea id="ta-1-2">Some text to...</textarea>
</td>
Then hide the <textarea> and show the <p>. When the user clicks the <p> then hide the <p> and show the <textarea>. Either put a submit button below the textarea or save its contents when it looses focus.
I'm trying for two days now several JavaScript lightweight Rich Text Editors (rte) such as nicEdit, mooEditable, MooRTE (the two last ones were considered because they use the mootools framework which I'm using for this project).
My problem is that with all of them, when I copy a pre-formated text from a web page (with words in bold, links etc...) and then paste it into the editor, it appears already formated.
This could be nice but that's a security problem because if I copy/paste a whole web page it will render the whole web page in the editor.
I just want my users to be able to do some basic formatting with the editor such as putting some text in bold, italic, add a link and indent their paragraphs.
An alternative could be showdown (which - I would bet - is used by stackoverflow), because this type of editors (with a preview box) don't suffer from the aforementioned issue (when you paste something in the textarea, it is unformatted text).
However, I'm not sure this would be appropriated to my case because the editor would be used to write long articles (much longer than most of the stackoverflow posts). In that case I think it would be better to have a proper editor that renders things instantly (I mean right in the textarea, not in a preview box). And a real WYSIWYG editor is more enticing and easy to use, in my opinion.
Is there a easy way to modify a RTE so that when I paste some text it is rendered unformatted?
Or do you think I should use the sort of solution that stackoverflow uses? (showdown or similar) Or do you know a RTE that doesn't have the copy-paste issue that I mentioned?
Note that I didn't try CKeditor, FCKEditor and TinyMCE because they are far too complex(heavy) and the one from YUI looks good but needs the whole library to work.
Thanks,
FuzzyTern
You are copying from a rich text source and pasting into a rich text destination. By default you will get rich text in the destination. The only way around this is to capture the paste event somehow, redirect the paste operation into a plain text field, then copy the unformatted text out of the plain text field into your rich text destination.
Use the onPaste handler to capture
paste events (doesn't work in
Firefox or Opera)
Use a hidden field to paste the
selected text into.
Insert the value of the hidden field
into the rich destination at the
cursor location.
Not sure where the profit comes from, but there you go.