gregorwolf / bookshop-demo

Simple CDS bookshop
112 stars 76 forks source link

feat: integrate rich text editor #98

Closed marianfoo closed 1 year ago

marianfoo commented 1 year ago

Erstes Section mit macros Rich Text Editor , hier gibt es leider kein Fullscreen.
Zweite Section mit dem Control Rich Text Editor. Hier gibt es Fullscreen aber da gibt in der Object Page Probleme. Oder reicht die Größe des Macros?

image

gregorwolf commented 1 year ago

Kann man beim Macro RTE auch Plugins definieren? Das Autoresize plugin würde für die Anforderung am besten passen.

marianfoo commented 1 year ago

das control ist noch relativ neu, erst seit 1.117, das heißt die properties sind nicht vorhanden, aber die APIs: https://github.com/gregorwolf/bookshop-demo/pull/98/commits/64e175fdac96efe0d55a5ad51db39758e916d675#diff-158e95a5b289591a4a04f46ee4cfc5eb7b4de5319edccf15a6c373434d13b213R18

Das heißt das Plugin Autoresize kann ich mitgeben, aber aktuell bekomme einen Fehler, könnte ein Bug sein da der Fehler anscheinend nur von this.getView().byId("myRichTextEditor").attachReady kommt image

grundsätzlich geht aber das Plugin autoresize.
Wenn ich das direkt mache mit sap.ui.getCore().byId("myRichTextEditor").addPlugin("autoresize") , geht es image

Wenn ich das in der Controller Extension aufrufe, bekomme ich immer den Fehler. Vielleicht muss ich die richtige Stelle finden, aber wenn ich die APIs in der Controller Extension nutze bekomme ich diese komischen SVG Fehler.

gregorwolf commented 1 year ago

Diese Resource ist weder in 1.119.1, 1.119.2 noch in 1.120.0 vorhanden:

Screenshot 2023-11-07 at 07 18 44

Vielleicht kann uns @c-kobo helfen?

marianfoo commented 1 year ago

Ich vermute eher einen Bug weil im Namen der Datei ein undefined ist. Aber sonst habe ich auch keine ähnliche Datei gefunden die abgefragt wird .

Die Frage ist auch ob wir die APIs überhaupt nutzen können, also freigegeben sind zum benutzen. Zumindest sind sie nicht in der Dokumentation.

gregorwolf commented 1 year ago

Vielleicht hat ja auch @MariusFreitag eine Idee.

marianfoo commented 1 year ago

The current problem is that I would like to add a plugin to the RTE with this.getView().byId("myRichTextEditor").addPlugin("autoresize");. Which events do I need to pay attention to so that I can always pass the plugin to the RTE. Of course, a plugin property like in the RichTextEditor would be best.

MariusFreitag commented 1 year ago

Hi @gregorwolf and @marianfoo,

Good to see that you are trying out the new building block!

Currently, it does not support adding plugins, but I'm also tagging @nlunets, as he might be able to provide some more details.

Best Marius

marianfoo commented 1 year ago

Hi @MariusFreitag , The macros RTE is perfect for the gregor use case, then we don't have to implement the RTE ourselves. And the APIs are also available for the macros RTE to add plugins. I just need guidance on which events or hooks I can use to add the plugin agin when it is activated in edit mode.

I also translated my last comment.

nlunets commented 1 year ago

Hello @marianfoo, @gregorwolf indeed as Marius said we don't allow to define plugins now.

We decide to switch the RTE based on the visibility of the FormattedText which is controller by the UI model value changing.

So one thing you could do is listen to the /isEditable property change on the ui model and adjust based on this but it's definitely not as nice as being able to control the plugins property directly.

gregorwolf commented 1 year ago

Thank you @nlunets for your response. Will plugins make it to the roadmap? For the current requirement it would also help if the Editor would show by default the resize option in the lower left corner (Check Full featured demo: Non-Premium Plugins only. Such a resize option is also shown here in the GitHub comment editor:

Screenshot 2023-11-08 at 07 28 55

Also GitHub does the automatic resizing of the text area which could be achieved with the Autoresize plugin.

nlunets commented 1 year ago

Supporting the plugins is something that we can consider for sure. For the resize option, I am trying to find the equivalent on the UI5 wrapper but it doesn't seem to be working even if I edit the configuration, have you managed to get it to work with the base UI5 RTE ?

marianfoo commented 1 year ago

I have not tried it it yet. Only with Auto resize plugin, which works.
Still need to try your suggestion. I hope I can get macros rte control to add the plugin

nlunets commented 1 year ago

autoresize works definitely (tried it out quickly), but the resize option seems to do nothing :/

marianfoo commented 1 year ago

Same with Fullscreen, I needed to add with the button group, but I don't have a example anymore.
Maybe try that, see if it works

marianfoo commented 1 year ago

@nlunets i tried again with your suggestion to listen for the ui model.
Unfortunately this does not work, because the macros RTE is still a Text until it is in view.
You can see in the screenshot i am in edit mode, but the RTE is still macros (see code here) so i dont have access to the macros RTE via like byId('myRichTextEditor') Is there any way to know when the macros RTE appears?

image

nlunets commented 1 year ago

Just like any other control, there is no way to know that they appear :/

marianfoo commented 1 year ago

Just like any other control, there is no way to know that they appear :/

thought so, was hopeful that i missed something Thank you for your support!