start removing raw serializer (#1098)
* start removing raw serializer
* convert first tests to use jsx
* simplify jsx tests for raw serializer
* allow for options in raw serializer tests
* add more preserve option tests
* convert plain serializer tests
* convert html serialize
* start converting html deserialize
* add hyperscript util
* remove slate-sugar copy-pasted
* finish converting html deserialize
* convert plugins tests
* update rendering tests
* convert schemas tests
* convert core plugin tests
* update hyperscript utl
* refactor changes test directory structure
* fix changes before migration
* add migrated changes test files
* remove <x- prefixes from migration
* get addMark at-current-range tests passing
* get delete at-current-range tests passing
* remove old tests
* convert deleteForward and deleteBackward
* convert insertBlock, insertInline, insertFragment, insertText
* convert removeMark, setBlock, setInline, splitBlock, splitInline
* add unstaged tests
* convert toggleMark, unwrapBlock, unwrapInline, wrapBlock, wrapInline, wrapText
* convert call, setData
* convert on-selection tests
* remove old on-selection tests
* convert history tests
* convert insertFragmentByKey, insertNodeByKey, insertTextByKey, mergeNodeByKey, moveNodeByKey
* convert removeNodeByKey, removeTextByKey, setMarkByKey, setNodeByKey
* convert splitDescendantsByKey, splitNodeByKey, unwrapBlockByKey, unwrapInlineByKey, unwrapNodeByKey, wrapBlockByKey
* fix tests
* port missing at-range tests to at-current-range
* remove at-range tests
* fix raw serializer tests
* fix linter
* fix to prefer toJSON as the canonical method name
* fix todos
* remove internal references to Raw
* add deprecation helper to Text.fromJSON
* convert examples to not use Raw, and not rely on terse
* remove focus-blur example, rename large document example
* refactor Raw serialize to deprecate, not remove, terse
* deprecate defaultBlockType, toRaw, cleanup serializers
2017-09-10 14:56:03 -07:00
|
|
|
/** @jsx h */
|
|
|
|
|
|
|
|
import React from 'react'
|
|
|
|
import h from '../../helpers/h'
|
|
|
|
|
2017-10-25 17:32:29 -07:00
|
|
|
function Image(props) {
|
2018-02-06 23:12:00 +00:00
|
|
|
return React.createElement('img', {
|
|
|
|
src: props.node.data.get('src'),
|
|
|
|
...props.attributes,
|
|
|
|
})
|
2017-10-25 17:32:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function renderNode(props) {
|
|
|
|
switch (props.node.type) {
|
2018-02-06 23:12:00 +00:00
|
|
|
case 'image':
|
|
|
|
return Image(props)
|
start removing raw serializer (#1098)
* start removing raw serializer
* convert first tests to use jsx
* simplify jsx tests for raw serializer
* allow for options in raw serializer tests
* add more preserve option tests
* convert plain serializer tests
* convert html serialize
* start converting html deserialize
* add hyperscript util
* remove slate-sugar copy-pasted
* finish converting html deserialize
* convert plugins tests
* update rendering tests
* convert schemas tests
* convert core plugin tests
* update hyperscript utl
* refactor changes test directory structure
* fix changes before migration
* add migrated changes test files
* remove <x- prefixes from migration
* get addMark at-current-range tests passing
* get delete at-current-range tests passing
* remove old tests
* convert deleteForward and deleteBackward
* convert insertBlock, insertInline, insertFragment, insertText
* convert removeMark, setBlock, setInline, splitBlock, splitInline
* add unstaged tests
* convert toggleMark, unwrapBlock, unwrapInline, wrapBlock, wrapInline, wrapText
* convert call, setData
* convert on-selection tests
* remove old on-selection tests
* convert history tests
* convert insertFragmentByKey, insertNodeByKey, insertTextByKey, mergeNodeByKey, moveNodeByKey
* convert removeNodeByKey, removeTextByKey, setMarkByKey, setNodeByKey
* convert splitDescendantsByKey, splitNodeByKey, unwrapBlockByKey, unwrapInlineByKey, unwrapNodeByKey, wrapBlockByKey
* fix tests
* port missing at-range tests to at-current-range
* remove at-range tests
* fix raw serializer tests
* fix linter
* fix to prefer toJSON as the canonical method name
* fix todos
* remove internal references to Raw
* add deprecation helper to Text.fromJSON
* convert examples to not use Raw, and not rely on terse
* remove focus-blur example, rename large document example
* refactor Raw serialize to deprecate, not remove, terse
* deprecate defaultBlockType, toRaw, cleanup serializers
2017-09-10 14:56:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-25 17:32:29 -07:00
|
|
|
export const props = {
|
|
|
|
renderNode,
|
|
|
|
}
|
|
|
|
|
2017-10-27 13:39:06 -07:00
|
|
|
export const value = (
|
|
|
|
<value>
|
start removing raw serializer (#1098)
* start removing raw serializer
* convert first tests to use jsx
* simplify jsx tests for raw serializer
* allow for options in raw serializer tests
* add more preserve option tests
* convert plain serializer tests
* convert html serialize
* start converting html deserialize
* add hyperscript util
* remove slate-sugar copy-pasted
* finish converting html deserialize
* convert plugins tests
* update rendering tests
* convert schemas tests
* convert core plugin tests
* update hyperscript utl
* refactor changes test directory structure
* fix changes before migration
* add migrated changes test files
* remove <x- prefixes from migration
* get addMark at-current-range tests passing
* get delete at-current-range tests passing
* remove old tests
* convert deleteForward and deleteBackward
* convert insertBlock, insertInline, insertFragment, insertText
* convert removeMark, setBlock, setInline, splitBlock, splitInline
* add unstaged tests
* convert toggleMark, unwrapBlock, unwrapInline, wrapBlock, wrapInline, wrapText
* convert call, setData
* convert on-selection tests
* remove old on-selection tests
* convert history tests
* convert insertFragmentByKey, insertNodeByKey, insertTextByKey, mergeNodeByKey, moveNodeByKey
* convert removeNodeByKey, removeTextByKey, setMarkByKey, setNodeByKey
* convert splitDescendantsByKey, splitNodeByKey, unwrapBlockByKey, unwrapInlineByKey, unwrapNodeByKey, wrapBlockByKey
* fix tests
* port missing at-range tests to at-current-range
* remove at-range tests
* fix raw serializer tests
* fix linter
* fix to prefer toJSON as the canonical method name
* fix todos
* remove internal references to Raw
* add deprecation helper to Text.fromJSON
* convert examples to not use Raw, and not rely on terse
* remove focus-blur example, rename large document example
* refactor Raw serialize to deprecate, not remove, terse
* deprecate defaultBlockType, toRaw, cleanup serializers
2017-09-10 14:56:03 -07:00
|
|
|
<document>
|
|
|
|
<image src="https://example.com/image.png" />
|
|
|
|
</document>
|
2017-10-27 13:39:06 -07:00
|
|
|
</value>
|
start removing raw serializer (#1098)
* start removing raw serializer
* convert first tests to use jsx
* simplify jsx tests for raw serializer
* allow for options in raw serializer tests
* add more preserve option tests
* convert plain serializer tests
* convert html serialize
* start converting html deserialize
* add hyperscript util
* remove slate-sugar copy-pasted
* finish converting html deserialize
* convert plugins tests
* update rendering tests
* convert schemas tests
* convert core plugin tests
* update hyperscript utl
* refactor changes test directory structure
* fix changes before migration
* add migrated changes test files
* remove <x- prefixes from migration
* get addMark at-current-range tests passing
* get delete at-current-range tests passing
* remove old tests
* convert deleteForward and deleteBackward
* convert insertBlock, insertInline, insertFragment, insertText
* convert removeMark, setBlock, setInline, splitBlock, splitInline
* add unstaged tests
* convert toggleMark, unwrapBlock, unwrapInline, wrapBlock, wrapInline, wrapText
* convert call, setData
* convert on-selection tests
* remove old on-selection tests
* convert history tests
* convert insertFragmentByKey, insertNodeByKey, insertTextByKey, mergeNodeByKey, moveNodeByKey
* convert removeNodeByKey, removeTextByKey, setMarkByKey, setNodeByKey
* convert splitDescendantsByKey, splitNodeByKey, unwrapBlockByKey, unwrapInlineByKey, unwrapNodeByKey, wrapBlockByKey
* fix tests
* port missing at-range tests to at-current-range
* remove at-range tests
* fix raw serializer tests
* fix linter
* fix to prefer toJSON as the canonical method name
* fix todos
* remove internal references to Raw
* add deprecation helper to Text.fromJSON
* convert examples to not use Raw, and not rely on terse
* remove focus-blur example, rename large document example
* refactor Raw serialize to deprecate, not remove, terse
* deprecate defaultBlockType, toRaw, cleanup serializers
2017-09-10 14:56:03 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
export const output = `
|
|
|
|
<div data-slate-editor="true" contenteditable="true" role="textbox">
|
2018-04-28 04:42:53 +08:00
|
|
|
<div data-slate-void="true">
|
|
|
|
<div data-slate-spacer="true" style="height:0;color:transparent;outline:none">
|
2017-10-13 18:05:05 -07:00
|
|
|
<span>
|
2017-11-12 00:35:30 +01:00
|
|
|
<span>
|
2018-02-21 12:38:56 -08:00
|
|
|
<span data-slate-zero-width="z">​</span>
|
2017-11-12 00:35:30 +01:00
|
|
|
</span>
|
2017-10-13 18:05:05 -07:00
|
|
|
</span>
|
|
|
|
</div>
|
2018-05-02 01:38:31 +01:00
|
|
|
<div contenteditable="false">
|
start removing raw serializer (#1098)
* start removing raw serializer
* convert first tests to use jsx
* simplify jsx tests for raw serializer
* allow for options in raw serializer tests
* add more preserve option tests
* convert plain serializer tests
* convert html serialize
* start converting html deserialize
* add hyperscript util
* remove slate-sugar copy-pasted
* finish converting html deserialize
* convert plugins tests
* update rendering tests
* convert schemas tests
* convert core plugin tests
* update hyperscript utl
* refactor changes test directory structure
* fix changes before migration
* add migrated changes test files
* remove <x- prefixes from migration
* get addMark at-current-range tests passing
* get delete at-current-range tests passing
* remove old tests
* convert deleteForward and deleteBackward
* convert insertBlock, insertInline, insertFragment, insertText
* convert removeMark, setBlock, setInline, splitBlock, splitInline
* add unstaged tests
* convert toggleMark, unwrapBlock, unwrapInline, wrapBlock, wrapInline, wrapText
* convert call, setData
* convert on-selection tests
* remove old on-selection tests
* convert history tests
* convert insertFragmentByKey, insertNodeByKey, insertTextByKey, mergeNodeByKey, moveNodeByKey
* convert removeNodeByKey, removeTextByKey, setMarkByKey, setNodeByKey
* convert splitDescendantsByKey, splitNodeByKey, unwrapBlockByKey, unwrapInlineByKey, unwrapNodeByKey, wrapBlockByKey
* fix tests
* port missing at-range tests to at-current-range
* remove at-range tests
* fix raw serializer tests
* fix linter
* fix to prefer toJSON as the canonical method name
* fix todos
* remove internal references to Raw
* add deprecation helper to Text.fromJSON
* convert examples to not use Raw, and not rely on terse
* remove focus-blur example, rename large document example
* refactor Raw serialize to deprecate, not remove, terse
* deprecate defaultBlockType, toRaw, cleanup serializers
2017-09-10 14:56:03 -07:00
|
|
|
<img src="https://example.com/image.png">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
`.trim()
|