0

Not Sure if the Documenatation is out of Date, but the standard code for creating a new richtext editor returns

Cannot read property 'RichTextEditor' of undefined

It looks like this is because there is no sap.ui.richtexteditor in the list of included resources.

var oRichTextEditor1 = new sap.ui.richtexteditor.RichTextEditor("myRTE1", {
    width:"100%", 
    height:"300px",
    showGroupClipboard:true,
    showGroupStructure:true,
    showGroupFont:true,
    showGroupInsert:true,
    showGroupLink:true,
    showGroupUndo:true,
    tooltip:"My RTE Tooltip"
});

What are my other options for a RichText/WYSIWYG editor in SAPUI5 ?

4

1 回答 1

2

You should use the sap.ui.define syntax to require the RichTextEditor control in your controller. As the control library is not included in the resources, it would not be readily available.

sap.ui.define([
  "com/sap/app/controller/BaseController",
  .
  .
  .
  "sap/ui/richtexteditor/RichTextEditor"
], function (BaseController, ........, RichTextEditor) {

onAfterRendering: function () {

        var oRichTextEditor1 = new RichTextEditor("myRTE1", {
            width:"100%", 
            height:"300px",
            showGroupClipboard:true,
            showGroupStructure:true,
            showGroupFont:true,
            showGroupInsert:true,
            showGroupLink:true,
            showGroupUndo:true,
            tooltip:"My RTE Tooltip"
        }); 
  } 
});
于 2017-10-30T05:59:50.323 回答