Skip to content

Commit

Permalink
Remove duplicate content that got added in botched merge-conflict res…
Browse files Browse the repository at this point in the history
…olution
  • Loading branch information
ryami333 committed Jul 23, 2024
1 parent 726eca1 commit c91678b
Showing 1 changed file with 5 additions and 112 deletions.
117 changes: 5 additions & 112 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<div align="center">
<a href="https://www.storyblok.com?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-js-client" align="center">
<img src="https://a.storyblok.com/f/88751/1776x360/4d075611c6/sb-js-sdk.png" alt="Storyblok Logo">
</a>
<h1 align="center">Universal JavaScript Client for Storyblok's API</h1>
<p align="center">This client is a thin wrapper for the <a href="http://www.storyblok.com?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-js-client" target="_blank">Storyblok</a> API's to use in Node.js and the browser.</p>
<a href="https://www.storyblok.com?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-js-client" align="center">
<img src="https://a.storyblok.com/f/88751/1776x360/4d075611c6/sb-js-sdk.png" alt="Storyblok Logo">
</a>
<h1 align="center">Universal JavaScript Client for Storyblok's API</h1>
<p align="center">This client is a thin wrapper for the <a href="http://www.storyblok.com?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-js-client" target="_blank">Storyblok</a> API's to use in Node.js and the browser.</p>
</div>

<p align="center">
Expand Down Expand Up @@ -214,9 +214,6 @@ Exceptions will be thrown as an object with the following structure:
message: Error // an Error object with the error message
status: number
response: ISbResponse
message: Error // an Error object with the error message
status: number
response: ISbResponse
}
```

Expand Down Expand Up @@ -275,10 +272,6 @@ const data = {
name: 'xy',
slug: 'xy',
},
story: {
name: 'xy',
slug: 'xy',
},
}

Storyblok.get(
Expand All @@ -291,28 +284,13 @@ Storyblok.get(
cache: 'no-cache',
body: JSON.stringify(data),
}
'cdn/stories/home',
{
version: 'draft',
},
{
mode: 'cors',
cache: 'no-cache',
body: JSON.stringify(data),
}
)
.then((response) => {
console.log(response)
})
.catch((error) => {
console.error(error)
})
.then((response) => {
console.log(response)
})
.catch((error) => {
console.error(error)
})
```

### Method `Storyblok#get`
Expand All @@ -331,20 +309,13 @@ With this method you can get single or multiple items. The multiple items are pa
```javascript
Storyblok.get('cdn/stories/home', {
version: 'draft',
version: 'draft',
})
.then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
})
.then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
})
```

#### Method `Storyblok#getAll`
Expand All @@ -364,20 +335,13 @@ With this method you can get all items at once.
```javascript
Storyblok.getAll('cdn/stories', {
version: 'draft',
version: 'draft',
})
.then((stories) => {
console.log(stories) // an array
})
.catch((error) => {
console.log(error)
})
.then((stories) => {
console.log(stories) // an array
})
.catch((error) => {
console.log(error)
})
```

#### Method `Storyblok#post` (only management api)
Expand All @@ -394,20 +358,13 @@ Storyblok.getAll('cdn/stories', {
```javascript
Storyblok.post('spaces/<YOUR_SPACE_ID>/stories', {
story: { name: 'xy', slug: 'xy' },
story: { name: 'xy', slug: 'xy' },
})
.then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
})
.then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
})
```

#### Method `Storyblok#put` (only management api)
Expand All @@ -424,20 +381,13 @@ Storyblok.post('spaces/<YOUR_SPACE_ID>/stories', {
```javascript
Storyblok.put('spaces/<YOUR_SPACE_ID>/stories/1', {
story: { name: 'xy', slug: 'xy' },
story: { name: 'xy', slug: 'xy' },
})
.then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
})
.then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
})
```

#### Method `Storyblok#delete` (only management api)
Expand All @@ -459,12 +409,6 @@ Storyblok.delete('spaces/<YOUR_SPACE_ID>/stories/1', null)
.catch((error) => {
console.log(error)
})
.then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
})
```

#### Method `Storyblok#flushCache`
Expand Down Expand Up @@ -761,18 +705,7 @@ import MySchema from 'storyblok-js-client/schema'

MySchema.nodes.heading = function (node) {
let attrs = {}
let attrs = {}

if (
node.content &&
node.content.length === 1 &&
node.content[0].marks &&
node.content[0].marks.length === 1 &&
node.content[0].marks[0].type === 'styled'
) {
attrs = node.content[0].marks[0].attrs
delete node.content[0].marks
}
if (
node.content &&
node.content.length === 1 &&
Expand All @@ -792,14 +725,6 @@ MySchema.nodes.heading = function (node) {
},
],
}
return {
tag: [
{
tag: `h${node.attrs.level}`,
attrs: attrs,
},
],
}
}

let rteResolver = new RichTextResolver(MySchema)
Expand Down Expand Up @@ -836,38 +761,6 @@ let rendered = rteResolver.render({
},
],
type: 'doc',
content: [
{
content: [
{
text: 'Normal headline',
type: 'text',
},
],
type: 'paragraph',
},
{
attrs: {
level: 3,
},
content: [
{
marks: [
{
attrs: {
class: 'margin-bottom-fdsafdsada',
},
type: 'styled',
},
],
text: 'Styled headline',
type: 'text',
},
],
type: 'heading',
},
],
type: 'doc',
})

console.log(rendered)
Expand Down

0 comments on commit c91678b

Please sign in to comment.