How can you modify clipboard text? - clipboard

Selecting and copying text off the page on the link below seems to lead to some text being automatically added. When this is pasted there is an extra line which starts off with "Read more:". How is this done?
Article at Dailymail.co.uk

They've got a lot of Javascript on that page. I assume that they're intercepting the copy, and fiddling with it somehow.

Related

How to set own clipboard data style and get other program's clipboard style?

For example, google docs can remebering the color, style, size and so on. Also, EXCEL can copy and paste data on diffierent charts. However, when you try to paste these into a txt, it failed and it seemed that there is nothing on the clipboard.
It shows that we can create our own style on clipboard. I wondering how it works and how could I set my own clipboard style and how to paste it(How to add a response event). Is there any API to achieve this?
Besides that, >>>>how could we get other program's data on the clipboard<<<<? I woundering this becuase I want to make a software that can help me remembering some special data forms(Sometimes I may forget and just press down Ctrl+C so I lose my data, and I have to get them again)
I have already serch the internet but there is no useful data.
Thank you.

Regarding shift + enter with ckeditor inserting invisible character

I am using CK editor 4.4.6.
It seem on the first instance of pressing shift + enter, the editor inserts an invisible character. Upon submission, the character saves as a question mark. I can't see the character in the form submission when viewing the debug in the browser or the source code in the WYSIWYG editor itself. I do however notice when I press the right arrow that the cursor pauses at this character even though I can't see it. The page is being served in UTF-8.
This character is zero-width-space and is used by CKEditor to workaround Safari's and Blink's problems with placing selection inside empty inline tags or around them or in couple of other positions.
However, this character should never end up in data. It's used only internally and it is removed when getting data from editor. So, if you can find it in your database it means that you either get data from editor incorrectly, or you encounter some bug in the mechanism I described. In the latter is true please report a bug on http://dev.ckeditor.com, but please also describe how you reproduce it.
Looks like the editor is inserting character 8203.
What's HTML character code 8203?
I don't want to mess with the editor script at the moment so I'm just stripping out that character in the future on form/ajax post.

keep text formatting when copying and pasting in/from memo

Basically, i paste my text in a memo, push some buttons and it's edited. That's what it should do. But when i copy my end-text out of it and paste it in a website, the text looses all of its line breaks. I tried adding them but that does not help, i tried richmemo, richedit. Nothing works.
Solved the problem. It was wordwrap. Had to divide the memo lines in strings to achieve it but it came out just fine.

Remove spaces from a string of text in clipboard

This is maybe a weird request but hear me out:
I have a huge database at my shop containing product codes, like 87 445 G 6 which I need to check for availability on a supplier's website. The problem is, the supplier's website consists of a web form in which I have to enter the code without spaces, so imagine that I have to manually delete spaces every time I paste a code or write it manually without.
I can't edit the database from which I copy the codes.
I wonder if some sort of plugin, script, or trick can be used directly in browser on the supplier's web form, or some software to modify how the windows clipboard works, maybe some option to copy text without spaces. Using Windows XP.
The OP has probably moved on, but for anyone else looking here, my approach was to tackle this from the windows clipboard side.
For background: I keep a list of my credit card info in Keepass. Sometimes (poorly coded) shopping cart checkout forms don't like spaces in between card numbers. I like storing them with spaces since it's easier to read off that way.
There's various Windows clipboard utilites out there, but it took me a while to find one that could do some processing on the clipboard contents and pasting it out - Clipboard Help and Spell
The program has a way to "save" a bunch of text transformations, and even assign the action to a hotkey.
For reference, my "Find and Replace" action is to find "\s" (without quotes) and leave the Replace textbox empty. "\s" will match whitespace character.
Use the javascript console
You could use the javascript console for your browser to edit the textarea after you paste.
Using Google Chrome (or Firefox)
Paste your text in the text area.
Right click the text area and click Inspect Element
Look at the id for the element
Now switch to the console view
then run these lines (making sure to replace with 'the-id' with your id)
var my_text_area = document.getElementById('the-id'); // Put your id in here
my_text_area.value = my_text_area.value.replace(/ /g,"") // Deletes just spaces
It's even simpler if you have access to jQuery:
$('#the-id').val($('#the-id').val().replace(/ /g, ""))
The replace function is simply using regular expressions to convert spaces to nothing. If you want to replace all whitespace (including newlines) you would use .replace(/\s/g,"").
For firefox, the names are the same but the UI is a little bit different.
Use greasemonkey
You can either write a greasemonkey plugin or try to find one that fits your needs.

How do I edit a text buffer (or selected text) with the Visual Studio 2010 SDK

I want to create a simple extension which modifies text buffers based on a command. No sample, documentation or template that I've found so far explains anything about working with text buffers. Anyone got a clue how to do this?
What I want to end up with is a format selection/document extension for text files, that wrap content around 72 characters per line.
I found this extension together with sample very helpful, and now I have something which works. Though it was very counter intuitive at first, I was trying to get the at the code window while this example instead uses a command filter to fiddle with the text view by extending the editor.
The ITextView interface provides access to the text in the editor, you can access the Buffer through that and make changes that way.
Link
http://github.com/noahric/alignassignments

Resources