dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
6.93k stars 1.15k forks source link

More modern style requests for flowdocument #9167

Open tingjiangcao opened 1 month ago

tingjiangcao commented 1 month ago

Split lines, code blocks, image comments, formulas, editable tables...

The saved document format xaml cannot contain images directly (similar to rtf format), nor can it save ‘event listeners’.

Need powerful flow document function, and ‘file format’, to meet the rich text editor convenient development.

miloush commented 1 month ago

This is not actionable, and WPF is not Word. If you are requesting a feature, create an issue for each feature and explain what it should do, why should it be built-in and ideally some user scenarios.

tingjiangcao commented 1 month ago

This is not actionable, and WPF is not Word. If you are requesting a feature, create an issue for each feature and explain what it should do, why should it be built-in and ideally some user scenarios.

Regarding these few RichTextbox (FlowDocument) issues I raised. https://github.com/dotnet/wpf/issues/9164 https://github.com/dotnet/wpf/issues/9165 https://github.com/dotnet/wpf/issues/9166 https://github.com/dotnet/wpf/issues/9167

If you are a developer and want to develop a native, relatively modern, rich text editor with WPF, the first thing that comes to your mind is RichTextbox+FlowDocument, and in doing so, you will face the following issues:

What format to save as a file? rtf or xaml? rtf supports limited styles, xaml can't embed image binary.

Is there any problem with editing basic elements? Can you delete inserted rows and columns from an already existing table? Do they work correctly? Is there a bug with shift+enter under Chinese input method?

Pasting images, does it cause memory spike? Custom UIContainer+Image control Does it also cause spiking? Can I set the cache mode?

If I choose to save a document in xaml format, and UIContainer+Image inserts an image, if I want to provide a slider under the image to resize the image, how can I do it (this slider has to be read normally by the xaml document)?

If I use UIContainer+Image to insert an image, if I want to provide a slider under the image to adjust the size of the image, how can I do it?

If I want to implement a custom table function in UIContainer with buttons for inserting specified rows and columns, I can do so.

If I use UIContainer+Border to realise the function of dividing line, is it normal to use ctrl+c and ctrl+v function of pasteboard.

...

Some of these problems can be solved, some are troublesome

If rich text editor related features are not provided, you can expect the open source community to implement them, or implement them yourself from the bottom, just like the WEB ecosystem. If provided, and the purpose is also to facilitate the rich text editor development, that flow document is difficult to meet the pragmatic needs.

If FlowDocument is not this purpose, then I misunderstood.

There isn't even a RichTextbox (FlowDocument) equivalent in WinUI3!

lindexi commented 1 month ago

@tingjiangcao How about https://github.com/icsharpcode/AvalonEdit ?