2017-08-09 83 views
0

我正在使用Rappid JS的試用版,該版本在bpmn編輯器中具有帶默認選項的模板。我需要在列表中添加新元素,以便我可以使用它並追加與其關聯的檢查器表單。使用Rappid JS在BPMN編輯器中添加新的模板選項

下面是我試過的代碼。這是POC實施Rappid JS所必需的。

bpmn.js

stencil.load([ 
    new joint.shapes.bpmn.Gateway, 
    new joint.shapes.bpmn.Activity, 
    . 
    . 
    new joint,shapes.bpmn.myStencil 
]); 

inpector.js

window.inputs = { 
    'bpmn.Gateway': { 
     . 
     . 
    }, 
    . 
    . 
    'bpmn.myStencil':{ 
    //same as in-built Gateway code 
    } 
}; 

錯誤圖示:

joint.shapes.bpmn.myStencil不是構造。

回答

0

我把它做使用下面的代碼裏面bpmn.js:

joint.shapes.basic.Rect = joint.shapes.basic.Generic.extend({ 
    markup: '<g class="rotatable"><g class="scalable"><rect class="body"/></g><text class="label"/></g>', 

    defaults: joint.util.deepSupplement({ 
     type: 'basic.Rect', 
     attrs: { 
      'rect': { fill: 'white', stroke: 'black', 'follow-scale': true, width: 80, height: 40 }, 
      ".label":{text:"",ref:".body","ref-x":.5,"ref-dy":20,"y-alignment":"middle","x-alignment":"middle","font-size":14,"font-family":"Arial, helvetica, sans-serif",fill:"#000000"}, 
      'text': { 'font-size': 14, 'ref-x': .5, 'ref-y': .5, ref: 'rect', 'y-alignment': 'middle', 'x-alignment': 'middle' } 
     } 
    }, joint.shapes.basic.Generic.prototype.defaults) 
}); 
相關問題