@contember/react-slate-editor-base 2.0.0-alpha.16 → 2.0.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/src/components/RichTextEditor.cjs +3 -3
- package/dist/development/src/components/RichTextEditor.cjs.map +1 -1
- package/dist/development/src/components/RichTextEditor.js +3 -3
- package/dist/development/src/components/RichTextEditor.js.map +1 -1
- package/dist/development/src/editor/createEditor.cjs.map +1 -1
- package/dist/development/src/editor/createEditor.js.map +1 -1
- package/dist/production/src/components/RichTextEditor.cjs +3 -3
- package/dist/production/src/components/RichTextEditor.cjs.map +1 -1
- package/dist/production/src/components/RichTextEditor.js +3 -3
- package/dist/production/src/components/RichTextEditor.js.map +1 -1
- package/dist/production/src/editor/createEditor.cjs.map +1 -1
- package/dist/production/src/editor/createEditor.js.map +1 -1
- package/dist/types/editor/createEditor.d.ts +1 -1
- package/dist/types/editor/createEditor.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types/plugins.d.ts +1 -2
- package/dist/types/types/plugins.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/components/RichTextEditor.tsx +3 -3
- package/src/editor/createEditor.ts +1 -1
- package/src/tsconfig.json +0 -1
- package/src/types/plugins.ts +1 -2
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Editor, Element, Path } from 'slate';
|
|
2
2
|
import { FunctionComponent, ReactNode } from 'react';
|
|
3
3
|
import { RenderElementProps, RenderLeafProps } from 'slate-react';
|
|
4
|
-
import { Environment } from '@contember/react-binding';
|
|
5
|
-
import { EntityAccessor } from '@contember/binding';
|
|
4
|
+
import { EntityAccessor, Environment } from '@contember/react-binding';
|
|
6
5
|
export type EditorPluginWrapperProps = {
|
|
7
6
|
children?: ReactNode;
|
|
8
7
|
editor: Editor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/types/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CAAC,CAAC,EAAE,aAAa,KAAK,OAAO,CAAA;IACvC,MAAM,EAAE,iBAAiB,CAAC,eAAe,CAAC,CAAA;CAC1C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/react-slate-editor-base",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.18",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/production/index.js",
|
|
@@ -33,9 +33,8 @@
|
|
|
33
33
|
"directory": "packages/react-slate-editor-base"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@contember/binding": "2.0.0-alpha.
|
|
37
|
-
"@contember/
|
|
38
|
-
"@contember/utilities": "2.0.0-alpha.16",
|
|
36
|
+
"@contember/react-binding": "2.0.0-alpha.18",
|
|
37
|
+
"@contember/utilities": "2.0.0-alpha.18",
|
|
39
38
|
"@radix-ui/primitive": "^1.1.0",
|
|
40
39
|
"@radix-ui/react-slot": "^1.1.0",
|
|
41
40
|
"is-hotkey": "^0.2.0",
|
|
@@ -28,7 +28,7 @@ export const RichTextEditor: FunctionComponent<RichTextEditorProps> = Component(
|
|
|
28
28
|
() => QueryLanguage.desugarRelativeSingleField(props, environment),
|
|
29
29
|
[environment, props],
|
|
30
30
|
)
|
|
31
|
-
const fieldAccessor = useMemo(() => entity.
|
|
31
|
+
const fieldAccessor = useMemo(() => entity.getField<string>(desugaredField), [entity, desugaredField])
|
|
32
32
|
|
|
33
33
|
// The cache is questionable, really.
|
|
34
34
|
const [contemberFieldElementCache] = useState(() => new WeakMap<FieldAccessor<string>, SlateElement[]>())
|
|
@@ -91,7 +91,7 @@ export const RichTextEditor: FunctionComponent<RichTextEditorProps> = Component(
|
|
|
91
91
|
const onChange = useCallback(
|
|
92
92
|
(value: Descendant[]) => {
|
|
93
93
|
getParent().batchUpdates(getAccessor => {
|
|
94
|
-
const fieldAccessor = getAccessor().
|
|
94
|
+
const fieldAccessor = getAccessor().getField(desugaredField)
|
|
95
95
|
|
|
96
96
|
if (SlateNode.string({ type: 'dummy', children: value }) === '' && fieldAccessor.valueOnServer === null) {
|
|
97
97
|
fieldAccessor.updateValue(null)
|
|
@@ -100,7 +100,7 @@ export const RichTextEditor: FunctionComponent<RichTextEditorProps> = Component(
|
|
|
100
100
|
|
|
101
101
|
if (SlateElement.isElement(value[0])) {
|
|
102
102
|
fieldAccessor.updateValue(serialize(value[0].children))
|
|
103
|
-
contemberFieldElementCache.set(getAccessor().
|
|
103
|
+
contemberFieldElementCache.set(getAccessor().getField(desugaredField), value as SlateElement[])
|
|
104
104
|
}
|
|
105
105
|
})
|
|
106
106
|
},
|
|
@@ -2,7 +2,7 @@ import { createEditorWithEssentials } from './createEditorWithEssentials'
|
|
|
2
2
|
import { Editor } from 'slate'
|
|
3
3
|
import { EditorPlugin, EditorPluginWrapperProps } from '../types'
|
|
4
4
|
import { createElement, FunctionComponent, ReactNode } from 'react'
|
|
5
|
-
import { EntityAccessor } from '@contember/binding'
|
|
5
|
+
import { EntityAccessor } from '@contember/react-binding'
|
|
6
6
|
import { Environment } from '@contember/react-binding'
|
|
7
7
|
|
|
8
8
|
|
package/src/tsconfig.json
CHANGED
package/src/types/plugins.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Editor, Element, Path } from 'slate'
|
|
2
2
|
import { FunctionComponent, ReactNode } from 'react'
|
|
3
3
|
import { RenderElementProps, RenderLeafProps } from 'slate-react'
|
|
4
|
-
import { Environment } from '@contember/react-binding'
|
|
5
|
-
import { EntityAccessor } from '@contember/binding'
|
|
4
|
+
import { EntityAccessor, Environment } from '@contember/react-binding'
|
|
6
5
|
|
|
7
6
|
export type EditorPluginWrapperProps = { children?: ReactNode; editor: Editor }
|
|
8
7
|
export type EditorPlugin = ((editor: Editor) => void) | {
|