1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-21 22:02:05 +02:00

Switch initialValue type in examples to Descendant

This commit is contained in:
Sunny Hirai 2021-03-29 09:49:44 -07:00
parent 4661f19d4b
commit c803e5ffd0
17 changed files with 24 additions and 54 deletions

View File

@ -19,7 +19,7 @@ import {
import { css } from 'emotion'
import { withHistory } from 'slate-history'
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -142,7 +142,7 @@ const Leaf = ({ attributes, children, leaf }) => {
)
}
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -1,10 +1,5 @@
import React, { useState, useMemo } from 'react'
import {
Transforms,
createEditor,
Element as SlateElement,
Descendant,
} from 'slate'
import { Transforms, createEditor, Descendant } from 'slate'
import { Slate, Editable, useSlateStatic, withReact } from 'slate-react'
import { withHistory } from 'slate-history'
import { css } from 'emotion'
@ -136,7 +131,7 @@ const InsertEditableVoidButton = () => {
)
}
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -2,7 +2,6 @@ import React, { useState, useMemo } from 'react'
import {
Transforms,
createEditor,
Node,
Element as SlateElement,
Descendant,
} from 'slate'
@ -12,8 +11,6 @@ import {
withReact,
useSlateStatic,
ReactEditor,
useFocused,
useSelected,
} from 'slate-react'
const EmbedsExample = () => {
@ -104,7 +101,7 @@ const UrlInput = ({ url, onChange }) => {
)
}
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -75,7 +75,7 @@ const Element = ({ attributes, children, element }) => {
}
}
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'title',
children: [{ text: 'Enforce Your Layout!' }],

View File

@ -147,7 +147,7 @@ const FormatButton = ({ format, icon }) => {
)
}
const initialValue: Element[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -1,11 +1,11 @@
import React, { useState, useMemo, useCallback } from 'react'
import faker from 'faker'
import { Element as SlateElement, Node, createEditor, Descendant } from 'slate'
import { createEditor, Descendant } from 'slate'
import { Slate, Editable, withReact } from 'slate-react'
const HEADINGS = 100
const PARAGRAPHS = 7
const initialValue: SlateElement[] = []
const initialValue: Descendant[] = []
for (let h = 0; h < HEADINGS; h++) {
initialValue.push({

View File

@ -2,12 +2,7 @@ import React, { useCallback, useMemo, useState } from 'react'
import { createPortal } from 'react-dom'
import isHotkey from 'is-hotkey'
import { Editable, withReact, useSlate, Slate, ReactEditor } from 'slate-react'
import {
Editor,
Element as SlateElement,
createEditor,
Descendant,
} from 'slate'
import { Editor, createEditor, Descendant } from 'slate'
import { withHistory } from 'slate-history'
import { Button, Icon, Toolbar } from '../components'
@ -122,7 +117,7 @@ const IFrame = ({ children, ...props }) => {
)
}
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -1,12 +1,7 @@
import React, { useState, useMemo } from 'react'
import imageExtensions from 'image-extensions'
import isUrl from 'is-url'
import {
Transforms,
createEditor,
Element as SlateElement,
Descendant,
} from 'slate'
import { Transforms, createEditor, Descendant } from 'slate'
import {
Slate,
Editable,
@ -137,7 +132,7 @@ const isImageUrl = url => {
return imageExtensions.includes(ext)
}
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -134,7 +134,7 @@ const LinkButton = () => {
)
}
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -109,7 +109,7 @@ const Leaf = ({ attributes, children, leaf }) => {
)
}
const initialValue: Element[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -160,7 +160,7 @@ const Element = ({ attributes, children, element }) => {
}
}
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -1,12 +1,5 @@
import React, { useMemo, useCallback, useRef, useEffect, useState } from 'react'
import {
Editor,
Transforms,
Range,
createEditor,
Element as SlateElement,
Descendant,
} from 'slate'
import { Editor, Transforms, Range, createEditor, Descendant } from 'slate'
import { withHistory } from 'slate-history'
import {
Slate,
@ -205,7 +198,7 @@ const Mention = ({ attributes, children, element }) => {
)
}
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -1,11 +1,6 @@
import React, { useState, useCallback, useMemo } from 'react'
import { jsx } from 'slate-hyperscript'
import {
Transforms,
createEditor,
Element as SlateElement,
Descendant,
} from 'slate'
import { Transforms, createEditor, Descendant } from 'slate'
import { withHistory } from 'slate-history'
import { css } from 'emotion'
import {
@ -216,7 +211,7 @@ const Leaf = ({ attributes, children, leaf }) => {
return <span {...attributes}>{children}</span>
}
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -1,5 +1,5 @@
import React, { useState, useMemo } from 'react'
import { createEditor, Element, Descendant } from 'slate'
import { createEditor, Descendant } from 'slate'
import { Slate, Editable, withReact } from 'slate-react'
import { withHistory } from 'slate-history'
@ -13,7 +13,7 @@ const PlainTextExample = () => {
)
}
const initialValue: Element[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -12,7 +12,7 @@ const ReadOnlyExample = () => {
)
}
const initialValue: Element[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [

View File

@ -175,7 +175,7 @@ const MarkButton = ({ format, icon }) => {
)
}
const initialValue: SlateElement[] = [
const initialValue: Descendant[] = [
{
type: 'paragraph',
children: [