TextElement.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. SC.loadPackage({ 'TextElement': {
  2. comment: 'I define a text element.',
  3. traits: [ 'Element' ],
  4. sharedProperties: {
  5. protoHTML: { initValue: '<div class="sg-element" data-superglue-type="TextElement" style="left: 0px; top: 0px; width: 0px; height: 0px;">'
  6. +'\t<p>Text</p>'
  7. +'</div>' },
  8. applicableWidgets: { initValue: [ 'WidgetBackgroundColor', 'WidgetBorderColor', 'WidgetBorder', 'WidgetBorderRadius', 'WidgetPadding', 'WidgetOpacity' ] },
  9. creationMenuItem: { initValue: '<div class="sg-editing-creation-menu-container"><button id="sg-editing-creation-menu-textElement" class="sg-editing-creation-menu-button" title="text"></button></div>' }
  10. },
  11. properties: {
  12. },
  13. methods: {
  14. init: {
  15. comment: 'I initalize a new TextElement for the DOM node given to me as argument.',
  16. code: function(aNode){
  17. this.delegate('Element', 'init', aNode);
  18. // Custom initialisation here
  19. }
  20. },
  21. activateTextEditor: {
  22. comment: 'I start the text editor on my element.',
  23. code: function(){
  24. SC.init('TextEditor', this);
  25. }
  26. }
  27. }
  28. }});