mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-11 01:33:58 +02:00
fix html serializer tests
This commit is contained in:
@@ -1,23 +1,25 @@
|
|||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
rules: [
|
||||||
deserialize(el, next) {
|
{
|
||||||
switch (el.tagName) {
|
deserialize(el, next) {
|
||||||
case 'p': {
|
switch (el.tagName) {
|
||||||
return {
|
case 'p': {
|
||||||
kind: 'block',
|
return {
|
||||||
type: 'paragraph',
|
kind: 'block',
|
||||||
nodes: next(el.children)
|
type: 'paragraph',
|
||||||
|
nodes: next(el.children)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
case 'blockquote': {
|
||||||
case 'blockquote': {
|
return {
|
||||||
return {
|
kind: 'block',
|
||||||
kind: 'block',
|
type: 'quote',
|
||||||
type: 'quote',
|
nodes: next(el.children)
|
||||||
nodes: next(el.children)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
@@ -1,17 +1,19 @@
|
|||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
rules: [
|
||||||
deserialize(el, next) {
|
{
|
||||||
switch (el.tagName) {
|
deserialize(el, next) {
|
||||||
case 'p': {
|
switch (el.tagName) {
|
||||||
return {
|
case 'p': {
|
||||||
kind: 'block',
|
return {
|
||||||
type: 'paragraph',
|
kind: 'block',
|
||||||
data: { key: 'value' },
|
type: 'paragraph',
|
||||||
nodes: next(el.children)
|
data: { key: 'value' },
|
||||||
|
nodes: next(el.children)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
@@ -1,16 +1,18 @@
|
|||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
rules: [
|
||||||
deserialize(el, next) {
|
{
|
||||||
switch (el.tagName) {
|
deserialize(el, next) {
|
||||||
case 'p': {
|
switch (el.tagName) {
|
||||||
return {
|
case 'p': {
|
||||||
kind: 'block',
|
return {
|
||||||
type: 'paragraph',
|
kind: 'block',
|
||||||
isVoid: true
|
type: 'paragraph',
|
||||||
|
isVoid: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
@@ -1,16 +1,18 @@
|
|||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
rules: [
|
||||||
deserialize(el, next) {
|
{
|
||||||
switch (el.tagName) {
|
deserialize(el, next) {
|
||||||
case 'p': {
|
switch (el.tagName) {
|
||||||
return {
|
case 'p': {
|
||||||
kind: 'block',
|
return {
|
||||||
type: 'paragraph',
|
kind: 'block',
|
||||||
nodes: next(el.children)
|
type: 'paragraph',
|
||||||
|
nodes: next(el.children)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
@@ -1,30 +1,32 @@
|
|||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
rules: [
|
||||||
deserialize(el, next) {
|
{
|
||||||
switch (el.tagName) {
|
deserialize(el, next) {
|
||||||
case 'p': {
|
switch (el.tagName) {
|
||||||
return {
|
case 'p': {
|
||||||
kind: 'block',
|
return {
|
||||||
type: 'paragraph',
|
kind: 'block',
|
||||||
nodes: next(el.children)
|
type: 'paragraph',
|
||||||
|
nodes: next(el.children)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
case 'a': {
|
||||||
case 'a': {
|
return {
|
||||||
return {
|
kind: 'inline',
|
||||||
kind: 'inline',
|
type: 'link',
|
||||||
type: 'link',
|
nodes: next(el.children)
|
||||||
nodes: next(el.children)
|
}
|
||||||
}
|
}
|
||||||
}
|
case 'b': {
|
||||||
case 'b': {
|
return {
|
||||||
return {
|
kind: 'inline',
|
||||||
kind: 'inline',
|
type: 'hashtag',
|
||||||
type: 'hashtag',
|
nodes: next(el.children)
|
||||||
nodes: next(el.children)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
@@ -1,26 +1,28 @@
|
|||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
rules: [
|
||||||
deserialize(el, next) {
|
{
|
||||||
switch (el.tagName) {
|
deserialize(el, next) {
|
||||||
case 'p': {
|
switch (el.tagName) {
|
||||||
return {
|
case 'p': {
|
||||||
kind: 'block',
|
return {
|
||||||
type: 'paragraph',
|
kind: 'block',
|
||||||
nodes: next(el.children)
|
type: 'paragraph',
|
||||||
|
nodes: next(el.children)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
case 'a': {
|
||||||
case 'a': {
|
return {
|
||||||
return {
|
kind: 'inline',
|
||||||
kind: 'inline',
|
type: 'link',
|
||||||
type: 'link',
|
nodes: next(el.children),
|
||||||
nodes: next(el.children),
|
data: {
|
||||||
data: {
|
href: el.attribs.href
|
||||||
href: el.attribs.href
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
@@ -1,23 +1,25 @@
|
|||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
rules: [
|
||||||
deserialize(el, next) {
|
{
|
||||||
switch (el.tagName) {
|
deserialize(el, next) {
|
||||||
case 'p': {
|
switch (el.tagName) {
|
||||||
return {
|
case 'p': {
|
||||||
kind: 'block',
|
return {
|
||||||
type: 'paragraph',
|
kind: 'block',
|
||||||
nodes: next(el.children)
|
type: 'paragraph',
|
||||||
|
nodes: next(el.children)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
case 'a': {
|
||||||
case 'a': {
|
return {
|
||||||
return {
|
kind: 'inline',
|
||||||
kind: 'inline',
|
type: 'link',
|
||||||
type: 'link',
|
isVoid: true
|
||||||
isVoid: true
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
@@ -1,23 +1,25 @@
|
|||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
rules: [
|
||||||
deserialize(el, next) {
|
{
|
||||||
switch (el.tagName) {
|
deserialize(el, next) {
|
||||||
case 'p': {
|
switch (el.tagName) {
|
||||||
return {
|
case 'p': {
|
||||||
kind: 'block',
|
return {
|
||||||
type: 'paragraph',
|
kind: 'block',
|
||||||
nodes: next(el.children)
|
type: 'paragraph',
|
||||||
|
nodes: next(el.children)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
case 'a': {
|
||||||
case 'a': {
|
return {
|
||||||
return {
|
kind: 'inline',
|
||||||
kind: 'inline',
|
type: 'link',
|
||||||
type: 'link',
|
nodes: next(el.children)
|
||||||
nodes: next(el.children)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
@@ -1,30 +1,32 @@
|
|||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
rules: [
|
||||||
deserialize(el, next) {
|
{
|
||||||
switch (el.tagName) {
|
deserialize(el, next) {
|
||||||
case 'p': {
|
switch (el.tagName) {
|
||||||
return {
|
case 'p': {
|
||||||
kind: 'block',
|
return {
|
||||||
type: 'paragraph',
|
kind: 'block',
|
||||||
nodes: next(el.children)
|
type: 'paragraph',
|
||||||
|
nodes: next(el.children)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
case 'em': {
|
||||||
case 'em': {
|
return {
|
||||||
return {
|
kind: 'mark',
|
||||||
kind: 'mark',
|
type: 'italic',
|
||||||
type: 'italic',
|
nodes: next(el.children)
|
||||||
nodes: next(el.children)
|
}
|
||||||
}
|
}
|
||||||
}
|
case 'strong': {
|
||||||
case 'strong': {
|
return {
|
||||||
return {
|
kind: 'mark',
|
||||||
kind: 'mark',
|
type: 'bold',
|
||||||
type: 'bold',
|
nodes: next(el.children)
|
||||||
nodes: next(el.children)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
@@ -1,30 +1,32 @@
|
|||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
rules: [
|
||||||
deserialize(el, next) {
|
{
|
||||||
switch (el.tagName) {
|
deserialize(el, next) {
|
||||||
case 'p': {
|
switch (el.tagName) {
|
||||||
return {
|
case 'p': {
|
||||||
kind: 'block',
|
return {
|
||||||
type: 'paragraph',
|
kind: 'block',
|
||||||
nodes: next(el.children)
|
type: 'paragraph',
|
||||||
|
nodes: next(el.children)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
case 'em': {
|
||||||
case 'em': {
|
return {
|
||||||
return {
|
kind: 'mark',
|
||||||
kind: 'mark',
|
type: 'italic',
|
||||||
type: 'italic',
|
nodes: next(el.children)
|
||||||
nodes: next(el.children)
|
}
|
||||||
}
|
}
|
||||||
}
|
case 'strong': {
|
||||||
case 'strong': {
|
return {
|
||||||
return {
|
kind: 'mark',
|
||||||
kind: 'mark',
|
type: 'bold',
|
||||||
type: 'bold',
|
nodes: next(el.children)
|
||||||
nodes: next(el.children)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
@@ -1,23 +1,25 @@
|
|||||||
|
|
||||||
export default [
|
export default {
|
||||||
{
|
rules: [
|
||||||
deserialize(el, next) {
|
{
|
||||||
switch (el.tagName) {
|
deserialize(el, next) {
|
||||||
case 'p': {
|
switch (el.tagName) {
|
||||||
return {
|
case 'p': {
|
||||||
kind: 'block',
|
return {
|
||||||
type: 'paragraph',
|
kind: 'block',
|
||||||
nodes: next(el.children)
|
type: 'paragraph',
|
||||||
|
nodes: next(el.children)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
case 'em': {
|
||||||
case 'em': {
|
return {
|
||||||
return {
|
kind: 'mark',
|
||||||
kind: 'mark',
|
type: 'italic',
|
||||||
type: 'italic',
|
nodes: next(el.children)
|
||||||
nodes: next(el.children)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
Reference in New Issue
Block a user