Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Releases: prismicio/javascript-kit

1.0.18

25 Sep 08:22
Compare
Choose a tag to compare

Breaking change: The content in StructuredText is now escaped. This was a bug that had to be fixed, but if you relied on it to include custom HTML it will no longer work. You can use a custom html serializer to get the behavior you need.

Bugfixes

  • The content in StructuredText is now escaped.
  • #64 Fixed grouping lists

1.0.17

25 Sep 08:21
Compare
Choose a tag to compare

Features

  • Custom HTML serializer for StructuredText.asHtml()
  • Custom user agent for NodeJS

1.0.14

25 Sep 08:21
Compare
Choose a tag to compare

Features

  • Add the "block-img" class to

    tags of images

1.0.13

25 Sep 08:21
Compare
Choose a tag to compare

Features

  • Labels for blocks and spans
  • Add support for h4 to h6

1.0.12

26 Jun 00:06
Compare
Choose a tag to compare
1.0.12 Pre-release
Pre-release

Features

  • Release IDs now exposed from /api.
  • Document objects now expose their LinkedDocument objects.

Internal

  • The Documents class was renamed to Response for consistency with kits in other technologies. This class wasn't even exported, so this shouldn't change a thing to people using the kit.

1.0.11

17 Jun 01:07
Compare
Choose a tag to compare
1.0.11 Pre-release
Pre-release

New feature

  • Cache on the Api instantiation: all the other API calls were cached eternally, but you had to call the /api document once for each page your users were building; now we make sure /api does not get requested more than once every few seconds.
  • Added alt attribute to HTML serialization of images (as an image fragment or as an image in a structured text).
  • asText() now exists for all fragment classes and for the Doc class, just like asHtml().
  • Doc now has a getColor() method.
  • Ref now exposes scheduledAt, if it belongs to a scheduled content release.

Bugfix

  • In the /api endpoint, the refs of content releases that are scheduled have a scheduledAt field, which wasn't exposed in the Api class; it now is.
  • Serialization of structured text fragments that start with a list item was buggy (the first item was out of the <ul>).
  • StructuredText.getFirstImage was throwing an exception, now returns a proper result.
  • Support for legacy Internet Explorer

1.0.10

12 Jun 22:01
Compare
Choose a tag to compare
1.0.10 Pre-release
Pre-release

New feature

  • Support for Group fragments
  • HTML serialization of preformatted blocks within structured text fragments
  • page, pageSize and orderings helper functions

Bugfix

  • Using JSON.parse rather then eval in tests (we did not use eval in the lib)
  • Removed the append of #json to each API call, which used to make Internet Explorer grumpy, and wasn't needed.

1.0.9

20 Feb 00:07
Compare
Choose a tag to compare
1.0.9 Pre-release
Pre-release

New feature

  • Pagination specifics are now exposed. This means now you still get your results paginated 20 by 20, but for each API call you also get the total number of pages, the total amount of results, the page number you're on, etc... which makes it trivial for you to build a pagination.

Potentially breaking changes

Note that the change introduced in this version will break all of your existing API query calls, so if you were using an earlier version of the prismic.io Javascript kit, _you will be most likely affected_.

Since 1.0.8, the callback in your submit function used to take err and results, an array of Doc objects. Now, pagination specifics are returned too, so your submit callback takes err and documents, an object of the class Documents, which contains the pagination specifics and the array of Doc objects (contained in documents.results).

Here's a real-life example to help you understand what you need to do:

You need to transform this:

api.form("everything").ref(ctx.ref).submit(function(err, results){
    /* Do something */
    results.forEach(function(result) { /* Do something */ }
    /* Do something */
});

into this:

api.form("everything").ref(ctx.ref).submit(function(err, documents){
    /* Do something */
    documents.results.forEach(function(result) { /* Do something */ }
    /* Do something */
    /* Do something new with documents.total_results_size, if you want */
});

Note that the line where you have to change results into documents.results does not need to be right within your submit callback, but can be located in a function called by your submit callback. Specifically, if you use an MVC framework, the submit call is most likely in the controller, while the line you need to change may be in the view.

1.0.8

06 Feb 23:18
Compare
Choose a tag to compare
1.0.8 Pre-release
Pre-release

Potentially breaking changes

Note that the change introduced in this version will break all of your existing API query calls and API instantiations, so if you were using an earlier version of the prismic.io Javascript kit, _you will be most likely affected_.

The signature of the callback methods for the library's endpoint (Prismic.Api) and for the submit functions both have changed to include the possibility of an error callback, from callback(data) to callback(err, data).

Here's a real-life example to help you understand what you need to do:

You need to transform this:

Prismic.Api(
    api_endpoint,
    function(api) {
        /* Do what needs to be done with api */
    },
    potential_token,
    potential_request_handler
);

into this:

Prismic.Api(
    api_endpoint,
    function(err, api) {
        if (err) { /* Do whatever you want with err, for instance display err.message */ }
        else { /* Do what needs to be done with api */ }
    },
    potential_token,
    potential_request_handler
);

And you need to transform this:

api.form("everything").ref(ctx.ref).submit(function(results){
    /* Do what needs to be done with the results array */
});

into this:

api.form("everything").ref(ctx.ref).submit(function(err, results){
    if (err) { /* Do whatever you want with err, for instance display err.message */ }
    else { /* Do what needs to be done with the results array */ }
});

If your project is based on one of our JavaScript starter projects, look for a "Bump to 1.0.8" commit in the starter project's repository.

1.0.7

03 Feb 19:39
Compare
Choose a tag to compare
1.0.7 Pre-release
Pre-release

Bugfixes

  • Fixed bug on img.getView when getting the main view, that was introduced in 1.0.6
  • Fixed bug on img.getView when getting other views, that seem never to have worked