Skip to content
Snippets Groups Projects
editor.js 1.25 KiB
Newer Older
  • Learn to ignore specific revisions
  •   /**
       * Get closest row of element
       *
       * @param {jQuery} $el
       * @returns {jQuery}
       */
      function getRow($el) {
    
        /**
         * Initializes editor
         */
    
        var $editor = $('.h5p-editor');
    
        var $fileField = $('input[name="h5pfile"]');
    
    
        if (H5PIntegration.hubIsEnabled) {
    
          // TODO: This can easily break in new themes. Improve robustness of this
          // by not including h5paction in form, when it should not be used.
          $('input[name="h5paction"]').parents('.fitem').last().hide();
    
        const mformId = H5PIntegration.editor && H5PIntegration.editor.formId !== null
          ? H5PIntegration.editor.formId
          : 'mform1';
    
    
        // Cancel validation and submission of form if clicking cancel button
        const cancelSubmitCallback = function ($button) {
          return $button.is('[name="cancel"]');
        };
    
    
        H5PEditor.init(
    
          $('input[name="h5paction"]'),
    
          $editor,
          $('input[name="h5plibrary"]'),
    
          $('input[name="h5pparams"]'),
          $('input[name="h5pmaxscore"]'),