YamlType.class.php 959 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. require_once(__DIR__.SLASH.'..'.SLASH.'..'.SLASH.'hackpoint'.SLASH.'types'.SLASH.'ReadmeType.class.php');
  3. class YamlType extends ReadmeType{
  4. public static function manifest(){
  5. return array(
  6. 'uid' => 'yaml',
  7. 'label' => 'YAML',
  8. 'icon' => 'fas fa-indent',
  9. 'color' => '#ffffff',
  10. 'background' => '#222222',
  11. 'description' => 'Structure YAML',
  12. 'fromExtension' => array('yaml','yml'),
  13. 'toExtension' => 'yml',
  14. 'default' => 'web:
  15. - restart: with-hackpoint-only',
  16. );
  17. }
  18. /* EDITION */
  19. public static function toHtml($resource,$sketch=null){
  20. $infos = self::manifest();
  21. return array(
  22. 'html'=>'<textarea id="content" onblur="hackpoint_resource_save_content()" class="arduino-text">'.$resource->content.'</textarea>',
  23. 'javascript' => "
  24. hackpoint_resource_mirrorify('.arduino-text',{
  25. mode : 'text/x-yaml',
  26. lineNumbers : true,
  27. theme : 'monokai',
  28. readOnly : false
  29. });
  30. "
  31. );
  32. }
  33. }
  34. ?>