Comments (3)
Is there any chance of an example please???
from avalonedit.
Sure.
In the OnLoad:
DataObject.AddPastingHandler(AvalonEditBox, OnPaste);
And then later:
private void OnPaste(object sender, DataObjectPastingEventArgs e)
{
var isText = e.SourceDataObject.GetDataPresent(DataFormats.UnicodeText, true);
if (!isText) return;
var text = (string)e.SourceDataObject.GetData(DataFormats.UnicodeText);
if (Uri.IsWellFormedUri(text))
{
var dataObject = new DataObject();
dataObject.SetData(DataFormats.UnicodeText, string.Format("<{0}>", text);
e.DataObject = dataObject;
}
}
To reproduce, drag and drop an image from a web browser. By default, AE will paste the link in. I want to modify the paste text to be surrounded by less than, greater than symbols (<link>
). This is for use in my Markdown Editor (http://mike-ward.net/markdownedit).
If I create a new dataobject (as per the example) and return it, the original dataobject's text is used, not the modified text.
I can achieve my desired functionality by canceling the paste command and issuing a new paste with the modified text. It works but feels a bit wrong.
Hope that clarifies the issue.
from avalonedit.
For reference, here's how I'm currently working around the issue:
https://github.com/mike-ward/Markdown-Edit/blob/master/src/MarkdownEdit/Controls/Editor.xaml.cs#L141
from avalonedit.
Related Issues (20)
- Focus of Text Edit causes Scroll Viewer to Jump When Used Inside Container Panel HOT 3
- Editing in Multiline: tab added in the beginning instead of after the caret column position
- Add support to draw Custom Annotation on Vertical Scrollbar
- Autocompletion with indentation not working
- Ability to add spell checking HOT 1
- Memeory Issue: Two many objects cannot be collected by GC HOT 2
- How can I use the code completion by press Tab key other than input dot?
- The code completion effiencency can be improved
- .net 7 HOT 2
- duration of TextChange in a rectangular selection HOT 5
- Json.xshd fix HOT 2
- failed to parse html
- can i add this to winforms HOT 2
- Using VisualLineElementGenerator will cause the caret position wrong HOT 1
- Objects not being destroyed HOT 1
- Custom Kerning/Letter Spacing
- Group similar operations together in the undo stack
- The shortcut key Ctrl+K,Ctrl+D can format all the code.
- Rectangle selection rendering glitch with horizontal scrolling
- Editor Not Rendering HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avalonedit.