feat: update to slate 0.58 && fix site build

This commit is contained in:
cudr
2020-05-11 09:21:49 +03:00
parent 0fd9390a99
commit 6adf4082dc
30 changed files with 180 additions and 107 deletions

View File

@@ -1,10 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@slate-collaborative/bridge": ["../../bridge"],
"@slate-collaborative/client": ["../../client"]
}
}
}

View File

@@ -1,12 +1,12 @@
{
"name": "@slate-collaborative/example",
"version": "0.5.0",
"version": "0.6.0",
"private": true,
"dependencies": {
"@emotion/core": "^10.0.17",
"@emotion/styled": "^10.0.17",
"@slate-collaborative/backend": "^0.5.0",
"@slate-collaborative/client": "^0.5.0",
"@slate-collaborative/backend": "^0.6.0",
"@slate-collaborative/client": "^0.6.0",
"@types/faker": "^4.1.5",
"@types/jest": "24.0.18",
"@types/node": "12.7.5",
@@ -22,15 +22,16 @@
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-scripts": "3.1.2",
"slate": "^0.57.2",
"slate-history": "^0.57.2",
"slate-react": "^0.57.2",
"slate": "0.58.0",
"slate-history": "0.58.0",
"slate-react": "0.58.0",
"typescript": "^3.8.3"
},
"scripts": {
"start": "node server.js",
"start:cra": "react-scripts start",
"build:example": "cross-env NODE_ENV=production && react-scripts build",
"prebuild": "cp -f ./tsconfig.production.json ./tsconfig.json",
"build": "cross-env NODE_ENV=production && react-scripts build",
"dev": "concurrently \"yarn start:cra\" \"yarn serve\"",
"serve": "nodemon --watch ../backend/lib --inspect server.js"
},
@@ -48,5 +49,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"engines": {
"node": "12.x"
}
}

View File

@@ -10,7 +10,7 @@ import styled from '@emotion/styled'
import { withIOCollaboration, useCursor } from '@slate-collaborative/client'
import { Instance, Title, H4, Button } from './Elements'
import { Instance, Title, H4, Button } from './Components'
import EditorFrame from './EditorFrame'

View File

@@ -9,11 +9,11 @@ import {
useSlate
} from 'slate-react'
import { ClientFrame, IconButton, Icon } from './Elements'
import { ClientFrame, IconButton, Icon } from './Components'
import Caret from './Caret'
const LIST_TYPES = ['numbered-list', 'bulleted-list']
const LIST_TYPES: string[] = ['numbered-list', 'bulleted-list']
export interface EditorFrame {
editor: ReactEditor
@@ -75,7 +75,7 @@ const toggleBlock = (editor: any, format: any) => {
const isList = LIST_TYPES.includes(format)
Transforms.unwrapNodes(editor, {
match: n => LIST_TYPES.includes(n.type),
match: n => LIST_TYPES.includes(n.type as any),
split: true
})
@@ -151,10 +151,12 @@ const Leaf: React.FC<RenderLeafProps> = ({ attributes, children, leaf }) => {
return (
<span
{...attributes}
style={{
position: 'relative',
backgroundColor: leaf.alphaColor
}}
style={
{
position: 'relative',
backgroundColor: leaf.alphaColor
} as any
}
>
{leaf.isCaret ? <Caret {...(leaf as any)} /> : null}
{children}

View File

@@ -3,7 +3,7 @@ import React, { useState, ChangeEvent } from 'react'
import faker from 'faker'
import debounce from 'lodash/debounce'
import { RoomWrapper, H4, Title, Button, Grid, Input } from './Elements'
import { RoomWrapper, H4, Title, Button, Grid, Input } from './Components'
import Client from './Client'

View File

@@ -0,0 +1,14 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@slate-collaborative/bridge": ["../../bridge"],
"@slate-collaborative/client": ["../../client"]
}
},
"references": [
{ "path": "../client" },
{ "path": "../backend" }
]
}

View File

@@ -2,25 +2,30 @@
"include": [
"src/**/*"
],
"extends": "./extend.tsconfig.json",
"extends": "./tsconfig.extend.json",
"compilerOptions": {
"rootDir": "../",
"baseUrl": "./src",
"allowJs": true,
"skipLibCheck": true,
"downlevelIteration": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"resolveJsonModule": true,
"declaration": false,
"declarationMap": false,
"noEmit": true
},
"references": [
{
"path": "../client"
},
{
"path": "../backend"
}
]
"noEmit": true,
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"module": "esnext",
"moduleResolution": "node",
"jsx": "react"
}
}

View File

@@ -0,0 +1,29 @@
{
"compilerOptions": {
"baseUrl": "./src",
"allowJs": true,
"skipLibCheck": true,
"downlevelIteration": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"resolveJsonModule": true,
"declaration": false,
"declarationMap": false,
"noEmit": true,
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"module": "esnext",
"moduleResolution": "node",
"jsx": "react"
},
"exclude": ["node_modules"],
"include": ["**/*.ts", "**/*.tsx"]
}