Sha256: 833e79fcd64a1a2806983968d5f1ead8e903dada4538414b93e14f511a1b0701

Contents?: true

Size: 1.55 KB

Versions: 11

Compression:

Stored size: 1.55 KB

Contents

'use strict';

(function () {
  // -- PATCH BEGINS HERE --
  // remove old scrivito.binaryFieldElement
  var definitions = scrivito.cms_element.definitions;
  for (var i = 0; i < definitions.length; ++i) {
    if (definitions[i] === scrivito.binaryFieldElement) {
      definitions.splice(i, 1);
      break;
    }
  }
  // -- PATCH ENDS HERE --

  scrivito.binaryFieldElement = {
    create_instance: function create_instance(cmsElement) {
      if (cmsElement.dom_element().attr('data-scrivito-field-type') === 'binary') {
        var that = scrivito.cms_field_element.create_instance(cmsElement);
        // -- PATCH BEGINS HERE --
        /*
        const bufferedWriter = new scrivito.BufferedWriter((value) => {
          if (scrivito.BinaryUtils.isFile(value)) {
            return scrivito.Binary.upload(value).into(that.basic_obj());
          }
          if (value instanceof scrivito.FutureBinary) {
            return value.into(that.basic_obj());
          }
           return scrivito.Promise.resolve(value);
        });
         _.extend(that, {
          preprocess(value) {
            return bufferedWriter.write(value).catch((error) => {
              scrivito.handleAjaxError(error);
              throw error;
            });
          },
        });
        */

        _.extend(that, {
          preprocess: function preprocess(value) {
            return scrivito.Promise.resolve(value);
          }
        });
        // -- PATCH ENDS HERE --

        return that;
      }
    }
  };

  scrivito.cms_element.definitions.push(scrivito.binaryFieldElement);
})();

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
infopark_fiona7-1.5.5.5.1 app/assets/javascripts/scrivito_patches/models/binary_field_element.js
infopark_fiona7-1.5.5.5.0 app/assets/javascripts/scrivito_patches/models/binary_field_element.js
infopark_fiona7-1.5.5.4.1 app/assets/javascripts/scrivito_patches/models/binary_field_element.js
infopark_fiona7-1.5.5.4.0 app/assets/javascripts/scrivito_patches/models/binary_field_element.js
infopark_fiona7-1.2.0.1.3 app/assets/javascripts/scrivito_patches/models/binary_field_element.js
infopark_fiona7-1.5.5.3.1 app/assets/javascripts/scrivito_patches/models/binary_field_element.js
infopark_fiona7-1.5.4.3.0 app/assets/javascripts/scrivito_patches/models/binary_field_element.js
infopark_fiona7-1.5.3.2.0 app/assets/javascripts/scrivito_patches/models/binary_field_element.js
infopark_fiona7-1.5.3.2.0.pre.beta1 app/assets/javascripts/scrivito_patches/models/binary_field_element.js
infopark_fiona7-1.5.2.1.0.pre.beta1 app/assets/javascripts/scrivito_patches/models/binary_field_element.js
infopark_fiona7-1.5.2.0.0 app/assets/javascripts/scrivito_patches/models/binary_field_element.js