Uploaded image for project: 'AppFormer'
  1. AppFormer
  2. AF-469

Cannot create custom editor

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • None
    • None
    • NEW
    • NEW

      I am researching adding a custom editor in BC for .feature files. I have the ace.js mode file (I see that most of our text editors also use ACE) and have tried two different ways of adding the editor, the JS api (in BC/plugins) and trying to create an editor in java and compile the jar and put it in BC/web-inf/lib.

      What approach do you recommend for adding a new editor for a new ResourceType? I tried adding the following js file in plugins folder from the docs[1]

      $registerEditor({
          "id": "sample editor",
          "type": "editor",
          "templateUrl": "editor.html",
          "resourceType": "org.uberfire.client.workbench.type.AnyResourceType",
          "on_concurrent_update":function(){
              alert('on_concurrent_update callback')
              $vfs_readAllString(document.getElementById('filename').innerHTML, function(a) {
                  document.getElementById('editor').value= a;
              });
          },
          "on_startup": function (uri) {
              $vfs_readAllString(uri, function(a) {
                  alert('sample on_startup callback')
              });
          },
          "on_open":function(uri){
              $vfs_readAllString(uri, function(a) {
                  document.getElementById('editor').value=a;
              });
              document.getElementById('filename').innerHTML = uri;
          }
      });
      

      I also added the editor.html file to the plugins folder but I can't get the sample editor to open any files. Further, I'm going to have to get it to work for .feature files which, afaik, includes adding a new ResourceType.

              eignatow Eder Ignatowicz
              selrahal Salem Elrahal (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: